Merging Bootloader & Application Hex Files

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to merge two hex files, one is a custom bootloader, the other is my user application. The bootloader starts at 0x80002000 (sits on top of DFU bootloader), the user application starts at 0x80008000. Both start locations were done by modifying trampoline.h.

I'm trying to merge the two files with srec_cat, and I get the following error:

srec_cat: Bootloader.hex: 2: warning:
    redundant 80000000 value
srec_cat: Bootloader.hex: 2: warning:
    redundant 80000001 value
srec_cat: Bootloader.hex: 2:
    contradictory 80000002 value (previous = 40, this one = 10)

If I use the -multi option it works, but it sounds like that's just overwriting, when neither hex file should be overlapping.

I've been reading AVRFreaks all day, and the only thing I can think is that maybe I need to make a custom linker script, instead of playing with the trampoline? I can't figure out how to do that in AS6 though, any thoughts?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you use a trampoline, it’ll start at 0x80000000 and the resulting hex file will contain that address. You might be able to strip the first some lines containing the trampoline off the hex files and then combine them.

It’s probably less painful to modify the application start address in the linker script, though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

catweax wrote:
If you use a trampoline, it’ll start at 0x80000000 and the resulting hex file will contain that address. You might be able to strip the first some lines containing the trampoline off the hex files and then combine them.

It’s probably less painful to modify the application start address in the linker script, though.

So I think I found the default linker scripts, but I can't figure out what the "proper" way to copy the linker script into my project would be. I'm using AS6, and when I look at the linker options it looks like I'd just need to add a flag pointing to my own linker script, but I'm not sure if that's the proper way to do it?

Also, if I modify the linker script, would I just "fake" it so that flash started at 0x80008000 instead of 0x80000000?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My project’s linker script is in src/SOFTWARE_FRAMEWORK/UTILS/LINKER_SCRIPTS/AT32UC3A3/256/GCC. Maybe your project has a similar directory?

The script should contain something like this:

PROVIDE (__executable_start = 0x80000000); . = 0x80000000;

Just adjust that to 0x80008000 and don’t use a trampoline. That should work. ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

catweax wrote:
My project’s linker script is in src/SOFTWARE_FRAMEWORK/UTILS/LINKER_SCRIPTS/AT32UC3A3/256/GCC. Maybe your project has a similar directory?

The script should contain something like this:

PROVIDE (__executable_start = 0x80000000); . = 0x80000000;

Just adjust that to 0x80008000 and don’t use a trampoline. That should work. ;-)

Interesting, an ASF 2.9.0 project has this file (well, close enough that I found it), but an ASF 3.1 project does not. I'll need to look into this later.

To remove the trampoline, would I just remove the files from the project? I can't figure out where it's being included from...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, sorry. My project still uses ASF 1.7 because I can’t get newer ASF versions to play nicely with AVR32 Studio 2.6. :(

I found this comment inside my trampoline.x:

In order to be able to program a project with both BatchISP and JTAGICE mkII without having to take the general-purpose fuses into consideration, add this file to the project and change the program entry point to _trampoline.

Among the linker flags I found this:

-Wl,-e,_trampoline

Remove the file and adjust the entry point and you’re done?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd keep fingers away from the linker skript. Use srecord!
The following archive contains an example that shows exactly what you need.

http://www.atmel.com/dyn/resourc...

-sb