summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/flash
diff options
context:
space:
mode:
authorIngo Albrecht <prom@berlin.ccc.de>2010-04-18 08:10:22 +0200
committerIngo Albrecht <prom@berlin.ccc.de>2010-07-20 14:41:20 +0200
commit55d8a53a0dbc985d927a147413f3ece6d3f32308 (patch)
treecf3b07d211620dec12674d9a422fdbc4310a4415 /src/target/firmware/flash
parent0412184b8d9a19422c91ea9be6f66ff9fc7bb766 (diff)
flash: verify source buffer alignment when programming. allow flashing first sector.
Diffstat (limited to 'src/target/firmware/flash')
-rw-r--r--src/target/firmware/flash/cfi_flash.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/target/firmware/flash/cfi_flash.c b/src/target/firmware/flash/cfi_flash.c
index 624d1433..697e11fa 100644
--- a/src/target/firmware/flash/cfi_flash.c
+++ b/src/target/firmware/flash/cfi_flash.c
@@ -133,7 +133,7 @@ static inline uint16_t flash_read16(const void *base_addr, uint32_t offset)
}
static char flash_protected(uint32_t block_offset) {
- return block_offset < 64*1024;
+ return 0; // block_offset < 64*1024;
}
@@ -268,7 +268,10 @@ int flash_program(flash_t *flash, uint32_t dst, void *src, uint32_t nbytes) {
return -EINVAL;
}
- /* check destination alignment */
+ /* check alignments */
+ if(((uint32_t)src)%2) {
+ return -EINVAL;
+ }
if(dst%2) {
return -EINVAL;
}