diff --git a/components/spi_flash/Kconfig b/components/spi_flash/Kconfig index 4ca5742be6..1853d0cc6c 100644 --- a/components/spi_flash/Kconfig +++ b/components/spi_flash/Kconfig @@ -66,6 +66,10 @@ menu "SPI Flash driver" If making this as "y" in your project, you will increase free IRAM. But you may miss out on some flash features and support for new flash chips. + Currently the ROM cannot support the following features: + + - SPI_FLASH_AUTO_SUSPEND (C3, S3) + choice SPI_FLASH_DANGEROUS_WRITE bool "Writing to dangerous flash regions" default SPI_FLASH_DANGEROUS_WRITE_ABORTS @@ -145,14 +149,14 @@ menu "SPI Flash driver" config SPI_FLASH_AUTO_SUSPEND bool "Auto suspend long erase/write operations" - default n + default n if !IDF_TARGET_ESP32C3 + default y if IDF_TARGET_ESP32C3 depends on IDF_TARGET_ESP32C3 && !SPI_FLASH_USE_LEGACY_IMPL && !SPI_FLASH_ROM_IMPL help - This is made default n, because this needs bootloader support. - This feature needs special bootloader support. - If you want to OTA to a image with this feature - (e.g. turn on this config option for OTA image), please make - sure the bootloader has the support for it. (above IDF v4.3) + This option is default n before ESP32-C3, because it needs bootloader support. + + CAUTION: If you want to OTA to an app with this feature turned on, please make + sure the bootloader has the support for it. (later than IDF v4.3) config SPI_FLASH_WRITE_CHUNK_SIZE int "Flash write chunk size" diff --git a/components/spi_flash/test/test_esp_flash.c b/components/spi_flash/test/test_esp_flash.c index 1360ea83bb..0402832da9 100644 --- a/components/spi_flash/test/test_esp_flash.c +++ b/components/spi_flash/test/test_esp_flash.c @@ -638,10 +638,12 @@ void esp_test_for_suspend(void) printf("aaaaa bbbbb zzzzz fffff qqqqq ccccc\n"); } +static volatile bool task_erase_end, task_suspend_end = false; void task_erase_large_region(void *arg) { esp_partition_t *part = (esp_partition_t *)arg; test_erase_large_region(part); + task_erase_end = true; vTaskDelete(NULL); } @@ -650,12 +652,7 @@ void task_request_suspend(void *arg) vTaskDelay(2); ESP_LOGI(TAG, "flash go into suspend"); esp_test_for_suspend(); - vTaskDelete(NULL); -} - -void task_delay(void *arg) -{ - esp_rom_delay_us(2000000); + task_suspend_end = true; vTaskDelete(NULL); } @@ -663,7 +660,9 @@ static void test_flash_suspend_resume(const esp_partition_t* part) { xTaskCreatePinnedToCore(task_request_suspend, "suspend", 2048, (void *)"test_for_suspend", UNITY_FREERTOS_PRIORITY + 3, NULL, 0); xTaskCreatePinnedToCore(task_erase_large_region, "test", 2048, (void *)part, UNITY_FREERTOS_PRIORITY + 2, NULL, 0); - xTaskCreatePinnedToCore(task_delay, "task_delay", 1024, (void *)"task_delay", UNITY_FREERTOS_PRIORITY + 1, NULL, 0); + while (!task_erase_end || !task_suspend_end) { + } + vTaskDelay(200); } FLASH_TEST_CASE("SPI flash suspend and resume test", test_flash_suspend_resume);