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: Eric Weddington
Subject: Re: [avr-chat] Strange struct problem
Date: Fri, 09 Dec 2005 09:31:32 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Daniel O'Connor wrote:
On Fri, 9 Dec 2005 16:07, Ian Caddy wrote:

Your problem is that you need to also include your initialised data
section in your hex file.  The initialised data will be copied to your
data section by the startup code, but only if you include it in your hex
file which you are not.

> avr-objcopy -j .text -O ihex testcase.elf testcase.hex

You are only including the .text section.

Because of this, the initilised data section is empty (0xFF) and these
values are copied to the data section on startup.


Doh!


> avr-objcopy -O ihex testcase.elf testcase.hex

should work for you as it will copy the sections that it thinks it
should rather than you telling it to just use the .text section with the
-j field.

I hope this helps,


Ahah! Thanks!
Actually I had to do "-j .text -j .data -j .bss" and it worked otherwise avrdude complained about addresses being out of range.

*does the happy dance*

Note that if you used the WinAVR Makefile Template, or you used MFile (available on *nix) to generate your makefile, then you wouldn't have run into this problem as there are pre-existing targets that take care of generating your hex file from the elf file with all the proper command line options. It might save you some time and trouble.

--
Eric Weddington




reply via email to

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