Hi Alice-
Thank you for the follow-up. I have re-mapped the flash as you advised:
PROGRAM_FLASH starts at 0x8000, size 0x3c0
Rm_bootloader_config starts at 0x83c0, size 0x40
REMFLASH starts at 0x8400, size 0x17c00
The linker script generator then produces the following regions in the _memory.ld file:
MEMORY
{
/* Define each memory region */
PROGRAM_FLASH (rx) : ORIGIN = 0x8000, LENGTH = 0x3c0 /* 960 bytes (alias Flash) */
Rm_bootloader_config (rx) : ORIGIN = 0x83c0, LENGTH = 0x40 /* 64 bytes (alias Flash2) */
REMFLASH (rx) : ORIGIN = 0x8400, LENGTH = 0x17c00 /* 95K bytes (alias Flash3) */
SRAM_UPPER (rwx) : ORIGIN = 0x20000000, LENGTH = 0x2000 /* 8K bytes (alias RAM) */
SRAM_LOWER (rwx) : ORIGIN = 0x1fffe000, LENGTH = 0x2000 /* 8K bytes (alias RAM2) */
}As expected, the linker complains that there is not enough space for my 35.3KB program in PROGRAM_FLASH. Now I'm trying to figure out how to relocate the .text section into the REMFLASH memory region. As far as I can tell, I'm going to need to override some of the FreeMarker linker script templates. I've done so (loosely following the "Relocating majority of application into RAM" example, but instead attempting to relocate it into REMFLASH) in order to produce a final linker script output that includes:
.text : ALIGN(4)
{
*startup_*.o (.text.*)
*(.text.main)
*(.text.__main)
*startup_*.o (.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(4);
} >PROGRAM_FLASH
.text : ALIGN(4)
{
*(.text*)
*(.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(4);
} >REMFLASHThis breaks the build, however:
/usr/local/mcuxpressoide-10.1.1_606/ide/tools/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: My-Application.axf: Not enough room for program headers, try linking with -N
/usr/local/mcuxpressoide-10.1.1_606/ide/tools/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: final link failed: Bad value
Am I overcomplicating this? Can you provide any further guidance on relocating the remainder of the program to the new section created after Rm_flash_bootloader?
Thanks,
Dave