File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/subsys/dfu/img_util/src Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,25 @@ LOG_MODULE_REGISTER(flash_img, CONFIG_IMG_MANAGER_LOG_LEVEL);
2323#include <bootutil/bootutil_public.h>
2424#endif
2525
26+ #ifdef CONFIG_USE_DT_CODE_PARTITION
27+ #define FIXED_PARTITION_ADDRESS (label ) \
28+ (DT_REG_ADDR(DT_NODELABEL(label)) + \
29+ DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label)), \
30+ (DT_GPARENT(DT_PARENT(DT_NODELABEL(label)))), \
31+ (DT_GPARENT(DT_NODELABEL(label))))))
32+ #define FLASH_LOAD_ADDRESS \
33+ (DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) + \
34+ DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_CHOSEN(zephyr_code_partition)), \
35+ (DT_GPARENT(DT_PARENT(DT_CHOSEN(zephyr_code_partition)))), \
36+ (DT_GPARENT(DT_CHOSEN(zephyr_code_partition))))))
37+ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION (label ) \
38+ (FIXED_PARTITION_ADDRESS(label) <= FLASH_LOAD_ADDRESS && \
39+ FIXED_PARTITION_ADDRESS(label) + DT_REG_SIZE(DT_NODELABEL(label)) > FLASH_LOAD_ADDRESS)
40+ #else
2641#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION (label ) \
2742 (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \
2843 FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET)
44+ #endif
2945
3046#include <zephyr/devicetree.h>
3147#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE ) && (CONFIG_TFM_MCUBOOT_IMAGE_NUMBER == 2 )
Original file line number Diff line number Diff line change 1212#define SLOT0_PARTITION slot0_partition
1313#define SLOT1_PARTITION slot1_partition
1414
15+ #ifdef CONFIG_USE_DT_CODE_PARTITION
16+ #define FIXED_PARTITION_ADDRESS (label ) \
17+ (DT_REG_ADDR(DT_NODELABEL(label)) + \
18+ DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label)), \
19+ (DT_GPARENT(DT_PARENT(DT_NODELABEL(label)))), \
20+ (DT_GPARENT(DT_NODELABEL(label))))))
21+ #define FLASH_LOAD_ADDRESS \
22+ (DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) + \
23+ DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_CHOSEN(zephyr_code_partition)), \
24+ (DT_GPARENT(DT_PARENT(DT_CHOSEN(zephyr_code_partition)))), \
25+ (DT_GPARENT(DT_CHOSEN(zephyr_code_partition))))))
26+ #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION (label ) \
27+ (FIXED_PARTITION_ADDRESS(label) <= FLASH_LOAD_ADDRESS && \
28+ FIXED_PARTITION_ADDRESS(label) + DT_REG_SIZE(DT_NODELABEL(label)) > FLASH_LOAD_ADDRESS)
29+ #else
1530#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION (label ) \
1631 (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \
1732 FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET)
33+ #endif
1834
1935#if FIXED_PARTITION_IS_RUNNING_APP_PARTITION (slot0_partition )
2036#define UPLOAD_PARTITION_ID FIXED_PARTITION_ID(SLOT1_PARTITION)
You can’t perform that action at this time.
0 commit comments