On 1/19/2022 7:13 AM, Michael Stocker wrote:
You are right.
-Wl,--undefined=signature
This will keep it in flash and not let the linker strip its value.
Also when preparing your .hex file for flashing you may need to
explicitly tell the sections you want.
avr-objcopy -j .text -j .data -j .my_signature -O ihex prog.elf prog.hex
Cheers
Michael
This may be a naive question, but is it possible to "place" the
signature in a specific location in the resulting output file, padding
the file to the required size to include the signature?
Use case:
One of the projects I utilize defines a 4 byte signature at the end of
the AVR code space (top 4 bytes), and it checks that signature in the
bootloader to see if an update on storage is newer than the one
installed. Right now, the main developer has created a Perl script that
pulls the resulting object file, padds it out, and puts the 4 bytes at
the end. It would be nice to do all of that in the linker.