Optiboot / optiboot

Small and Fast Bootloader for Arduino and other Atmel AVR chips
Other
1.09k stars 401 forks source link

Put BIGBOOT strings in flash so __do_copy_data doesn't get placed ahead of the jump table. #266

Closed justarandomgeek closed 5 years ago

justarandomgeek commented 5 years ago

I found when compiling with BIGBOOT that __do_copy_data was being placed before the jump table, due to the human-readable config flag info being placed in .data. Using the .progmem section puts them before most of .text still, and using .text.buildinfo to sort into the .text.* rule produced linker errors (optiboot.c:(.init9+0x10a): warning: internal error: out of range error optiboot.c:(.init9+0x168): warning: internal error: out of range error, on the lines using eeprom_*_byte()). I placed them in .fini8 to get it ordered properly to work, but someone with more linker-fu might have a better solution.

WestfW commented 5 years ago

Well, rats. I could swear that I had tested some of the BIGBOOT images :-(

justarandomgeek commented 5 years ago

FWIW, it did boot correctly even with that in place (the end of __do_copy_data just rolled right on into the jump to main), it's just the jump to do_spm wasn't in the correct place to be called by the app - so it would have appeared to work until you tried to call do_spm and then it would just roll right on into the bootloader for a "reset" instead!