Skip to content

Commit

Permalink
Merge branch 'feature/mmu_driver' into 'master'
Browse files Browse the repository at this point in the history
esp_mm: new virtual memory mapping driver via mmu

Closes IDF-5847, IDF-6076, IDF-5023, IDF-5339, and IDFGH-8961

See merge request espressif/esp-idf!20540
  • Loading branch information
Icarus113 committed Feb 7, 2023
2 parents 86797f0 + 98892a3 commit 1c69929
Show file tree
Hide file tree
Showing 108 changed files with 3,838 additions and 1,180 deletions.
1 change: 1 addition & 0 deletions .gitlab/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -91,6 +91,7 @@
/components/esp_hw_support/ @esp-idf-codeowners/system @esp-idf-codeowners/peripherals
/components/esp_lcd/ @esp-idf-codeowners/peripherals
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
/components/esp_mm/ @esp-idf-codeowners/peripherals
/components/esp_netif/ @esp-idf-codeowners/network
/components/esp_netif_stack/ @esp-idf-codeowners/network
/components/esp_partition/ @esp-idf-codeowners/storage
Expand Down
Expand Up @@ -139,12 +139,8 @@ static const char *TAG = "bootloader_flash";
63th block for bootloader_flash_read
*/
#define MMU_BLOCK0_VADDR SOC_DROM_LOW
#ifdef SOC_MMU_PAGE_SIZE_CONFIGURABLE
#define MMAP_MMU_SIZE (DRAM0_CACHE_ADDRESS_HIGH(SPI_FLASH_MMU_PAGE_SIZE) - DRAM0_CACHE_ADDRESS_LOW - SPI_FLASH_MMU_PAGE_SIZE) // This mmu size means that the mmu size to be mapped
#else
#define MMAP_MMU_SIZE (DRAM0_CACHE_ADDRESS_HIGH - DRAM0_CACHE_ADDRESS_LOW - SPI_FLASH_MMU_PAGE_SIZE) // This mmu size means that the mmu size to be mapped
#endif
#define MMU_BLOCK63_VADDR (MMU_BLOCK0_VADDR + MMAP_MMU_SIZE)
#define MMAP_MMU_SIZE (DRAM0_CACHE_ADDRESS_HIGH - DRAM0_CACHE_ADDRESS_LOW) // This mmu size means that the mmu size to be mapped
#define MMU_BLOCK63_VADDR (MMU_BLOCK0_VADDR + MMAP_MMU_SIZE - SPI_FLASH_MMU_PAGE_SIZE)
#define FLASH_READ_VADDR MMU_BLOCK63_VADDR
#endif

Expand Down
4 changes: 2 additions & 2 deletions components/driver/test_apps/rmt/main/test_rmt_tx.c
Expand Up @@ -466,11 +466,11 @@ static void test_rmt_multi_channels_trans(size_t channel0_mem_block_symbols, siz
#define TEST_RMT_CHANS 2
#define TEST_LED_NUM 24
#define TEST_STOP_TIME_NO_SYNCHRO_DELTA 150
#if CONFIG_IDF_TARGET_ESP32C6
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
#define TEST_STOP_TIME_SYNCHRO_DELTA 400
#else
#define TEST_STOP_TIME_SYNCHRO_DELTA 10
#endif // CONFIG_IDF_TARGET_ESP32C6
#endif // #if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
rmt_tx_channel_config_t tx_channel_cfg = {
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 10000000, // 10MHz, 1 tick = 0.1us (led strip needs a high resolution)
Expand Down
4 changes: 2 additions & 2 deletions components/driver/test_apps/spi/master/main/test_app_main.c
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -9,7 +9,7 @@
#include "esp_heap_caps.h"

// iterator to load partition tables in `test spi bus lock, with flash` will lead memory not free
#define TEST_MEMORY_LEAK_THRESHOLD (250)
#define TEST_MEMORY_LEAK_THRESHOLD (350)

static size_t before_free_8bit;
static size_t before_free_32bit;
Expand Down
24 changes: 24 additions & 0 deletions components/esp_mm/CMakeLists.txt
@@ -0,0 +1,24 @@
idf_build_get_property(target IDF_TARGET)

set(includes "include")

# Note: requires spi_flash for cache_utils, will be refactored
set(priv_requires heap spi_flash)

set(srcs)

if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
set(srcs "esp_mmu_map.c"
"port/${target}/ext_mem_layout.c")
endif()

idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes}
PRIV_REQUIRES ${priv_requires})

if(NOT BOOTLOADER_BUILD)
if(CONFIG_SPIRAM)
# Use esp_psram for `esp_psram_extram_writeback_cache()` on ESP32
idf_component_optional_requires(PRIVATE esp_psram)
endif()
endif()
8 changes: 8 additions & 0 deletions components/esp_mm/Kconfig
@@ -0,0 +1,8 @@
menu "ESP Memory Management"

# Add MMU setting menu here
# Add Cache setting menu here

orsource "./Kconfig.mmap"

endmenu # ESP Memory Management
3 changes: 3 additions & 0 deletions components/esp_mm/Kconfig.mmap
@@ -0,0 +1,3 @@
menu "MMAP Configuration"

endmenu

0 comments on commit 1c69929

Please sign in to comment.