Skip to content

Commit 2956a35

Browse files
authored
Merge pull request #10538 from masoudr/master
Enabled crash reporting for DISCO_F407VG target
2 parents f65e30e + 06ed3c4 commit 2956a35

File tree

5 files changed

+66
-6
lines changed

5 files changed

+66
-6
lines changed

platform/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@
198198
"NUCLEO_F411RE": {
199199
"crash-capture-enabled": true,
200200
"fatal-error-auto-reboot-enabled": true
201+
},
202+
"DISCO_F407VG": {
203+
"crash-capture-enabled": true,
204+
"fatal-error-auto-reboot-enabled": true
201205
}
202206
}
203207
}

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/TOOLCHAIN_ARM_MICRO/STM32F407xx.sct

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@
2929

3030
#define VECTOR_SIZE 0x188
3131

32-
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
32+
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
33+
34+
#define MBED_IRAM1_START (MBED_RAM_START + VECTOR_SIZE + MBED_CRASH_REPORT_RAM_SIZE)
35+
#define MBED_IRAM1_SIZE (MBED_RAM_SIZE - VECTOR_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
36+
37+
38+
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE+MBED_CRASH_REPORT_RAM_SIZE)
3339

3440
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3541

@@ -39,7 +45,10 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3945
.ANY (+RO)
4046
}
4147

42-
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
48+
RW_m_crash_data (MBED_RAM_START+VECTOR_SIZE) EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
49+
}
50+
51+
RW_IRAM1 MBED_IRAM1_START MBED_IRAM1_SIZE { ; RW data
4352
.ANY (+RW +ZI)
4453
}
4554

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/TOOLCHAIN_ARM_STD/STM32F407xx.sct

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,50 @@
33
; *** Scatter-Loading Description File ***
44
; *****************************************
55

6+
; 1 MB FLASH (0x100000) + 192 KB SRAM (0x30000) + 64 KB CCBRAM (0x10000)+ 4 KB BKPSRAM
7+
8+
#if !defined(MBED_APP_START)
9+
#define MBED_APP_START 0x08000000
10+
#endif
11+
12+
#if !defined(MBED_APP_SIZE)
13+
#define MBED_APP_SIZE 0x100000
14+
#endif
15+
616
#if !defined(MBED_BOOT_STACK_SIZE)
717
#define MBED_BOOT_STACK_SIZE 0x400
818
#endif
919

1020
#define Stack_Size MBED_BOOT_STACK_SIZE
1121

12-
LR_IROM1 0x08000000 0x00100000 { ; load region size_region
13-
ER_IROM1 0x08000000 0x00100000 { ; load address = execution address
22+
#define MBED_RAM_START 0x20000000
23+
#define MBED_RAM_SIZE 0x30000
24+
#define MBED_VECTTABLE_RAM_START (MBED_RAM_START)
25+
#define MBED_VECTTABLE_RAM_SIZE 0x1B0
26+
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
27+
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
28+
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
29+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
30+
31+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
32+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
1433
*.o (RESET, +First)
1534
*(InRoot$$Sections)
1635
.ANY (+RO)
1736
}
18-
RW_IRAM1 0x20000188 0x0001FE78-Stack_Size {
37+
38+
; Total: 107 vectors = 428 bytes (0x1AC) 8-byte aligned = 0x1B0 (0x1AC + 0x4) to be reserved in RAM
39+
RW_IRAM1 (MBED_RAM0_START) (MBED_RAM0_SIZE-Stack_Size) { ; RW data
1940
.ANY (+RW +ZI)
2041
}
42+
2143
RW_IRAM2 0x10000000 0x00010000 { ; CCM
2244
.ANY (CCMRAM)
2345
}
46+
47+
RW_m_crash_data MBED_CRASH_REPORT_RAM_START EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
48+
}
49+
2450
ARM_LIB_STACK (0x20000188+0x0001FE78) EMPTY -Stack_Size { ; stack
2551
}
2652
}

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/TOOLCHAIN_GCC_ARM/STM32F407XG.ld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
STACK_SIZE = MBED_BOOT_STACK_SIZE;
88

9+
M_CRASH_DATA_RAM_SIZE = 0x100;
10+
911
MEMORY
1012
{
1113
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
@@ -85,6 +87,18 @@ SECTIONS
8587
__etext = .;
8688
_sidata = .;
8789

90+
.crash_data_ram :
91+
{
92+
. = ALIGN(8);
93+
__CRASH_DATA_RAM__ = .;
94+
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
95+
KEEP(*(.keep.crash_data_ram))
96+
*(.m_crash_data_ram) /* This is a user defined section */
97+
. += M_CRASH_DATA_RAM_SIZE;
98+
. = ALIGN(8);
99+
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
100+
} > RAM
101+
88102
.data : AT (__etext)
89103
{
90104
__data_start__ = .;

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F407xG/device/TOOLCHAIN_IAR/stm32f407xx.icf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
88
define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
99
define symbol __NVIC_start__ = 0x20000000;
1010
define symbol __NVIC_end__ = 0x20000187;
11-
define symbol __ICFEDIT_region_RAM_start__ = 0x20000188;
11+
define symbol __region_CRASH_DATA_RAM_start__ = 0x20000188;
12+
define symbol __region_CRASH_DATA_RAM_end__ = 0x20000287;
13+
define symbol __ICFEDIT_region_RAM_start__ = 0x20000288;
1214
define symbol __ICFEDIT_region_RAM_end__ = 0x2001FFFF;
1315
/*-Sizes-*/
1416
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
@@ -20,8 +22,13 @@ define symbol __ICFEDIT_size_heap__ = 0x8000;
2022

2123
define memory mem with size = 4G;
2224
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
25+
define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__];
2326
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
2427

28+
/* Define Crash Data Symbols */
29+
define exported symbol __CRASH_DATA_RAM_START__ = __region_CRASH_DATA_RAM_start__;
30+
define exported symbol __CRASH_DATA_RAM_END__ = __region_CRASH_DATA_RAM_end__;
31+
2532
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
2633
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
2734

0 commit comments

Comments
 (0)