Skip to content

Commit

Permalink
bugfix: soc: esp32: disable interrupts in flash operation
Browse files Browse the repository at this point in the history
When interrupts are placed in flash, it needs to be disabled
when flash operations are called. This is not happening in current
v3.7.0 release, causing system to crash whenever flash operations
and interrupts happens simultaneously.

Fixes #77952

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
  • Loading branch information
sylvioalves committed Sep 7, 2024
1 parent 36940db commit 5cae700
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions soc/espressif/esp32/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <xtensa/corebits.h>
#include <esp_private/spi_flash_os.h>
#include <esp_private/esp_mmu_map_private.h>
#include <esp_flash_internal.h>
#if CONFIG_ESP_SPIRAM
#include <esp_psram.h>
#include <esp_private/esp_psram_extram.h>
Expand Down Expand Up @@ -149,6 +150,7 @@ void IRAM_ATTR __esp_platform_start(void)
#ifdef CONFIG_SOC_FLASH_ESP32
esp_mspi_pin_init();
spi_flash_init_chip_state();
esp_flash_app_init();
#endif

#if CONFIG_ESP_SPIRAM
Expand All @@ -174,15 +176,6 @@ void IRAM_ATTR __esp_platform_start(void)
(&_ext_ram_bss_end - &_ext_ram_bss_start) * sizeof(_ext_ram_bss_start));
#endif /* CONFIG_ESP_SPIRAM */

/* Scheduler is not started at this point. Hence, guard functions
* must be initialized after esp_spiram_init_cache which internally
* uses guard functions. Setting guard functions before SPIRAM
* cache initialization will result in a crash.
*/
#if CONFIG_SOC_FLASH_ESP32 || CONFIG_ESP_SPIRAM
spi_flash_guard_set(&g_flash_guard_default_ops);
#endif

#endif /* !CONFIG_MCUBOOT */

esp_intr_initialize();
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ manifest:
groups:
- hal
- name: hal_espressif
revision: 87e7902d7184a8280b4d13bce79801a723f4ddd8
revision: pull/333/head
path: modules/hal/espressif
west-commands: west/west-commands.yml
groups:
Expand Down

0 comments on commit 5cae700

Please sign in to comment.