Skip to content

Commit 2c0962f

Browse files
committed
Merge branch 'feature/spi_flash_auto_suspend_default_on_c3' into 'master'
spi_flash: make the auto_suspend default y on C3 See merge request espressif/esp-idf!12233
2 parents b88ec36 + b1d3d0a commit 2c0962f

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

components/spi_flash/Kconfig

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ menu "SPI Flash driver"
6666
If making this as "y" in your project, you will increase free IRAM.
6767
But you may miss out on some flash features and support for new flash chips.
6868

69+
Currently the ROM cannot support the following features:
70+
71+
- SPI_FLASH_AUTO_SUSPEND (C3, S3)
72+
6973
choice SPI_FLASH_DANGEROUS_WRITE
7074
bool "Writing to dangerous flash regions"
7175
default SPI_FLASH_DANGEROUS_WRITE_ABORTS
@@ -145,14 +149,14 @@ menu "SPI Flash driver"
145149

146150
config SPI_FLASH_AUTO_SUSPEND
147151
bool "Auto suspend long erase/write operations"
148-
default n
152+
default n if !IDF_TARGET_ESP32C3
153+
default y if IDF_TARGET_ESP32C3
149154
depends on IDF_TARGET_ESP32C3 && !SPI_FLASH_USE_LEGACY_IMPL && !SPI_FLASH_ROM_IMPL
150155
help
151-
This is made default n, because this needs bootloader support.
152-
This feature needs special bootloader support.
153-
If you want to OTA to a image with this feature
154-
(e.g. turn on this config option for OTA image), please make
155-
sure the bootloader has the support for it. (above IDF v4.3)
156+
This option is default n before ESP32-C3, because it needs bootloader support.
157+
158+
CAUTION: If you want to OTA to an app with this feature turned on, please make
159+
sure the bootloader has the support for it. (later than IDF v4.3)
156160

157161
config SPI_FLASH_WRITE_CHUNK_SIZE
158162
int "Flash write chunk size"

components/spi_flash/test/test_esp_flash.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,12 @@ void esp_test_for_suspend(void)
638638
printf("aaaaa bbbbb zzzzz fffff qqqqq ccccc\n");
639639
}
640640

641+
static volatile bool task_erase_end, task_suspend_end = false;
641642
void task_erase_large_region(void *arg)
642643
{
643644
esp_partition_t *part = (esp_partition_t *)arg;
644645
test_erase_large_region(part);
646+
task_erase_end = true;
645647
vTaskDelete(NULL);
646648
}
647649

@@ -650,20 +652,17 @@ void task_request_suspend(void *arg)
650652
vTaskDelay(2);
651653
ESP_LOGI(TAG, "flash go into suspend");
652654
esp_test_for_suspend();
653-
vTaskDelete(NULL);
654-
}
655-
656-
void task_delay(void *arg)
657-
{
658-
esp_rom_delay_us(2000000);
655+
task_suspend_end = true;
659656
vTaskDelete(NULL);
660657
}
661658

662659
static void test_flash_suspend_resume(const esp_partition_t* part)
663660
{
664661
xTaskCreatePinnedToCore(task_request_suspend, "suspend", 2048, (void *)"test_for_suspend", UNITY_FREERTOS_PRIORITY + 3, NULL, 0);
665662
xTaskCreatePinnedToCore(task_erase_large_region, "test", 2048, (void *)part, UNITY_FREERTOS_PRIORITY + 2, NULL, 0);
666-
xTaskCreatePinnedToCore(task_delay, "task_delay", 1024, (void *)"task_delay", UNITY_FREERTOS_PRIORITY + 1, NULL, 0);
663+
while (!task_erase_end || !task_suspend_end) {
664+
}
665+
vTaskDelay(200);
667666
}
668667

669668
FLASH_TEST_CASE("SPI flash suspend and resume test", test_flash_suspend_resume);

0 commit comments

Comments
 (0)