change(esp_psram): Consider all PSRAM regions in PMP protection

This commit is contained in:
harshal.patil
2026-05-19 21:28:36 +05:30
committed by Mahavir Jain
parent 10d2d9cb9f
commit d1d45ff256

View File

@@ -778,7 +778,11 @@ static size_t esp_psram_get_effective_mapped_size(void)
}
if (s_psram_ctx.is_initialised) {
return s_psram_ctx.mapped_regions[PSRAM_MEM_8BIT_ALIGNED].size + s_psram_ctx.mapped_regions[PSRAM_MEM_32BIT_ALIGNED].size;
size_t mapped = 0;
for (int i = 0; i < PSRAM_MEM_TYPE_NUM; i++) {
mapped += s_psram_ctx.mapped_regions[i].size;
}
return mapped;
} else {
uint32_t psram_available_size = 0;
esp_err_t ret = esp_psram_impl_get_available_size(&psram_available_size);
@@ -817,7 +821,11 @@ size_t esp_psram_get_heap_size_to_protect(void)
}
if (s_psram_ctx.is_initialised) {
return s_psram_ctx.regions_to_heap[PSRAM_MEM_8BIT_ALIGNED].size + s_psram_ctx.regions_to_heap[PSRAM_MEM_32BIT_ALIGNED].size;
size_t heap = 0;
for (int i = 0; i < PSRAM_MEM_TYPE_NUM; i++) {
heap += s_psram_ctx.regions_to_heap[i].size;
}
return heap;
} else {
size_t effective_mapped_size = esp_psram_get_effective_mapped_size();
if (effective_mapped_size == 0) {