|
STM32 Bootloader
Customizable Bootloader for STM32 microcontrollers
|
Macros | |
| #define | SYSTEM_MEMORY_ADDRESS 0x1FFF0000U |
| #define | FLASH_SIZE_WRAPPER (uint32_t)(FLASH_SIZE) |
| #define | FLASH_BANK_SIZE_WRAPPER (uint32_t)(FLASH_BANK_SIZE) |
| #define | FLASH_PAGE_NB_PER_BANK (uint32_t)(FLASH_BANK_SIZE_WRAPPER / FLASH_PAGE_SIZE) |
Functions | |
| void | FlashClearErrorFlags (void) |
| Clear all flash error flags. | |
| bool | FlashCheckIfDataFits (const uint32_t address, const uint32_t length) |
| Check if an array of data fits into the flash. More... | |
| bool | FlashCheckIfWriteProtectionEnabled (const uint32_t address, const uint32_t length) |
| Check if flash write protection is enabled for the specified region. More... | |
| bool | FlashDisableWriteProtection (void) |
| Disable flash write protection for the application area. More... | |
| bool | FlashEnableWriteProtection (const uint32_t address, const uint32_t length) |
| Enable flash write protection for the specified region. More... | |
| bool | FlashCompare (const uint8_t *const data, const uint32_t address, const uint32_t length) |
| Compare buffer content with microcontroller flash content. More... | |
| uint32_t | FlashRead (uint8_t *const data, const uint32_t address, const uint32_t length) |
| Read data from the microcontroller flash. More... | |
| uint32_t | FlashWrite (const uint8_t *const data, const uint32_t address, const uint32_t length) |
| Write data into the microcontroller flash. More... | |
| void | FlashRemapMemoryToSystemFlash (void) |
| Remap the microcontroller flash memory to the built-in system flash memory. More... | |
| static bool | FlashPerformErase (const uint32_t address, const uint32_t length) |
| Private helper function to perform the actual erase of the required flash pages. More... | |
| static uint32_t | FlashPerformWrite (const uint8_t *const data, const uint32_t address, const uint32_t length) |
| Private helper function to perform the actual writing of the provided data into the flash. More... | |
| static uint32_t | FlashGetBank (const uint32_t address) |
| Get the bank where the provided address is located. More... | |
| static uint32_t | FlashGetPage (const uint32_t address) |
| Get the page number where the provided address is located. More... | |
| static bool | FlashCheckIfPageRangesOverlap (const uint32_t range1Start, const uint32_t range1End, const uint32_t range2Start, const uint32_t range2End) |
| Check if two flash page ranges overlap. More... | |
| #define FLASH_BANK_SIZE_WRAPPER (uint32_t)(FLASH_BANK_SIZE) |
| #define FLASH_PAGE_NB_PER_BANK (uint32_t)(FLASH_BANK_SIZE_WRAPPER / FLASH_PAGE_SIZE) |
| #define FLASH_SIZE_WRAPPER (uint32_t)(FLASH_SIZE) |
| #define SYSTEM_MEMORY_ADDRESS 0x1FFF0000U |
| bool FlashCheckIfDataFits | ( | const uint32_t | address, |
| const uint32_t | length | ||
| ) |
Check if an array of data fits into the flash.
| address | The physical starting address of the data in the flash. |
| length | The length of the data. |
|
static |
Check if two flash page ranges overlap.
| range1Start | Start page of the first range. |
| range1End | End page of the first range. |
| range2Start | Start page of the second range. |
| range2End | End page of the second range. |
| bool FlashCheckIfWriteProtectionEnabled | ( | const uint32_t | address, |
| const uint32_t | length | ||
| ) |
Check if flash write protection is enabled for the specified region.
| address | Starting address of the region to check. |
| length | Length of the region in bytes. |
| bool FlashCompare | ( | const uint8_t *const | data, |
| const uint32_t | address, | ||
| const uint32_t | length | ||
| ) |
Compare buffer content with microcontroller flash content.
This function is useful for instance during flash write: if the content of the buffer matches with the flash content, the flash does not need to be written.
| data | Buffer which content is to be compared with the flash. |
| address | Physical address of the flash for the comparison. |
| length | Length of the compared content. |
| bool FlashDisableWriteProtection | ( | void | ) |
| bool FlashEnableWriteProtection | ( | const uint32_t | address, |
| const uint32_t | length | ||
| ) |
Enable flash write protection for the specified region.
| address | Starting address of the region to protect. |
| length | Length of the region in bytes. |
|
static |
|
static |
Get the page number where the provided address is located.
| address | Physical address to be checked. |
|
static |
Private helper function to perform the actual erase of the required flash pages.
| address | Physical flash address where the data is erased. |
| length | The length of the data in bytes. |
|
static |
Private helper function to perform the actual writing of the provided data into the flash.
| data | Buffer containing the data to be written. |
| address | Physical flash address where the data is written. |
| length | The length of the data to be written in bytes. |
| uint32_t FlashRead | ( | uint8_t *const | data, |
| const uint32_t | address, | ||
| const uint32_t | length | ||
| ) |
Read data from the microcontroller flash.
| data | Buffer where the data from the flash is copied into. |
| address | Physical address where the data is to be read. |
| length | Data size (in bytes) to be read from the flash. |
| void FlashRemapMemoryToSystemFlash | ( | void | ) |
| uint32_t FlashWrite | ( | const uint8_t *const | data, |
| const uint32_t | address, | ||
| const uint32_t | length | ||
| ) |
Write data into the microcontroller flash.
The function automatically erases the required flash pages before writing to the flash. All existing data located in those pages will be erased.
| data | Buffer containing the data to be written. |
| address | Physical flash address where the data is written. |
| length | The length of the data to be written in bytes. |