diff --git a/components/esp_common/CMakeLists.txt b/components/esp_common/CMakeLists.txt index ba77a6b87f..f1234a5d00 100644 --- a/components/esp_common/CMakeLists.txt +++ b/components/esp_common/CMakeLists.txt @@ -2,13 +2,11 @@ idf_build_get_property(target IDF_TARGET) if(${target} STREQUAL "linux") set(ldfragments) - set(srcs "src/esp_err_check_linux.c") else() set(ldfragments common.lf soc.lf) - set(srcs) endif() -list(APPEND srcs "src/esp_err_to_name.c") +set(srcs "src/esp_err_to_name.c") # Note: esp_ipc, esp_pm added as a public requirement to keep compatibility as to be located here. idf_component_register(SRCS "${srcs}" diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index eac1a98ced..d2f97850ec 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -3,10 +3,12 @@ idf_build_get_property(target IDF_TARGET) # On Linux, we only support a few features, hence this simple component registration if(${target} STREQUAL "linux") idf_component_register(SRCS "esp_system.c" + "esp_err.c" "port/soc/linux/reset_reason.c" "port/soc/linux/system_internal.c" "port/esp_system_linux.c" - INCLUDE_DIRS "include") + INCLUDE_DIRS "include" + PRIV_REQUIRES spi_flash) return() endif() diff --git a/components/esp_system/test_apps/linux_apis/main/esp_system_test.c b/components/esp_system/test_apps/linux_apis/main/esp_system_test.c index 4e6755a02c..7e5c912be7 100644 --- a/components/esp_system/test_apps/linux_apis/main/esp_system_test.c +++ b/components/esp_system/test_apps/linux_apis/main/esp_system_test.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -108,6 +108,27 @@ TEST_CASE("heap_size_stubs", "[esp_system]") TEST_ASSERT_EQUAL(UINT32_MAX, esp_get_minimum_free_heap_size()); } +esp_err_t esp_ok_func(void) +{ + return ESP_OK; +} + +esp_err_t esp_fail_func(void) +{ + return ESP_FAIL; +} + +TEST_CASE("ESP_ERROR_CHECK_WITHOUT_ABORT", "[esp_system]") +{ + ESP_ERROR_CHECK_WITHOUT_ABORT(esp_ok_func()); + ESP_ERROR_CHECK_WITHOUT_ABORT(esp_fail_func()); +} + +TEST_CASE("ESP_ERROR_CHECK", "[esp_system]") +{ + ESP_ERROR_CHECK(esp_ok_func()); +} + void app_main(void) { printf("Running esp_system host test app"); diff --git a/components/nvs_flash/test_nvs_host/Makefile b/components/nvs_flash/test_nvs_host/Makefile index 044a39e72a..ed1cb6ec2a 100644 --- a/components/nvs_flash/test_nvs_host/Makefile +++ b/components/nvs_flash/test_nvs_host/Makefile @@ -26,7 +26,7 @@ SOURCE_FILES = \ test_partition_manager.cpp \ main.cpp -SOURCE_FILES_C = ../../esp_rom/linux/esp_rom_crc.c ../../esp_common/src/esp_err_check_linux.c +SOURCE_FILES_C = ../../esp_rom/linux/esp_rom_crc.c esp_err_check_mock.c ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) COMPILER := clang diff --git a/components/esp_common/src/esp_err_check_linux.c b/components/nvs_flash/test_nvs_host/esp_err_check_mock.c similarity index 100% rename from components/esp_common/src/esp_err_check_linux.c rename to components/nvs_flash/test_nvs_host/esp_err_check_mock.c diff --git a/components/spi_flash/CMakeLists.txt b/components/spi_flash/CMakeLists.txt index af29e02de5..147f01294f 100644 --- a/components/spi_flash/CMakeLists.txt +++ b/components/spi_flash/CMakeLists.txt @@ -1,6 +1,7 @@ idf_build_get_property(target IDF_TARGET) if(${target} STREQUAL "linux") idf_component_register(SRCS "linux/spi_flash_linux.c" + "linux/cache_utils.c" INCLUDE_DIRS include PRIV_INCLUDE_DIRS include/spi_flash) return() diff --git a/components/spi_flash/linux/cache_utils.c b/components/spi_flash/linux/cache_utils.c new file mode 100644 index 0000000000..956b497bb3 --- /dev/null +++ b/components/spi_flash/linux/cache_utils.c @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +bool spi_flash_cache_enabled(void) +{ + return true; +}