Skip to content

Commit 0753eba

Browse files
committed
Migrate NUCLEO_F303K8 to Mbed OS 5 baremetal
* Use two memory regions in ARM toolchain linker file to support Microlib * Replace `target.default_lib` with `target.c_lib` * Specify supported lib sizes per toolchain * Add support for Mbed OS 5
1 parent 532654e commit 0753eba

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/TOOLCHAIN_ARM_STD/stm32f303x8.sct

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

31+
#if !defined(MBED_APP_START)
32+
#define MBED_APP_START 0x08000000
33+
#endif
34+
35+
; STM32F303K8: 64KB FLASH (0x10000)
36+
#if !defined(MBED_APP_SIZE)
37+
#define MBED_APP_SIZE 0x10000
38+
#endif
39+
40+
#if !defined(MBED_RAM_START)
41+
#define MBED_RAM_START 0x20000000
42+
#endif
43+
44+
;12KB SRAM (0x3000)
45+
#if !defined(MBED_RAM_SIZE)
46+
#define MBED_RAM_SIZE 0x3000
47+
#endif
48+
49+
3150
#if !defined(MBED_BOOT_STACK_SIZE)
32-
#define MBED_BOOT_STACK_SIZE 0x400
51+
#define MBED_BOOT_STACK_SIZE 0x400
3352
#endif
3453

35-
#define Stack_Size MBED_BOOT_STACK_SIZE
54+
; 60 Non-Core vectors + 16 ARM Core System Handler Vectors vectors + reserved areas = 98 vectors 392 bytes (0x188) to be reserved in RAM
55+
#define VECTOR_SIZE 0x188
56+
57+
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
3658

37-
; STM32F303K8: 64KB FLASH (0x10000) + 12KB SRAM (0x3000)
38-
LR_IROM1 0x08000000 0x10000 { ; load region size_region
59+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3960

40-
ER_IROM1 0x08000000 0x10000 { ; load address = execution address
61+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
4162
*.o (RESET, +First)
4263
*(InRoot$$Sections)
4364
.ANY (+RO)
4465
}
4566

46-
; 98 vectors = 392 bytes (0x188) to be reserved in RAM
47-
RW_IRAM1 (0x20000000+0x188) (0x3000-0x188-Stack_Size) { ; RW data
67+
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
4868
.ANY (+RW +ZI)
4969
}
5070

51-
ARM_LIB_STACK (0x20000000+0x3000) EMPTY -Stack_Size { ; stack
71+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
5272
}
53-
}
5473

74+
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
75+
}
76+
}

targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/TOOLCHAIN_GCC_ARM/STM32F303X8.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
STACK_SIZE = MBED_BOOT_STACK_SIZE;
88

9+
/* 60 Non-Core vectors + 16 ARM Core System Handler Vectors vectors + reserved areas = 392 bytes (0x188) to be reserved in RAM */
910
MEMORY
1011
{
1112
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K

targets/targets.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,6 +2807,11 @@
28072807
"IAR",
28082808
"GCC_ARM"
28092809
],
2810+
"supported_c_libs": {
2811+
"arm": ["std", "small"],
2812+
"gcc_arm": ["std", "small"],
2813+
"iar": ["std"]
2814+
},
28102815
"macros": [
28112816
"USE_HAL_DRIVER",
28122817
"USE_FULL_LL_DRIVER",
@@ -3630,12 +3635,14 @@
36303635
}
36313636
},
36323637
"overrides": {
3633-
"lse_available": 0
3638+
"lse_available": 0,
3639+
"boot-stack-size": "0x400",
3640+
"tickless-from-us-ticker": true
36343641
},
36353642
"detect_code": [
36363643
"0775"
36373644
],
3638-
"default_lib": "small",
3645+
"c_lib": "small",
36393646
"device_has_add": [
36403647
"ANALOGOUT",
36413648
"CAN",
@@ -3645,7 +3652,7 @@
36453652
"LPTICKER"
36463653
],
36473654
"release_versions": [
3648-
"2"
3655+
"2", "5"
36493656
],
36503657
"device_name": "STM32F303K8"
36513658
},

0 commit comments

Comments
 (0)