-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/fix_spi_flash_api_concurrency_issue_v5.1' into '…
…release/v5.1' spi_flash: fix concurrency issue when concurrently calling esp_flash apis (v5.1) See merge request espressif/esp-idf!24508
- Loading branch information
Showing
20 changed files
with
434 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
components/spi_flash/test_apps/components/test_flash_utils/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set(srcs "test_flash_utils.c") | ||
|
||
idf_component_register(SRCS ${srcs} | ||
INCLUDE_DIRS include | ||
REQUIRES esp_partition) |
27 changes: 27 additions & 0 deletions
27
components/spi_flash/test_apps/components/test_flash_utils/include/test_flash_utils.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <esp_types.h> | ||
#include "esp_partition.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
|
||
/** | ||
* Return the 'flash_test' custom data partition | ||
* defined in the custom partition table. | ||
* | ||
* @return partition handle | ||
*/ | ||
const esp_partition_t *get_test_flash_partition(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
17 changes: 17 additions & 0 deletions
17
components/spi_flash/test_apps/components/test_flash_utils/test_flash_utils.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <string.h> | ||
#include "test_flash_utils.h" | ||
|
||
const esp_partition_t *get_test_flash_partition(void) | ||
{ | ||
/* This finds "flash_test" partition defined in custom partitions.csv */ | ||
const esp_partition_t *result = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, | ||
ESP_PARTITION_SUBTYPE_ANY, "flash_test"); | ||
assert(result != NULL); /* means partition table set wrong */ | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
components/spi_flash/test_apps/esp_flash_stress/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This is the project CMakeLists.txt file for the test subproject | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/components/spi_flash/test_apps/components") | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
||
project(test_esp_flash_stress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | | ||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | |
8 changes: 8 additions & 0 deletions
8
components/spi_flash/test_apps/esp_flash_stress/main/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set(srcs "test_app_main.c" | ||
"test_esp_flash_stress.c") | ||
|
||
# In order for the cases defined by `TEST_CASE` to be linked into the final elf, | ||
# the component can be registered as WHOLE_ARCHIVE | ||
idf_component_register(SRCS ${srcs} | ||
PRIV_REQUIRES test_flash_utils spi_flash unity | ||
WHOLE_ARCHIVE) |
35 changes: 35 additions & 0 deletions
35
components/spi_flash/test_apps/esp_flash_stress/main/test_app_main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "unity.h" | ||
#include "unity_test_utils.h" | ||
#include "esp_heap_caps.h" | ||
|
||
// load partition table in tests will use memory | ||
#define TEST_MEMORY_LEAK_THRESHOLD (600) | ||
|
||
void setUp(void) | ||
{ | ||
unity_utils_record_free_mem(); | ||
} | ||
|
||
void tearDown(void) | ||
{ | ||
esp_reent_cleanup(); //clean up some of the newlib's lazy allocations | ||
unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD); | ||
} | ||
|
||
void app_main(void) | ||
{ | ||
printf(" ______ _____ _____ ______ _ _ _____ _ \n"); | ||
printf("| ____|/ ____| __ \\ | ____| | | | / ____| | \n"); | ||
printf("| |__ | (___ | |__) | | |__ | | __ _ ___| |__ | (___ | |_ _ __ ___ ___ ___ \n"); | ||
printf("| __| \\___ \\| ___/ | __| | |/ _` / __| '_ \\ \\___ \\| __| '__/ _ \\/ __/ __|\n"); | ||
printf("| |____ ____) | | | | | | (_| \\__ \\ | | | ____) | |_| | | __/\\__ \\__ \\\n"); | ||
printf("|______|_____/|_| |_| |_|\\__,_|___/_| |_| |_____/ \\__|_| \\___||___/___/\n"); | ||
|
||
unity_run_menu(); | ||
} |
Oops, something went wrong.