Browse Source

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>
tags/v0.4.0-rc2
Øyvind Harboe 14 years ago
parent
commit
cdcb9b0885
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/flash/nor/core.c

+ 6
- 0
src/flash/nor/core.c View File

@@ -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 */



Loading…
Cancel
Save