Skip to content

Commit e33e936

Browse files
authored
Merge pull request #12663 from hugueskamba/hk-NUCLEO_F303K8-fix-microlib-support-optimize-ram
Migrate NUCLEO_F303K8 to Mbed OS 5 baremetal
2 parents 6bd55d6 + 4e61240 commit e33e936

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,6 +2734,11 @@
27342734
"IAR",
27352735
"GCC_ARM"
27362736
],
2737+
"supported_c_libs": {
2738+
"arm": ["std", "small"],
2739+
"gcc_arm": ["std", "small"],
2740+
"iar": ["std"]
2741+
},
27372742
"macros": [
27382743
"USE_HAL_DRIVER",
27392744
"USE_FULL_LL_DRIVER",
@@ -3558,12 +3563,14 @@
35583563
}
35593564
},
35603565
"overrides": {
3561-
"lse_available": 0
3566+
"lse_available": 0,
3567+
"boot-stack-size": "0x400",
3568+
"tickless-from-us-ticker": true
35623569
},
35633570
"detect_code": [
35643571
"0775"
35653572
],
3566-
"default_lib": "small",
3573+
"c_lib": "small",
35673574
"device_has_add": [
35683575
"ANALOGOUT",
35693576
"CAN",
@@ -3572,9 +3579,7 @@
35723579
"device_has_remove": [
35733580
"LPTICKER"
35743581
],
3575-
"release_versions": [
3576-
"2"
3577-
],
3582+
"supported_application_profiles":["bare-metal"],
35783583
"device_name": "STM32F303K8"
35793584
},
35803585
"NUCLEO_F303RE": {

0 commit comments

Comments
 (0)