Skip to content

Commit daf6112

Browse files
authored
Merge pull request #15299 from mikrodust-henrikp/stm32f412xe_build_fix
Make STM32F412xE targets build
2 parents 6fcd9c6 + 684181c commit daf6112

File tree

5 files changed

+106
-5
lines changed

5 files changed

+106
-5
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F412xE/TOOLCHAIN_ARM/stm32f412xe.sct

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
/* Round up VECTORS_SIZE to 8 bytes */
3838
#define VECTORS_SIZE (((NVIC_NUM_VECTORS * 4) + 7) AND ~7)
3939

40+
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
41+
42+
#define MBED_IRAM1_START (MBED_RAM_START + VECTORS_SIZE + MBED_CRASH_REPORT_RAM_SIZE)
43+
#define MBED_IRAM1_SIZE (MBED_RAM_SIZE - VECTORS_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
44+
45+
46+
#define RAM_FIXED_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE + VECTORS_SIZE + MBED_CRASH_REPORT_RAM_SIZE)
47+
4048
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
4149

4250
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
@@ -45,11 +53,14 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
4553
.ANY (+RO)
4654
}
4755

48-
RW_IRAM1 (MBED_RAM_START + VECTORS_SIZE) { ; RW data
49-
.ANY (+RW +ZI)
56+
RW_m_crash_data (MBED_RAM_START + VECTORS_SIZE) EMPTY MBED_CRASH_REPORT_RAM_SIZE { ; RW data
57+
}
58+
59+
RW_IRAM1 MBED_IRAM1_START MBED_IRAM1_SIZE { ; RW data
60+
.ANY (+RW +ZI)
5061
}
5162

52-
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_START + MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE - AlignExpr(ImageLimit(RW_IRAM1), 16)) { ; Heap growing up
63+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_IRAM1_START + MBED_RAM_SIZE - RAM_FIXED_SIZE - AlignExpr(ImageLimit(RW_IRAM1), 16)) { ; Heap growing up
5364
}
5465

5566
ARM_LIB_STACK (MBED_RAM_START + MBED_RAM_SIZE) EMPTY -MBED_CONF_TARGET_BOOT_STACK_SIZE { ; Stack region growing down

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F412xE/TOOLCHAIN_GCC_ARM/stm32f412xe.ld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
/* Round up VECTORS_SIZE to 8 bytes */
3636
#define VECTORS_SIZE (((NVIC_NUM_VECTORS * 4) + 7) & 0xFFFFFFF8)
3737

38+
M_CRASH_DATA_RAM_SIZE = 0x100;
39+
3840
MEMORY
3941
{
4042
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
@@ -114,6 +116,18 @@ SECTIONS
114116
__etext = .;
115117
_sidata = .;
116118

119+
.crash_data_ram :
120+
{
121+
. = ALIGN(8);
122+
__CRASH_DATA_RAM__ = .;
123+
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
124+
KEEP(*(.keep.crash_data_ram))
125+
*(.m_crash_data_ram) /* This is a user defined section */
126+
. += M_CRASH_DATA_RAM_SIZE;
127+
. = ALIGN(8);
128+
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
129+
} > RAM
130+
117131
.data : AT (__etext)
118132
{
119133
__data_start__ = .;

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F412xE/TOOLCHAIN_IAR/stm32f412xe.icf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ if (!isdefinedsymbol(MBED_CONF_TARGET_BOOT_STACK_SIZE)) {
3939

4040
/* Round up VECTORS_SIZE to 8 bytes */
4141
define symbol VECTORS_SIZE = ((VECTORS * 4) + 7) & ~7;
42-
define symbol RAM_REGION_START = MBED_RAM_START + VECTORS_SIZE;
43-
define symbol RAM_REGION_SIZE = MBED_RAM_SIZE - VECTORS_SIZE;
42+
43+
define symbol CRASH_DATA_START = MBED_RAM_START + VECTORS_SIZE;
44+
define symbol CRASH_DATA_SIZE = 0x100;
45+
define exported symbol __CRASH_DATA_RAM_START__ = CRASH_DATA_START;
46+
47+
define symbol RAM_REGION_START = CRASH_DATA_START + CRASH_DATA_SIZE;
48+
define symbol RAM_REGION_SIZE = MBED_RAM_SIZE - VECTORS_SIZE - CRASH_DATA_SIZE;
4449

4550
define memory mem with size = 4G;
4651
define region ROM_region = mem:[from MBED_APP_START size MBED_APP_SIZE];
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef MBED_FLASH_DATA_H
31+
#define MBED_FLASH_DATA_H
32+
33+
#include "device.h"
34+
#include <stdint.h>
35+
36+
#if DEVICE_FLASH
37+
38+
/* Exported types ------------------------------------------------------------*/
39+
/* Exported constants --------------------------------------------------------*/
40+
/* Exported macro ------------------------------------------------------------*/
41+
/* Flash size */
42+
#define FLASH_SIZE (uint32_t) 0x80000 // 512 KB
43+
44+
/* Base address of the Flash sectors Bank 1 */
45+
#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */
46+
#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */
47+
#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */
48+
#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */
49+
#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */
50+
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */
51+
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */
52+
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */
53+
54+
#endif
55+
#endif

targets/targets.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,22 @@
19141914
"0320"
19151915
]
19161916
},
1917+
"MCU_STM32F412xE": {
1918+
"inherits": [
1919+
"MCU_STM32F4"
1920+
],
1921+
"public": false,
1922+
"extra_labels_add": [
1923+
"STM32F412xE"
1924+
],
1925+
"macros_add": [
1926+
"STM32F412Zx"
1927+
],
1928+
"device_has_add": [
1929+
"CAN",
1930+
"TRNG"
1931+
]
1932+
},
19171933
"MCU_STM32F412xG": {
19181934
"inherits": [
19191935
"MCU_STM32F4"

0 commit comments

Comments
 (0)