Skip to content
Permalink
Browse files

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>
  • Loading branch information...
nvlsianpu authored and nashif committed May 8, 2019
1 parent 03199f9 commit c2f08dadf0d6d687cc67a1f4043220637479af27
Showing with 9 additions and 1 deletion.
  1. +9 −1 subsys/dfu/img_util/flash_img.c
@@ -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));
}

0 comments on commit c2f08da

Please sign in to comment.
You can’t perform that action at this time.