Skip to content

Commit e94c43e

Browse files
committed
[nrf fromlist] dfu: img_util: Fix partition detection
Fixes the logic in detecting which partition is being executed from, also fixes a test for this feature Upstream PR #: 106189 Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent d6c6c2b commit e94c43e

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

subsys/dfu/img_util/flash_img.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,8 @@ LOG_MODULE_REGISTER(flash_img, CONFIG_IMG_MANAGER_LOG_LEVEL);
2323
#include <bootutil/bootutil_public.h>
2424
#endif
2525

26-
#if defined(CONFIG_FLASH_USES_MAPPED_PARTITION)
2726
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
2827
DT_SAME_NODE(DT_CHOSEN(zephyr_code_partition), DT_NODELABEL(label))
29-
#else
30-
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
31-
DT_SAME_NODE(PARTITION_NODE_MTD(DT_CHOSEN(zephyr_code_partition)), \
32-
PARTITION_MTD(label)) && (PARTITION_ADDRESS(label) <= \
33-
(CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET) && \
34-
PARTITION_ADDRESS(label) + PARTITION_SIZE(label) > \
35-
(CONFIG_FLASH_BASE_ADDRESS + CONFIG_FLASH_LOAD_OFFSET))
36-
#endif
3728

3829
#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) && (CONFIG_TFM_MCUBOOT_IMAGE_NUMBER == 2)
3930
#define UPLOAD_FLASH_AREA_LABEL slot1_ns_partition

tests/subsys/dfu/img_util/src/main.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
#define SLOT0_PARTITION slot0_partition
1414
#define SLOT1_PARTITION slot1_partition
1515

16-
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
17-
DT_SAME_NODE(PARTITION_NODE_MTD(DT_CHOSEN(zephyr_code_partition)), \
18-
PARTITION_MTD(label)) && \
19-
(PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \
20-
PARTITION_OFFSET(label) + PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET)
16+
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
17+
DT_SAME_NODE(DT_CHOSEN(zephyr_code_partition), DT_NODELABEL(label))
2118

2219
#if PARTITION_IS_RUNNING_APP_PARTITION(slot0_partition)
2320
#define UPLOAD_PARTITION_ID PARTITION_ID(SLOT1_PARTITION)

0 commit comments

Comments
 (0)