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

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

[avr-gcc-list] Re: Format of HEX file when program memory addresses exce


From: David Brown
Subject: [avr-gcc-list] Re: Format of HEX file when program memory addresses exceed 64K
Date: Fri, 07 May 2010 11:12:50 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4

On 06/05/2010 20:34, Graham Davies wrote:
I've spent over an hour looking for this information on the Web and in
the WinAVR documentation but I can't find it so I'm asking for some
pointers.

I'm using WinAVR-20081205 with AVRStudio 4.15, letting the GCC plug-in
do all the heavy lifting (I'm not writing my own Makefiles or link
scripts or anthing like that). The target is an ATmega1280, which is
significant to my question because it has more than 64Kbytes of program
memory. The output format is Intel HEX and I totally grok what I'm
getting now as my program size is less than 64Kbytes. I even know where
this is coming from. The generated Makefile uses 'avr-objcopy -O ihex'
to get this.

What I need to know is what the HEX file is going to look like when my
program inevitably grows is size above 64Kbytes. What mechanism will
'objcopy' use to get above sixteen address bits? I need to know this
exactly because I need to write a Flash loader to read such a file.

I just need to know where to look for this information or what to Google
for.

Thanks, Graham.

Just a little note about versions - your WinAVR versions is over a year out of date, and AVRStudio is now at 4.18 (IIRC). I'm not suggesting that you have to update - it's never a good idea to update tools in the middle of a project unless you have good reason. But if you find you have problems, then give the newer versions a try.

In addition to other people's suggestions about where to find the relevant documentation, the obvious idea is to try it and see. Make a few large dummy functions so that your code is big enough, and generate the hex file.

An example function would be:

volatile long int dummy1, dummy2, dummy3;
void __attribute__((used)) dummyFunc(void) {
        dummy1 = dummy2 + dummy3;
        dummy1 = dummy2 + dummy3;
        // Make lots of copy-and-paste copies
        dummy1 = dummy2 + dummy3;
}

The volatile and "used" attribute are so that the compiler can't be smart and remove the code.





reply via email to

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