@@ -99,46 +99,26 @@ static bool spu_region_is_flash_region_in_address_range(uint8_t region_id, uint3
99
99
}
100
100
#endif
101
101
102
- #if defined(REGION_PCD_SRAM_ADDRESS )
103
- static bool spu_region_is_sram_region_in_address_range (uint8_t region_id , uint32_t start_address , uint32_t end_address )
104
- {
105
- size_t start_id = (start_address - DEVICE_SRAM_BASE_ADDRESS ) / SRAM_SECURE_ATTRIBUTION_REGION_SIZE ;
106
- size_t end_id = (end_address - DEVICE_SRAM_BASE_ADDRESS ) / SRAM_SECURE_ATTRIBUTION_REGION_SIZE ;
107
- return region_id >= start_id && region_id <= end_id ;
108
- }
109
- #endif
110
-
111
102
static bool spu_region_is_bootloader_region (NRF_SPU_Type * p_reg , uint8_t region_id )
112
103
{
113
104
bool is_bootloader = false;
114
105
115
106
#ifdef REGION_MCUBOOT_ADDRESS
116
- is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_MCUBOOT_ADDRESS , REGION_MCUBOOT_END_ADDRESS );
107
+ is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_MCUBOOT_ADDRESS , REGION_MCUBOOT_LIMIT );
117
108
#endif
118
109
#ifdef REGION_B0_ADDRESS
119
- is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_B0_ADDRESS , REGION_B0_END_ADDRESS );
110
+ is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_B0_ADDRESS , REGION_B0_LIMIT );
120
111
#endif
121
112
#ifdef REGION_S0_ADDRESS
122
- is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_S0_ADDRESS , REGION_S0_END_ADDRESS );
113
+ is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_S0_ADDRESS , REGION_S0_LIMIT );
123
114
#endif
124
115
#ifdef REGION_S1_ADDRESS
125
- is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_S1_ADDRESS , REGION_S1_END_ADDRESS );
116
+ is_bootloader = is_bootloader || spu_region_is_flash_region_in_address_range (region_id , REGION_S1_ADDRESS , REGION_S1_LIMIT );
126
117
#endif
127
118
128
119
return is_bootloader ;
129
120
}
130
121
131
- static bool spu_region_is_pcd_region (NRF_SPU_Type * p_reg , uint8_t region_id )
132
- {
133
- bool is_pcd = false;
134
-
135
- #ifdef PM_PCD_SRAM_ADDRESS
136
- is_pcd = is_pcd || spu_region_is_sram_region_in_address_range (region_id , PM_PCD_SRAM_ADDRESS , PM_PCD_SRAM_END_ADDRESS );
137
- #endif
138
-
139
- return is_pcd ;
140
- }
141
-
142
122
void spu_regions_reset_unlocked_secure (void )
143
123
{
144
124
for (size_t i = 0 ; i < NUM_FLASH_SECURE_ATTRIBUTION_REGIONS ; i ++ ) {
@@ -153,14 +133,12 @@ void spu_regions_reset_unlocked_secure(void)
153
133
}
154
134
155
135
for (size_t i = 0 ; i < NUM_SRAM_SECURE_ATTRIBUTION_REGIONS ; i ++ ) {
156
- if (!spu_region_is_pcd_region (NRF_SPU , i )) {
157
- nrf_spu_ramregion_set (NRF_SPU , i ,
158
- SPU_SECURE_ATTR_SECURE ,
159
- NRF_SPU_MEM_PERM_READ
160
- | NRF_SPU_MEM_PERM_WRITE
161
- | NRF_SPU_MEM_PERM_EXECUTE ,
162
- SPU_LOCK_CONF_UNLOCKED );
163
- }
136
+ nrf_spu_ramregion_set (NRF_SPU , i ,
137
+ SPU_SECURE_ATTR_SECURE ,
138
+ NRF_SPU_MEM_PERM_READ
139
+ | NRF_SPU_MEM_PERM_WRITE
140
+ | NRF_SPU_MEM_PERM_EXECUTE ,
141
+ SPU_LOCK_CONF_UNLOCKED );
164
142
}
165
143
}
166
144
0 commit comments