stm32: Enable support on other stm32f0 chips

The remaining stm32f0 chips have flash hardware similar to stm32f1.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-05-16 21:47:23 -04:00 committed by Eric Callahan
parent 5cbc25d676
commit 1e6a2de3b1
2 changed files with 9 additions and 6 deletions

View File

@ -51,14 +51,14 @@ choice
bool "STM32F446"
select MACH_STM32F4
config MACH_STM32F031
bool "STM32F031" if 0
bool "STM32F031"
select MACH_STM32F0
config MACH_STM32F042
bool "STM32F042"
select MACH_STM32F0
select MACH_STM32F0x2
config MACH_STM32F070
bool "STM32F070" if 0
bool "STM32F070"
select MACH_STM32F0
config MACH_STM32F072
bool "STM32F072"

View File

@ -38,15 +38,18 @@ flash_get_page_size(uint32_t addr)
return 64 * 1024;
else
return 128 * 1024;
} else if (CONFIG_MACH_STM32F042) {
return 1024;
} else if (CONFIG_MACH_STM32F103) {
// Check for a 1K page size on the stm32f103
uint16_t *flash_size = (void*)FLASHSIZE_BASE;
if (*flash_size < 256)
return *flash_size < 256 ? 1024 : 2 * 1024;
} else if (CONFIG_MACH_STM32F0) {
if (CONFIG_MACH_STM32F042)
return 1024;
}
if (CONFIG_MACH_STM32F072)
return 2 * 1024;
uint16_t *flash_size = (void*)FLASHSIZE_BASE;
return *flash_size <= 64 ? 1024 : 2 * 1024;
}
}
// Check if the data at the given address has been erased (all 0xff)