dfu/img_util: : non-secure app support

In non-secure Trustzone application dedicated flash non-secure
partition are used instead of regular one, which become secure
partition in Trustzone collaboration model.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2019-05-08 17:06:11 +02:00 committed by Anas Nashif
parent 03199f9994
commit c2f08dadf0

View File

@ -23,6 +23,14 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <flash.h>
#endif
#include <generated_dts_board.h>
/* DT_FLASH_AREA_IMAGE_XX_YY values used below are auto-generated by DT */
#ifdef CONFIG_TRUSTED_EXECUTION_NONSECURE
#define FLASH_AREA_IMAGE_SECONDARY DT_FLASH_AREA_IMAGE_1_NONSECURE_ID
#else
#define FLASH_AREA_IMAGE_SECONDARY DT_FLASH_AREA_IMAGE_1_ID
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE */
BUILD_ASSERT_MSG((CONFIG_IMG_BLOCK_BUF_SIZE % DT_FLASH_WRITE_BLOCK_SIZE == 0),
"CONFIG_IMG_BLOCK_BUF_SIZE is not a multiple of "
"DT_FLASH_WRITE_BLOCK_SIZE");
@ -212,6 +220,6 @@ int flash_img_init(struct flash_img_context *ctx)
#ifdef CONFIG_IMG_ERASE_PROGRESSIVELY
ctx->off_last = -1;
#endif
return flash_area_open(DT_FLASH_AREA_IMAGE_1_ID,
return flash_area_open(FLASH_AREA_IMAGE_SECONDARY,
(const struct flash_area **)&(ctx->flash_area));
}