Skip to content

Commit e720fa2

Browse files
committed
soc: Use absolute address in active partition
Use absolute addresses while determining a running application partition. Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 0985cce commit e720fa2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

soc/nordic/nrf54h/soc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
4343
(DT_GPARENT(DT_NODELABEL(label))))))
4444

4545
#ifdef CONFIG_USE_DT_CODE_PARTITION
46-
#define FLASH_LOAD_OFFSET DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition))
46+
#define FLASH_LOAD_ADDRESS \
47+
(DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) + \
48+
DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_CHOSEN(zephyr_code_partition)), \
49+
(DT_GPARENT(DT_PARENT(DT_CHOSEN(zephyr_code_partition)))), \
50+
(DT_GPARENT(DT_CHOSEN(zephyr_code_partition))))))
51+
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
52+
(FIXED_PARTITION_ADDRESS(label) <= FLASH_LOAD_ADDRESS && \
53+
FIXED_PARTITION_ADDRESS(label) + DT_REG_SIZE(DT_NODELABEL(label)) > FLASH_LOAD_ADDRESS)
4754
#elif defined(CONFIG_FLASH_LOAD_OFFSET)
4855
#define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET
49-
#endif
50-
5156
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
5257
(DT_REG_ADDR(DT_NODELABEL(label)) <= FLASH_LOAD_OFFSET && \
5358
DT_REG_ADDR(DT_NODELABEL(label)) + DT_REG_SIZE(DT_NODELABEL(label)) > FLASH_LOAD_OFFSET)
59+
#endif
5460

5561
sys_snode_t soc_node;
5662

0 commit comments

Comments
 (0)