This document provides guidance for relocating Code and Data within the MCU memory map. As part of this process it explains how create new memory segments and sections by editing the GCC Linker File (.ld) for Kinetis Architectures.
Contents:
1.- Introduction
2.- Preliminary Backgrounds
3.- Linker File (.ld) Overview
4.- Relocating Code
4.1.- Prerequisites
4.2.- Relocating Code in ROM
4.3.- Relocating Code in RAM
4.4.- Relocating Code in a Specific RAM address
4.5.- Relocating Code in External RAM
5.- Relocating Data
6.- Linker File for RAM Project
Best Regards,
Carlos Mendoza
Technical Support Engineer
In MCUXpresso, it appears that manual editing of the .ld file is no longer the approved technique, having been replaced by the Managed Linker / Freemarker / Memory Editor system. Is there an updated version of the "Relocating Code ..." doc for MCUXpresso?
Hi Robert,
You are correct, the above approach is not recommended for MCUXpresso IDE. You can find more information on how to place variables and functions into different memory blocks in MCUXpresso in the chapter 16.7 Modifying the Generated Linker Script / Memory Layout.
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
Carlos:
Thanks for the info. I've pored over chapter 16.7 and have created a set of linkscripts, but I have not yet succeeded in properly relocating all the pieces of the target program for loading by the KBOOT protocol. Is there an updated document that addresses relocating a program for KBOOT?
Some specific questions:
Here's what I currently have:
/* boot_hdr.ldt: */
.bca :
{
. = ALIGN(4);
KEEP(*(.BootloaderConfig))
. = ALIGN(4);
} > m_bootloader_cfg
/* section_top.ldt */
.interrupts :
{
__VECTOR_TABLE = .;
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} > m_interrupts
Hi Robert,
There is no need to modify the linker scripts to make your application usable with MCUBOOT, you can keep using the managed linker scripts fucntionality and just add an offset to the start of your application, you just have to open the project properties go to C/C++ Build > MCU settings and change the Flash start Location of your application:
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
Hi Carlos_Mendoza, I've done that step to relocate the application in PROGRAM_FLASH to the BL_APP_VECTOR_TABLE_ADDRESS (e.g. 0xA000 on my target or 0x8000 in your example). However, robertpoor's question is about defining a section to the application for the BCA (bootloader configuration area) in flash. Is there updated documentation for MCUXpresso that describes how to do this properly using the managed linker files? Everything I have found does not cover relocating data to FLASH or and doesn't handle the case for the Flash Config Block (section FlashConfig) at flash offset 0x400.
Relocating Code and Data Using the MCUXpresso IDE (https://community.nxp.com/docs/DOC-335283?comment...) from Alice_Yang only mentions relocating data into RAM for example.