mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-29 19:08:12 +00:00
memory_protect: fix FLASH_OPTCR check
This commit is contained in:
parent
ef89fc4e89
commit
c796800b2b
4
memory.c
4
memory.c
@ -30,8 +30,8 @@ void memory_protect(void)
|
||||
#if MEMORY_PROTECT
|
||||
// Reference STM32F205 Flash programming manual revision 5 http://www.st.com/resource/en/programming_manual/cd00233952.pdf
|
||||
// Section 2.6 Option bytes
|
||||
// set RDP level 2 WRP for sectors 0 and 1 flash option control register matches
|
||||
if (((FLASH_OPTION_BYTES_1 & 0xFFEC) == 0xCCEC) && ((FLASH_OPTION_BYTES_2 & 0xFFF) == 0xFFC) && ((FLASH_OPTCR & 0x0FFFFFEC) == 0x0FFCCCED)) {
|
||||
// set RDP level 2 WRP for sectors 0 and 1 flash option control register matches
|
||||
if (((FLASH_OPTION_BYTES_1 & 0xFFEC) == 0xCCEC) && ((FLASH_OPTION_BYTES_2 & 0xFFF) == 0xFFC) && (FLASH_OPTCR == 0x0FFCCCED)) {
|
||||
return; // already set up correctly - bail out
|
||||
}
|
||||
flash_unlock_option_bytes();
|
||||
|
Loading…
Reference in New Issue
Block a user