diff --git a/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.c b/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.c index d25238639..eab83cf89 100644 --- a/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.c +++ b/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.c @@ -32,7 +32,6 @@ /* Driver local definitions. */ /*===========================================================================*/ -#define STM32_FLASH_SECTOR_SIZE 1024U #define STM32_FLASH_LINE_SIZE 2U #define STM32_FLASH_LINE_MASK (STM32_FLASH_LINE_SIZE - 1U) @@ -321,8 +320,8 @@ flash_error_t efl_lld_program(void *instance, flash_offset_t offset, /** * @brief Starts a whole-device erase operation. - * @note This function does nothing, as STM32F1 has only one bank - * and it is where the program is running on. + * @note This function does nothing, the flash memory is where the program + * is running on. * * @param[in] ip pointer to a @p EFlashDriver instance * @return An error code. diff --git a/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.h b/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.h index c2dfb1bac..33708d24a 100644 --- a/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.h +++ b/os/hal/ports/STM32/STM32F1xx/hal_efl_lld.h @@ -51,6 +51,10 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +#if !defined(STM32_FLASH_SECTOR_SIZE) +#error "STM32_FLASH_SECTOR_SIZE not defined in registry" +#endif + #if !defined(STM32_FLASH_NUMBER_OF_BANKS) #error "STM32_FLASH_NUMBER_OF_BANKS not defined in registry" #endif diff --git a/os/hal/ports/STM32/STM32F1xx/stm32_registry.h b/os/hal/ports/STM32/STM32F1xx/stm32_registry.h index f643b9bad..f00249a35 100644 --- a/os/hal/ports/STM32/STM32F1xx/stm32_registry.h +++ b/os/hal/ports/STM32/STM32F1xx/stm32_registry.h @@ -117,6 +117,7 @@ /* Flash attributes.*/ #define STM32_FLASH_NUMBER_OF_BANKS 1 +#define STM32_FLASH_SECTOR_SIZE 1024U #if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__) #define STM32_FLASH_SECTORS_PER_BANK 32 /* Maximum, can be redefined.*/ #endif @@ -329,6 +330,7 @@ /* Flash attributes.*/ #define STM32_FLASH_NUMBER_OF_BANKS 1 +#define STM32_FLASH_SECTOR_SIZE 1024U #if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__) #define STM32_FLASH_SECTORS_PER_BANK 32 /* Maximum, can be redefined.*/ #endif @@ -513,6 +515,7 @@ /* Flash attributes.*/ #define STM32_FLASH_NUMBER_OF_BANKS 1 +#define STM32_FLASH_SECTOR_SIZE 1024U #if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__) #define STM32_FLASH_SECTORS_PER_BANK 128 /* Maximum, can be redefined.*/ #endif @@ -730,6 +733,7 @@ /* Flash attributes.*/ #define STM32_FLASH_NUMBER_OF_BANKS 1 +#define STM32_FLASH_SECTOR_SIZE 2048U #if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__) #define STM32_FLASH_SECTORS_PER_BANK 256 /* Maximum, can be redefined.*/ #endif @@ -969,6 +973,7 @@ /* Flash attributes.*/ #define STM32_FLASH_NUMBER_OF_BANKS 2 +#define STM32_FLASH_SECTOR_SIZE 2048U #if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__) #define STM32_FLASH_SECTORS_PER_BANK 256 /* Maximum, can be redefined.*/ #endif @@ -1228,6 +1233,7 @@ /* Flash attributes.*/ #define STM32_FLASH_NUMBER_OF_BANKS 1 +#define STM32_FLASH_SECTOR_SIZE 2048U #if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__) #define STM32_FLASH_SECTORS_PER_BANK 128 /* Maximum, can be redefined.*/ #endif