From c9bec434aaf4d08619c39574a267bfd825655096 Mon Sep 17 00:00:00 2001 From: KonstantinKondrashov Date: Wed, 15 Jun 2022 15:31:33 +0800 Subject: [PATCH] bootloader_efuse: Adds IRAM_ATTR for efuse API Fixes startup of app for case: bootloader with 40Mhz and app with 80Mhz (ESPTOOLPY_FLASHFREQ) Closes https://github.com/espressif/esp-idf/issues/9156 --- components/bootloader_support/src/bootloader_efuse_esp32.c | 5 +++-- components/bootloader_support/src/bootloader_efuse_esp32c3.c | 5 +++-- components/bootloader_support/src/bootloader_efuse_esp32h2.c | 5 +++-- components/bootloader_support/src/bootloader_efuse_esp32s2.c | 5 +++-- components/bootloader_support/src/bootloader_efuse_esp32s3.c | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/components/bootloader_support/src/bootloader_efuse_esp32.c b/components/bootloader_support/src/bootloader_efuse_esp32.c index 2a89e63ce4..629d4ff92c 100644 --- a/components/bootloader_support/src/bootloader_efuse_esp32.c +++ b/components/bootloader_support/src/bootloader_efuse_esp32.c @@ -8,8 +8,9 @@ #include "bootloader_clock.h" #include "soc/efuse_reg.h" #include "soc/syscon_reg.h" +#include "esp_attr.h" -uint8_t bootloader_common_get_chip_revision(void) +IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void) { uint8_t eco_bit0, eco_bit1, eco_bit2; eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15; @@ -42,7 +43,7 @@ uint8_t bootloader_common_get_chip_revision(void) return chip_ver; } -uint32_t bootloader_common_get_chip_ver_pkg(void) +IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void) { uint32_t pkg_version = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); uint32_t pkg_version_4bit = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG_4BIT); diff --git a/components/bootloader_support/src/bootloader_efuse_esp32c3.c b/components/bootloader_support/src/bootloader_efuse_esp32c3.c index aa59b5e60f..1cafda91b0 100644 --- a/components/bootloader_support/src/bootloader_efuse_esp32c3.c +++ b/components/bootloader_support/src/bootloader_efuse_esp32c3.c @@ -6,14 +6,15 @@ #include #include "soc/efuse_reg.h" +#include "esp_attr.h" -uint8_t bootloader_common_get_chip_revision(void) +IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void) { // should return the same value as esp_efuse_get_chip_ver() return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_WAFER_VERSION); } -uint32_t bootloader_common_get_chip_ver_pkg(void) +IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void) { // should return the same value as esp_efuse_get_pkg_ver() return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION); diff --git a/components/bootloader_support/src/bootloader_efuse_esp32h2.c b/components/bootloader_support/src/bootloader_efuse_esp32h2.c index aa59b5e60f..1cafda91b0 100644 --- a/components/bootloader_support/src/bootloader_efuse_esp32h2.c +++ b/components/bootloader_support/src/bootloader_efuse_esp32h2.c @@ -6,14 +6,15 @@ #include #include "soc/efuse_reg.h" +#include "esp_attr.h" -uint8_t bootloader_common_get_chip_revision(void) +IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void) { // should return the same value as esp_efuse_get_chip_ver() return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_WAFER_VERSION); } -uint32_t bootloader_common_get_chip_ver_pkg(void) +IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void) { // should return the same value as esp_efuse_get_pkg_ver() return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION); diff --git a/components/bootloader_support/src/bootloader_efuse_esp32s2.c b/components/bootloader_support/src/bootloader_efuse_esp32s2.c index 0ecabe7078..ec57413ada 100644 --- a/components/bootloader_support/src/bootloader_efuse_esp32s2.c +++ b/components/bootloader_support/src/bootloader_efuse_esp32s2.c @@ -8,14 +8,15 @@ #include "bootloader_clock.h" #include "bootloader_common.h" #include "soc/efuse_reg.h" +#include "esp_attr.h" -uint8_t bootloader_common_get_chip_revision(void) +IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void) { // should return the same value as esp_efuse_get_chip_ver() return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_WAFER_VERSION); } -uint32_t bootloader_common_get_chip_ver_pkg(void) +IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void) { // should return the same value as esp_efuse_get_pkg_ver() return REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_4_REG, EFUSE_PKG_VERSION); diff --git a/components/bootloader_support/src/bootloader_efuse_esp32s3.c b/components/bootloader_support/src/bootloader_efuse_esp32s3.c index 61d179f697..c1ded735e3 100644 --- a/components/bootloader_support/src/bootloader_efuse_esp32s3.c +++ b/components/bootloader_support/src/bootloader_efuse_esp32s3.c @@ -5,15 +5,16 @@ */ #include +#include "esp_attr.h" -uint8_t bootloader_common_get_chip_revision(void) +IRAM_ATTR uint8_t bootloader_common_get_chip_revision(void) { // should return the same value as esp_efuse_get_chip_ver() /* No other revisions for ESP32-S3 */ return 0; } -uint32_t bootloader_common_get_chip_ver_pkg(void) +IRAM_ATTR uint32_t bootloader_common_get_chip_ver_pkg(void) { // should return the same value as esp_efuse_get_pkg_ver() return 0;