avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] stack(?) problems


From: antarctic
Subject: Re: [avr-gcc-list] stack(?) problems
Date: Mon, 6 Aug 2007 17:35:23 +0200
User-agent: KMail/1.8

Hallo Tobias !

läuft das Beispiel unten auch falsch oder ist das nur ein "example der idee".
Über IRQ Routinen wäre ein "volatile" Problem möglich. Das gleiche
wäre denkbar, wenn du "p" selbst nie verwendest (wegoptimiert).

volatile int x;

nach  
        p = &test;
        x = *p;
        // shows the debugger here the same problem ?

lg,
Bernd


Am Montag, 6. August 2007 12:12 schrieb Tobias Pflug:
> Hi, 
> 
> I am currently in the process of porting code written for
> the ImageCraft C compiler to gcc. Now i'm having some
> problems where very trivial code does not work:
> 
> 
> int test;
> int *p;
> 
> int main()
> {
>   test = 0;
>   p = &test;
>   ...
> }
> 
> avr-nm main.elf | grep test
> 0000000000804020 b test
> 
> When testing the code in gdb:
> [After the value assignments of course]
> 
> (gdb) print p
> $1 = (int *) 0x800000
> (gdb) print &test
> $2 = (int *) 0x804020
> 
> I can't provide the full code because of copyright/NDA issues. I'm using
> gcc-4.1.0 Code was tried with -O1 and -Os. 
> 
> Compiler flags:
> 
> avr-gcc -c -mmcu=atmega128 -I. -gstabs   -O1 -funsigned-char
> -funsigned-bitfields -fpack-struct -fshort-enums -Wall
> -Wstrict-prototypes
> 
> Any ideas what's going wrong and what I could try?
> 
> Thanks alot.
> regards,
> 
> Tobias Pflug
> 
> 
> 
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]