mcuboot/boot/zephyr/include
Marti Bolivar 29d3a77d3b zephyr: fix flash_area_to_sectors()
This fixes MCUB-39.

On Zephyr targets, flash_area_to_sectors() assumes that the flash
device's sector size is equal to the size of the scratch area.

That breaks swap and rollback when scratch size doesn't divide image
size, since the image flash areas will not be correctly configured.
This is a valid configuration supported by the rest of mcuboot.

The best way to fix this would be to get the flash layout from Zephyr,
but that's not possible yet.

Instead, provide a new FLASH_AREA_IMAGE_SECTOR_SIZE define from
target.h. This must be the sector size for these areas:

       - FLASH_AREA_IMAGE_0
       - FLASH_AREA_IMAGE_1
       - FLASH_AREA_IMAGE_SCRATCH

Other areas on the device may have sizes different than
FLASH_AREA_IMAGE_SECTOR_SIZE.

This won't work on platforms where those areas have nonuniform sector
sizes, but we'll cross that bridge when we come to it. (At that point,
an upstream Zephyr change to the flash API really seems needed.)

Revert to the old/buggy behavior when FLASH_AREA_IMAGE_SECTOR_SIZE
isn't provided, but emit a warning. Additionally, touch up the logging
and error handling while we're here.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:48:15 -04:00
..
flash_map flash_map: delete obsolete flash_map* declarations 2017-02-10 16:44:41 -05:00
hal zephyr: Move code under 'boot' directory 2017-01-10 09:49:47 -07:00
os zephyr: Move code under 'boot' directory 2017-01-10 09:49:47 -07:00
syscfg zephyr: Move code under 'boot' directory 2017-01-10 09:49:47 -07:00
sysflash zephyr: Move code under 'boot' directory 2017-01-10 09:49:47 -07:00
config-asn1.h zephyr: Support RSA, and ECDSA P-256 signing 2017-02-02 08:39:18 -07:00
config-boot.h zephyr: Include mbedtls config file 2017-01-10 09:51:39 -07:00
target.h zephyr: fix flash_area_to_sectors() 2017-03-21 15:48:15 -04:00