aboutsummaryrefslogtreecommitdiff
path: root/stmhal/storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/storage.c')
-rw-r--r--stmhal/storage.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/stmhal/storage.c b/stmhal/storage.c
index 0c91fa084..7f910f4e2 100644
--- a/stmhal/storage.c
+++ b/stmhal/storage.c
@@ -86,11 +86,14 @@ STATIC byte flash_cache_mem[0x4000] __attribute__((aligned(4))); // 16k
#elif defined(STM32L476xx)
+extern uint8_t _flash_fs_start;
+extern uint8_t _flash_fs_end;
+
// The STM32L476 doesn't have CCRAM, so we use the 32K SRAM2 for this.
#define CACHE_MEM_START_ADDR (0x10000000) // SRAM2 data RAM, 32k
#define FLASH_SECTOR_SIZE_MAX (0x00800) // 2k max
-#define FLASH_MEM_SEG1_START_ADDR (0x08000800) // sector 1
-#define FLASH_MEM_SEG1_NUM_BLOCKS (252) // 1 Block=512 Bytes Reserve 126 kBytes
+#define FLASH_MEM_SEG1_START_ADDR ((long)&_flash_fs_start)
+#define FLASH_MEM_SEG1_NUM_BLOCKS ((&_flash_fs_end - &_flash_fs_start) / 512)
#else
#error "no storage support for this MCU"