avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Version/Signature in Flash


From: Michael Kwasnicki
Subject: Re: Version/Signature in Flash
Date: Wed, 19 Jan 2022 17:05:46 +0100

I am not sure if I got it right.
The linker is only involved until the .elf file has been created.
If the question is to pad out the content of the .hex file so it is one continuous block then it can be done with :

avr-objcopy -j .text -j .data -j .my_signature --gap-fill 0xFF -O ihex prog.elf prog.hex 

The gap-fill argument fills the blanks with a specific value (0xFF in this case).

Cheers

Michael


Am 2022-01-19 um 16:30 schrieb Jim Brain <brain@jbrain.com>:

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]