From 43561a40d296531eb07dee5c3fe50bcdc8837982 Mon Sep 17 00:00:00 2001 From: chenjianqiang Date: Thu, 13 Jun 2019 17:16:22 +0800 Subject: [PATCH] bugfix(psram): make sure the psram_io struct is initialized and make unknown psram package version more obvious --- components/esp32/Kconfig | 2 +- components/esp32/spiram_psram.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 3d0a96d4f..8e1d0c302 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -300,7 +300,7 @@ menu "ESP32-specific" config SPIRAM_SPIWP_SD3_PIN int "SPI PSRAM WP(SD3) Pin when customising pins via eFuse (read help)" - depends on ESPTOOLPY_FLASHMODE_DIO || ESPTOOLPY_FLASHMODE_DOUT + depends on FLASHMODE_DIO || FLASHMODE_DOUT range 0 33 default 7 help diff --git a/components/esp32/spiram_psram.c b/components/esp32/spiram_psram.c index 20773546c..1b3c0e7f9 100644 --- a/components/esp32/spiram_psram.c +++ b/components/esp32/spiram_psram.c @@ -616,7 +616,7 @@ psram_size_t psram_get_size() */ esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vaddrmode) //psram init { - psram_io_t psram_io; + psram_io_t psram_io = {0}; uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); uint32_t pkg_ver = chip_ver & 0x7; if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) { @@ -642,6 +642,9 @@ esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vad ESP_EARLY_LOGI(TAG, "This chip is ESP32-D0WD"); psram_io.psram_clk_io = D0WD_PSRAM_CLK_IO; psram_io.psram_cs_io = D0WD_PSRAM_CS_IO; + } else { + ESP_EARLY_LOGE(TAG, "Not a valid or known package id: %d", pkg_ver); + abort(); } const uint32_t spiconfig = ets_efuse_get_spiconfig();