mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'fix/mmap_cache_flash_wr' into 'master'
fix(mmap): fixed mmap read data wrong when flash being erased/written and cache not disabled Closes IDFGH-14084 See merge request espressif/esp-idf!29804
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -27,6 +27,12 @@ extern "C" {
|
||||
*/
|
||||
esp_err_t esp_flash_init_default_chip(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize main flash
|
||||
* @param chip Pointer to main SPI flash(SPI1 CS0) chip to use..
|
||||
*/
|
||||
esp_err_t esp_flash_init_main(esp_flash_t *chip);
|
||||
|
||||
/**
|
||||
* Enable OS-level SPI flash protections in IDF
|
||||
*
|
||||
@@ -76,7 +82,7 @@ esp_err_t esp_flash_deinit_os_functions(esp_flash_t* chip, spi_bus_lock_dev_hand
|
||||
*
|
||||
* @return esp_err_t always ESP_OK.
|
||||
*/
|
||||
esp_err_t esp_flash_init_main_bus_lock(void);
|
||||
esp_err_t esp_flash_app_init_os_functions(void);
|
||||
|
||||
/**
|
||||
* Initialize OS-level functions for the main flash chip.
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_rom_caps.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//executables are placed on flash
|
||||
#define MMAP_EXECUTABLES_FROM_FLASH (!((CONFIG_SPIRAM_FETCH_INSTRUCTIONS && CONFIG_SPIRAM_RODATA) || CONFIG_APP_BUILD_TYPE_RAM))
|
||||
#define MMAP_ROM_IMPL_ENABLED (CONFIG_SPI_FLASH_ROM_IMPL && ESP_ROM_HAS_SPI_FLASH_MMAP)
|
||||
|
||||
#if !CONFIG_IDF_TARGET_ESP32
|
||||
//No mmap lock for ESP32, since it's useless to block while can't read from flash with SPI0 (cache) and SPI1 (driver) at the same time.
|
||||
|
||||
/**
|
||||
* Initialize the internal lock earlier to bypass the memory leak check.
|
||||
*/
|
||||
esp_err_t flash_mmap_lock_init(void);
|
||||
|
||||
/**
|
||||
* Freeze the mmap table
|
||||
*/
|
||||
void flash_mmap_lock_freeze(void);
|
||||
|
||||
/**
|
||||
* Unfreeze the mmap table
|
||||
*/
|
||||
void flash_mmap_lock_unfreeze(void);
|
||||
|
||||
/**
|
||||
* Return whether there is remaining mmap regions, must be called between flash_mmap_lock_freeze() and flash_mmap_lock_unfreeze().
|
||||
*/
|
||||
bool flash_mmap_remain(void);
|
||||
|
||||
#endif //!CONFIG_IDF_TARGET_ESP32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -78,12 +78,6 @@ uint8_t esp_mspi_get_io(esp_mspi_io_t io);
|
||||
*/
|
||||
void spi_flash_set_rom_required_regs(void);
|
||||
|
||||
/**
|
||||
* @brief Initialize main flash
|
||||
* @param chip Pointer to main SPI flash(SPI1 CS0) chip to use..
|
||||
*/
|
||||
esp_err_t esp_flash_init_main(esp_flash_t *chip);
|
||||
|
||||
/**
|
||||
* @brief Should be only used by SPI1 Flash driver to know the necessary timing registers
|
||||
* @param out_timing_config Pointer to timing_tuning parameters.
|
||||
|
||||
Reference in New Issue
Block a user