File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 7272#ifdef STM32F0xx
7373// Flash base address (Bank2, page 256)
7474#define FLASH_BASE_ADDRESS 0x0803F800
75+ #elif defined (STM32F1xx )
76+ #define FLASH_BASE_ADDRESS ((uint32_t)((FLASH_BANK1_END + 1) - FLASH_PAGE_SIZE)) //0x0801FC00
77+ #define FLASH_PAGE_NUMBER 127
7578#elif defined (STM32F3xx )
7679#define FLASH_BASE_ADDRESS ((uint32_t)((0x0807FFFF + 1) - FLASH_PAGE_SIZE)) //0x0807F800
7780#elif defined (STM32F4xx )
@@ -173,7 +176,8 @@ void set_data_to_flash(void)
173176 uint32_t offset = 0 ;
174177 uint32_t address = FLASH_BASE_ADDRESS ;
175178 uint32_t address_end = FLASH_BASE_ADDRESS + E2END ;
176- #if defined (STM32F0xx ) || defined (STM32F3xx ) || defined (STM32L0xx ) || defined(STM32L4xx )
179+ #if defined (STM32F0xx ) || defined (STM32F1xx ) || defined (STM32F3xx ) || \
180+ defined (STM32L0xx ) || defined(STM32L4xx )
177181 uint32_t pageError = 0 ;
178182 uint64_t data = 0 ;
179183
@@ -183,6 +187,9 @@ void set_data_to_flash(void)
183187 EraseInitStruct .Banks = FLASH_BANK_NUMBER ;
184188 EraseInitStruct .Page = FLASH_PAGE_NUMBER ;
185189#else // STM32F4xx
190+ #ifdef STM32F1xx
191+ EraseInitStruct .Banks = FLASH_BANK_1 ;
192+ #endif
186193 EraseInitStruct .PageAddress = FLASH_BASE_ADDRESS ;
187194#endif
188195 EraseInitStruct .NbPages = 1 ;
You can’t perform that action at this time.
0 commit comments