OK, I thought I understood the .elf to .srec but after looking at it I have some questions:
<div class='quotetop'>QUOTE </div>
--- Quote Start ---
I imagine the real code will be in the form of an .elf file created by Nios II IDE correct?[/b]
--- Quote End ---
Yes.
<div class='quotetop'>QUOTE </div>
--- Quote Start ---
For the secondary bootloader to get this .elf into RAM, it will need to stored on the host as some kind of boot record, meaning something that the bootloader can easliy translate into a series of "copy this data to address X" operations. Typically, you'll start by converting the .elf to an .srec using nios2-elf-objcopy. From there you can create a boot record.[/b]
--- Quote End ---
Included in the .elf file is the .entry section that goes in the EPCS. Should I strip this out? Is it benign since I can't write to it anyway? Now, presumably, I'll want to place the real code at a differnet address that the one in the .elf file. If I use
nios2-elf-objcopy -v -O srec --change-addresses 0x2000 --srec-forceS3 boardxxx.elf boardxxx.srec
then it seems like 0x2000 gets added to all addresses. Is this correct? It also adds 0x2000 to the previously mentioned .entry section. Is there a way to selectively add an offset so I can exclude the EPCS part?
<div class='quotetop'>QUOTE </div>
--- Quote Start ---
There is a bootcopier example posted on this forum that uses this kind of boot record. Check out "EPCS boot loader" under the "Post your own IP" downloads.[/b]
--- Quote End ---
After looking through the EPCS boot loader code I can't possibly see how it works. It expects a 4 byte length followed by a 4 byte address. I only see a 1 byte length in the epcs_controller_boot_rom.flash file that gets generated for my code followed by a 4 byte relative offset. What am I missing?
thanks again for your help.