Skip to content

Commit a0943ed

Browse files
committed
stm32/boards: stm32l43*.ld Add tunable FS sizes for 256 KiB parts.
stm32/boards/stm32l43x_12kFS.ld stm32/boards/stm32l43x_26kFS.ld Replace stm32l432.ld with tunable versions for all stm32l43x parts. The LENGTH(FLASH_FS) needs to be tuned for each board port to squeeze in drivers (eg USB, CANbus). These changes allow editing one number (FS_SIZE) and all regions are calculated automatically. stm32l43x_26kFS.ld provides a 26 KiB file system for minimal ports, eg NUCLEO_L432KC. stm32l43x_12kFS.ld provides a 12 KiB file system for ports with USB. stm32/boards/NUCLEO_L432KC/mpconfigboard.mk Use new stm32l43x_26kFS.ld. Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
1 parent 938fca4 commit a0943ed

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MCU_SERIES = l4
22
CMSIS_MCU = STM32L432xx
33
AF_FILE = boards/stm32l432_af.csv
4-
LD_FILES = boards/stm32l432.ld boards/common_basic.ld
4+
LD_FILES = boards/stm32l43x_26kFS.ld boards/common_basic.ld
55
OPENOCD_CONFIG = boards/openocd_stm32l4.cfg
66

77
# MicroPython settings

ports/stm32/boards/stm32l432.ld renamed to ports/stm32/boards/stm32l43x_12kFS.ld

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
/*
2-
GNU linker script for STM32L432KC
2+
GNU linker script for STM32L431xC STM32L432KC STM32L433xC STM32L442KC STM32L443xC.
3+
FLASH 256K with 2K blocks, RAM 64K.
4+
FLASH_FS length (FS_SIZE) is easily tunable to allow for adding features, eg USB, CANbus.
35
*/
46

5-
/* Specify the memory areas */
7+
/* Specify the memory areas.
8+
FS_SIZE is not a region, it is only used to define the File System length.
9+
*/
610
MEMORY
711
{
8-
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 230K /* sectors 0-114 */
9-
FLASH_FS (r) : ORIGIN = 0x08039800, LENGTH = 26K /* sectors 115-127 */
12+
ALL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
13+
FS_SIZE (r) : ORIGIN = 0, LENGTH = 12K /* Adjust the File System size here */
14+
15+
FLASH (rx) : ORIGIN = ORIGIN(ALL_FLASH), LENGTH = LENGTH(ALL_FLASH) - LENGTH(FS_SIZE)
16+
FLASH_FS (r) : ORIGIN = ORIGIN(FLASH) + LENGTH(FLASH), LENGTH = LENGTH(FS_SIZE)
1017
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K /* SRAM1, 48K + SRAM2, 16K */
1118
}
1219

ports/stm32/boards/stm32l43x_26kFS.ld

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
GNU linker script for STM32L431xC STM32L432KC STM32L433xC STM32L442KC STM32L443xC.
3+
FLASH 256K with 2K blocks, RAM 64K.
4+
FLASH_FS length (FS_SIZE) is easily tunable to allow for adding features, eg USB, CANbus.
5+
*/
6+
7+
/* Specify the memory areas.
8+
FS_SIZE is not a region, it is only used to define the File System length.
9+
*/
10+
MEMORY
11+
{
12+
ALL_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
13+
FS_SIZE (r) : ORIGIN = 0, LENGTH = 26K /* Adjust the File System size here */
14+
15+
FLASH (rx) : ORIGIN = ORIGIN(ALL_FLASH), LENGTH = LENGTH(ALL_FLASH) - LENGTH(FS_SIZE)
16+
FLASH_FS (r) : ORIGIN = ORIGIN(FLASH) + LENGTH(FLASH), LENGTH = LENGTH(FS_SIZE)
17+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K /* SRAM1, 48K + SRAM2, 16K */
18+
}
19+
20+
/* produce a link error if there is not this amount of RAM for these sections */
21+
_minimum_stack_size = 2K;
22+
_minimum_heap_size = 16K;
23+
24+
/* Define the stack. The stack is full descending so begins just above last byte of RAM,
25+
or bottom of FS cache.. Note that EABI requires the stack to be 8-byte aligned for a call. */
26+
27+
/* RAM extents for the garbage collector */
28+
_ram_start = ORIGIN(RAM);
29+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
30+
31+
_micropy_hw_internal_flash_storage_ram_cache_end = _ram_end;
32+
_micropy_hw_internal_flash_storage_ram_cache_start = _micropy_hw_internal_flash_storage_ram_cache_end - 2K; /* fs cache = 2K */
33+
34+
_estack = _micropy_hw_internal_flash_storage_ram_cache_start - _estack_reserve;
35+
_sstack = _estack - 10K; /* stack = 10K */
36+
37+
_heap_start = _ebss; /* heap starts just after statically allocated memory */
38+
_heap_end = _sstack; /* bss + heap = 52K, tunable by adjusting stack size */
39+
40+
_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS);
41+
_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy