diff --git a/subsys/dfu/boot/mcuboot.c b/subsys/dfu/boot/mcuboot.c index 8e1725a1729..1070448cb44 100644 --- a/subsys/dfu/boot/mcuboot.c +++ b/subsys/dfu/boot/mcuboot.c @@ -69,7 +69,8 @@ struct mcuboot_v1_raw_header { #define BOOT_FLAG_IMAGE_OK 0 #define BOOT_FLAG_COPY_DONE 1 -#define FLASH_MIN_WRITE_SIZE DT_FLASH_WRITE_BLOCK_SIZE +#define FLASH_MIN_WRITE_SIZE \ + DT_PROP(DT_CHOSEN(zephyr_flash), write_block_size) /* DT_FLASH_AREA_IMAGE_XX_YY values used below are auto-generated by DT */ #ifdef CONFIG_TRUSTED_EXECUTION_NONSECURE diff --git a/subsys/dfu/img_util/flash_img.c b/subsys/dfu/img_util/flash_img.c index 543fd8ef967..d437ecff6b4 100644 --- a/subsys/dfu/img_util/flash_img.c +++ b/subsys/dfu/img_util/flash_img.c @@ -31,9 +31,12 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define FLASH_AREA_IMAGE_SECONDARY DT_FLASH_AREA_IMAGE_1_ID #endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE */ -BUILD_ASSERT((CONFIG_IMG_BLOCK_BUF_SIZE % DT_FLASH_WRITE_BLOCK_SIZE == 0), +#define FLASH_WRITE_BLOCK_SIZE \ + DT_PROP(DT_CHOSEN(zephyr_flash), write_block_size) + +BUILD_ASSERT((CONFIG_IMG_BLOCK_BUF_SIZE % FLASH_WRITE_BLOCK_SIZE == 0), "CONFIG_IMG_BLOCK_BUF_SIZE is not a multiple of " - "DT_FLASH_WRITE_BLOCK_SIZE"); + "FLASH_WRITE_BLOCK_SIZE"); static bool flash_verify(const struct flash_area *fa, off_t offset, u8_t *data, size_t len) diff --git a/subsys/net/lib/openthread/platform/openthread-core-zephyr-config.h b/subsys/net/lib/openthread/platform/openthread-core-zephyr-config.h index 75c95e4e0e5..6741afa0d6d 100644 --- a/subsys/net/lib/openthread/platform/openthread-core-zephyr-config.h +++ b/subsys/net/lib/openthread/platform/openthread-core-zephyr-config.h @@ -85,7 +85,8 @@ * is set in your SOC dts file. * */ -#define SETTINGS_CONFIG_PAGE_SIZE DT_FLASH_ERASE_BLOCK_SIZE +#define SETTINGS_CONFIG_PAGE_SIZE \ + DT_PROP(DT_CHOSEN(zephyr_flash), erase_block_size) /** * @def SETTINGS_CONFIG_PAGE_NUM diff --git a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c index 3202ddbdb7e..7795bd9dc2d 100644 --- a/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c +++ b/tests/subsys/settings/fcb_init/src/settings_test_fcb_init.c @@ -25,9 +25,11 @@ static u32_t val32; /* leverage that this area has to be embededd flash part */ #ifdef DT_FLASH_AREA_IMAGE_0_ID +#define FLASH_WRITE_BLOCK_SIZE \ + DT_PROP(DT_CHOSEN(zephyr_flash), write_block_size) static const volatile __attribute__((section(".rodata"))) -__aligned(DT_FLASH_WRITE_BLOCK_SIZE) -u8_t prepared_mark[DT_FLASH_WRITE_BLOCK_SIZE] = {ERASED_VAL}; +__aligned(FLASH_WRITE_BLOCK_SIZE) +u8_t prepared_mark[FLASH_WRITE_BLOCK_SIZE] = {ERASED_VAL}; #endif static int c1_set(const char *name, size_t len, settings_read_cb read_cb, @@ -88,7 +90,7 @@ void test_prepare_storage(void) int err; const struct flash_area *fa; struct device *dev; - u8_t new_val[DT_FLASH_WRITE_BLOCK_SIZE]; + u8_t new_val[FLASH_WRITE_BLOCK_SIZE]; if (prepared_mark[0] == ERASED_VAL) { TC_PRINT("First run: erasing the storage\r\n"); @@ -107,7 +109,7 @@ void test_prepare_storage(void) zassert_true(err == 0, "can't unprotect flash"); (void)memset(new_val, (~ERASED_VAL) & 0xFF, - DT_FLASH_WRITE_BLOCK_SIZE); + FLASH_WRITE_BLOCK_SIZE); err = flash_write(dev, (off_t)&prepared_mark, &new_val, sizeof(new_val)); zassert_true(err == 0, "can't write prepared_mark");