AnsweredAssumed Answered

Modifying linker scripts in MCUXpresso

Question asked by Robert Poor on Jun 7, 2018
Latest reply on Jun 14, 2018 by Robert Poor

I've recently switched from KDS to MCUXpresso, but I'm stumped on how to modify the load map.  

 

Specifically: in KDS, to support a flash-resident bootloader in low memory, I modified the memory areas in MKL27Z64xxx4_flash.ld from its default:

MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0000FBF0
m_data (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000
m_usb_sram (RW) : ORIGIN = 0x400FE000, LENGTH = 0x00000200
}

to look like this. Note that the BCA starts at 0x43c0 and m_text at 0x4400, and I've added a "BootloaderConfig" section:

MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
m_bootloader_config (RX) : ORIGIN = 0x43C0, LENGTH = 0x0040
m_text (RX) : ORIGIN = 0x00004400, LENGTH = 0x0000B800
m_data (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000
m_usb_sram (RW) : ORIGIN = 0x400FE000, LENGTH = 0x00000200
}
SECTIONS
{
...
.bca :
{
. = ALIGN(4);
KEEP(*(.BootloaderConfig)) /* Bootloader Configuration Area (BCA) */
. = ALIGN(4);
} > m_bootloader_config
...
}

 

After that, I could use __attribute__((section(".BootloaderConfig"))) in my code to initialize the BCA.

 

However, with the new Managed Linker system in MCUXpresso, the .ld files are evidently automatically generated by "Freemarker", so it would be a Bad Idea to modify the generated files directly.

 

But I'm stumped as to how to tell Freemarker to make the corresponding changes.  Are there examples of how to do this?

Outcomes