1
votes

I'm using GNU GCC linker. My goal is to fill unused Flash memory space so that I will always get a binary output in the same size for CRC calculation. In linker script I created additional section

.fill_flash :
{
    flashUsed = .;
    FILL(0xDEADC0DE);
    . = flashUsed + LENGTH(BOOTLOADER) - SIZEOF(.isr_vector) - SIZEOF(.text) - SIZEOF(.ARM.extab) - SIZEOF(.ARM) - SIZEOF(.preinit_array) - SIZEOF(.init_array) - SIZEOF(.fini_array) - SIZEOF(.data) - SIZEOF(.ccmram);
    KEEP(*(.fill_flash))
} AT >BOOTLOADER

I can see it in the dump file and it has the proper size, so adding this to used Flash fills the entire space of MCU memory. However, in the binary output there is no my section. How can I force linker to keep it and loaded into BOOTLOADER region?

1

1 Answers

1
votes

The solution is simple, need to add additional BYTE() command, so linker will have anything in its output for that section:

BYTE(0x00)