mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
add ability for developers to easily avoid locking their flash memory sectors
This commit is contained in:
parent
d15dd7c944
commit
90d214eb4b
@ -59,6 +59,12 @@ else
|
|||||||
LDSCRIPT = $(TOP_DIR)/memory.ld
|
LDSCRIPT = $(TOP_DIR)/memory.ld
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MEMORY_PROTECT), 0)
|
||||||
|
CFLAGS += -DMEMORY_PROTECT=0
|
||||||
|
else
|
||||||
|
CFLAGS += -DMEMORY_PROTECT=1
|
||||||
|
endif
|
||||||
|
|
||||||
LDFLAGS += --static \
|
LDFLAGS += --static \
|
||||||
-Wl,--start-group \
|
-Wl,--start-group \
|
||||||
-lc \
|
-lc \
|
||||||
|
2
memory.c
2
memory.c
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
void memory_protect(void)
|
void memory_protect(void)
|
||||||
{
|
{
|
||||||
|
#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
|
// 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
|
// Bit 0 OPTLOCK: Option lock: ignored by flash_program_option_bytes
|
||||||
flash_program_option_bytes(0x0FFCCCEC);
|
flash_program_option_bytes(0x0FFCCCEC);
|
||||||
flash_lock_option_bytes();
|
flash_lock_option_bytes();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int memory_bootloader_hash(uint8_t *hash)
|
int memory_bootloader_hash(uint8_t *hash)
|
||||||
|
Loading…
Reference in New Issue
Block a user