Altera_Forum
Honored Contributor
20 years agoGot a question for the bootloader/flash gurus
If I run elf2flash with the --boot option I can make a .flash file out of a .elf file identical to the ext_flash.flash file the Nios IDE makes for me. Both files have 8 bytes I can't account for though. All the bytes from the boot_loader_cfi.srec file are at the beginning of the file, and all the bytes from the .exceptions, .text, .rodata, and .rwdata sections are after that, but inbetween there's 8 bytes that I can't identify.
The weird part is that it's not always the same 8 bytes, but they only show up if I use the --boot option. If I don't use that option the .flash file starts with the bytes from the ELF file. The only commonality I've found in the various flash files is that the last 4 bytes are "20000001" sometimes. I suppose it doesn't really matter what they are, but it's bugging me that there's 8 bytes I can't identify in the flash file. I tried decoding them by hand and they don't seem to be instructions. Edit: The "20000001" is actually 0x01000020, or my exception address. Duh. That still leaves the other 4 bytes though...I have a project where I went through the multiprocessor tutorial. For cpu 1 the 8 bytes are (big endian):00012970 01000020 and for cpu 2: 0000eff0 01100020 What do 0x00012970 and 0x0000eff0 represent? Edit 2: They're the sum of the filesz members of the program headers for the ELF file. Or to put it another way, they're how many bytes the .exceptions, .text, .rodata, and .rwdata sections take up. Well that was fun. Hopefully this helps someone and I haven't just been talking to myself. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif