stm32: Use STM32xx macros instead of MCU_SERIES_xx to select MCU type.

The CMSIS files for the STM32 range provide macros to distinguish between
the different MCU series: STM32F4, STM32F7, STM32H7, STM32L4, etc.  Prefer
to use these instead of custom ones.
This commit is contained in:
Damien George
2018-03-17 10:42:50 +11:00
parent 5edce4539b
commit e37b8ba5a5
20 changed files with 130 additions and 130 deletions

View File

@@ -34,7 +34,7 @@ typedef struct {
uint32_t sector_count;
} flash_layout_t;
#if defined(MCU_SERIES_F4)
#if defined(STM32F4)
static const flash_layout_t flash_layout[] = {
{ 0x08000000, 0x04000, 4 },
@@ -50,7 +50,7 @@ static const flash_layout_t flash_layout[] = {
#endif
};
#elif defined(MCU_SERIES_F7)
#elif defined(STM32F7)
// FLASH_FLAG_PGSERR (Programming Sequence Error) was renamed to
// FLASH_FLAG_ERSERR (Erasing Sequence Error) in STM32F7
@@ -62,7 +62,7 @@ static const flash_layout_t flash_layout[] = {
{ 0x08040000, 0x40000, 3 },
};
#elif defined(MCU_SERIES_L4)
#elif defined(STM32L4)
static const flash_layout_t flash_layout[] = {
{ (uint32_t)FLASH_BASE, (uint32_t)FLASH_PAGE_SIZE, 512 },
@@ -78,7 +78,7 @@ static const flash_layout_t flash_layout[] = {
#error Unsupported processor
#endif
#if defined(MCU_SERIES_L4) || defined(STM32H7)
#if defined(STM32L4) || defined(STM32H7)
// get the bank of a given flash address
static uint32_t get_bank(uint32_t addr) {
@@ -103,7 +103,7 @@ static uint32_t get_bank(uint32_t addr) {
}
}
#if defined(MCU_SERIES_L4)
#if defined(STM32L4)
// get the page of a given flash address
static uint32_t get_page(uint32_t addr) {
if (addr < (FLASH_BASE + FLASH_BANK_SIZE)) {
@@ -153,7 +153,7 @@ void flash_erase(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32)
FLASH_EraseInitTypeDef EraseInitStruct;
#if defined(MCU_SERIES_L4)
#if defined(STM32L4)
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS);
// erase the sector(s)
@@ -220,7 +220,7 @@ void flash_erase_it(uint32_t flash_dest, const uint32_t *src, uint32_t num_word3
*/
void flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32) {
#if defined(MCU_SERIES_L4)
#if defined(STM32L4)
// program the flash uint64 by uint64
for (int i = 0; i < num_word32 / 2; i++) {