Re: Version/Signature in Flash

2022-01-19 Thread Michael Kwasnicki
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

Re: Version/Signature in Flash

2022-01-19 Thread Jim Brain
On 1/19/2022 10:05 AM, Michael Kwasnicki wrote: 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

Re: Version/Signature in Flash

2022-01-19 Thread Jim Brain
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

Re: Version/Signature in Flash

2022-01-19 Thread Klaus Rudolph
Hi, -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 works perfect!

Re: Version/Signature in Flash

2022-01-19 Thread Trampas Stern
I recommend creating the section in the linker file. It is often easier for the next guy looking at your code to find the section in the linker file. That is, embedded development follows a path, from writing code to make it work, to making it work reliably, to making it where the next guy can

Re: Version/Signature in Flash

2022-01-19 Thread Klaus Rudolph
Thanks for the linker command! I was not aware that we are able to define a section and put the content to flash by simply adding something on the linker command. Is there no need to tell the linker that this section should be kept as it is typically not referenced and "optimized" out? Thanks!

Re: Version/Signature in Flash

2022-01-19 Thread Michael Stocker
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

Re: Version/Signature in Flash

2022-01-19 Thread Michael Stocker
Hallo Klaus, you can always define your own sections at a fixed location in flash and write anything you like in there. But every time you start a new section the previous one is closed implicitly. So it cannot be in the middle of another section. It also cannot go at the beginning of flash

Version/Signature in Flash

2022-01-18 Thread Klaus Rudolph
Hi, is there already a defined wy to place a user defined signature in the flash memory? Use Case: Simply put some version info, maybe a a string with given format or a git hash id or whatever in a specified flash area. I see we have a section ".signature" but this is in use for a predefined 3