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)