summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-07-02 16:26:17 +0200
committerDamien George <damien@micropython.org>2022-10-06 23:14:08 +1100
commit9f4df86016d8181dc06683d528dbd85473a1dbb9 (patch)
tree4ffb62584020d4ce89e62d1a5eb3f7cdd64fde1e
parent387025f5d12ec6313b396e63e770dd9f22f9daeb (diff)
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.
-rw-r--r--ports/samd/boards/samd21x18a.ld3
-rw-r--r--ports/samd/boards/samd51g19a.ld3
-rw-r--r--ports/samd/boards/samd51j19a.ld3
-rw-r--r--ports/samd/boards/samd51p19a.ld3
-rw-r--r--ports/samd/mcu/samd21/mpconfigmcu.h2
-rw-r--r--ports/samd/mcu/samd51/mpconfigmcu.h7
-rw-r--r--ports/samd/samd_flash.c6
7 files changed, 17 insertions, 10 deletions
diff --git a/ports/samd/boards/samd21x18a.ld b/ports/samd/boards/samd21x18a.ld
index b7d59c315..81a84a15d 100644
--- a/ports/samd/boards/samd21x18a.ld
+++ b/ports/samd/boards/samd21x18a.ld
@@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 8K;
+_oflash_fs = ORIGIN(FLASH) + 192K - 8K;
+_sflash_fs = LENGTH(FLASH) - 192K + 8K - 1;
+
_sheap = _ebss;
_eheap = _sstack;
diff --git a/ports/samd/boards/samd51g19a.ld b/ports/samd/boards/samd51g19a.ld
index e0baa9bba..cd03320ba 100644
--- a/ports/samd/boards/samd51g19a.ld
+++ b/ports/samd/boards/samd51g19a.ld
@@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 16K;
+_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
+_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
+
_sheap = _ebss;
_eheap = _sstack;
diff --git a/ports/samd/boards/samd51j19a.ld b/ports/samd/boards/samd51j19a.ld
index e0baa9bba..cd03320ba 100644
--- a/ports/samd/boards/samd51j19a.ld
+++ b/ports/samd/boards/samd51j19a.ld
@@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 16K;
+_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
+_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
+
_sheap = _ebss;
_eheap = _sstack;
diff --git a/ports/samd/boards/samd51p19a.ld b/ports/samd/boards/samd51p19a.ld
index e0baa9bba..cd03320ba 100644
--- a/ports/samd/boards/samd51p19a.ld
+++ b/ports/samd/boards/samd51p19a.ld
@@ -13,5 +13,8 @@ MEMORY
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
_sstack = _estack - 16K;
+_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
+_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
+
_sheap = _ebss;
_eheap = _sstack;
diff --git a/ports/samd/mcu/samd21/mpconfigmcu.h b/ports/samd/mcu/samd21/mpconfigmcu.h
index 9329a6eb8..7ee23b59b 100644
--- a/ports/samd/mcu/samd21/mpconfigmcu.h
+++ b/ports/samd/mcu/samd21/mpconfigmcu.h
@@ -12,8 +12,6 @@
#define MICROPY_PY_MATH (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 MICROPY_HW_UART_TXBUF (1)
diff --git a/ports/samd/mcu/samd51/mpconfigmcu.h b/ports/samd/mcu/samd51/mpconfigmcu.h
index 0e5a88565..19193992f 100644
--- a/ports/samd/mcu/samd51/mpconfigmcu.h
+++ b/ports/samd/mcu/samd51/mpconfigmcu.h
@@ -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
#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 MICROPY_HW_UART_TXBUF (1)
diff --git a/ports/samd/samd_flash.c b/ports/samd/samd_flash.c
index 2fffd614f..6d9ee9689 100644
--- a/ports/samd/samd_flash.c
+++ b/ports/samd/samd_flash.c
@@ -53,11 +53,13 @@ typedef struct _samd_flash_obj_t {
uint32_t flash_size;
} samd_flash_obj_t;
+extern uint8_t _oflash_fs, _sflash_fs;
+
// Build a Flash storage at top.
STATIC samd_flash_obj_t samd_flash_obj = {
.base = { &samd_flash_type },
- .flash_base = MICROPY_HW_FLASH_STORAGE_BASE, // Board specific: mpconfigboard.h
- .flash_size = MICROPY_HW_FLASH_STORAGE_BYTES, // Board specific: mpconfigboard.h
+ .flash_base = (uint32_t)&_oflash_fs, // Get from MCU-Specific loader script.
+ .flash_size = (uint32_t)&_sflash_fs, // Get from MCU-Specific loader script.
};
// FLASH stuff