How do I create a ''gap'' at a specific address in flash memory?
I am working with the STM32F407 microcontroller and building using Eclipse/GNU and my project is using a standard linker script (can be found in, for example, the Discovery Demonstration Board ''Blink LED''-example). I would like to create a gap at a specific address in flash memory:
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
MY_GAP (rx) : ORIGIN = 0x08004000, LENGTH = 16K
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 992K
The above does not work well, it simply puts the stuff that should reside in FLASH at address0x08008000, so the first sector is wasted. The below is not a solution either because I want the tools to have the freedom to pick FLASH_BEGINNING or FLASH_END, I don't want to have to make that decision in the linker script:
FLASH_BEGINNING (rx) : ORIGIN = 0x08000000, LENGTH = 16K
MY_GAP (rx) : ORIGIN = 0x08004000, LENGTH = 16K
FLASH_END (rx) : ORIGIN = 0x08008000, LENGTH = 992K
I basically want the code to be packed so no memory is wasted and I shouldn't have to make changes to the linker script if the code size increases. Can someone please help me?