Skip to content

Commit 01f864e

Browse files
author
Cruz Monrreal
authored
Merge pull request #8553 from bcostm/F413ZH_bootloader
STM32F413ZH: Add bootloader support
2 parents 737b36f + 8560e47 commit 01f864e

File tree

6 files changed

+45
-12
lines changed

6 files changed

+45
-12
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH/TARGET_DISCO_F413ZH/system_clock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include "stm32f4xx.h"
3333
#include "mbed_error.h"
34-
34+
#include "nvic_addr.h"
3535

3636
/*!< Uncomment the following line if you need to relocate your vector Table in
3737
Internal SRAM. */
@@ -94,7 +94,7 @@ void SystemInit(void)
9494
#ifdef VECT_TAB_SRAM
9595
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
9696
#else
97-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
97+
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; /* Vector Table Relocation in Internal FLASH */
9898
#endif
9999

100100
/* In DISCO_F413ZH board, Arduino connector and Wifi embeded module are sharing the same SPI pins */

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH/device/TOOLCHAIN_ARM_MICRO/stm32f413xh.sct

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2017, STMicroelectronics
@@ -27,15 +28,24 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

30-
; STM32F413ZH: 1536 KB FLASH (0x150000) + 320 KB SRAM (0x50000)
31-
LR_IROM1 0x08000000 0x150000 { ; load region size_region
31+
#if !defined(MBED_APP_START)
32+
#define MBED_APP_START 0x08000000
33+
#endif
3234

33-
ER_IROM1 0x08000000 0x150000 { ; load address = execution address
35+
; 1536KB FLASH (0x180000)
36+
#if !defined(MBED_APP_SIZE)
37+
#define MBED_APP_SIZE 0x180000
38+
#endif
39+
40+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
41+
42+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
3443
*.o (RESET, +First)
3544
*(InRoot$$Sections)
3645
.ANY (+RO)
3746
}
3847

48+
; 320KB SRAM (0x50000)
3949
; Total: 118 vectors = 472 bytes (0x1D8) to be reserved in RAM
4050
RW_IRAM1 (0x20000000+0x1D8) (0x50000-0x1D8) { ; RW data
4151
.ANY (+RW +ZI)

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH/device/TOOLCHAIN_ARM_STD/stm32f413xh.sct

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2017, STMicroelectronics
@@ -27,15 +28,24 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

30-
; STM32F413ZH: 1536 KB FLASH (0x150000) + 320 KB SRAM (0x50000)
31-
LR_IROM1 0x08000000 0x150000 { ; load region size_region
31+
#if !defined(MBED_APP_START)
32+
#define MBED_APP_START 0x08000000
33+
#endif
3234

33-
ER_IROM1 0x08000000 0x150000 { ; load address = execution address
35+
; 1536KB FLASH (0x180000)
36+
#if !defined(MBED_APP_SIZE)
37+
#define MBED_APP_SIZE 0x180000
38+
#endif
39+
40+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
41+
42+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
3443
*.o (RESET, +First)
3544
*(InRoot$$Sections)
3645
.ANY (+RO)
3746
}
3847

48+
; 320KB SRAM (0x50000)
3949
; Total: 118 vectors = 472 bytes (0x1D8) to be reserved in RAM
4050
RW_IRAM1 (0x20000000+0x1D8) (0x50000-0x1D8) { ; RW data
4151
.ANY (+RW +ZI)

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH/device/TOOLCHAIN_GCC_ARM/STM32F413xH.ld

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
#if !defined(MBED_APP_START)
2+
#define MBED_APP_START 0x08000000
3+
#endif
4+
5+
#if !defined(MBED_APP_SIZE)
6+
#define MBED_APP_SIZE 1536K
7+
#endif
8+
19
/* Linker script to configure memory regions. */
210
MEMORY
311
{
4-
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1536K
12+
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
513
RAM (rwx) : ORIGIN = 0x200001D8, LENGTH = 320K - 0x1D8
614
}
715

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH/device/TOOLCHAIN_IAR/stm32f413xx.icf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/* [ROM = 1536kb = 0x180000] */
2-
define symbol __intvec_start__ = 0x08000000;
3-
define symbol __region_ROM_start__ = 0x08000000;
4-
define symbol __region_ROM_end__ = 0x0817FFFF;
2+
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; }
3+
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x180000; }
4+
5+
define symbol __intvec_start__ = MBED_APP_START;
6+
define symbol __region_ROM_start__ = MBED_APP_START;
7+
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
58

69
/* [RAM = 320kb = 0x50000] Vector table dynamic copy: 118 vectors = 472 bytes (0x1D8) to be reserved in RAM */
710
define symbol __NVIC_start__ = 0x20000000;

targets/targets.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,7 @@
12951295
"detect_code": ["0743"],
12961296
"macros_add": ["USB_STM_HAL", "USBHOST_OTHER"],
12971297
"device_has_add": ["ANALOGOUT", "CAN", "SERIAL_ASYNCH", "SERIAL_FC", "TRNG", "FLASH", "QSPI"],
1298+
"bootloader_supported": true,
12981299
"release_versions": ["2", "5"],
12991300
"device_name": "STM32F413ZH"
13001301
},
@@ -1317,6 +1318,7 @@
13171318
"detect_code": ["0743"],
13181319
"macros_add": ["USB_STM_HAL", "USBHOST_OTHER"],
13191320
"device_has_add": ["ANALOGOUT", "CAN", "SERIAL_ASYNCH", "SERIAL_FC", "TRNG", "FLASH"],
1321+
"bootloader_supported": true,
13201322
"release_versions": ["2", "5"],
13211323
"device_name": "STM32F413ZH"
13221324
},

0 commit comments

Comments
 (0)