Merge branch 'feat/mmu_support_h21' into 'master'

mmu: supported esp_mmu_map and flash_mmap drivers on esp32h21

Closes IDF-11540

See merge request espressif/esp-idf!39038
This commit is contained in:
Armando (Dou Yiwen)
2025-05-14 11:40:59 +08:00
4 changed files with 27 additions and 12 deletions

View File

@@ -14,8 +14,6 @@
#include "hal/mmu_types.h" #include "hal/mmu_types.h"
#include "hal/efuse_ll.h" #include "hal/efuse_ll.h"
//TODO: [ESP32H21] IDF-11540, inherit from h2
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@@ -255,6 +255,14 @@ config SOC_CPU_PMP_REGION_GRANULARITY
int int
default 4 default 4
config SOC_MMU_PAGE_SIZE_CONFIGURABLE
bool
default y
config SOC_MMU_PAGE_SIZE_8KB_SUPPORTED
bool
default y
config SOC_MMU_PERIPH_NUM config SOC_MMU_PERIPH_NUM
int int
default 1 default 1

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -75,25 +75,34 @@ extern "C" {
#if (SOC_MMU_PAGE_SIZE == 0x10000) #if (SOC_MMU_PAGE_SIZE == 0x10000)
/** /**
* - 64KB MMU page size: the last 0xFFFF, which is the offset * - 64KB MMU page size: the last 0xFFFF, which is the offset
* - 128 MMU entries, needs 0x7F to hold it. * - 256 MMU entries, needs 0xFF to hold it.
*
* Therefore, 0xFF,FFFF
*/
#define SOC_MMU_LINEAR_ADDR_MASK 0xFFFFFF
#elif (SOC_MMU_PAGE_SIZE == 0x8000)
/**
* - 32KB MMU page size: the last 0x7FFF, which is the offset
* - 256 MMU entries, needs 0xFF to hold it.
* *
* Therefore, 0x7F,FFFF * Therefore, 0x7F,FFFF
*/ */
#define SOC_MMU_LINEAR_ADDR_MASK 0x7FFFFF #define SOC_MMU_LINEAR_ADDR_MASK 0x7FFFFF
#elif (SOC_MMU_PAGE_SIZE == 0x8000) #elif (SOC_MMU_PAGE_SIZE == 0x4000)
/** /**
* - 32KB MMU page size: the last 0x7FFF, which is the offset * - 16KB MMU page size: the last 0x3FFF, which is the offset
* - 128 MMU entries, needs 0x7F to hold it. * - 256 MMU entries, needs 0xFF to hold it.
* *
* Therefore, 0x3F,FFFF * Therefore, 0x3F,FFFF
*/ */
#define SOC_MMU_LINEAR_ADDR_MASK 0x3FFFFF #define SOC_MMU_LINEAR_ADDR_MASK 0x3FFFFF
#elif (SOC_MMU_PAGE_SIZE == 0x4000) #elif (SOC_MMU_PAGE_SIZE == 0x2000)
/** /**
* - 16KB MMU page size: the last 0x3FFF, which is the offset * - 8KB MMU page size: the last 0x1FFF, which is the offset
* - 128 MMU entries, needs 0x7F to hold it. * - 256 MMU entries, needs 0xFF to hold it.
* *
* Therefore, 0x1F,FFFF * Therefore, 0x1F,FFFF
*/ */

View File

@@ -161,8 +161,8 @@
#define SOC_CPU_PMP_REGION_GRANULARITY 4 #define SOC_CPU_PMP_REGION_GRANULARITY 4
/*-------------------------- MMU CAPS ----------------------------------------*/ /*-------------------------- MMU CAPS ----------------------------------------*/
// #define SOC_MMU_PAGE_SIZE_CONFIGURABLE (1) #define SOC_MMU_PAGE_SIZE_CONFIGURABLE (1)
// #define SOC_MMU_PAGE_SIZE_8KB_SUPPORTED (1) #define SOC_MMU_PAGE_SIZE_8KB_SUPPORTED (1)
#define SOC_MMU_PERIPH_NUM (1U) #define SOC_MMU_PERIPH_NUM (1U)
#define SOC_MMU_LINEAR_ADDRESS_REGION_NUM (1U) #define SOC_MMU_LINEAR_ADDRESS_REGION_NUM (1U)
#define SOC_MMU_DI_VADDR_SHARED (1) /*!< D/I vaddr are shared */ #define SOC_MMU_DI_VADDR_SHARED (1) /*!< D/I vaddr are shared */