From cdcb9b0885cdb2ca2a212536ab68acc2e9bc7fad Mon Sep 17 00:00:00 2001 From: Øyvind Harboe Date: Tue, 19 Jan 2010 09:47:21 +0100 Subject: flash: add error messages upon incorrect arguments to flash iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/flash/nor/core.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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 */ -- cgit v1.2.3