@@ -32,6 +32,15 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
3232#define HSFLL_NODE DT_NODELABEL(cpurad_hsfll)
3333#endif
3434
35+ #ifdef CONFIG_USE_DT_CODE_PARTITION
36+ #define FLASH_LOAD_OFFSET DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition))
37+ #elif defined(CONFIG_FLASH_LOAD_OFFSET )
38+ #define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET
39+ #endif
40+
41+ #define PARTITION_IS_RUNNING_APP_PARTITION (label ) \
42+ (DT_REG_ADDR(DT_NODELABEL(label)) == FLASH_LOAD_OFFSET)
43+
3544sys_snode_t soc_node ;
3645
3746#define FICR_ADDR_GET (node_id , name ) \
@@ -44,8 +53,6 @@ sys_snode_t soc_node;
4453 ADDRESS_DOMAIN_Msk | \
4554 ADDRESS_BUS_Msk)))
4655
47- #define DT_NODELABEL_CPURAD_SLOT0_PARTITION DT_NODELABEL(cpurad_slot0_partition)
48-
4956static void power_domain_init (void )
5057{
5158 /*
@@ -172,11 +179,24 @@ void soc_late_init_hook(void)
172179 */
173180 uint8_t * msg = NULL ;
174181 size_t msg_size = 0 ;
175-
176- void * radiocore_address =
177- (void * )(DT_REG_ADDR (DT_GPARENT (DT_NODELABEL_CPURAD_SLOT0_PARTITION )) +
178- DT_REG_ADDR (DT_NODELABEL_CPURAD_SLOT0_PARTITION ) +
179- CONFIG_ROM_START_OFFSET );
182+ void * radiocore_address = NULL ;
183+
184+ if (PARTITION_IS_RUNNING_APP_PARTITION (slot0_partition )) {
185+ radiocore_address =
186+ (void * )(DT_REG_ADDR (DT_GPARENT (DT_NODELABEL (cpurad_slot0_partition ))) +
187+ DT_REG_ADDR (DT_NODELABEL (cpurad_slot0_partition )) +
188+ CONFIG_ROM_START_OFFSET );
189+ #if DT_NODE_EXISTS (DT_NODELABEL (cpurad_slot1_partition ))
190+ } else if (PARTITION_IS_RUNNING_APP_PARTITION (slot1_partition )) {
191+ radiocore_address =
192+ (void * )(DT_REG_ADDR (DT_GPARENT (DT_NODELABEL (cpurad_slot1_partition ))) +
193+ DT_REG_ADDR (DT_NODELABEL (cpurad_slot1_partition )) +
194+ CONFIG_ROM_START_OFFSET );
195+ #endif
196+ } else {
197+ __ASSERT (radiocore_address != NULL , "Unable to find radio core code parition" );
198+ return ;
199+ }
180200
181201 /* Don't wait as this is not yet supported. */
182202 bool cpu_wait = false;
0 commit comments