Skip to content

Commit ef8c1c3

Browse files
committed
Linker script modifications for crash data region
1 parent 6181394 commit ef8c1c3

File tree

44 files changed

+496
-43
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+496
-43
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_ARM_STD/MK66FN2M0xxx18.sct

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@
7272
#define m_interrupts_ram_start 0x1FFF0000
7373
#define m_interrupts_ram_size __ram_vector_table_size__
7474

75-
#define m_data_start (m_interrupts_ram_start + m_interrupts_ram_size)
76-
#define m_data_size (0x00010000 - m_interrupts_ram_size)
75+
#define m_crash_report_ram_start (m_interrupts_ram_start + m_interrupts_ram_size)
76+
#define m_crash_report_ram_size (0x100)
77+
78+
#define m_data_start (m_crash_report_ram_start + m_crash_report_ram_size)
79+
#define m_data_size (0x00010000 - (m_interrupts_ram_size+m_crash_report_ram_size))
7780

7881
#define m_data_2_start 0x20000000
7982
#define m_data_2_size 0x00030000
@@ -110,6 +113,8 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo
110113
VECTOR_RAM m_interrupts_start EMPTY 0 {
111114
}
112115
#endif
116+
RW_m_crash_data m_crash_report_ram_start EMPTY m_crash_report_ram_size { ; RW data
117+
}
113118
RW_m_data m_data_start m_data_size { ; RW data
114119
.ANY (+RW +ZI)
115120
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_GCC_ARM/MK66FN2M0xxx18.ld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ __heap_size__ = 0x6000;
6666
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
6767
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
6868
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
69+
M_CRASH_DATA_RAM_SIZE = 0x100;
6970

7071
/* Specify the memory areas */
7172
MEMORY
@@ -195,6 +196,18 @@ SECTIONS
195196
. = ALIGN(8);
196197
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
197198
} > m_data
199+
200+
.crash_data_ram :
201+
{
202+
. = ALIGN(8);
203+
__CRASH_DATA_RAM__ = .;
204+
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
205+
KEEP(*(.keep.crash_data_ram))
206+
*(.m_crash_data_ram) /* This is a user defined section */
207+
. += M_CRASH_DATA_RAM_SIZE;
208+
. = ALIGN(8);
209+
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
210+
} > m_data
198211

199212
__VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
200213
__RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/device/TOOLCHAIN_IAR/MK66FN2M0xxx18.icf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
7272
define symbol m_interrupts_ram_start = 0x1FFF0000;
7373
define symbol m_interrupts_ram_end = 0x1FFF0000 + __ram_vector_table_offset__;
7474

75-
define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
75+
define symbol m_crash_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
76+
define symbol m_crash_data_size = 0x100;
77+
78+
define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__ + m_crash_data_size;
7679
define symbol m_data_end = 0x1FFFFFFF;
7780

7881
define symbol m_data_2_start = 0x20000000;
@@ -94,6 +97,8 @@ if (isdefinedsymbol(__heap_size__)) {
9497
define exported symbol __VECTOR_TABLE = m_interrupts_start;
9598
define exported symbol __VECTOR_RAM = isdefinedsymbol(__ram_vector_table__) ? m_interrupts_ram_start : m_interrupts_start;
9699
define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__;
100+
define exported symbol __CRASH_DATA_RAM_START__ = m_crash_data_start;
101+
define exported symbol __CRASH_DATA_RAM_END__ = m_crash_data_start + m_crash_data_size;
97102

98103
define memory mem with size = 4G;
99104
define region m_flash_config_region = mem:[from m_flash_config_start to m_flash_config_end];

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_ARM_STD/MK64FN1M0xxx12.sct

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@
8080
#define m_interrupts_ram_start 0x1FFF0000
8181
#define m_interrupts_ram_size __ram_vector_table_size__
8282

83-
#define m_data_start (m_interrupts_ram_start + m_interrupts_ram_size)
84-
#define m_data_size (0x00010000 - m_interrupts_ram_size)
83+
#define m_crash_report_ram_start (m_interrupts_ram_start + m_interrupts_ram_size)
84+
#define m_crash_report_ram_size (0x100)
85+
86+
#define m_data_start (m_crash_report_ram_start + m_crash_report_ram_size)
87+
#define m_data_size (0x00010000 - (m_interrupts_ram_size+m_crash_report_ram_size))
8588

8689
#define m_data_2_start 0x20000000
8790
#define m_data_2_size 0x00030000
@@ -118,6 +121,8 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo
118121
VECTOR_RAM m_interrupts_start EMPTY 0 {
119122
}
120123
#endif
124+
RW_m_crash_data m_crash_report_ram_start EMPTY m_crash_report_ram_size { ; RW data
125+
}
121126
RW_m_data m_data_start m_data_size { ; RW data
122127
.ANY (+RW +ZI)
123128
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ __heap_size__ = 0x6000;
7474
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
7575
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
7676
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
77+
M_CRASH_DATA_RAM_SIZE = 0x100;
7778

7879
/* Specify the memory areas */
7980
MEMORY
@@ -200,6 +201,18 @@ SECTIONS
200201
. = ALIGN(8);
201202
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
202203
} > m_data
204+
205+
.crash_data_ram :
206+
{
207+
. = ALIGN(8);
208+
__CRASH_DATA_RAM__ = .;
209+
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
210+
KEEP(*(.keep.crash_data_ram))
211+
*(.m_crash_data_ram) /* This is a user defined section */
212+
. += M_CRASH_DATA_RAM_SIZE;
213+
. = ALIGN(8);
214+
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
215+
} > m_data
203216

204217

205218
__VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_IAR/MK64FN1M0xxx12.icf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ define symbol m_text_end = MBED_APP_START + MBED_APP_SIZE - 1;
7979
define symbol m_interrupts_ram_start = 0x1FFF0000;
8080
define symbol m_interrupts_ram_end = 0x1FFF0000 + __ram_vector_table_offset__;
8181

82-
define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
82+
define symbol m_crash_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
83+
define symbol m_crash_data_size = 0x100;
84+
85+
define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__ + m_crash_data_size;
8386
define symbol m_data_end = 0x1FFFFFFF;
8487

8588
define symbol m_data_2_start = 0x20000000;
@@ -101,6 +104,8 @@ if (isdefinedsymbol(__heap_size__)) {
101104
define exported symbol __VECTOR_TABLE = m_interrupts_start;
102105
define exported symbol __VECTOR_RAM = isdefinedsymbol(__ram_vector_table__) ? m_interrupts_ram_start : m_interrupts_start;
103106
define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__;
107+
define exported symbol __CRASH_DATA_RAM_START__ = m_crash_data_start;
108+
define exported symbol __CRASH_DATA_RAM_END__ = m_crash_data_start + m_crash_data_size;
104109

105110
define memory mem with size = 4G;
106111
define region m_flash_config_region = mem:[from m_flash_config_start to m_flash_config_end];

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222

2323
#define MBED_RAM0_START MBED_RAM_START
2424
#define MBED_RAM0_SIZE 0x100
25-
#define MBED_RAM1_START (MBED_RAM_START + MBED_RAM0_SIZE)
26-
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - MBED_RAM0_SIZE)
25+
26+
#define MBED_CRASH_REPORT_RAM_START (MBED_RAM0_START + MBED_RAM0_SIZE)
27+
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
28+
29+
#define MBED_RAM1_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
30+
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - (MBED_RAM0_SIZE + MBED_CRASH_REPORT_RAM_SIZE))
2731

2832
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
2933
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
@@ -34,6 +38,8 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
3438
RW_IRAM0 MBED_RAM0_START UNINIT MBED_RAM0_SIZE { ;no init section
3539
*(*nvictable)
3640
}
41+
RW_m_crash_data MBED_CRASH_REPORT_RAM_START EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
42+
}
3743
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE {
3844
.ANY (+RW +ZI)
3945
}

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@
3838

3939
#define MBED_RAM0_START MBED_RAM_START
4040
#define MBED_RAM0_SIZE 0x100
41-
#define MBED_RAM1_START (MBED_RAM_START + MBED_RAM0_SIZE)
42-
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - MBED_RAM0_SIZE)
41+
42+
#define MBED_CRASH_REPORT_RAM_START (MBED_RAM0_START + MBED_RAM0_SIZE)
43+
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
44+
45+
#define MBED_RAM1_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
46+
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - (MBED_RAM0_SIZE + MBED_CRASH_REPORT_RAM_SIZE))
4347

4448
MEMORY
4549
{
4650
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
4751
RAM_NVIC (rwx) : ORIGIN = MBED_RAM0_START, LENGTH = MBED_RAM0_SIZE
52+
RAM_CRASH_DATA (rwx) : ORIGIN = MBED_CRASH_REPORT_RAM_START, LENGTH = MBED_CRASH_REPORT_RAM_SIZE
4853
RAM (rwx) : ORIGIN = MBED_RAM1_START, LENGTH = MBED_RAM1_SIZE
4954
}
5055

@@ -206,6 +211,18 @@ SECTIONS
206211
KEEP(*(.nvictable))
207212
PROVIDE(__stop_nvictable = .);
208213
} > RAM_NVIC
214+
215+
.crash_data_ram :
216+
{
217+
. = ALIGN(8);
218+
__CRASH_DATA_RAM__ = .;
219+
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
220+
KEEP(*(.keep.crash_data_ram))
221+
*(.m_crash_data_ram) /* This is a user defined section */
222+
. += MBED_CRASH_REPORT_RAM_SIZE;
223+
. = ALIGN(8);
224+
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
225+
} > RAM_CRASH_DATA
209226

210227
.noinit (NOLOAD) :
211228
{

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52840.icf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ if (!isdefinedsymbol(MBED_RAM_START)) {
2424

2525
define symbol MBED_RAM0_START = MBED_RAM_START;
2626
define symbol MBED_RAM0_SIZE = 0x100;
27-
define symbol MBED_RAM1_START = (MBED_RAM_START + MBED_RAM0_SIZE);
28-
define symbol MBED_RAM1_SIZE = (MBED_RAM_SIZE - MBED_RAM0_SIZE);
27+
define symbol MBED_CRASH_REPORT_RAM_START = (MBED_RAM_START + MBED_RAM0_SIZE);
28+
define symbol MBED_CRASH_REPORT_RAM_SIZE = 0x100;
29+
define symbol MBED_RAM1_START = (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE);
30+
define symbol MBED_RAM1_SIZE = (MBED_RAM_SIZE - (MBED_RAM0_SIZE + MBED_CRASH_REPORT_RAM_SIZE));
31+
define exported symbol __CRASH_DATA_RAM_START__ = MBED_CRASH_REPORT_RAM_START;
32+
define exported symbol __CRASH_DATA_RAM_END__ = MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE;
2933

3034
/*-Specials-*/
3135
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;

targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_MICRO/M487.sct

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
#define SPIM_CCM_START 0x20020000
1212
#define SPIM_CCM_END 0x20028000
1313

14+
#define MBED_RAM_START 0x20000000
15+
#define MBED_RAM_SIZE 0x20000
16+
#define MBED_STACK_RAM_START (MBED_RAM_START)
17+
#define MBED_STACK_RAM_SIZE 0x800
18+
#define MBED_VECTTABLE_RAM_START (MBED_STACK_RAM_START + MBED_STACK_RAM_SIZE)
19+
#define MBED_VECTTABLE_RAM_SIZE (4*(16 + 96))
20+
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
21+
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
22+
1423
LR_IROM1 MBED_APP_START {
1524
ER_IROM1 MBED_APP_START { ; load address = execution address
1625
*(RESET, +First)
@@ -19,10 +28,13 @@ LR_IROM1 MBED_APP_START {
1928
}
2029

2130

22-
ARM_LIB_STACK 0x20000000 EMPTY 0x800 {
31+
ARM_LIB_STACK MBED_STACK_RAM_START EMPTY MBED_STACK_RAM_SIZE {
32+
}
33+
34+
ER_IRAMVEC MBED_VECTTABLE_RAM_START EMPTY MBED_VECTTABLE_RAM_SIZE { ; Reserve for vectors
2335
}
2436

25-
ER_IRAMVEC 0x20000800 EMPTY (4*(16 + 96)) { ; Reserve for vectors
37+
RW_m_crash_data MBED_CRASH_REPORT_RAM_START EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; Reserve for crash data storage
2638
}
2739

2840
RW_IRAM1 AlignExpr(+0, 16) { ; 16 byte-aligned

0 commit comments

Comments
 (0)