|
| 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