samd/boards: Move the flash filesystem definitions to the linker files.

They used to be in mpconfigmcu.h, but have to be different for different
chip variants, like the SAMD51x20.
This commit is contained in:
robert-hh 2022-07-02 16:26:17 +02:00 committed by Damien George
parent 387025f5d1
commit 9f4df86016
7 changed files with 17 additions and 10 deletions

View File

@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8; _estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 8K; _sstack = _estack - 8K;
_oflash_fs = ORIGIN(FLASH) + 192K - 8K;
_sflash_fs = LENGTH(FLASH) - 192K + 8K - 1;
_sheap = _ebss; _sheap = _ebss;
_eheap = _sstack; _eheap = _sstack;

View File

@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8; _estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 16K; _sstack = _estack - 16K;
_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
_sheap = _ebss; _sheap = _ebss;
_eheap = _sstack; _eheap = _sstack;

View File

@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8; _estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 16K; _sstack = _estack - 16K;
_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
_sheap = _ebss; _sheap = _ebss;
_eheap = _sstack; _eheap = _sstack;

View File

@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8; _estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 16K; _sstack = _estack - 16K;
_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
_sheap = _ebss; _sheap = _ebss;
_eheap = _sstack; _eheap = _sstack;

View File

@ -12,8 +12,6 @@
#define MICROPY_PY_MATH (0) #define MICROPY_PY_MATH (0)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
#define MICROPY_HW_FLASH_STORAGE_BASE (0x30000)
#define MICROPY_HW_FLASH_STORAGE_BYTES (0xFFFF)
#define VFS_BLOCK_SIZE_BYTES (1536) // 24x 64B flash pages; #define VFS_BLOCK_SIZE_BYTES (1536) // 24x 64B flash pages;
#define MICROPY_HW_UART_TXBUF (1) #define MICROPY_HW_UART_TXBUF (1)

View File

@ -19,12 +19,7 @@ unsigned long trng_random_u32(void);
// Due to a limitation in the TC counter for us, the ticks period is 2**29 // Due to a limitation in the TC counter for us, the ticks period is 2**29
#define MICROPY_PY_UTIME_TICKS_PERIOD (0x20000000) #define MICROPY_PY_UTIME_TICKS_PERIOD (0x20000000)
// MicroPython configs
// samd_flash.c flash parameters
// Build a 128k Flash storage at top. 512k-128k=384k=0x60000
// 512*1024= 0x80000 minus 128*1024= 0x20000 = 0x60000
#define MICROPY_HW_FLASH_STORAGE_BASE (0x60000)
#define MICROPY_HW_FLASH_STORAGE_BYTES (0x1FFFF)
#define VFS_BLOCK_SIZE_BYTES (1536) // #define VFS_BLOCK_SIZE_BYTES (1536) //
#define MICROPY_HW_UART_TXBUF (1) #define MICROPY_HW_UART_TXBUF (1)

View File

@ -53,11 +53,13 @@ typedef struct _samd_flash_obj_t {
uint32_t flash_size; uint32_t flash_size;
} samd_flash_obj_t; } samd_flash_obj_t;
extern uint8_t _oflash_fs, _sflash_fs;
// Build a Flash storage at top. // Build a Flash storage at top.
STATIC samd_flash_obj_t samd_flash_obj = { STATIC samd_flash_obj_t samd_flash_obj = {
.base = { &samd_flash_type }, .base = { &samd_flash_type },
.flash_base = MICROPY_HW_FLASH_STORAGE_BASE, // Board specific: mpconfigboard.h .flash_base = (uint32_t)&_oflash_fs, // Get from MCU-Specific loader script.
.flash_size = MICROPY_HW_FLASH_STORAGE_BYTES, // Board specific: mpconfigboard.h .flash_size = (uint32_t)&_sflash_fs, // Get from MCU-Specific loader script.
}; };
// FLASH stuff // FLASH stuff