Re: Version/Signature in Flash

Klaus Rudolph <[email protected]> Wed, 19 Jan 2022 16:07:54 +0100
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
Hi,


>
> -Wl,--undefined=3Dsignature
>
> 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
>

works perfect! Thanks!

Maybe an additional question as I am using different controllers.

Is there any option to tell the linker something like
-Wl,--section-start=3D.my_signature=3DFLASH_END-0x50

This can be done easily in the linker script, but I did not want to take
a copy of the whole avr-libc/binutils installation to add a new section
in each of the .x files.
Some idea how I can "ask" for the last possible flash address of the
controller? Maybe by compiling some empty prog, picking a symbol from
elf, place it in the Makefile-variable and go for final link? Strange...
:) Sounds possible... I will also take a look...

Thanks
  Klaus