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

pull/25/head
mruddy 7 years ago committed by Pavol Rusnak
parent d15dd7c944
commit 90d214eb4b

@ -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 \

@ -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)

Loading…
Cancel
Save