flash_internal: add support for STM32F401CE

This commit is contained in:
King Kévin 2021-05-14 14:30:15 +02:00
parent 0a18d73197
commit a716cb10cf
2 changed files with 58 additions and 0 deletions

View File

@ -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}"

View File

@ -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)