Skip to content

Commit a7de5b4

Browse files
committed
[nrf noup] boot: zephyr: Update partition macros
Updates partition macros to use the new, non-deprecated macros Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent f581923 commit a7de5b4

File tree

10 files changed

+51
-53
lines changed

10 files changed

+51
-53
lines changed

boot/bootutil/zephyr/src/boot_request_flash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
#include "bootutil/bootutil_log.h"
1313

14-
#define MAIN_FLASH_DEV FIXED_PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request))
15-
#define MAIN_OFFSET FIXED_PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request))
16-
#define MAIN_SIZE FIXED_PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request))
14+
#define MAIN_FLASH_DEV PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request))
15+
#define MAIN_OFFSET PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request))
16+
#define MAIN_SIZE PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request))
1717

1818
#ifdef CONFIG_NRF_MCUBOOT_BOOT_REQUEST_PREFERENCE_KEEP
19-
#define BACKUP_FLASH_DEV FIXED_PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request_backup))
20-
#define BACKUP_OFFSET FIXED_PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request_backup))
21-
#define BACKUP_SIZE FIXED_PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request_backup))
19+
#define BACKUP_FLASH_DEV PARTITION_NODE_DEVICE(DT_CHOSEN(nrf_bootloader_request_backup))
20+
#define BACKUP_OFFSET PARTITION_NODE_OFFSET(DT_CHOSEN(nrf_bootloader_request_backup))
21+
#define BACKUP_SIZE PARTITION_NODE_SIZE(DT_CHOSEN(nrf_bootloader_request_backup))
2222
#endif /* CONFIG_NRF_MCUBOOT_BOOT_REQUEST_PREFERENCE_KEEP */
2323

2424
#define BOOT_REQUEST_CHECKSUM_SIZE sizeof(uint32_t)

boot/zephyr/boot_serial_extension_zephyr_basic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int bs_custom_storage_erase(const struct nmgr_hdr *hdr,
4141
return MGMT_ERR_ENOTSUP;
4242
}
4343

44-
rc = flash_area_open(FIXED_PARTITION_ID(storage_partition), &fa);
44+
rc = flash_area_open(PARTITION_ID(storage_partition), &fa);
4545

4646
if (rc < 0) {
4747
BOOT_LOG_ERR("failed to open flash area");

boot/zephyr/firmware_loader_bm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);
2626

2727
static struct flash_area fa_app_installer = {
2828
.fa_id = 1,
29-
.fa_off = FIXED_PARTITION_OFFSET(slot0_partition),
30-
.fa_size = FIXED_PARTITION_SIZE(slot0_partition),
29+
.fa_off = PARTITION_OFFSET(slot0_partition),
30+
.fa_size = PARTITION_SIZE(slot0_partition),
3131
.fa_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller)),
3232
};
3333

boot/zephyr/flash_map_extended.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,26 @@ int flash_area_id_from_direct_image(int image_id)
135135
switch (image_id) {
136136
case 0:
137137
case 1:
138-
return FIXED_PARTITION_ID(slot0_partition);
139-
#if FIXED_PARTITION_EXISTS(slot1_partition)
138+
return PARTITION_ID(slot0_partition);
139+
#if PARTITION_EXISTS(slot1_partition)
140140
case 2:
141-
return FIXED_PARTITION_ID(slot1_partition);
141+
return PARTITION_ID(slot1_partition);
142142
#endif
143-
#if FIXED_PARTITION_EXISTS(slot2_partition)
143+
#if PARTITION_EXISTS(slot2_partition)
144144
case 3:
145-
return FIXED_PARTITION_ID(slot2_partition);
145+
return PARTITION_ID(slot2_partition);
146146
#endif
147-
#if FIXED_PARTITION_EXISTS(slot3_partition)
147+
#if PARTITION_EXISTS(slot3_partition)
148148
case 4:
149-
return FIXED_PARTITION_ID(slot3_partition);
149+
return PARTITION_ID(slot3_partition);
150150
#endif
151-
#if FIXED_PARTITION_EXISTS(slot4_partition)
151+
#if PARTITION_EXISTS(slot4_partition)
152152
case 5:
153-
return FIXED_PARTITION_ID(slot4_partition);
153+
return PARTITION_ID(slot4_partition);
154154
#endif
155-
#if FIXED_PARTITION_EXISTS(slot5_partition)
155+
#if PARTITION_EXISTS(slot5_partition)
156156
case 6:
157-
return FIXED_PARTITION_ID(slot5_partition);
157+
return PARTITION_ID(slot5_partition);
158158
#endif
159159
}
160160
return -EINVAL;

boot/zephyr/include/sysflash/sysflash.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
4848
{
4949
static const int all_slots[] = {
50-
FOR_EACH_NONEMPTY_TERM(FIXED_PARTITION_ID, (,), ALL_AVAILABLE_SLOTS)
50+
FOR_EACH_NONEMPTY_TERM(PARTITION_ID, (,), ALL_AVAILABLE_SLOTS)
5151
};
5252
return all_slots[img * 2 + slot];
5353
};
@@ -61,13 +61,13 @@ static inline uint32_t __flash_area_ids_for_slot(int img, int slot)
6161
#define FLASH_AREA_IMAGE_SECONDARY(x) __flash_area_ids_for_slot(x, 1)
6262

6363
#if !defined(CONFIG_BOOT_SWAP_USING_MOVE) && !defined(CONFIG_BOOT_SWAP_USING_OFFSET)
64-
#define FLASH_AREA_IMAGE_SCRATCH FIXED_PARTITION_ID(scratch_partition)
64+
#define FLASH_AREA_IMAGE_SCRATCH PARTITION_ID(scratch_partition)
6565
#endif
6666

6767
#else /* !CONFIG_SINGLE_APPLICATION_SLOT && !CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP */
6868

69-
#define FLASH_AREA_IMAGE_PRIMARY(x) FIXED_PARTITION_ID(slot0_partition)
70-
#define FLASH_AREA_IMAGE_SECONDARY(x) FIXED_PARTITION_ID(slot0_partition)
69+
#define FLASH_AREA_IMAGE_PRIMARY(x) PARTITION_ID(slot0_partition)
70+
#define FLASH_AREA_IMAGE_SECONDARY(x) PARTITION_ID(slot0_partition)
7171

7272
#endif /* CONFIG_SINGLE_APPLICATION_SLOT */
7373

boot/zephyr/include/target.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
!defined(CONFIG_SOC_FAMILY_ESPRESSIF_ESP32)) || \
3939
(defined(CONFIG_SOC_SERIES_NRF54H) && !DT_HAS_CHOSEN(zephyr_flash)) || \
4040
!defined(FLASH_ALIGN) || \
41-
!(FIXED_PARTITION_EXISTS(slot0_partition)) || \
42-
!(FIXED_PARTITION_EXISTS(slot1_partition) || CONFIG_SINGLE_APPLICATION_SLOT) || \
43-
(defined(CONFIG_BOOT_SWAP_USING_SCRATCH) && !FIXED_PARTITION_EXISTS(scratch_partition))
41+
!(PARTITION_EXISTS(slot0_partition)) || \
42+
!(PARTITION_EXISTS(slot1_partition) || CONFIG_SINGLE_APPLICATION_SLOT) || \
43+
(defined(CONFIG_BOOT_SWAP_USING_SCRATCH) && !PARTITION_EXISTS(scratch_partition))
4444
#error "Target support is incomplete; cannot build mcuboot."
4545
#endif
4646

47-
#if (MCUBOOT_IMAGE_NUMBER == 2) && (!(FIXED_PARTITION_EXISTS(slot2_partition)) || \
48-
!(FIXED_PARTITION_EXISTS(slot3_partition)))
47+
#if (MCUBOOT_IMAGE_NUMBER == 2) && (!(PARTITION_EXISTS(slot2_partition)) || \
48+
!(PARTITION_EXISTS(slot3_partition)))
4949
#error "Target support is incomplete; cannot build mcuboot."
5050
#endif
5151

boot/zephyr/load_ironside_se_conf_mpc.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,49 @@ BUILD_ASSERT(MCUBOOT_IMAGE_NUMBER <= 2,
2525

2626
/* clang-format off */
2727
#define MIN_START_ADDR(_label0, _label1) \
28-
MIN(FIXED_PARTITION_ADDRESS(_label0), \
28+
MIN(PARTITION_ADDRESS(_label0), \
2929
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
30-
(FIXED_PARTITION_ADDRESS(_label1)), \
30+
(PARTITION_ADDRESS(_label1)), \
3131
(UINTPTR_MAX)))
3232

3333
#define MIN_END_ADDR(_label0, _label1) \
34-
MIN((FIXED_PARTITION_ADDRESS(_label0) + FIXED_PARTITION_SIZE(_label0)), \
34+
MIN((PARTITION_ADDRESS(_label0) + PARTITION_SIZE(_label0)), \
3535
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
36-
((FIXED_PARTITION_ADDRESS(_label1) + FIXED_PARTITION_SIZE(_label1))), \
36+
((PARTITION_ADDRESS(_label1) + PARTITION_SIZE(_label1))), \
3737
(UINTPTR_MAX)))
3838

3939
#define MAX_START_ADDR(_label0, _label1) \
40-
MAX(FIXED_PARTITION_ADDRESS(_label0), \
40+
MAX(PARTITION_ADDRESS(_label0), \
4141
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
42-
(FIXED_PARTITION_ADDRESS(_label1)), \
42+
(PARTITION_ADDRESS(_label1)), \
4343
(0)))
4444

4545
#define MAX_END_ADDR(_label0, _label1) \
46-
MAX((FIXED_PARTITION_ADDRESS(_label0) + FIXED_PARTITION_SIZE(_label0)), \
46+
MAX((PARTITION_ADDRESS(_label0) + PARTITION_SIZE(_label0)), \
4747
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_label1)), \
48-
((FIXED_PARTITION_ADDRESS(_label1) + FIXED_PARTITION_SIZE(_label1))), \
48+
((PARTITION_ADDRESS(_label1) + PARTITION_SIZE(_label1))), \
4949
(0)))
5050
/* clang-format on */
5151

52-
#define ACCESSIBLE_MRAM_START FIXED_PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition))
52+
#define ACCESSIBLE_MRAM_START PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition))
5353
BUILD_ASSERT((ACCESSIBLE_MRAM_START % OVERRIDE_ALIGNMENT) == 0);
5454

5555
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(secure_storage_partition))
56-
BUILD_ASSERT((FIXED_PARTITION_ADDRESS(secure_storage_partition) +
57-
FIXED_PARTITION_SIZE(secure_storage_partition)) ==
56+
BUILD_ASSERT((PARTITION_ADDRESS(secure_storage_partition) +
57+
PARTITION_SIZE(secure_storage_partition)) ==
5858
(DT_REG_ADDR(DT_NODELABEL(mram1x)) + DT_REG_SIZE(DT_NODELABEL(mram1x))),
5959
"The MPC override configuration used to provide write protection for the image "
6060
"partitions currently requires that the secure storage partitions are placed at the "
6161
"end of MRAM.");
6262

63-
#define ACCESSIBLE_MRAM_END FIXED_PARTITION_ADDRESS(secure_storage_partition)
63+
#define ACCESSIBLE_MRAM_END PARTITION_ADDRESS(secure_storage_partition)
6464
#else
6565
#define ACCESSIBLE_MRAM_END (DT_REG_ADDR(DT_NODELABEL(mram1x)) + DT_REG_SIZE(DT_NODELABEL(mram1x)))
6666
#endif
6767
BUILD_ASSERT((ACCESSIBLE_MRAM_END % OVERRIDE_ALIGNMENT) == 0);
6868

6969
#define BOOT_PARTITION_END \
70-
(FIXED_PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition)) + \
70+
(PARTITION_NODE_ADDRESS(DT_CHOSEN(zephyr_code_partition)) + \
7171
CONFIG_NCS_MCUBOOT_MPCCONF_STATIC_WRITE_PROTECTION_INITIAL_REGION_SIZE)
7272
BUILD_ASSERT((BOOT_PARTITION_END % OVERRIDE_ALIGNMENT) == 0);
7373

boot/zephyr/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@
7171
#define SECONDARY_SLOT 1
7272

7373
#define IMAGE0_PRIMARY_START_ADDRESS \
74-
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_0), reg, 0)
74+
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_0), reg, 0)
7575
#define IMAGE0_PRIMARY_SIZE \
76-
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_0), reg, 1)
76+
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_0), reg, 1)
7777

7878
#define IMAGE1_PRIMARY_START_ADDRESS \
79-
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_1), reg, 0)
79+
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_1), reg, 0)
8080
#define IMAGE1_PRIMARY_SIZE \
81-
DT_PROP_BY_IDX(DT_NODE_BY_FIXED_PARTITION_LABEL(image_1), reg, 1)
81+
DT_PROP_BY_IDX(DT_NODE_BY_PARTITION_LABEL(image_1), reg, 1)
8282

8383
#endif /* CONFIG_SOC_FAMILY_ESPRESSIF_ESP32 */
8484

boot/zephyr/nrf54h20_custom_s2ram.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ volatile struct mcuboot_resume_s mcuboot_resume;
2525
#error "mcuboot resume support section not defined in dts"
2626
#endif
2727

28-
#define FIXED_PARTITION_ADDR(node_label) DT_REG_ADDR(DT_NODELABEL(node_label))
29-
3028
#define S2RAM_SLOT_INFO_A 0x37
3129
#define S2RAM_SLOT_INFO_B 0xA4
3230

@@ -76,17 +74,17 @@ void pm_s2ram_mark_check_and_mediate(void)
7674
#ifdef CONFIG_BOOT_DIRECT_XIP
7775
if (mcuboot_resume.slot_info == S2RAM_SLOT_INFO_A) {
7876
vt = (struct arm_vector_table *)
79-
(FIXED_PARTITION_ADDR(slot0_partition) + APP_EXE_START_OFFSET);
77+
(PARTITION_ADDRESS(slot0_partition) + APP_EXE_START_OFFSET);
8078
} else if (mcuboot_resume.slot_info == S2RAM_SLOT_INFO_B) {
8179
vt = (struct arm_vector_table *)
82-
(FIXED_PARTITION_ADDR(slot1_partition) + APP_EXE_START_OFFSET);
80+
(PARTITION_ADDRESS(slot1_partition) + APP_EXE_START_OFFSET);
8381
} else {
8482
/* invalid slot info */
8583
goto resume_failed;
8684
}
8785
#else
8886
vt = (struct arm_vector_table *)
89-
(FIXED_PARTITION_ADDR(slot0_partition) + APP_EXE_START_OFFSET);
87+
(PARTITION_ADDRESS(slot0_partition) + APP_EXE_START_OFFSET);
9088
#endif
9189

9290
/* Jump to application */

samples/runtime-source/zephyr/hooks/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ static struct image_header _hdr;
1717
static uint8_t tmpbuf[BOOT_TMPBUF_SZ];
1818

1919
static uint8_t known_ids[] = {
20-
FIXED_PARTITION_ID(slot0_partition),
21-
FIXED_PARTITION_ID(slot1_partition),
20+
PARTITION_ID(slot0_partition),
21+
PARTITION_ID(slot1_partition),
2222
};
2323

2424
static int current_id;

0 commit comments

Comments
 (0)