mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'feat/flash_32bit_support_p4_v5.3' into 'release/v5.3'
feature(spi_flash): Add 32bit address support for esp32p4 eco1 (backport v5.3) See merge request espressif/esp-idf!31262
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "esp_spi_flash_counters.h"
|
||||
#include "esp_rom_spiflash.h"
|
||||
#include "bootloader_flash.h"
|
||||
#include "esp_check.h"
|
||||
|
||||
__attribute__((unused)) static const char TAG[] = "spi_flash";
|
||||
|
||||
@@ -406,6 +407,11 @@ esp_err_t esp_flash_init_default_chip(void)
|
||||
if (default_chip.size > legacy_chip->chip_size) {
|
||||
ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, legacy_chip->chip_size/1024);
|
||||
}
|
||||
#if !CONFIG_IDF_TARGET_ESP32P4 || !CONFIG_APP_BUILD_TYPE_RAM // IDF-10019
|
||||
if (legacy_chip->chip_size > 16 * 1024 * 1024) {
|
||||
ESP_RETURN_ON_ERROR_ISR(esp_mspi_32bit_address_flash_feature_check(), TAG, "32bit address feature check failed");
|
||||
}
|
||||
#endif // !CONFIG_IDF_TARGET_ESP32P4 || !CONFIG_APP_BUILD_TYPE_RAM
|
||||
// Set chip->size equal to ROM flash size(also equal to the size in binary image header), which means the available size that can be used
|
||||
default_chip.size = legacy_chip->chip_size;
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
#include "bootloader_flash_config.h"
|
||||
#include "esp_compiler.h"
|
||||
#include "esp_rom_efuse.h"
|
||||
#include "soc/chip_revision.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
#if CONFIG_SPIRAM
|
||||
#include "esp_private/esp_psram_io.h"
|
||||
#endif
|
||||
@@ -288,3 +290,19 @@ uint8_t esp_mspi_get_io(esp_mspi_io_t io)
|
||||
return s_mspi_io_num_default[io];
|
||||
#endif // SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE
|
||||
}
|
||||
|
||||
#if !CONFIG_IDF_TARGET_ESP32P4 || !CONFIG_APP_BUILD_TYPE_RAM // IDF-10019
|
||||
esp_err_t IRAM_ATTR esp_mspi_32bit_address_flash_feature_check(void)
|
||||
{
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
// IDF-10019
|
||||
unsigned chip_version = efuse_hal_chip_revision();
|
||||
if (unlikely(!ESP_CHIP_REV_ABOVE(chip_version, 1))) {
|
||||
ESP_EARLY_LOGE(TAG, "32bit address (flash over 16MB) has high risk on ESP32P4 ECO0");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // !CONFIG_IDF_TARGET_ESP32P4 || !CONFIG_APP_BUILD_TYPE_RAM
|
||||
|
||||
@@ -119,6 +119,13 @@ void spi_flash_set_erasing_flag(bool status);
|
||||
*/
|
||||
bool spi_flash_brownout_need_reset(void);
|
||||
|
||||
/**
|
||||
* @brief Check whether esp-chip supports 32bit address properly
|
||||
*
|
||||
* @return ESP_OK for supported, ESP_ERR_NOT_SUPPORTED for not supported
|
||||
*/
|
||||
esp_err_t esp_mspi_32bit_address_flash_feature_check(void);
|
||||
|
||||
#if CONFIG_SPI_FLASH_HPM_ON
|
||||
/**
|
||||
* @brief Enable SPI flash high performance mode.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3 |
|
||||
| ----------------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S3 |
|
||||
| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
||||
@@ -75,7 +75,11 @@ static bool IRAM_ATTR gptimer_alarm_suspend_cb(gptimer_handle_t timer, const gpt
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
Cache_Invalidate_DCache_All();
|
||||
#endif
|
||||
#if CONFIG_IDF_TARGET_ESP32P4
|
||||
Cache_Invalidate_All(CACHE_MAP_L2_CACHE);
|
||||
#else
|
||||
Cache_Invalidate_ICache_All();
|
||||
#endif
|
||||
s_flash_func_t1 = esp_cpu_get_cycle_count();
|
||||
func_in_flash();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user