8000 samd/boards: Move the flash filesystem definitions to the linker files. · jimmo/micropython@9f4df86 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f4df86

Browse files
robert-hhdpgeorge
authored andcommitted
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.
1 parent 387025f commit 9f4df86

File tree

7 files changed

+17
-10
lines changed

7 files changed

+17
-10
lines changed

ports/samd/boards/samd21x18a.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ MEMORY
1313
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
1414
_sstack = _estack - 8K;
1515

16+
_oflash_fs = ORIGIN(FLASH) + 192K - 8K;
17+
_sflash_fs = LENGTH(FLASH) - 192K + 8K - 1;
18+
1619
_sheap = _ebss;
1720
_eheap = _sstack;

ports/samd/boards/samd51g19a.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ MEMORY
1313
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
1414
_sstack = _estack - 16K;
1515

16+
_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
17+
_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
18+
1619
_sheap = _ebss;
1720
_eheap = _sstack;

ports/samd/boards/samd51j19a.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ MEMORY
1313
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
1414
_sstack = _estack - 16K;
1515

16+
_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
17+
_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
18+
1619
_sheap = _ebss;
1720
_eheap = _sstack;

ports/samd/boards/samd51p19a.ld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ MEMORY
1313
_estack = ORIGIN(RAM) + LENGTH(RAM) - 8;
1414
_sstack = _estack - 16K;
1515

16+
_oflash_fs = ORIGIN(FLASH) + 384K - 16K;
17+
_sflash_fs = LENGTH(FLASH) - 384K + 16K - 1;
18+
1619
_sheap = _ebss;
1720
_eheap = _sstack;

ports/samd/mcu/samd21/mpconfigmcu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#define MICROPY_PY_MATH (0)
1313
#define MICROPY_PY_CMATH (0)
1414

15-
#define MICROPY_HW_FLASH_STORAGE_BASE (0x30000)
16-
#define MICROPY_HW_FLASH_STORAGE_BYTES (0xFFFF)
1715
#define VFS_BLOCK_SIZE_BYTES (1536) // 24x 64B flash pages;
1816

1917
#define MICROPY_HW_UART_TXBUF (1)

ports/samd/mcu/samd51/mpconfigmcu.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ unsigned long trng_random_u32(void);
1919

2020
// Due to a limitation in the TC counter for us, the ticks period is 2**29
2121
#define MICROPY_PY_UTIME_TICKS_PERIOD (0x20000000)
22-
// MicroPython configs
23-
// samd_flash.c flash parameters
24-
// Build a 128k Flash storage at top. 512k-128k=384k=0x60000
25-
// 512*1024= 0x80000 minus 128*1024= 0x20000 = 0x60000
26-
#define MICROPY_HW_FLASH_STORAGE_BASE (0x60000)
27-
#define MICROPY_HW_FLASH_STORAGE_BYTES (0x1FFFF)
22+
2823
#define VFS_BLOCK_SIZE_BYTES (1536) //
2924

3025
#define MICROPY_HW_UART_TXBUF (1)

ports/samd/samd_flash.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ typedef struct _samd_flash_obj_t {
5353
uint32_t flash_size;
5454
} samd_flash_obj_t;
5555

56+
extern uint8_t _oflash_fs, _sflash_fs;
57+
5658
// Build a Flash storage at top.
5759
STATIC samd_flash_obj_t samd_flash_obj = {
5860
.base = { &samd_flash_type },
59-
.flash_base = MICROPY_HW_FLASH_STORAGE_BASE, // Board specific: mpconfigboard.h
60-
.flash_size = MICROPY_HW_FLASH_STORAGE_BYTES, // Board specific: mpconfigboard.h
61+
.flash_base = (uint32_t)&_oflash_fs, // Get from MCU-Specific loader script.
62+
.flash_size = (uint32_t)&_sflash_fs, // Get from MCU-Specific loader script.
6163
};
6264

6365
// FLASH stuff

0 commit comments

Comments
 (0)
0