summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-01-19 09:47:21 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-01-19 10:58:48 +0100
commitcdcb9b0885cdb2ca2a212536ab68acc2e9bc7fad (patch)
treebbc1f9630ed147f7696443099a3edc520d702d60 /src/flash
parent5ab34b28ce3378a0a36b122a07af4f0f4769a24f (diff)
downloadopenocd+libswd-cdcb9b0885cdb2ca2a212536ab68acc2e9bc7fad.tar.gz
openocd+libswd-cdcb9b0885cdb2ca2a212536ab68acc2e9bc7fad.tar.bz2
openocd+libswd-cdcb9b0885cdb2ca2a212536ab68acc2e9bc7fad.tar.xz
openocd+libswd-cdcb9b0885cdb2ca2a212536ab68acc2e9bc7fad.zip
flash: add error messages upon incorrect arguments to flash iteration
According to OpenOCD error handling rules the error is logged at where it occurs(same site where an exception would have been thrown). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/nor/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c
index aedaa866..277da38c 100644
--- a/src/flash/nor/core.c
+++ b/src/flash/nor/core.c
@@ -324,14 +324,20 @@ static int flash_iterate_address_range(struct target *target,
{
/* special case, erase whole bank when length is zero */
if (addr != c->base)
+ {
+ LOG_ERROR("Whole bank access must start at beginning of bank.");
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
+ }
return callback(c, 0, c->num_sectors - 1);
}
/* check whether it all fits in this bank */
if (addr + length - 1 > c->base + c->size - 1)
+ {
+ LOG_ERROR("Flash access does not fit into bank.");
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
+ }
/** @todo: handle erasures that cross into adjacent banks */