From 2133ca95221e86505e8d29a43bf718fbc0a45e88 Mon Sep 17 00:00:00 2001 From: Armando Date: Fri, 16 Aug 2024 15:12:34 +0800 Subject: [PATCH] test(sd): added .cpp build test --- components/hal/include/hal/spi_hal.h | 2 +- .../system/cxx_build_test/main/CMakeLists.txt | 3 +- .../main/test_sdmmc_sdspi_init.cpp | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 tools/test_apps/system/cxx_build_test/main/test_sdmmc_sdspi_init.cpp diff --git a/components/hal/include/hal/spi_hal.h b/components/hal/include/hal/spi_hal.h index 605158ecc90c..553142682f47 100644 --- a/components/hal/include/hal/spi_hal.h +++ b/components/hal/include/hal/spi_hal.h @@ -129,7 +129,7 @@ typedef struct { #if SOC_SPI_AS_CS_SUPPORTED uint32_t as_cs : 1; ///< Whether to toggle the CS while the clock toggles, device specific #endif - uint32_t positive_cs : 1; ///< Whether the positive CS feature is abled, device specific + uint32_t positive_cs : 1; ///< Whether the positive CS feature is enabled, device specific };//boolean configurations } spi_hal_dev_config_t; diff --git a/tools/test_apps/system/cxx_build_test/main/CMakeLists.txt b/tools/test_apps/system/cxx_build_test/main/CMakeLists.txt index 59cbf3f832ab..072dc356681f 100644 --- a/tools/test_apps/system/cxx_build_test/main/CMakeLists.txt +++ b/tools/test_apps/system/cxx_build_test/main/CMakeLists.txt @@ -1,6 +1,7 @@ set(srcs cxx_build_test_main.cpp test_soc_reg_macros.cpp - test_cxx_standard.cpp) + test_cxx_standard.cpp + test_sdmmc_sdspi_init.cpp) if(CONFIG_SOC_I2C_SUPPORTED) list(APPEND srcs test_i2c_lcd.cpp) diff --git a/tools/test_apps/system/cxx_build_test/main/test_sdmmc_sdspi_init.cpp b/tools/test_apps/system/cxx_build_test/main/test_sdmmc_sdspi_init.cpp new file mode 100644 index 000000000000..d79daeb37954 --- /dev/null +++ b/tools/test_apps/system/cxx_build_test/main/test_sdmmc_sdspi_init.cpp @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "soc/soc_caps.h" + +#if SOC_SDMMC_HOST_SUPPORTED +#include "driver/sdmmc_host.h" +#endif + +#include "driver/sdspi_host.h" + + +/** + * Check that C-style designated initializers are valid in C++ file. + */ +static void test_initializers() __attribute__((unused)); + +static void test_initializers() +{ +#if SOC_SDMMC_HOST_SUPPORTED + sdmmc_host_t sdmmc_host = SDMMC_HOST_DEFAULT(); + (void) sdmmc_host; + sdmmc_slot_config_t sdmmc_slot = SDMMC_SLOT_CONFIG_DEFAULT(); + (void) sdmmc_slot; +#endif + sdmmc_host_t sdspi_host = SDSPI_HOST_DEFAULT(); + (void) sdspi_host; + sdspi_device_config_t sdspi_dev = SDSPI_DEVICE_CONFIG_DEFAULT(); + (void) sdspi_dev; +}