Follow+Star Public Account, don’t miss out on exciting content
Source | MultiMCU EDU
Keil MDK Dispersed Loading Files
Taking the Keil MDK linker file for the i.MX RT1052 as an example, the content of the linker file is rewritten by directly writing the address as follows:
#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)LR_m_text 0x60000000 0x60002400+0x00FFDC00-0x60000000 { ; 16MB loading domain RW_m_config_text 0x60000000 FIXED 0x00001000 { ; allocate 4KB loading .boot_hdr.conf * (.boot_hdr.conf, +FIRST) ; FIXED means "fixed address", loading address and execution address are the same } ; Base address 0x60000000 must be an absolute address RW_m_ivt_text 0x60001000 FIXED 0x00001000 { ; Allocate another 4KB loading * (.boot_hdr.ivt, +FIRST) ; .boot_hdr.ivt, use FIRST to specify that it should be placed at the starting position of the execution area * (.boot_hdr.boot_data) ; .boot_hdr.boot_data * (.boot_hdr.dcd_data) ; .boot_hdr.dcd_data }#elseLR_m_text 0x60002000 0x60002400+0x00FFDC00-0x60002000 { ; Loading domain, releasing the first 8KB of 16MB } VECTOR_ROM 0x60002000 FIXED 0x00000400 { ; Allocate 1KB loading RESET(RESET is the segment name defined in assembly) * (RESET,+FIRST) ; FIRST is used to specify that the RESET segment is placed at the starting position } ER_m_text 0x60002400 FIXED 0x00FFDC00 { ; FIXED means "fixed address", loading address and execution address are the same * (InRoot$$Sections) ; InRoot$$Sections specifies the root area .ANY (+RO) ; Load all read-only attribute data, including: Code, RW-Data, RO-Data } RW_m_data 0x20000000 0x00020000-Stack_Size-Heap_Size { ; In DTCM, remove space occupied by heap and stack .ANY (+RW) ; Load all RW data } ZI_m_data 0x80000000 0x01E00000{ ; 30MB runtime domain .ANY (+ZI) ; Load all ZI data } RW_m_ncache 0x81E00000 0x00200000 { ; 2MB runtime domain * (NonCacheable.init) ; Load separately in the total 32MB SRAM * (NonCacheable) ; NonCacheable.init, NonCacheable *(m_usb_dma_init_data) ; m_usb_dma_init_data *(m_usb_dma_noninit_data) ; m_usb_dma_noninit_data } Fast_m_data 0x00000000 0x00020000{ ; 128KB ITCM runtime domain * (CodeQuickAccess) ; Load CodeQuickAccess * (DataQuickAccess) ; Load DataQuickAccess } ARM_LIB_HEAP +0 EMPTY Heap_Size { ; Immediately follows the previous runtime domain, loads Heap_Size } ; EMPTY means blank memory ARM_LIB_STACK 0x20000000+0x00020000 EMPTY -Stack_Size { ; 128KB DTCM starts from the top down Stack_Size } ; Allocate stack space
The above file defines two memory allocation methods, one is shown in the figure below:
The other method is shown in the figure below:
For the Flash starting address 0x60000000, the official document “IMXRT1050RM” states:
ITCM, DTCM and OCRAM
On the i.MX RT1052, ITCM, DTCM, and OCRAM share 512KB of FlexRAM, which is why the figure above can place the Heap in ITCM while giving up the Heap’s position in DTCM. This can be found in the “IMXRT1050RM”:
Where Symbols are Defined in Each Domain
In the linker script, symbols like <span>.boot_hdr.conf</span>
and <span>RESET</span>
are defined in the assembly and C source files, as shown in the figure below:
The Role of Domain Names in Source Files
Regarding what a “domain” is, it is described in Zhou Ligong’s “A Brief Explanation of Dispersed Loading/Dispersed Loading Files.pdf”.
Not only will the source files define symbols used in the linker script, but conversely, the assembly source files will also use symbols defined in the linker script, as shown in the figure below:
Code Copying
Here are the key points from Zhou Ligong’s “A Brief Explanation of Dispersed Loading/Dispersed Loading Files.pdf”:
1. The code stored in the first runtime domain will not be copied additionally
2. It is stipulated that the code stored in the remaining runtime domains will be copied
3. The base address of the first runtime domain must be the same as the base address of the loading domain
InRoot$$Sections
Regarding <span>InRoot$$Sections</span>
, there is a detailed explanation in “KEIL MDK Dispersed Loading Example 2 – Code Loading into On-Chip SRAM and Some Rules”.


