mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
memory_protect: update last commit
This commit is contained in:
parent
5bb769a740
commit
0c30a19300
8
memory.c
8
memory.c
@ -22,16 +22,16 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "sha2.h"
|
#include "sha2.h"
|
||||||
|
|
||||||
#define OPTION_BYTES_1 ((uint64_t *)0x1FFFC000)
|
#define FLASH_OPTION_BYTES_1 (*(const uint64_t *)0x1FFFC000)
|
||||||
#define OPTION_BYTES_2 ((uint64_t *)0x1FFFC008)
|
#define FLASH_OPTION_BYTES_2 (*(const uint64_t *)0x1FFFC008)
|
||||||
|
|
||||||
void memory_protect(void)
|
void memory_protect(void)
|
||||||
{
|
{
|
||||||
#if MEMORY_PROTECT
|
#if MEMORY_PROTECT
|
||||||
// Reference STM32F205 Flash programming manual revision 5 http://www.st.com/resource/en/programming_manual/cd00233952.pdf
|
// Reference STM32F205 Flash programming manual revision 5 http://www.st.com/resource/en/programming_manual/cd00233952.pdf
|
||||||
// Section 2.6 Option bytes
|
// Section 2.6 Option bytes
|
||||||
// set RDP level 2 WRP for sectors 0 and 1 flash option control register matches
|
// set RDP level 2 WRP for sectors 0 and 1 flash option control register matches
|
||||||
if ((((*OPTION_BYTES_1) & 0xFFEC) == 0xCCEC) && (((*OPTION_BYTES_2) & 0xFFF) == 0xFFC) && (FLASH_OPTCR == 0x0FFCCCED)) {
|
if (((FLASH_OPTION_BYTES_1 & 0xFFEC) == 0xCCEC) && ((FLASH_OPTION_BYTES_2 & 0xFFF) == 0xFFC) && ((FLASH_OPTCR & 0x0FFFFFEC) == 0x0FFCCCED)) {
|
||||||
return; // already set up correctly - bail out
|
return; // already set up correctly - bail out
|
||||||
}
|
}
|
||||||
flash_unlock_option_bytes();
|
flash_unlock_option_bytes();
|
||||||
|
Loading…
Reference in New Issue
Block a user