zephyr: restructure the build process to use board config files
Move the board specific configurations into its own header file, which
can now be created per board, once it gets tested and validated by the
bootloader.
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
diff --git a/boot/zephyr/flash_map.c b/boot/zephyr/flash_map.c
index aadf13a..ad5cd05 100644
--- a/boot/zephyr/flash_map.c
+++ b/boot/zephyr/flash_map.c
@@ -21,6 +21,8 @@
#include <misc/printk.h>
#include <flash.h>
+#include MCUBOOT_TARGET_CONFIG
+
#include <flash_map/flash_map.h>
#include <hal/hal_flash.h>
#include <sysflash/sysflash.h>
@@ -34,28 +36,22 @@
static const struct flash_area part_map[] = {
{
.fa_id = FLASH_AREA_IMAGE_0,
- .fa_off = 0x20000,
- .fa_size = 0x20000,
+ .fa_off = FLASH_AREA_IMAGE_0_OFFSET,
+ .fa_size = FLASH_AREA_IMAGE_0_SIZE,
},
{
.fa_id = FLASH_AREA_IMAGE_1,
- .fa_off = 0x40000,
- .fa_size = 0x20000,
+ .fa_off = FLASH_AREA_IMAGE_1_OFFSET,
+ .fa_size = FLASH_AREA_IMAGE_1_SIZE,
},
{
.fa_id = FLASH_AREA_IMAGE_SCRATCH,
- .fa_off = 0x60000,
- .fa_size = 0x20000,
+ .fa_off = FLASH_AREA_IMAGE_SCRATCH_OFFSET,
+ .fa_size = FLASH_AREA_IMAGE_SCRATCH_SIZE,
},
};
/*
- * The K64F has a simple 1MB of uniform 4KB sectors. Initially, we'll
- * use the same partition layout as the Carbon board to make
- * development easier.
- */
-
-/*
* `open` a flash area. The `area` in this case is not the individual
* sectors, but describes the particular flash area in question.
*/
@@ -137,13 +133,13 @@
if (*cnt < 1)
return -1;
- off = (idx - FLASH_AREA_IMAGE_0 + 1) * 0x20000;
+ off = (idx - FLASH_AREA_IMAGE_0 + 1) * FLASH_AREA_IMAGE_0_OFFSET;
ret->fa_id = idx;
ret->fa_device_id = 0;
ret->pad16 = 0;
ret->fa_off = off;
- ret->fa_size = 0x20000;
+ ret->fa_size = FLASH_AREA_IMAGE_0_SIZE;
return 0;
}