aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKing Kévin <kingkevin@cuvoodoo.info>2021-05-14 14:30:15 +0200
committerKing Kévin <kingkevin@cuvoodoo.info>2021-05-14 14:30:15 +0200
commita716cb10cf4a31ffe90ce34821aa9d42d9b560f0 (patch)
treec62adcabdbe9bab970ab03351246ac9f324996af
parent0a18d73197bccfd3e0c5b24e9f203b9c90f0ae50 (diff)
flash_internal: add support for STM32F401CE
-rw-r--r--Rakefile1
-rw-r--r--lib/flash_internal.c57
2 files changed, 58 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 4b54ec3..12bc006 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,6 +19,7 @@ BOARD = ENV["BOARD"] || "MINIF401"
# get MCU from board
DEVICE = case BOARD
when "MINIF401"
+ # the genuine MINIF401 with stm32f401cc is discontinued and has been replaced with stm32f401ce (just more RAM/flash), but knockoffs with stm32f401cc are still common
"stm32f401cc"
else
raise "unknown MCU for board #{BOARD}"
diff --git a/lib/flash_internal.c b/lib/flash_internal.c
index 37c9fb9..ff82df3 100644
--- a/lib/flash_internal.c
+++ b/lib/flash_internal.c
@@ -65,12 +65,69 @@ static const struct flash_internal_section_info_s sections_f401xbc[] = {
},
};
+/** information about the STM42F401xD/E flash sections */
+static const struct flash_internal_section_info_s sections_f401xde[] = {
+ {
+ .number = 0,
+ .size = 16,
+ .start = FLASH_BASE + (0) * 1024,
+ .end = FLASH_BASE + (16) * 1024 - 1,
+ },
+ {
+ .number = 1,
+ .size = 16,
+ .start = FLASH_BASE + (0 + 16) * 1024,
+ .end = FLASH_BASE + (16 + 16) * 1024 - 1,
+ },
+ {
+ .number = 2,
+ .size = 16,
+ .start = FLASH_BASE + (0 + 16 + 16) * 1024,
+ .end = FLASH_BASE + (16 + 16 + 16) * 1024 - 1,
+ },
+ {
+ .number = 3,
+ .size = 16,
+ .start = FLASH_BASE + (0 + 16 + 16 + 16) * 1024,
+ .end = FLASH_BASE + (16 + 16 + 16 + 16) * 1024 - 1,
+ },
+ {
+ .number = 4,
+ .size = 64,
+ .start = FLASH_BASE + (0 + 16 + 16 + 16 + 16) * 1024,
+ .end = FLASH_BASE + (16 + 16 + 16 + 16 + 64) * 1024 - 1,
+ },
+ {
+ .number = 5,
+ .size = 128,
+ .start = FLASH_BASE + (0 + 16 + 16 + 16 + 16 + 64) * 1024,
+ .end = FLASH_BASE + (16 + 16 + 16 + 16 + 64 + 128) * 1024 - 1,
+ },
+ {
+ .number = 6,
+ .size = 128,
+ .start = FLASH_BASE + (0 + 16 + 16 + 16 + 16 + 64 + 128) * 1024,
+ .end = FLASH_BASE + (16 + 16 + 16 + 16 + 64 + 128 + 128) * 1024 - 1,
+ },
+ {
+ .number = 7,
+ .size = 128,
+ .start = FLASH_BASE + (0 + 16 + 16 + 16 + 16 + 64 + 128 + 128) * 1024,
+ .end = FLASH_BASE + (16 + 16 + 16 + 16 + 64 + 128 + 128 + 128) * 1024 - 1,
+ },
+};
+
static const struct flash_sections_info_s flash_sections_info[] = {
{
.device_id = 0x423,
.number = LENGTH(sections_f401xbc),
.sections = sections_f401xbc,
},
+ {
+ .device_id = 0x433,
+ .number = LENGTH(sections_f401xde),
+ .sections = sections_f401xde,
+ },
};
bool flash_internal_range(uint32_t address, size_t size)