bootloader: add xmc spi_flash startup flow to improve reliability

This commit is contained in:
Michael (XIAO Xufeng)
2021-08-01 14:23:36 +08:00
parent ce9e615679
commit e00f6cbde9
10 changed files with 249 additions and 30 deletions

View File

@@ -15,6 +15,8 @@
#include "esp_rom_sys.h"
#include "esp_timer.h"
#include "bootloader_flash.h" //for bootloader_flash_xmc_startup
#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/spi_flash.h"
@@ -419,3 +421,21 @@ TEST_CASE("rom unlock will not erase QE bit", "[spi_flash]")
TEST_ASSERT(status & 0x40);
}
#endif
static IRAM_ATTR NOINLINE_ATTR void test_xmc_startup(void)
{
extern void spi_flash_disable_interrupts_caches_and_other_cpu(void);
extern void spi_flash_enable_interrupts_caches_and_other_cpu(void);
esp_err_t ret = ESP_OK;
spi_flash_disable_interrupts_caches_and_other_cpu();
ret = bootloader_flash_xmc_startup();
spi_flash_enable_interrupts_caches_and_other_cpu();
TEST_ASSERT_EQUAL(ESP_OK, ret);
}
TEST_CASE("bootloader_flash_xmc_startup can be called when cache disabled", "[spi_flash]")
{
test_xmc_startup();
}