Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII [RSS Feed]

#1 Nov. 16, 2005 13:57:06

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII


Hi,

I'm new here.
I'm working with ATmega128, Stk500, stk501 and jTagIce mkII.
i have installed on my windows XP AvrStudio 4.12 and WinAvr 20050214.
WinAvr uses Avr-Gcc 3.4.3 and GDB 6.1. I have a problem with the following code:

#include <avr/io.h>

int somma(int a, int b)

{
return a+b;
}

int main ()
{ int e = 10;
int r = 1;
r = somma(e,r);
r=r+1;
return r;
}

it's a stupid program. When debbugging it step by step the main regularly calls
somma(e,r).
After somma(e,r) finished, the control flow does not return in main at r=r+1
but in a part of memory without code (after the exit() of the main). Can you
help me with this problem?

Best regards

Antonio

-------------------------------------------------------------------------
Visitahttp://domini.interfree.it, il sito di Interfree dove trovare
soluzioni semplici e complete che soddisfano le tue esigenze in Internet,
ecco due esempi di offerte:

- Registrazione Dominio: un dominio con 1 MB di spazio disco + 2 caselle
email a soli 18,59 euro
- MioDominio: un dominio con 20 MB di spazio disco + 5 caselle email
a soli 51,13 euro

Vieni a trovarci!

Lo Staff di Interfree
-------------------------------------------------------------------------



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 16, 2005 15:44:53

Dave H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII


From:
#include <avr/io.h>

int somma(int a, int b)

{
return a+b;
}

int main ()
{ int e = 10;
int r = 1;
r = somma(e,r);
r=r+1;
return r;
}it's a stupid program. When debbugging it step by step the main regularlycalls somma(e,r).After somma(e,r) finished, the control flow does not return in main atr=r+1 but in a part of memory without code (after the exit() of the main).Can you help me with this problem?Just a guess: Try making 'r' volatile, i.e., change the declaration of r to

int volatile r = 1;Because r is not used other than as the return value, the compiler might beoptimizing out accesses to the variable itself. The 'volatile' declarationforces the compiler to retain these accesses.HTH,
-=Dave




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#3 Nov. 16, 2005 16:06:49

a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII


Problem is most serious.
The Push and Pop and Ret operation does not functioning corretly.
When i do the Push and Pop operation the stack does unchage.

thanks


-------------------------------------------------------------------------
Visitahttp://domini.interfree.it, il sito di Interfree dove trovare
soluzioni semplici e complete che soddisfano le tue esigenze in Internet,
ecco due esempi di offerte:

- Registrazione Dominio: un dominio con 1 MB di spazio disco + 2 caselle
email a soli 18,59 euro
- MioDominio: un dominio con 20 MB di spazio disco + 5 caselle email
a soli 51,13 euro

Vieni a trovarci!

Lo Staff di Interfree
-------------------------------------------------------------------------



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#4 Nov. 17, 2005 06:05:33

Joerg W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII


wrote:

> The Push and Pop and Ret operation does not functioning corretly.
> When i do the Push and Pop operation the stack does unchage.

Try reading the FAQ... I bet you forgot to turn off the M103C fuse.

> -------------------------------------------------------------------------
> Visitahttp://domini.interfree.it, ...


10 lines of advertisement, plus another three blank lines -- compared
to 5 lines content of your message. That looks like the best reason
to *not* use that email provider. Maybe you'll tell'em.

--
cheers, J"org .-.-. --... ...-- -.. . DL8DTLhttp://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support