Skip to content

Commit 97e1c9c

Browse files
authored
Merge pull request #10287 from linlingao/pr10177
Enable MTS_DRAGONFLY_F411RE to register with Pelion
2 parents 872ad22 + 84b8517 commit 97e1c9c

File tree

11 files changed

+148
-28
lines changed

11 files changed

+148
-28
lines changed

components/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@
3232
"SPI_CLK": "PE_12",
3333
"SPI_CS": "PE_11"
3434
},
35-
"MTB_ADV_WISE_1530": {
35+
"MTB_ADV_WISE_1530": {
3636
"SPI_MOSI": "PC_3",
3737
"SPI_MISO": "PC_2",
3838
"SPI_CLK": "PB_13",
39-
"SPI_CS": "PC_12"
39+
"SPI_CS": "PC_12"
4040
},
41-
"MTB_MXCHIP_EMW3166": {
41+
"MTB_MXCHIP_EMW3166": {
4242
"SPI_MOSI": "PB_15",
4343
"SPI_MISO": "PB_14",
4444
"SPI_CLK": "PB_13",
45-
"SPI_CS": "PA_10"
45+
"SPI_CS": "PA_10"
4646
},
47-
"MTB_USI_WM_BN_BM_22": {
47+
"MTB_USI_WM_BN_BM_22": {
4848
"SPI_MOSI": "PC_3",
4949
"SPI_MISO": "PC_2",
5050
"SPI_CLK": "PB_13",
51-
"SPI_CS": "PA_6"
51+
"SPI_CS": "PA_6"
5252
},
53-
"MTB_ADV_WISE_1570": {
53+
"MTB_ADV_WISE_1570": {
5454
"SPI_MOSI": "PA_7",
5555
"SPI_MISO": "PA_6",
5656
"SPI_CLK": "PA_5",
@@ -62,6 +62,12 @@
6262
"SPI_MISO": "PE_13",
6363
"SPI_CLK": "PE_12",
6464
"SPI_CS": "PE_11"
65+
},
66+
"MTS_DRAGONFLY_F411RE": {
67+
"SPI_MOSI": "SPI3_MOSI",
68+
"SPI_MISO": "SPI3_MISO",
69+
"SPI_CLK": "SPI3_SCK",
70+
"SPI_CS": "SPI_CS1"
6571
}
6672
}
6773
}

features/lwipstack/mbed_lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@
176176
},
177177
"FVP_MPS2_M3": {
178178
"mem-size": 36560
179+
},
180+
"MTS_DRAGONFLY_F411RE": {
181+
"tcpip-thread-stacksize": 1600
179182
}
180183
}
181184
}

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_ARM_STD/stm32f411re.sct

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,51 @@
2828
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3030

31+
#if !defined(MBED_APP_START)
32+
#ifdef DISABLE_POST_BINARY_HOOK
33+
#define MBED_APP_START 0x08000000
34+
#else
35+
#define MBED_APP_START 0x08010000
36+
#endif
37+
#endif
38+
39+
#if !defined(MBED_APP_SIZE)
40+
#ifdef DISABLE_POST_BINARY_HOOK
41+
#define MBED_APP_SIZE 0x80000
42+
#else
43+
#define MBED_APP_SIZE (0x80000 - 0x10000)
44+
#endif
45+
#endif
46+
3147
#if !defined(MBED_BOOT_STACK_SIZE)
3248
#define MBED_BOOT_STACK_SIZE 0x400
3349
#endif
3450

3551
#define Stack_Size MBED_BOOT_STACK_SIZE
3652

37-
; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000)
38-
; FIRST 64 KB FLASH FOR BOOTLOADER
39-
; REST 448 KB FLASH FOR APPLICATION
40-
LR_IROM1 0x08010000 0x70000 { ; load region size_region
53+
#define MBED_RAM_START 0x20000000
54+
#define MBED_RAM_SIZE 0x20000
55+
#define MBED_VECTTABLE_RAM_START (MBED_RAM_START)
56+
#define MBED_VECTTABLE_RAM_SIZE 0x198
57+
#define MBED_RAM0_START (MBED_RAM_START + MBED_VECTTABLE_RAM_SIZE)
58+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE - MBED_VECTTABLE_RAM_SIZE)
59+
60+
; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000) if not using MTS bootloader
61+
; If using MTS bootloader, FIRST 64 KB FLASH FOR BOOTLOADER, REST 448 KB FLASH FOR APPLICATION
62+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4163

42-
ER_IROM1 0x08010000 0x70000 { ; load address = execution address
64+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
4365
*.o (RESET, +First)
4466
*(InRoot$$Sections)
4567
.ANY (+RO)
4668
}
4769

4870
; Total: 102 vectors = 408 bytes (0x198) to be reserved in RAM
49-
RW_IRAM1 (0x20000000+0x198) (0x20000-0x198-Stack_Size) { ; RW data
71+
RW_IRAM1 (MBED_RAM0_START) (MBED_RAM0_SIZE-Stack_Size) { ; RW data
5072
.ANY (+RW +ZI)
5173
}
5274

53-
ARM_LIB_STACK (0x20000000+0x20000) EMPTY -Stack_Size { ; stack
75+
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
5476
}
5577
}
5678

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/NUCLEO_F411RE.ld

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
/* Linker script for STM32F411 */
22

3+
#if !defined(MBED_APP_START)
4+
#ifdef DISABLE_POST_BINARY_HOOK
5+
#define MBED_APP_START 0x08000000
6+
#else
7+
#define MBED_APP_START 0x08010000
8+
#endif
9+
#endif
10+
11+
#if !defined(MBED_APP_SIZE)
12+
#ifdef DISABLE_POST_BINARY_HOOK
13+
#define MBED_APP_SIZE 0x80000
14+
#else
15+
#define MBED_APP_SIZE (0x80000 - 0x10000)
16+
#endif
17+
#endif
18+
319
#if !defined(MBED_BOOT_STACK_SIZE)
420
#define MBED_BOOT_STACK_SIZE 0x400
521
#endif
622

723
STACK_SIZE = MBED_BOOT_STACK_SIZE;
824

25+
926
/* Linker script to configure memory regions. */
1027
MEMORY
11-
{
12-
/* First 64kB of flash reserved for bootloader */
13-
/* Other 448kB for application */
14-
FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 448K
28+
{
29+
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
1530
/* CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K */
1631
RAM (rwx) : ORIGIN = 0x20000198, LENGTH = 128k - 0x198
1732
}

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/startup_STM32F41x.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ __HeapLimit:
6666

6767
.section .isr_vector
6868
.align 2
69-
.globl __isr_vector
70-
__isr_vector:
69+
.globl g_pfnVectors
70+
g_pfnVectors:
7171
.long __StackTop /* Top of Stack */
7272
.long Reset_Handler /* Reset Handler */
7373
.long NMI_Handler /* NMI Handler */
@@ -171,7 +171,7 @@ __isr_vector:
171171
.long SPI4_IRQHandler /* SPI4 */
172172
.long SPI5_IRQHandler /* SPI5 */
173173

174-
.size __isr_vector, . - __isr_vector
174+
.size g_pfnVectors, . - g_pfnVectors
175175

176176
.text
177177
.thumb

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_IAR/stm32f411xe.icf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
if ((!isdefinedsymbol(MBED_APP_START)) && isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_START = 0x08000000; }
2+
if ((!isdefinedsymbol(MBED_APP_START)) && !isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_START = 0x08010000; }
3+
if ((!isdefinedsymbol(MBED_APP_SIZE)) && isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_SIZE = 0x80000; }
4+
if ((!isdefinedsymbol(MBED_APP_SIZE)) && !isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_SIZE = 0x70000; }
5+
16
/* [ROM = 512kb = 0x80000] */
2-
define symbol __intvec_start__ = 0x08010000;
3-
define symbol __region_ROM_start__ = 0x08010000;
4-
define symbol __region_ROM_end__ = 0x0807FFFF;
7+
define symbol __intvec_start__ = MBED_APP_START;
8+
define symbol __region_ROM_start__ = MBED_APP_START;
9+
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
510

611
/* [RAM = 128kb = 0x20000] Vector table dynamic copy: 102 vectors = 408 bytes (0x198) to be reserved in RAM */
712
define symbol __NVIC_start__ = 0x20000000;
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
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/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/system_clock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "stm32f4xx.h"
3838
#include "mbed_debug.h"
39+
#include "nvic_addr.h"
3940

4041
/*!< Uncomment the following line if you need to relocate your vector Table in
4142
Internal SRAM. */
@@ -96,7 +97,7 @@ void SystemInit(void)
9697
#ifdef VECT_TAB_SRAM
9798
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
9899
#else
99-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
100+
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; /* Vector Table Relocation in Internal FLASH */
100101
#endif
101102

102103
}

targets/targets.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4303,6 +4303,7 @@
43034303
"inherits": ["FAMILY_STM32"],
43044304
"core": "Cortex-M4F",
43054305
"extra_labels_add": ["STM32F4", "STM32F411RE"],
4306+
"components_add": ["FLASHIAP"],
43064307
"config": {
43074308
"modem_is_on_board": {
43084309
"help": "Value: Tells the build system that the modem is on-board as oppose to a plug-in shield/module.",
@@ -4316,17 +4317,18 @@
43164317
}
43174318
},
43184319
"overrides": { "lse_available": 0 },
4319-
"macros_add": ["HSE_VALUE=26000000", "VECT_TAB_OFFSET=0x08010000"],
4320+
"macros_add": ["HSE_VALUE=26000000"],
43204321
"post_binary_hook": {
43214322
"function": "MTSCode.combine_bins_mts_dragonfly",
43224323
"toolchains": ["GCC_ARM", "ARM_STD", "ARM_MICRO", "IAR"]
43234324
},
4324-
"device_has_add": ["MPU"],
4325+
"device_has_add": ["MPU", "FLASH"],
43254326
"device_has_remove": [
43264327
"SERIAL_FC"
43274328
],
43284329
"release_versions": ["2", "5"],
4329-
"device_name": "STM32F411RE"
4330+
"device_name": "STM32F411RE",
4331+
"bootloader_supported": true
43304332
},
43314333
"MTS_DRAGONFLY_L471QG": {
43324334
"inherits": ["FAMILY_STM32"],

tools/targets/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ def get_post_build_hook(self, toolchain_labels):
408408
hook_data = self.post_binary_hook
409409
except AttributeError:
410410
return None
411+
# If hook is null, also return
412+
if hook_data is None:
413+
return None
411414
# A hook was found. The hook's name is in the format
412415
# "classname.functionname"
413416
temp = hook_data["function"].split(".")

0 commit comments

Comments
 (0)