Stores data on the flash memory of stm32f4xx

Dependents:   DISCO-F429ZI_LCDTS_demo_richard

Fork of storage_on_flash by henning l

Revision:
1:801ddc4634a5
Parent:
0:4cb438b58dc2
--- a/SOF_dev_stm32_f4xx.cpp	Fri Nov 18 14:37:15 2016 +0000
+++ b/SOF_dev_stm32_f4xx.cpp	Fri Mar 16 15:50:04 2018 +0000
@@ -38,16 +38,42 @@
     {FLASH_SECTOR_4, 0x08010000, 64*1024},
     {FLASH_SECTOR_5, 0x08020000, 128*1024},
     {FLASH_SECTOR_6, 0x08040000, 128*1024},
-    {FLASH_SECTOR_7, 0x08060000, 128*1024},
+    {FLASH_SECTOR_7, 0x08060000, 128*1024}, 
 };
+#error wrong device
 #else
-#error "Not supported device"
+static const SOF_SectorSpec_t _sec_spec[] = {
+    {FLASH_SECTOR_0, 0x08000000, 16*1024},
+    {FLASH_SECTOR_1, 0x08004000, 16*1024},
+    {FLASH_SECTOR_2, 0x08008000, 16*1024},
+    {FLASH_SECTOR_3, 0x0800C000, 16*1024},
+    {FLASH_SECTOR_4, 0x08010000, 64*1024},
+    {FLASH_SECTOR_5, 0x08020000, 128*1024},
+    {FLASH_SECTOR_6, 0x08040000, 128*1024},
+    {FLASH_SECTOR_7, 0x08060000, 128*1024},
+    {FLASH_SECTOR_8, 0x08080000, 128*1024},
+    {FLASH_SECTOR_9, 0x080A0000, 128*1024},
+    {FLASH_SECTOR_10, 0x080C0000, 128*1024},
+    {FLASH_SECTOR_11, 0x080E0000, 128*1024}, //BANK2 after this limit
+    {FLASH_SECTOR_12, 0x08100000, 16*1024},  
+    {FLASH_SECTOR_13, 0x08104000, 16*1024},    
+    {FLASH_SECTOR_14, 0x08108000, 16*1024},    
+    {FLASH_SECTOR_15, 0x0810C000, 16*1024},    
+    {FLASH_SECTOR_16, 0x08110000, 64*1024},  
+    {FLASH_SECTOR_17, 0x08120000, 128*1024},
+    {FLASH_SECTOR_18, 0x08140000, 128*1024},
+    {FLASH_SECTOR_19, 0x08160000, 128*1024},
+    {FLASH_SECTOR_20, 0x08180000, 128*1024},
+    {FLASH_SECTOR_21, 0x081A0000, 128*1024},
+    {FLASH_SECTOR_22, 0x081C0000, 128*1024},
+    {FLASH_SECTOR_13, 0x081E0000, 128*1024}
+};
 #endif
 
 #define N_SECTOR_SPEC			(sizeof(_sec_spec)/sizeof(_sec_spec[0]))
 
 #define SECTOR_NO(sector)		_sec_spec[sector].sec_no
-#define SECTOR_ADDR(sector)	_sec_spec[sector].sec_addr
+#define SECTOR_ADDR(sector)		_sec_spec[sector].sec_addr
 #define SECTOR_SIZE(sector)		_sec_spec[sector].sec_size