Skip to content

Commit 4d56b94

Browse files
authored
Merge pull request #10349 from studavekar/fix-nuvonton-crash-data
Fix crash capture feature for nuvoton
2 parents 71b12f9 + 53ae5fe commit 4d56b94

File tree

7 files changed

+39
-12
lines changed

7 files changed

+39
-12
lines changed

platform/mbed_crash_data_offsets.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ extern "C" {
2828
extern uint32_t Image$$RW_m_crash_data$$ZI$$Base[];
2929
extern uint32_t Image$$RW_m_crash_data$$ZI$$Size;
3030
#define __CRASH_DATA_RAM_START__ Image$$RW_m_crash_data$$ZI$$Base
31-
#define __CRASH_DATA_RAM_SIZE__ Image$$RW_m_crash_data$$ZI$$Size
3231
#elif defined(__ICCARM__)
3332
extern uint32_t __CRASH_DATA_RAM_START__[];
3433
extern uint32_t __CRASH_DATA_RAM_END__[];
35-
#define __CRASH_DATA_RAM_SIZE__ (__CRASH_DATA_RAM_END__ - __CRASH_DATA_RAM_START__)
3634
#elif defined(__GNUC__)
3735
extern uint32_t __CRASH_DATA_RAM_START__[];
3836
extern uint32_t __CRASH_DATA_RAM_END__[];
39-
#define __CRASH_DATA_RAM_SIZE__ (__CRASH_DATA_RAM_END__ - __CRASH_DATA_RAM_START__)
4037
#endif /* defined(__CC_ARM) */
4138

4239
/* Offset definitions for context capture */

platform/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@
183183
"crash-capture-enabled": true,
184184
"fatal-error-auto-reboot-enabled": true
185185
},
186+
"NUMAKER_PFM_NUC472": {
187+
"crash-capture-enabled": true,
188+
"fatal-error-auto-reboot-enabled": true
189+
},
186190
"NRF52840_DK": {
187191
"crash-capture-enabled": true,
188192
"fatal-error-auto-reboot-enabled": true

targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_IAR/M487.icf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
1010
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
1111
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
1212
define symbol __ICFEDIT_region_IRAM_start__ = 0x20000000;
13-
define symbol __ICFEDIT_region_IRAM_end__ = 0x20028000 - 1;
13+
define symbol __ICFEDIT_region_IRAM_end__ = 0x20027F00 - 1;
14+
define symbol __region_CRASH_DATA_RAM_start__ = 0x20027F00;
15+
define symbol __region_CRASH_DATA_RAM_end__ = 0x20028000 - 1;
1416
/*-Sizes-*/
1517
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
16-
define symbol __ICFEDIT_size_crash_data__ = 0x100;
1718
define symbol __ICFEDIT_size_intvec__ = (4 * (16 + 96));
1819
define symbol __ICFEDIT_size_heap__ = 0x10000;
1920
/**** End of ICF editor section. ###ICF###*/
@@ -22,16 +23,16 @@ define symbol __ICFEDIT_size_heap__ = 0x10000;
2223
define memory mem with size = 4G;
2324
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
2425
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
26+
define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__];
2527

2628
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
2729
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
2830
/* NOTE: Vector table base requires to be aligned to the power of vector table size. Give a safe value here. */
2931
define block IRAMVEC with alignment = 1024, size = __ICFEDIT_size_intvec__ { };
30-
define block CRASH_DATA_RAM with alignment = 8, size = __ICFEDIT_size_crash_data__ { };
3132

3233
/* Define Crash Data Symbols */
33-
define exported symbol __CRASH_DATA_RAM_START__ = __ICFEDIT_region_IRAM_start__ + __ICFEDIT_size_cstack__ + __ICFEDIT_size_intvec__;
34-
define exported symbol __CRASH_DATA_RAM_END__ = __ICFEDIT_region_IRAM_start__ + __ICFEDIT_size_cstack__ + __ICFEDIT_size_intvec__ + __ICFEDIT_size_crash_data__;
34+
define exported symbol __CRASH_DATA_RAM_START__ = __region_CRASH_DATA_RAM_start__;
35+
define exported symbol __CRASH_DATA_RAM_END__ = __region_CRASH_DATA_RAM_end__;
3536

3637
initialize by copy { readwrite };
3738
do not initialize { section .noinit };
@@ -41,6 +42,5 @@ place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
4142
place in ROM_region { readonly };
4243
place at start of IRAM_region { block CSTACK };
4344
place in IRAM_region { block IRAMVEC };
44-
place in IRAM_region { block CRASH_DATA_RAM };
4545
place in IRAM_region { readwrite };
4646
place in IRAM_region { block HEAP };

targets/TARGET_NUVOTON/TARGET_NUC472/device/TOOLCHAIN_ARM_MICRO/TARGET_NU_XRAM_SUPPORTED/NUC472.sct

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
4747
ER_IRAMVEC AlignExpr(+0, 1024) EMPTY VECTOR_SIZE { ; Reserve for vectors
4848
}
4949

50+
RW_m_crash_data AlignExpr(+0, 0x100) EMPTY 0x100 { ; Reserve for crash data storage
51+
}
52+
5053
RW_IRAM1 AlignExpr(+0, 16) { ; 16 byte-aligned
5154
.ANY (+RW +ZI)
5255
}

targets/TARGET_NUVOTON/TARGET_NUC472/device/TOOLCHAIN_ARM_STD/TARGET_NU_XRAM_SUPPORTED/NUC472.sct

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ LR_IROM1 MBED_APP_START {
3131
ER_IRAMVEC AlignExpr(+0, 1024) EMPTY (4*(16 + 142)) { ; Reserve for vectors
3232
}
3333

34+
RW_m_crash_data AlignExpr(+0, 0x100) EMPTY 0x100 { ; Reserve for crash data storage
35+
}
36+
3437
RW_IRAM1 AlignExpr(+0, 16) { ; 16 byte-aligned
3538
.ANY (+RW +ZI)
3639
}
37-
40+
3841
; Too large to place into internal SRAM. So place into external SRAM instead.
3942
ER_XRAM1 0x60000000 {
4043
*lwip_* (+ZI)

targets/TARGET_NUVOTON/TARGET_NUC472/device/TOOLCHAIN_GCC_ARM/TARGET_NU_XRAM_SUPPORTED/NUC472.ld

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define MBED_BOOT_STACK_SIZE 0x400
1515
#endif
1616

17+
M_CRASH_DATA_RAM_SIZE = 0x100;
1718
StackSize = MBED_BOOT_STACK_SIZE;
1819

1920
MEMORY
@@ -132,7 +133,19 @@ SECTIONS
132133
. += __vector_size;
133134
PROVIDE(__end_vector_table__ = .);
134135
} > RAM_INTERN
135-
136+
137+
.crash_data_ram :
138+
{
139+
. = ALIGN(8);
140+
__CRASH_DATA_RAM__ = .;
141+
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
142+
KEEP(*(.keep.crash_data_ram))
143+
*(.m_crash_data_ram) /* This is a user defined section */
144+
. += M_CRASH_DATA_RAM_SIZE;
145+
. = ALIGN(8);
146+
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
147+
} > RAM_INTERN
148+
136149
.data :
137150
{
138151
PROVIDE( __etext = LOADADDR(.data) );

targets/TARGET_NUVOTON/TARGET_NUC472/device/TOOLCHAIN_IAR/TARGET_NU_XRAM_SUPPORTED/NUC472_442.icf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
1010
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
1111
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
1212
define symbol __ICFEDIT_region_IRAM_start__ = 0x20000000;
13-
define symbol __ICFEDIT_region_IRAM_end__ = 0x20010000 - 1;
13+
define symbol __ICFEDIT_region_IRAM_end__ = 0x2000FF00 - 1;
14+
define symbol __region_CRASH_DATA_RAM_start__ = 0x2000FF00;
15+
define symbol __region_CRASH_DATA_RAM_end__ = 0x20010000 - 1;
1416
define symbol __ICFEDIT_region_XRAM_start__ = 0x60000000;
1517
define symbol __ICFEDIT_region_XRAM_end__ = 0x60100000 - 1;
1618
/*-Sizes-*/
@@ -23,6 +25,11 @@ define memory mem with size = 4G;
2325
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
2426
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM_start__ to __ICFEDIT_region_IRAM_end__];
2527
define region XRAM_region = mem:[from __ICFEDIT_region_XRAM_start__ to __ICFEDIT_region_XRAM_end__];
28+
define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__];
29+
30+
/* Define Crash Data Symbols */
31+
define exported symbol __CRASH_DATA_RAM_START__ = __region_CRASH_DATA_RAM_start__;
32+
define exported symbol __CRASH_DATA_RAM_END__ = __region_CRASH_DATA_RAM_end__;
2633

2734
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
2835
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };

0 commit comments

Comments
 (0)