Browse Source

flash: add error message if image is too big for flash

replaced assert() w/error message if the image is
too big.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
tags/v0.5.0-rc1
Øyvind Harboe 14 years ago
parent
commit
9ab7636ce6
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/flash/nor/core.c

+ 5
- 1
src/flash/nor/core.c View File

@@ -636,7 +636,11 @@ int flash_write_unlock(struct target *target, struct image *image,
LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes);
}

assert (run_address + run_size - 1 <= c->base + c->size - 1);
if (run_address + run_size - 1 > c->base + c->size - 1)
{
LOG_ERROR("The image is too big for the flash");
return ERROR_FAIL;
}

/* If we're applying any sector automagic, then pad this
* (maybe-combined) segment to the end of its last sector.


Loading…
Cancel
Save