avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Strange struct problem


From: Daniel O'Connor
Subject: Re: [avr-chat] Strange struct problem
Date: Fri, 9 Dec 2005 13:14:05 +1030
User-agent: KMail/1.8.2

On Fri, 9 Dec 2005 11:53, Larry Barello wrote:
> Oh, I forgot to add: if automatics cannot fit into registers they go onto a
> stack frame...  Some might assume all automatics go onto the frame but GCC
> doesn't.

Hmm, I would expect if it's in the stack frame it should still be accessible 
'normally' though..

Even if I declare it static it still gives the same result :(

Looking at the .lst file I see that both are in the data section, so they 
should be accessible without using lpm.

> Cheers!
>
> -----------
> Larry Barello
> www.barello.net
>
> | -----Original Message-----
> | From: address@hidden [mailto:avr-chat-
> | address@hidden On Behalf Of Larry Barello
> | Sent: Thursday, December 08, 2005 5:06 PM
> | To: address@hidden; address@hidden
> | Subject: RE: [avr-chat] Strange struct problem
> |
> | You are declaring the data as automatic.  GCC is very clever and puts
> | automatic variables into registers unless you either a) take an address
> | of them, b) declare too many (or too big) or c) set optimization low.
> |
> | I ran across this with a boot loader I was writing.  I wanted to save a
> | 24 bit address in a struct (rampz + address) and the resulting code was
> | seriously broken (actually, the compiler would crash).  In short, your
> | automatic variables that are structs or unions need to fit into one of
> | the normal sizes: byte, word, long, or double long.
> |
> | When they do fit, spectacular code will be generated.
> |
> | -----------
> | Larry Barello
> | www.barello.net
>
> _______________________________________________
> AVR-chat mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-chat

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

Attachment: pgpFONx49KaXs.pgp
Description: PGP signature


reply via email to

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