Code: Select all
diff --git a/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.c b/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.c
index e03ecee1b..9f2dd94d6 100644
--- a/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.c
+++ b/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.c
@@ -104,6 +104,18 @@ static const flash_sector_descriptor_t efl_lld_sect2[STM32_FLASH2_SECTORS_TOTAL]
{ 4 * 16384 + 65536 + 6 * 131072, 131072} /* Sector 11. */
};
+/* Sector table for 512K device. */
+static const flash_sector_descriptor_t efl_lld_sect3[STM32_FLASH3_SECTORS_TOTAL] = {
+ { 0, 16384}, /* Sector 0. */
+ { 1 * 16384, 16384}, /* Sector 1. */
+ { 2 * 16384, 16384}, /* Sector 2. */
+ { 3 * 16384, 16384}, /* Sector 3. */
+ { 4 * 16384, 65536}, /* Sector 4. */
+ { 4 * 16384 + 65536, 131072}, /* Sector 5. */
+ { 4 * 16384 + 65536 + 1 * 131072, 131072}, /* Sector 6. */
+ { 4 * 16384 + 65536 + 2 * 131072, 131072}, /* Sector 7. */
+};
+
/* The descriptors for 1.5M device. */
static const flash_descriptor_t efl_lld_size1[STM32_FLASH_NUMBER_OF_BANKS] = {
{ /* Single bank organisation. */
@@ -132,6 +144,20 @@ static const flash_descriptor_t efl_lld_size2[STM32_FLASH_NUMBER_OF_BANKS] = {
}
};
+/* The descriptors for 512K device. */
+static const flash_descriptor_t efl_lld_size3[STM32_FLASH_NUMBER_OF_BANKS] = {
+ { /* Single bank organisation. */
+ .attributes = FLASH_ATTR_ERASED_IS_ONE |
+ FLASH_ATTR_MEMORY_MAPPED,
+ .page_size = STM32_FLASH_LINE_SIZE,
+ .sectors_count = STM32_FLASH3_SECTORS_TOTAL,
+ .sectors = efl_lld_sect3,
+ .sectors_size = 0,
+ .address = (uint8_t *)FLASH_BASE,
+ .size = STM32_FLASH3_SIZE * STM32_FLASH_SIZE_SCALE
+ }
+};
+
/* Table describing possible flash sizes and descriptors for this device. */
static const efl_lld_size_t efl_lld_flash_sizes[] = {
{
@@ -139,6 +165,9 @@ static const efl_lld_size_t efl_lld_flash_sizes[] = {
},
{
.desc = efl_lld_size2
+ },
+ {
+ .desc = efl_lld_size3
}
};
#elif defined(STM32F401xx) || defined(STM32F411xx) || \
diff --git a/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.h b/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.h
index 73eae8e66..c69bbc0f7 100644
--- a/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.h
+++ b/os/hal/ports/STM32/STM32F4xx/hal_efl_lld.h
@@ -65,8 +65,10 @@
#define STM32_FLASH_NUMBER_OF_BANKS 1
#define STM32_FLASH1_SIZE 1536U
#define STM32_FLASH2_SIZE 1024U
+#define STM32_FLASH3_SIZE 512U
#define STM32_FLASH1_SECTORS_TOTAL 16
#define STM32_FLASH2_SECTORS_TOTAL 12
+#define STM32_FLASH3_SECTORS_TOTAL 8
#elif defined(STM32F401xx) || defined(STM32F411xx) || \
defined(__DOXYGEN__)