1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

add ability for developers to easily avoid locking their flash memory sectors

This commit is contained in:
mruddy 2017-06-30 09:02:47 -04:00 committed by Pavol Rusnak
parent d15dd7c944
commit 90d214eb4b
2 changed files with 8 additions and 0 deletions

View File

@ -59,6 +59,12 @@ else
LDSCRIPT = $(TOP_DIR)/memory.ld
endif
ifeq ($(MEMORY_PROTECT), 0)
CFLAGS += -DMEMORY_PROTECT=0
else
CFLAGS += -DMEMORY_PROTECT=1
endif
LDFLAGS += --static \
-Wl,--start-group \
-lc \

View File

@ -27,6 +27,7 @@
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
@ -45,6 +46,7 @@ void memory_protect(void)
// Bit 0 OPTLOCK: Option lock: ignored by flash_program_option_bytes
flash_program_option_bytes(0x0FFCCCEC);
flash_lock_option_bytes();
#endif
}
int memory_bootloader_hash(uint8_t *hash)