diff options
Diffstat (limited to 'stmhal/flash.c')
| -rw-r--r-- | stmhal/flash.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/stmhal/flash.c b/stmhal/flash.c index 670c4cd3a..54f5f85c6 100644 --- a/stmhal/flash.c +++ b/stmhal/flash.c @@ -34,6 +34,21 @@ #define FLASH_FLAG_PGSERR FLASH_FLAG_ERSERR #endif +#if defined(STM32F7) + +/* Base address of the Flash sectors */ +#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 32 Kbytes */ +#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08008000) /* Base @ of Sector 1, 32 Kbytes */ +#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08010000) /* Base @ of Sector 2, 32 Kbytes */ +#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x08018000) /* Base @ of Sector 3, 32 Kbytes */ +#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08020000) /* Base @ of Sector 4, 128 Kbytes */ +#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08040000) /* Base @ of Sector 5, 256 Kbytes */ +#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08080000) /* Base @ of Sector 6, 256 Kbytes */ +#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x080C0000) /* Base @ of Sector 7, 256 Kbytes */ +#define ADDR_FLASH_END ((uint32_t)0x08100000) /* 1 Mbytes total */ + +#else + /* Base address of the Flash sectors */ #define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */ #define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */ @@ -43,11 +58,16 @@ #define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */ #define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */ #define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */ -#if defined(FLASH_SECTOR_8) +#if !defined(FLASH_SECTOR_8) +#define ADDR_FLASH_END ((uint32_t)0x08080000) /* 512 Kbytes total */ +#else #define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */ #define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */ #define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */ #define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */ +#define ADDR_FLASH_END ((uint32_t)0x08100000) /* 1 Mbytes total */ +#endif + #endif static const uint32_t flash_info_table[26] = { @@ -64,10 +84,8 @@ static const uint32_t flash_info_table[26] = { ADDR_FLASH_SECTOR_9, FLASH_SECTOR_9, ADDR_FLASH_SECTOR_10, FLASH_SECTOR_10, ADDR_FLASH_SECTOR_11, FLASH_SECTOR_11, - ADDR_FLASH_SECTOR_11 + 0x20000, 0, - #else - ADDR_FLASH_SECTOR_7 + 0x20000, 0, #endif + ADDR_FLASH_END, 0, }; uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size) { |
