diff options
author | Ingo Albrecht <prom@berlin.ccc.de> | 2010-07-19 08:56:25 +0200 |
---|---|---|
committer | Ingo Albrecht <prom@berlin.ccc.de> | 2010-07-20 14:41:21 +0200 |
commit | 3f891b75c683b43ac65a7f36d58b2de40fae1942 (patch) | |
tree | ea984132f4e40c57b94e15ac180c1e79d2413185 /src/target/firmware | |
parent | 23359954b9da256d5727072cb90c12272309ba4d (diff) |
firmware: better flash protection
Diffstat (limited to 'src/target/firmware')
-rw-r--r-- | src/target/firmware/Makefile.inc | 3 | ||||
-rw-r--r-- | src/target/firmware/flash/cfi_flash.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/target/firmware/Makefile.inc b/src/target/firmware/Makefile.inc index 9c569865..30240343 100644 --- a/src/target/firmware/Makefile.inc +++ b/src/target/firmware/Makefile.inc @@ -25,6 +25,9 @@ CFLAGS += -g$(DEBUGF) # Uncomment this line if you want to write to flash. #CFLAGS += -DCONFIG_FLASH_WRITE +# Uncomment this line if you want to write to flash, including the bootloader. +#CFLAGS += -DCONFIG_FLASH_WRITE_LOADER + # some older toolchains don't support this, ignore it for now #ASFLAGS=-Wa,-adhlns=$(<:.S=.lst),--g$(DEBUGF) $(INCLUDES) -D__ASSEMBLY__ ASFLAGS=-Wa,-adhlns=$(<:.S=.lst) $(INCLUDES) -D__ASSEMBLY__ diff --git a/src/target/firmware/flash/cfi_flash.c b/src/target/firmware/flash/cfi_flash.c index 452b395e..5ca81b65 100644 --- a/src/target/firmware/flash/cfi_flash.c +++ b/src/target/firmware/flash/cfi_flash.c @@ -142,7 +142,11 @@ static inline uint16_t flash_read16(const void *base_addr, uint32_t offset) __ramtext static char flash_protected(uint32_t block_offset) { #ifdef CONFIG_FLASH_WRITE +# ifdef CONFIG_FLASH_WRITE_LOADER return 0; +# else + return block_offset <= 0xFFFF; +# endif #else return 1; #endif |