Skip to content

Add temporary fix for mmu map and late init of psram #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions patches/mmu_map.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/components/esp_mm/esp_mmu_map.c b/components/esp_mm/esp_mmu_map.c
index b7d927f8fe..6a8c4635f0 100644
--- a/components/esp_mm/esp_mmu_map.c
+++ b/components/esp_mm/esp_mmu_map.c
@@ -315,6 +315,19 @@ esp_err_t esp_mmu_map_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps,
s_mmu_ctx.mem_regions[found_region_id].max_slot_size -= aligned_size;
ESP_EARLY_LOGV(TAG, "found laddr is 0x%x", laddr);

+ mem_block_t *mem_block = NULL;
+ mem_region_t *region = &s_mmu_ctx.mem_regions[found_region_id];
+ TAILQ_FOREACH(mem_block, &region->mem_block_head, entries) {
+ if (mem_block == TAILQ_FIRST(&region->mem_block_head) || mem_block == TAILQ_LAST(&region->mem_block_head, mem_block_head_)) {
+ TAILQ_REMOVE(&region->mem_block_head, mem_block, entries);
+ } else {
+ // probably the reservation of MMU region should be disallowed for this case - already some MMU mappings exist?
+ // assert/abort
+ ESP_EARLY_LOGE(TAG, "already some MMU mappings exist?");
+ abort();
+ }
+ }
+
uint32_t vaddr = 0;
if (caps & MMU_MEM_CAP_EXEC) {
vaddr = mmu_ll_laddr_to_vaddr(laddr, MMU_VADDR_INSTRUCTION);
1 change: 1 addition & 0 deletions tools/install-esp-idf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then
# Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source
cd $IDF_PATH
patch -p1 -N -i ../patches/esp32s2_i2c_ll_master_init.diff
patch -p1 -N -i ../patches/mmu_map.diff
cd -
fi

Expand Down