stm32:l4:flash: Fix option bytes programming

FLASH_CR_OPTSTRT needs to be written to FLASH_CR, and there is no reason
to mask the last two data bits.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
(original code appeared to be badly copied from the flash_common_f24 codebase)
This commit is contained in:
Bruno Randolf 2018-09-20 16:38:14 +01:00 committed by Karl Palsson
parent 833ddd9b0a
commit 53ce5aa3dd

View File

@ -196,8 +196,8 @@ void flash_program_option_bytes(uint32_t data)
flash_unlock_option_bytes();
}
FLASH_OPTR = data & ~0x3;
FLASH_OPTR |= FLASH_CR_OPTSTRT;
FLASH_OPTR = data;
FLASH_CR |= FLASH_CR_OPTSTRT;
flash_wait_for_last_operation();
}
/**@}*/