Skip to content

Commit c643c91

Browse files
committed
targets:MIMXRT1050: Update link file for application
For the application(firmware) booted by bootloader(OTA), the image doesn't need the "flash_config" and "ivt" header. So update the link file to support both kinds of application (firmware) booted by bootROM and bootloader. In default, the compilation will get the image with "flash_config" and "ivt" header, for example the bootloader compiling. When compiling the OTA application image, please add the line as below in the mbed_app.json file. "target.macros_add" : ["MBED_APP_COMPILE"] This will remove the "flash_config" and "ivt" header in the final image. Signed-off-by: Gavin Liu <[email protected]>
1 parent 5b791eb commit c643c91

File tree

3 files changed

+43
-15
lines changed

3 files changed

+43
-15
lines changed

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/device/TOOLCHAIN_ARM_STD/MIMXRT1052xxxxx.sct

+11-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define MBED_APP_SIZE 0x400000
4343
#endif
4444

45+
#if !defined(MBED_APP_COMPILE)
4546
#define m_flash_config_start MBED_APP_START
4647
#define m_flash_config_size 0x00001000
4748

@@ -53,6 +54,13 @@
5354

5455
#define m_text_start MBED_APP_START + 0x2400
5556
#define m_text_size MBED_APP_SIZE - 0x2400
57+
#else
58+
#define m_interrupts_start MBED_APP_START
59+
#define m_interrupts_size 0x00000400
60+
61+
#define m_text_start MBED_APP_START + 0x400
62+
#define m_text_size MBED_APP_SIZE - 0x400
63+
#endif
5664

5765
#define m_text2_start 0x00000000
5866
#define m_text2_size 0x00020000
@@ -90,7 +98,8 @@
9098
#define Heap_Size 0x0400
9199
#endif
92100

93-
LR_IROM1 m_flash_config_start m_text_start+m_text_size-m_flash_config_start { ; load region size_region
101+
LR_IROM1 MBED_APP_START m_text_start+m_text_size-MBED_APP_START { ; load region size_region
102+
#if !defined(MBED_APP_COMPILE)
94103
RW_m_config_text m_flash_config_start FIXED m_flash_config_size { ; load address = execution address
95104
* (.boot_hdr.conf, +FIRST)
96105
}
@@ -100,6 +109,7 @@ LR_IROM1 m_flash_config_start m_text_start+m_text_size-m_flash_config_start {
100109
* (.boot_hdr.boot_data)
101110
* (.boot_hdr.dcd_data)
102111
}
112+
#endif
103113
VECTOR_ROM m_interrupts_start FIXED m_interrupts_size { ; load address = execution address
104114
* (RESET,+FIRST)
105115
}

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/device/TOOLCHAIN_GCC_ARM/MIMXRT1052xxxxx.ld

+7-1
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@ M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
5050
/* Specify the memory areas */
5151
MEMORY
5252
{
53+
#if !defined(MBED_APP_COMPILE)
5354
m_flash_config (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x00001000
5455
m_ivt (RX) : ORIGIN = MBED_APP_START + 0x1000, LENGTH = 0x00001000
5556
m_interrupts (RX) : ORIGIN = MBED_APP_START + 0x2000, LENGTH = 0x00000400
5657
m_text (RX) : ORIGIN = MBED_APP_START + 0x2400, LENGTH = MBED_APP_SIZE - 0x2400
58+
#else
59+
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x00000400
60+
m_text (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = MBED_APP_SIZE - 0x400
61+
#endif
5762
m_text2 (RX) : ORIGIN = 0x00000000, LENGTH = 0x00020000
5863
m_data (RW) : ORIGIN = 0x80000000, LENGTH = 0x01E00000
5964
m_ncache (RW) : ORIGIN = 0x81E00000, LENGTH = 0x00200000
@@ -64,6 +69,7 @@ MEMORY
6469
/* Define output sections */
6570
SECTIONS
6671
{
72+
#if !defined(MBED_APP_COMPILE)
6773
.flash_config :
6874
{
6975
. = ALIGN(8);
@@ -82,7 +88,7 @@ SECTIONS
8288
KEEP(* (.boot_hdr.dcd_data)) /* dcd section */
8389
. = ALIGN(8);
8490
} > m_ivt
85-
91+
#endif
8692
/* The startup code goes first into internal RAM */
8793
.interrupts :
8894
{

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/device/TOOLCHAIN_IAR/MIMXRT1052xxxxx.icf

+25-13
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,19 @@ define symbol __heap_size__=0x10000;
4646
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
4747
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
4848

49-
define symbol m_interrupts_start = MBED_APP_START + 0x2000;
50-
define symbol m_interrupts_end = MBED_APP_START + 0x23FF;
49+
if (!isdefinedsymbol(MBED_APP_COMPILE)) {
50+
define symbol m_interrupts_start = MBED_APP_START + 0x2000;
51+
define symbol m_interrupts_end = MBED_APP_START + 0x23FF;
5152

52-
define symbol m_text_start = MBED_APP_START + 0x2400;
53-
define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
53+
define symbol m_text_start = MBED_APP_START + 0x2400;
54+
define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
55+
} else {
56+
define symbol m_interrupts_start = MBED_APP_START;
57+
define symbol m_interrupts_end = MBED_APP_START + 0x3FF;
58+
59+
define symbol m_text_start = MBED_APP_START + 0x400;
60+
define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
61+
}
5462

5563
define symbol m_text2_start = 0x00000000;
5664
define symbol m_text2_end = 0x0001FFFF;
@@ -70,10 +78,12 @@ define symbol m_data3_end = 0x81DFFFFF;
7078
define symbol m_ncache_start = 0x81E00000;
7179
define symbol m_ncache_end = 0x81FFFFFF;
7280

73-
define exported symbol m_boot_hdr_conf_start = MBED_APP_START;
74-
define symbol m_boot_hdr_ivt_start = MBED_APP_START + 0x1000;
75-
define symbol m_boot_hdr_boot_data_start = MBED_APP_START + 0x1020;
76-
define symbol m_boot_hdr_dcd_data_start = MBED_APP_START + 0x1030;
81+
if (!isdefinedsymbol(MBED_APP_COMPILE)) {
82+
define exported symbol m_boot_hdr_conf_start = MBED_APP_START;
83+
define symbol m_boot_hdr_ivt_start = MBED_APP_START + 0x1000;
84+
define symbol m_boot_hdr_boot_data_start = MBED_APP_START + 0x1020;
85+
define symbol m_boot_hdr_dcd_data_start = MBED_APP_START + 0x1030;
86+
}
7787

7888
/* Sizes */
7989
if (isdefinedsymbol(__stack_size__)) {
@@ -117,12 +127,14 @@ do not initialize { section .noinit };
117127

118128
place at address mem: m_interrupts_start { readonly section .intvec };
119129

120-
place at address mem:m_boot_hdr_conf_start { section .boot_hdr.conf };
121-
place at address mem:m_boot_hdr_ivt_start { section .boot_hdr.ivt };
122-
place at address mem:m_boot_hdr_boot_data_start { readonly section .boot_hdr.boot_data };
123-
place at address mem:m_boot_hdr_dcd_data_start { readonly section .boot_hdr.dcd_data };
130+
if (!isdefinedsymbol(MBED_APP_COMPILE)) {
131+
place at address mem:m_boot_hdr_conf_start { section .boot_hdr.conf };
132+
place at address mem:m_boot_hdr_ivt_start { section .boot_hdr.ivt };
133+
place at address mem:m_boot_hdr_boot_data_start { readonly section .boot_hdr.boot_data };
134+
place at address mem:m_boot_hdr_dcd_data_start { readonly section .boot_hdr.dcd_data };
135+
keep{ section .boot_hdr.conf, section .boot_hdr.ivt, section .boot_hdr.boot_data, section .boot_hdr.dcd_data };
136+
}
124137

125-
keep{ section .boot_hdr.conf, section .boot_hdr.ivt, section .boot_hdr.boot_data, section .boot_hdr.dcd_data };
126138

127139
place in TEXT_region { readonly };
128140
place in DATA3_region { block RW };

0 commit comments

Comments
 (0)