I want to fill unused program flash memory with a couple of instructions (cli,wdr). I don't think there is a way to do it without getting into the linker script(at least I haven't figured one out if there is). So, I tried to get the FILL command to work, but am unable to get ld to do anything with the FILL command. I am using a mega88, and the linker script is 'avr4.x'.
This is what I think should work according to the ld docs-
... *(.fini0) /* Infinite loop after program termination. */ _etext = . ; FILL(0x55) } > text .data : AT (ADDR (.text) + SIZEOF (.text)) { PROVIDE (__data_start = .) ; ...
with the FILL(0x55) added by me (not showing the whole script obviously, just the little parts around what I added).
I have also tried =fillexpr at the end of the .text section ('} > text =0x55'), but am unable to make that work either.
I do see that it could be a problem with where I am placing the fill command, which brings up another question- how do the initialized variables get placed at the end of the text section, when the data section is directed to the ram location? Which means my FILL command has to be after the variable data, but not in the data section. I'm lost.
If anyone can enlighten me as to how to use the FILL command in the linker script, would be much appreciated. Thanks!