stm32l0/l1: flash: support half page flashing
Tested on L1 and L0 using the "dapboot" project, see https://github.com/devanlai/dapboot/pull/27 for L1 and https://github.com/devanlai/dapboot/pull/30 for L0
This commit is contained in:
@@ -120,6 +120,19 @@ void flash_unlock_progmem(void);
|
||||
void flash_lock_progmem(void);
|
||||
void flash_lock_option_bytes(void);
|
||||
void flash_unlock_acr(void);
|
||||
/** Erase a page in flash.
|
||||
* @param page_address For L1, must be first word in page, L0 doesn't care
|
||||
* Takes 1 tprog. Flash must already be unlocked!
|
||||
*/
|
||||
void flash_erase_page(uint32_t page_address);
|
||||
|
||||
/**
|
||||
* Write a half page from buf to dst.
|
||||
* This function _must_ be in ram! (See the Ref Man for more details)
|
||||
* @param dst where to write to, expected to be aligned and erased.
|
||||
* @param buf the half page to write, size required depends on target
|
||||
*/
|
||||
void flash_program_half_page(uint32_t *dst, void *buf);
|
||||
|
||||
void eeprom_program_word(uint32_t address, uint32_t data);
|
||||
void eeprom_program_words(uint32_t address, uint32_t *data, int length_in_words);
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
/* --- FLASH_OPTR values ----------------------------------------------------- */
|
||||
#define FLASH_OPTR_NBOOT1 (1 << 31)
|
||||
|
||||
#define FLASH_HALF_PAGE_SIZE 16
|
||||
|
||||
BEGIN_DECLS
|
||||
|
||||
END_DECLS
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
/* --- FLASH_SR values ----------------------------------------------------- */
|
||||
#define FLASH_SR_OPTVERRUSR (1 << 12)
|
||||
|
||||
/* --- Function prototypes ------------------------------------------------- */
|
||||
#define FLASH_HALF_PAGE_SIZE 32
|
||||
|
||||
BEGIN_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user