From 334126315f36268cd4de9637bbfe7f6845f462a7 Mon Sep 17 00:00:00 2001 From: morris Date: Thu, 5 May 2022 11:39:13 +0800 Subject: [PATCH 1/7] esp32c2: level up from preview targets --- components/esp_hw_support/port/esp32c2/rtc_init.c | 2 +- components/esp_system/Kconfig | 2 +- components/esp_system/int_wdt.c | 5 ----- tools/idf_py_actions/constants.py | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/components/esp_hw_support/port/esp32c2/rtc_init.c b/components/esp_hw_support/port/esp32c2/rtc_init.c index 4535f0fe3b..37ca6a5742 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_init.c +++ b/components/esp_hw_support/port/esp32c2/rtc_init.c @@ -128,7 +128,7 @@ void rtc_vddsdio_set_config(rtc_vddsdio_config_t config) static void set_ocode_by_efuse(int calib_version) { // ESP32C2-TODO: IDF-4940 - abort(); + ESP_HW_LOGW(TAG, "set_ocode_by_efuse not supported yet"); } static void calibrate_ocode(void) diff --git a/components/esp_system/Kconfig b/components/esp_system/Kconfig index b37e4009ea..d717177546 100644 --- a/components/esp_system/Kconfig +++ b/components/esp_system/Kconfig @@ -366,7 +366,7 @@ menu "ESP System Settings" config ESP_INT_WDT bool "Interrupt watchdog" - default y + default y if !IDF_TARGET_ESP32C2 # add support in IDF-4114 help This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time, either because a task turned off interrupts and did not turn them on for a long time, or because an diff --git a/components/esp_system/int_wdt.c b/components/esp_system/int_wdt.c index 74a3942524..6f16f3b071 100644 --- a/components/esp_system/int_wdt.c +++ b/components/esp_system/int_wdt.c @@ -149,12 +149,7 @@ void esp_int_wdt_cpu_init(void) esp_register_freertos_tick_hook_for_cpu(tick_hook, cpu_hal_get_core_id()); ESP_INTR_DISABLE(WDT_INT_NUM); -#if SOC_TIMER_GROUPS > 1 esp_rom_route_intr_matrix(cpu_hal_get_core_id(), ETS_TG1_WDT_LEVEL_INTR_SOURCE, WDT_INT_NUM); -#else - // TODO: Clean up code for ESP32-C2, IDF-4114 - ESP_EARLY_LOGW("INT_WDT", "ESP32-C2 only has one timer group"); -#endif /* Set the type and priority to watch dog interrupts */ #if SOC_CPU_HAS_FLEXIBLE_INTC diff --git a/tools/idf_py_actions/constants.py b/tools/idf_py_actions/constants.py index 707f86946a..3f802a1c2b 100644 --- a/tools/idf_py_actions/constants.py +++ b/tools/idf_py_actions/constants.py @@ -25,5 +25,5 @@ if os.name != 'nt': URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf' -SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3'] -PREVIEW_TARGETS = ['linux', 'esp32h2', 'esp32c2'] +SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2'] +PREVIEW_TARGETS = ['linux', 'esp32h2'] From 24f5fecef052cf33058dd1f909e11fba9f8c1789 Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 6 May 2022 18:57:14 +0800 Subject: [PATCH 2/7] hal: use ROM implementation for systimer and wdt on esp32c2 --- components/driver/CMakeLists.txt | 4 +- .../esp_rom/esp32c2/Kconfig.soc_caps.in | 8 ++ components/esp_rom/esp32c2/esp_rom_caps.h | 4 +- .../esp_rom/esp32s3/Kconfig.soc_caps.in | 4 + components/esp_rom/esp32s3/esp_rom_caps.h | 1 + components/esp_system/Kconfig | 3 +- components/esp_system/int_wdt.c | 2 + components/hal/CMakeLists.txt | 79 +++++++++---------- components/hal/Kconfig | 22 ++---- components/hal/linker.lf | 6 +- docs/en/api-guides/performance/size.rst | 11 +++ ...g.ci copy.esp32c2_with_rom_impl_components | 5 ++ .../sdkconfig.ci.esp32c2_rom_impl_components | 5 -- ...fig.ci.esp32c2_without_rom_impl_components | 5 ++ 14 files changed, 88 insertions(+), 71 deletions(-) create mode 100644 tools/test_apps/system/build_test/sdkconfig.ci copy.esp32c2_with_rom_impl_components delete mode 100644 tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_rom_impl_components create mode 100644 tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_without_rom_impl_components diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index 22dce0b6b5..168619a024 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -88,7 +88,7 @@ if(${target} STREQUAL "esp32") "esp32/dac.c") endif() -if(IDF_TARGET STREQUAL "esp32s2") +if(${target} STREQUAL "esp32s2") list(APPEND srcs "dac_common.c" "touch_sensor_common.c" "esp32s2/touch_sensor.c" @@ -103,7 +103,7 @@ if(${target} STREQUAL "esp32s3") "esp32s3/touch_sensor.c") endif() -if(IDF_TARGET STREQUAL "esp32c3") +if(${target} STREQUAL "esp32c3") list(APPEND srcs "esp32c3/adc2_init_cal.c") endif() diff --git a/components/esp_rom/esp32c2/Kconfig.soc_caps.in b/components/esp_rom/esp32c2/Kconfig.soc_caps.in index 162e79190c..0eebf6d89a 100644 --- a/components/esp_rom/esp32c2/Kconfig.soc_caps.in +++ b/components/esp_rom/esp32c2/Kconfig.soc_caps.in @@ -26,3 +26,11 @@ config ESP_ROM_GET_CLK_FREQ config ESP_ROM_HAS_RVFPLIB bool default y + +config ESP_ROM_HAS_HAL_WDT + bool + default y + +config ESP_ROM_HAS_HAL_SYSTIMER + bool + default y diff --git a/components/esp_rom/esp32c2/esp_rom_caps.h b/components/esp_rom/esp32c2/esp_rom_caps.h index 9574825971..dfc376b77d 100644 --- a/components/esp_rom/esp32c2/esp_rom_caps.h +++ b/components/esp_rom/esp32c2/esp_rom_caps.h @@ -11,4 +11,6 @@ #define ESP_ROM_UART_CLK_IS_XTAL (1) // UART clock source is selected to XTAL in ROM #define ESP_ROM_HAS_RETARGETABLE_LOCKING (1) // ROM was built with retargetable locking #define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency` -#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib +#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib +#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver +#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver diff --git a/components/esp_rom/esp32s3/Kconfig.soc_caps.in b/components/esp_rom/esp32s3/Kconfig.soc_caps.in index 1b62cbaa28..b4e07adfd5 100644 --- a/components/esp_rom/esp32s3/Kconfig.soc_caps.in +++ b/components/esp_rom/esp32s3/Kconfig.soc_caps.in @@ -38,3 +38,7 @@ config ESP_ROM_HAS_ERASE_0_REGION_BUG config ESP_ROM_GET_CLK_FREQ bool default y + +config ESP_ROM_HAS_HAL_WDT + bool + default y diff --git a/components/esp_rom/esp32s3/esp_rom_caps.h b/components/esp_rom/esp32s3/esp_rom_caps.h index 9c8a4931cf..e5fe2017ff 100644 --- a/components/esp_rom/esp32s3/esp_rom_caps.h +++ b/components/esp_rom/esp32s3/esp_rom_caps.h @@ -15,3 +15,4 @@ #define ESP_ROM_USB_SERIAL_DEVICE_NUM (4) // The serial port ID (UART, USB, ...) of USB_SERIAL_JTAG in the ROM. #define ESP_ROM_HAS_ERASE_0_REGION_BUG (1) // ROM has esp_flash_erase_region(size=0) bug #define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency` +#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver diff --git a/components/esp_system/Kconfig b/components/esp_system/Kconfig index d717177546..f0a711161a 100644 --- a/components/esp_system/Kconfig +++ b/components/esp_system/Kconfig @@ -366,7 +366,8 @@ menu "ESP System Settings" config ESP_INT_WDT bool "Interrupt watchdog" - default y if !IDF_TARGET_ESP32C2 # add support in IDF-4114 + default n if IDF_TARGET_ESP32C2 # add support in IDF-4114 + default y help This watchdog timer can detect if the FreeRTOS tick interrupt has not been called for a certain time, either because a task turned off interrupts and did not turn them on for a long time, or because an diff --git a/components/esp_system/int_wdt.c b/components/esp_system/int_wdt.c index 6f16f3b071..4a47bcb60c 100644 --- a/components/esp_system/int_wdt.c +++ b/components/esp_system/int_wdt.c @@ -149,7 +149,9 @@ void esp_int_wdt_cpu_init(void) esp_register_freertos_tick_hook_for_cpu(tick_hook, cpu_hal_get_core_id()); ESP_INTR_DISABLE(WDT_INT_NUM); +#if SOC_TIMER_GROUPS > 1 esp_rom_route_intr_matrix(cpu_hal_get_core_id(), ETS_TG1_WDT_LEVEL_INTR_SOURCE, WDT_INT_NUM); +#endif /* Set the type and priority to watch dog interrupts */ #if SOC_CPU_HAS_FLEXIBLE_INTC diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index 903952646a..e87249d7fc 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -8,7 +8,7 @@ set(srcs "mpu_hal.c" set(includes "${target}/include" "include" "platform_port/include") -if(NOT CONFIG_HAL_WDT_ROM_IMPL) +if(NOT CONFIG_HAL_WDT_USE_ROM_IMPL) list(APPEND srcs "wdt_hal_iram.c") endif() @@ -16,7 +16,7 @@ if(NOT ${target} STREQUAL "esp32") list(APPEND srcs "cache_hal.c") endif() -if(target STREQUAL "esp32h2") +if(${target} STREQUAL "esp32h2") if(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1) list(APPEND includes "${target}/include/rev1") elseif(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2) @@ -49,50 +49,64 @@ if(NOT BOOTLOADER_BUILD) "adc_hal_common.c" "adc_hal.c") - if(CONFIG_SOC_SYSTIMER_SUPPORTED) - if(NOT CONFIG_HAL_SYSTIMER_ROM_IMPL) - list(APPEND srcs "systimer_hal.c") - endif() + if(CONFIG_SOC_SYSTIMER_SUPPORTED AND NOT CONFIG_HAL_SYSTIMER_USE_ROM_IMPL) + list(APPEND srcs "systimer_hal.c") + endif() + + if(CONFIG_SOC_RMT_SUPPORTED) + list(APPEND srcs "rmt_hal.c") + endif() + + if(CONFIG_SOC_PCNT_SUPPORTED) + list(APPEND srcs "pcnt_hal.c") + endif() + + if(CONFIG_SOC_MCPWM_SUPPORTED) + list(APPEND srcs "mcpwm_hal.c") + endif() + + if(CONFIG_SOC_TWAI_SUPPORTED) + list(APPEND srcs "twai_hal.c" "twai_hal_iram.c") + endif() + + if(CONFIG_SOC_GDMA_SUPPORTED) + list(APPEND srcs "gdma_hal.c") + endif() + + if(CONFIG_SOC_I2S_SUPPORTED) + list(APPEND srcs "i2s_hal.c") + endif() + + if(CONFIG_SOC_SIGMADELTA_SUPPORTED) + list(APPEND srcs "sigmadelta_hal.c") + endif() + + if(CONFIG_ETH_USE_ESP32_EMAC) + list(APPEND srcs "emac_hal.c") endif() if(${target} STREQUAL "esp32") list(APPEND srcs "dac_hal.c" - "rmt_hal.c" - "sigmadelta_hal.c" - "mcpwm_hal.c" - "pcnt_hal.c" "sdio_slave_hal.c" "touch_sensor_hal.c" - "i2s_hal.c" - "twai_hal.c" - "twai_hal_iram.c" "aes_hal.c" "esp32/adc_hal.c" "esp32/brownout_hal.c" "esp32/interrupt_descriptor_table.c" "esp32/touch_sensor_hal.c" "esp32/gpio_hal_workaround.c") - if(NOT BOOTLOADER_BUILD AND CONFIG_ETH_USE_ESP32_EMAC) - list(APPEND srcs "emac_hal.c") - endif() endif() if(${target} STREQUAL "esp32s2") list(APPEND srcs "dac_hal.c" - "rmt_hal.c" - "sigmadelta_hal.c" - "pcnt_hal.c" "spi_flash_hal_gpspi.c" "spi_slave_hd_hal.c" "touch_sensor_hal.c" "usb_hal.c" "usb_phy_hal.c" "xt_wdt_hal.c" - "i2s_hal.c" - "twai_hal.c" - "twai_hal_iram.c" "aes_hal.c" "esp32s2/brownout_hal.c" "esp32s2/cp_dma_hal.c" @@ -105,21 +119,13 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32s3") list(APPEND srcs "ds_hal.c" - "rmt_hal.c" - "sigmadelta_hal.c" - "gdma_hal.c" "lcd_hal.c" - "mcpwm_hal.c" - "pcnt_hal.c" "spi_flash_hal_gpspi.c" "spi_slave_hd_hal.c" "touch_sensor_hal.c" "usb_hal.c" "usb_phy_hal.c" "xt_wdt_hal.c" - "i2s_hal.c" - "twai_hal.c" - "twai_hal_iram.c" "aes_hal.c" "esp32s3/brownout_hal.c" "esp32s3/hmac_hal.c" @@ -132,15 +138,9 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32c3") list(APPEND srcs "ds_hal.c" - "gdma_hal.c" - "rmt_hal.c" - "sigmadelta_hal.c" "spi_flash_hal_gpspi.c" "spi_slave_hd_hal.c" "xt_wdt_hal.c" - "i2s_hal.c" - "twai_hal.c" - "twai_hal_iram.c" "aes_hal.c" "esp32c3/adc_hal.c" "esp32c3/brownout_hal.c" @@ -151,14 +151,8 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32h2") list(APPEND srcs "ds_hal.c" - "gdma_hal.c" - "rmt_hal.c" - "sigmadelta_hal.c" "spi_flash_hal_gpspi.c" "spi_slave_hd_hal.c" - "i2s_hal.c" - "twai_hal.c" - "twai_hal_iram.c" "aes_hal.c" "esp32h2/brownout_hal.c" "esp32h2/hmac_hal.c" @@ -168,7 +162,6 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32c2") list(APPEND srcs "ecc_hal.c" - "gdma_hal.c" "spi_flash_hal_gpspi.c" "spi_slave_hd_hal.c" "esp32c2/brownout_hal.c" diff --git a/components/hal/Kconfig b/components/hal/Kconfig index fa8588620a..0e6b0bc2c1 100644 --- a/components/hal/Kconfig +++ b/components/hal/Kconfig @@ -65,14 +65,9 @@ menu "Hardware Abstraction Layer (HAL) and Low Level (LL)" default 4 if HAL_LOG_LEVEL_DEBUG default 5 if HAL_LOG_LEVEL_VERBOSE - config HAL_SYSTIMER_HAS_ROM_IMPL - bool - depends on IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32S3 - default y if IDF_TARGET_ESP32C2 # TODO: IDF-4917 - - config HAL_SYSTIMER_ROM_IMPL - bool "Use systimer HAL implementation in ROM" - depends on HAL_SYSTIMER_HAS_ROM_IMPL + config HAL_SYSTIMER_USE_ROM_IMPL + bool "Use ROM implementation of SysTimer HAL driver" + depends on ESP_ROM_HAS_HAL_SYSTIMER default y help Enable this flag to use HAL functions from ROM instead of ESP-IDF. @@ -83,14 +78,9 @@ menu "Hardware Abstraction Layer (HAL) and Low Level (LL)" features will be added and bugs will be fixed in the IDF source but cannot be synced to ROM. - config HAL_WDT_HAS_ROM_IMPL - bool - depends on IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32S3 - default y if IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32S3 - - config HAL_WDT_ROM_IMPL - bool "Use WDT HAL implementation in ROM" - depends on HAL_WDT_HAS_ROM_IMPL + config HAL_WDT_USE_ROM_IMPL + bool "Use ROM implementation of WDT HAL driver" + depends on ESP_ROM_HAS_HAL_WDT default y help Enable this flag to use HAL functions from ROM instead of ESP-IDF. diff --git a/components/hal/linker.lf b/components/hal/linker.lf index 729118368c..a2fa83ba21 100644 --- a/components/hal/linker.lf +++ b/components/hal/linker.lf @@ -16,14 +16,14 @@ entries: i2c_hal_iram (noflash) cpu_hal (noflash) soc_hal (noflash) - if HAL_WDT_HAS_ROM_IMPL = n || HAL_WDT_ROM_IMPL = n: + if HAL_WDT_USE_ROM_IMPL = n: wdt_hal_iram (noflash) + if SOC_SYSTIMER_SUPPORTED = y && HAL_SYSTIMER_USE_ROM_IMPL = n: + systimer_hal (noflash) if TWAI_ISR_IN_IRAM = y: twai_hal_iram (noflash) if IDF_TARGET_ESP32 = n: spi_flash_hal_gpspi (noflash) - if HAL_SYSTIMER_HAS_ROM_IMPL = n || HAL_SYSTIMER_ROM_IMPL = n: - systimer_hal (noflash) if GPTIMER_CTRL_FUNC_IN_IRAM = y: timer_hal_iram (noflash) if GPIO_CTRL_FUNC_IN_IRAM = y: diff --git a/docs/en/api-guides/performance/size.rst b/docs/en/api-guides/performance/size.rst index 39b6f148f9..adebc8f23b 100644 --- a/docs/en/api-guides/performance/size.rst +++ b/docs/en/api-guides/performance/size.rst @@ -411,6 +411,17 @@ VFS * :ref:`CONFIG_VFS_SUPPORT_DIR` — can be disabled if the application doesn't use directory related functions, such as ``readdir`` (see the description of this option for the complete list). Applications which only open, read and write specific files and don't need to enumerate or create directories can disable this option, reducing the code size by 0.5 kB or more, depending on the filesystem drivers in use. * :ref:`CONFIG_VFS_SUPPORT_IO` — can be disabled if the application doesn't use filesystems or file-like peripheral drivers. This disables all VFS functionality, including the three options mentioned above. When this option is disabled, :doc:`console ` can't be used. Note that the application can still use standard I/O functions with socket file descriptors when this option is disabled. Compared to the default configuration, disabling this option reduces code size by about 9.4 kB. +.. only:: esp32c2 + + HAL + @@@ + + .. list:: + + :CONFIG_ESP_ROM_HAS_HAL_SYSTIMER: * Enabling :ref:`CONFIG_HAL_SYSTIMER_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the systimer HAL driver of ROM implementation. + :CONFIG_ESP_ROM_HAS_HAL_WDT: * Enabling :ref:`CONFIG_HAL_WDT_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the watchdog HAL driver of ROM implementation. + + Bootloader Size --------------- diff --git a/tools/test_apps/system/build_test/sdkconfig.ci copy.esp32c2_with_rom_impl_components b/tools/test_apps/system/build_test/sdkconfig.ci copy.esp32c2_with_rom_impl_components new file mode 100644 index 0000000000..68e9623a04 --- /dev/null +++ b/tools/test_apps/system/build_test/sdkconfig.ci copy.esp32c2_with_rom_impl_components @@ -0,0 +1,5 @@ +CONFIG_IDF_TARGET="esp32c2" +CONFIG_HAL_WDT_USE_ROM_IMPL=y +CONFIG_HAL_SYSTIMER_USE_ROM_IMPL=y +CONFIG_HEAP_TLSF_USE_ROM_IMPL=y +CONFIG_SPI_FLASH_ROM_IMPL=y diff --git a/tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_rom_impl_components b/tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_rom_impl_components deleted file mode 100644 index 9552d799b5..0000000000 --- a/tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_rom_impl_components +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_IDF_TARGET="esp32c2" -CONFIG_HAL_WDT_ROM_IMPL=n -CONFIG_HAL_SYSTIMER_ROM_IMPL=n -CONFIG_HEAP_ROM_IMPL=n -CONFIG_SPI_FLASH_ROM_IMPL=y diff --git a/tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_without_rom_impl_components b/tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_without_rom_impl_components new file mode 100644 index 0000000000..e777b39382 --- /dev/null +++ b/tools/test_apps/system/build_test/sdkconfig.ci.esp32c2_without_rom_impl_components @@ -0,0 +1,5 @@ +CONFIG_IDF_TARGET="esp32c2" +CONFIG_HAL_WDT_USE_ROM_IMPL=n +CONFIG_HAL_SYSTIMER_USE_ROM_IMPL=n +CONFIG_HEAP_TLSF_USE_ROM_IMPL=n +CONFIG_SPI_FLASH_ROM_IMPL=n From 068adfba70f969cfa0baf0c023dd5653755f380e Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 6 May 2022 19:20:05 +0800 Subject: [PATCH 3/7] heap: use ROM implementation for heap tlsf on esp32c2 --- components/esp_rom/CMakeLists.txt | 2 +- components/esp_rom/esp32c2/Kconfig.soc_caps.in | 4 ++++ components/esp_rom/esp32c2/esp_rom_caps.h | 1 + components/heap/CMakeLists.txt | 2 +- components/heap/Kconfig | 11 +++-------- components/heap/heap_caps_init.c | 2 +- components/heap/linker.lf | 2 +- components/heap/multi_heap.c | 6 +++--- components/heap/multi_heap_poisoning.c | 2 +- docs/en/api-guides/performance/size.rst | 8 ++++++++ 10 files changed, 24 insertions(+), 16 deletions(-) diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index 17eecab140..44d9365029 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -200,7 +200,7 @@ else() # Regular app build rom_linker_script("newlib-nano") endif() - if(CONFIG_HEAP_ROM_IMPL) + if(CONFIG_HEAP_TLSF_USE_ROM_IMPL) rom_linker_script("heap") endif() endif() diff --git a/components/esp_rom/esp32c2/Kconfig.soc_caps.in b/components/esp_rom/esp32c2/Kconfig.soc_caps.in index 0eebf6d89a..b6e13da822 100644 --- a/components/esp_rom/esp32c2/Kconfig.soc_caps.in +++ b/components/esp_rom/esp32c2/Kconfig.soc_caps.in @@ -34,3 +34,7 @@ config ESP_ROM_HAS_HAL_WDT config ESP_ROM_HAS_HAL_SYSTIMER bool default y + +config ESP_ROM_HAS_HEAP_TLSF + bool + default y diff --git a/components/esp_rom/esp32c2/esp_rom_caps.h b/components/esp_rom/esp32c2/esp_rom_caps.h index dfc376b77d..eee69daaaa 100644 --- a/components/esp_rom/esp32c2/esp_rom_caps.h +++ b/components/esp_rom/esp32c2/esp_rom_caps.h @@ -14,3 +14,4 @@ #define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver +#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library diff --git a/components/heap/CMakeLists.txt b/components/heap/CMakeLists.txt index ceedec32e7..66e32e9cee 100644 --- a/components/heap/CMakeLists.txt +++ b/components/heap/CMakeLists.txt @@ -3,7 +3,7 @@ set(srcs "heap_caps_init.c" "multi_heap.c") -if(NOT CONFIG_HEAP_ROM_IMPL) +if(NOT CONFIG_HEAP_TLSF_USE_ROM_IMPL) list(APPEND srcs "heap_tlsf.c") endif() diff --git a/components/heap/Kconfig b/components/heap/Kconfig index 67720aa3ca..f19574a691 100644 --- a/components/heap/Kconfig +++ b/components/heap/Kconfig @@ -71,14 +71,9 @@ menu "Heap memory debugging" help When enabled, if a memory allocation operation fails it will cause a system abort. - config HEAP_HAS_ROM_IMPL - bool - depends on IDF_TARGET_ESP32C2 - default y if IDF_TARGET_ESP32C2 - - config HEAP_ROM_IMPL - bool "Use heap implementation in ROM" - depends on HEAP_HAS_ROM_IMPL + config HEAP_TLSF_USE_ROM_IMPL + bool "Use ROM implementation of heap tlsf library" + depends on ESP_ROM_HAS_HEAP_TLSF default y help Enable this flag to use heap functions from ROM instead of ESP-IDF. diff --git a/components/heap/heap_caps_init.c b/components/heap/heap_caps_init.c index bbefa0482a..75556dd155 100644 --- a/components/heap/heap_caps_init.c +++ b/components/heap/heap_caps_init.c @@ -49,7 +49,7 @@ void heap_caps_enable_nonos_stack_heaps(void) */ void heap_caps_init(void) { -#ifdef CONFIG_HEAP_ROM_IMPL +#ifdef CONFIG_HEAP_TLSF_USE_ROM_IMPL extern void multi_heap_in_rom_init(void); multi_heap_in_rom_init(); #endif diff --git a/components/heap/linker.lf b/components/heap/linker.lf index 31cf88aa9e..55b6465205 100644 --- a/components/heap/linker.lf +++ b/components/heap/linker.lf @@ -1,7 +1,7 @@ [mapping:heap] archive: libheap.a entries: - if HEAP_HAS_ROM_IMPL = n || HEAP_ROM_IMPL = n: + if HEAP_TLSF_USE_ROM_IMPL = n: heap_tlsf (noflash) multi_heap (noflash) if HEAP_POISONING_DISABLED = n: diff --git a/components/heap/multi_heap.c b/components/heap/multi_heap.c index a4b3997620..2f28b0c574 100644 --- a/components/heap/multi_heap.c +++ b/components/heap/multi_heap.c @@ -22,7 +22,7 @@ /* Defines compile-time configuration macros */ #include "multi_heap_config.h" -#if (!defined MULTI_HEAP_POISONING) && (!defined CONFIG_HEAP_ROM_IMPL) +#if (!defined MULTI_HEAP_POISONING) && (!defined CONFIG_HEAP_TLSF_USE_ROM_IMPL) /* if no heap poisoning, public API aliases directly to these implementations */ void *multi_heap_malloc(multi_heap_handle_t heap, size_t size) __attribute__((alias("multi_heap_malloc_impl"))); @@ -77,7 +77,7 @@ typedef struct multi_heap_info { tlsf_t heap_data; } heap_t; -#ifdef CONFIG_HEAP_ROM_IMPL +#ifdef CONFIG_HEAP_TLSF_USE_ROM_IMPL void _multi_heap_lock(void *lock) { @@ -99,7 +99,7 @@ void multi_heap_in_rom_init(void) multi_heap_os_funcs_init(&multi_heap_os_funcs); } -#else //#ifndef CONFIG_HEAP_ROM_IMPL +#else //#ifndef CONFIG_HEAP_TLSF_USE_ROM_IMPL /* Return true if this block is free. */ static inline bool is_free(const block_header_t *block) diff --git a/components/heap/multi_heap_poisoning.c b/components/heap/multi_heap_poisoning.c index 31dfc69452..45f95cde7c 100644 --- a/components/heap/multi_heap_poisoning.c +++ b/components/heap/multi_heap_poisoning.c @@ -334,7 +334,7 @@ multi_heap_handle_t multi_heap_register(void *start, size_t size) memset(start, FREE_FILL_PATTERN, size); } #endif -#ifdef CONFIG_HEAP_ROM_IMPL +#ifdef CONFIG_HEAP_TLSF_USE_ROM_IMPL tlsf_poison_fill_pfunc_set(multi_heap_internal_poison_fill_region); #endif return multi_heap_register_impl(start, size); diff --git a/docs/en/api-guides/performance/size.rst b/docs/en/api-guides/performance/size.rst index adebc8f23b..fae92c0cd5 100644 --- a/docs/en/api-guides/performance/size.rst +++ b/docs/en/api-guides/performance/size.rst @@ -421,6 +421,14 @@ VFS :CONFIG_ESP_ROM_HAS_HAL_SYSTIMER: * Enabling :ref:`CONFIG_HAL_SYSTIMER_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the systimer HAL driver of ROM implementation. :CONFIG_ESP_ROM_HAS_HAL_WDT: * Enabling :ref:`CONFIG_HAL_WDT_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the watchdog HAL driver of ROM implementation. +.. only:: esp32c2 + + Heap + @@@@ + + .. list:: + + :CONFIG_ESP_ROM_HAS_HEAP_TLSF: * Enabling :ref:`CONFIG_HEAP_TLSF_USE_ROM_IMPL` can reduce the IRAM usage and binary size by linking in the TLSF library of ROM implementation. Bootloader Size --------------- From aaa2eca57d98f46429db6c7792658ba4e9dc507c Mon Sep 17 00:00:00 2001 From: morris Date: Sat, 7 May 2022 22:59:34 +0800 Subject: [PATCH 4/7] blink: support ESP8684-DevKitM board --- examples/common_components/led_strip/CMakeLists.txt | 8 +++++++- examples/get-started/blink/README.md | 4 ++-- examples/get-started/blink/main/CMakeLists.txt | 2 +- examples/get-started/blink/main/Kconfig.projbuild | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/common_components/led_strip/CMakeLists.txt b/examples/common_components/led_strip/CMakeLists.txt index a9c4b523a2..978fdf7111 100644 --- a/examples/common_components/led_strip/CMakeLists.txt +++ b/examples/common_components/led_strip/CMakeLists.txt @@ -1,3 +1,9 @@ -idf_component_register(SRCS "src/led_strip_rmt_dev.c" "src/led_strip_rmt_encoder.c" +set(srcs) + +if(CONFIG_SOC_RMT_SUPPORTED) + list(APPEND srcs "src/led_strip_rmt_dev.c" "src/led_strip_rmt_encoder.c") +endif() + +idf_component_register(SRCS ${srcs} INCLUDE_DIRS "include" "interface" PRIV_REQUIRES "driver") diff --git a/examples/get-started/blink/README.md b/examples/get-started/blink/README.md index ae6a65eff4..6a0d315606 100644 --- a/examples/get-started/blink/README.md +++ b/examples/get-started/blink/README.md @@ -12,7 +12,7 @@ Before project configuration and build, be sure to set the correct chip target u ### Hardware Required -* A development board with ESP32/ESP32-S2/ESP32-S3/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.) +* A development board with Espressif SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.) * A USB cable for Power supply and programming Some development boards use an addressable LED instead of a regular one. These development boards include: @@ -48,7 +48,7 @@ See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/l ## Example Output -As you run the example, you will see the LED blinking, according to the previously defined period. For the addressable LED, you can also change the LED color by setting the `led_strip_set_pixel(pStrip_a, 0, 16, 16, 16);` (LED Strip, Pixel Number, Red, Green, Blue) with values from 0 to 255 in the `blink.c` file. +As you run the example, you will see the LED blinking, according to the previously defined period. For the addressable LED, you can also change the LED color by setting the `led_strip_set_pixel(led_strip, 0, 16, 16, 16);` (LED Strip, Pixel Number, Red, Green, Blue) with values from 0 to 255 in the [source file](main/blink_example_main.c). ``` I (315) example: Example configured to blink addressable LED! diff --git a/examples/get-started/blink/main/CMakeLists.txt b/examples/get-started/blink/main/CMakeLists.txt index 448f871365..a7f0baca81 100644 --- a/examples/get-started/blink/main/CMakeLists.txt +++ b/examples/get-started/blink/main/CMakeLists.txt @@ -1,2 +1,2 @@ idf_component_register(SRCS "blink_example_main.c" - INCLUDE_DIRS ".") + INCLUDE_DIRS ".") diff --git a/examples/get-started/blink/main/Kconfig.projbuild b/examples/get-started/blink/main/Kconfig.projbuild index 18b13a773d..b7699706d4 100644 --- a/examples/get-started/blink/main/Kconfig.projbuild +++ b/examples/get-started/blink/main/Kconfig.projbuild @@ -2,7 +2,7 @@ menu "Example Configuration" choice BLINK_LED prompt "Blink LED type" - default BLINK_LED_GPIO if IDF_TARGET_ESP32 + default BLINK_LED_GPIO if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C2 default BLINK_LED_RMT help Defines the default peripheral for blink example @@ -16,7 +16,7 @@ menu "Example Configuration" config BLINK_GPIO int "Blink GPIO number" range 0 48 - default 8 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32H2 + default 8 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32C2 default 18 if IDF_TARGET_ESP32S2 default 48 if IDF_TARGET_ESP32S3 default 5 From 6d288575dc51823eea4a267b4e327406755a91cd Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 9 May 2022 18:10:08 +0800 Subject: [PATCH 5/7] test: fix broken host test of idf_as_lib --- examples/build_system/cmake/idf_as_lib/main.c | 13 ++++----- .../cmake/idf_as_lib/stubs/esp32/cpu_start.c | 6 ++++ .../idf_as_lib/stubs/esp32/esp_chip_info.h | 28 +++++++++++++++++++ .../cmake/idf_as_lib/stubs/esp32/esp_system.h | 23 +++++++-------- .../cmake/idf_as_lib/stubs/esp32/flash_ops.c | 6 ++++ .../cmake/idf_as_lib/stubs/esp32/system_api.c | 7 ++++- .../idf_as_lib/stubs/freertos/freertos/task.h | 13 +++++++++ .../cmake/idf_as_lib/stubs/freertos/task.c | 6 ++++ .../stubs/spi_flash/esp_spi_flash.h | 14 ++++++++++ tools/ci/check_copyright_ignore.txt | 8 ------ 10 files changed, 97 insertions(+), 27 deletions(-) create mode 100644 examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_chip_info.h diff --git a/examples/build_system/cmake/idf_as_lib/main.c b/examples/build_system/cmake/idf_as_lib/main.c index f61f972f2a..c069d36833 100644 --- a/examples/build_system/cmake/idf_as_lib/main.c +++ b/examples/build_system/cmake/idf_as_lib/main.c @@ -1,15 +1,14 @@ -/* Hello World Example +/* + * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ - This example code is in the Public Domain (or CC0 licensed, at your option.) - - Unless required by applicable law or agreed to in writing, this - software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - CONDITIONS OF ANY KIND, either express or implied. -*/ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_chip_info.h" +#include "esp_system.h" #include "esp_spi_flash.h" void app_main(void) diff --git a/examples/build_system/cmake/idf_as_lib/stubs/esp32/cpu_start.c b/examples/build_system/cmake/idf_as_lib/stubs/esp32/cpu_start.c index 6969d03be7..243246c707 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/esp32/cpu_start.c +++ b/examples/build_system/cmake/idf_as_lib/stubs/esp32/cpu_start.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + #include #include diff --git a/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_chip_info.h b/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_chip_info.h new file mode 100644 index 0000000000..f05021e8a1 --- /dev/null +++ b/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_chip_info.h @@ -0,0 +1,28 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CHIP_FEATURE_EMB_FLASH (1UL << 0) +#define CHIP_FEATURE_BT (1UL << 4) +#define CHIP_FEATURE_BLE (1UL << 5) + +typedef struct { + uint32_t features; //!< bit mask of CHIP_FEATURE_x feature flags + uint8_t cores; //!< number of CPU cores + uint8_t revision; //!< chip revision number +} esp_chip_info_t; + +void esp_chip_info(esp_chip_info_t *out_info); + +#ifdef __cplusplus +} +#endif diff --git a/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_system.h b/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_system.h index 3cd073adf1..a3d2143c55 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_system.h +++ b/examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_system.h @@ -1,15 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ #pragma once -#include -#define CHIP_FEATURE_EMB_FLASH (1UL << 0) -#define CHIP_FEATURE_BT (1UL << 4) -#define CHIP_FEATURE_BLE (1UL << 5) - -typedef struct { - uint32_t features; //!< bit mask of CHIP_FEATURE_x feature flags - uint8_t cores; //!< number of CPU cores - uint8_t revision; //!< chip revision number -} esp_chip_info_t; +#ifdef __cplusplus +extern "C" { +#endif void esp_restart(void); -void esp_chip_info(esp_chip_info_t* out_info); + +#ifdef __cplusplus +} +#endif diff --git a/examples/build_system/cmake/idf_as_lib/stubs/esp32/flash_ops.c b/examples/build_system/cmake/idf_as_lib/stubs/esp32/flash_ops.c index 046ae31071..28c3a41499 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/esp32/flash_ops.c +++ b/examples/build_system/cmake/idf_as_lib/stubs/esp32/flash_ops.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + #include "esp_spi_flash.h" int spi_flash_get_chip_size(void) diff --git a/examples/build_system/cmake/idf_as_lib/stubs/esp32/system_api.c b/examples/build_system/cmake/idf_as_lib/stubs/esp32/system_api.c index be70ac0ea8..2da59ef089 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/esp32/system_api.c +++ b/examples/build_system/cmake/idf_as_lib/stubs/esp32/system_api.c @@ -1,7 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ #include #include #include -#include "esp_system.h" +#include "esp_chip_info.h" extern jmp_buf buf; diff --git a/examples/build_system/cmake/idf_as_lib/stubs/freertos/freertos/task.h b/examples/build_system/cmake/idf_as_lib/stubs/freertos/freertos/task.h index 14533fbcdc..96031d9c87 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/freertos/freertos/task.h +++ b/examples/build_system/cmake/idf_as_lib/stubs/freertos/freertos/task.h @@ -1,7 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ #pragma once #include +#ifdef __cplusplus +extern "C" { +#endif + #define portTICK_PERIOD_MS 1000 void vTaskDelay( const uint32_t xTicksToDelay ); + +#ifdef __cplusplus +} +#endif diff --git a/examples/build_system/cmake/idf_as_lib/stubs/freertos/task.c b/examples/build_system/cmake/idf_as_lib/stubs/freertos/task.c index 095025804d..bd3d4a5e3e 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/freertos/task.c +++ b/examples/build_system/cmake/idf_as_lib/stubs/freertos/task.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + #include #include "freertos/task.h" diff --git a/examples/build_system/cmake/idf_as_lib/stubs/spi_flash/esp_spi_flash.h b/examples/build_system/cmake/idf_as_lib/stubs/spi_flash/esp_spi_flash.h index 788bfa2606..ede1cb373e 100644 --- a/examples/build_system/cmake/idf_as_lib/stubs/spi_flash/esp_spi_flash.h +++ b/examples/build_system/cmake/idf_as_lib/stubs/spi_flash/esp_spi_flash.h @@ -1,5 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + #pragma once #include +#ifdef __cplusplus +extern "C" { +#endif + int spi_flash_get_chip_size(void); + +#ifdef __cplusplus +} +#endif diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index f3093b2ff0..fabd425104 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -1947,14 +1947,6 @@ examples/bluetooth/nimble/bleprph_wifi_coex/main/bleprph.h examples/bluetooth/nimble/bleprph_wifi_coex/main/gatt_svr.c examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c examples/build_system/cmake/component_manager/main/component_manager.c -examples/build_system/cmake/idf_as_lib/main.c -examples/build_system/cmake/idf_as_lib/stubs/esp32/cpu_start.c -examples/build_system/cmake/idf_as_lib/stubs/esp32/esp_system.h -examples/build_system/cmake/idf_as_lib/stubs/esp32/flash_ops.c -examples/build_system/cmake/idf_as_lib/stubs/esp32/system_api.c -examples/build_system/cmake/idf_as_lib/stubs/freertos/freertos/task.h -examples/build_system/cmake/idf_as_lib/stubs/freertos/task.c -examples/build_system/cmake/idf_as_lib/stubs/spi_flash/esp_spi_flash.h examples/build_system/cmake/import_lib/main/main.cpp examples/build_system/cmake/import_prebuilt/main/main.c examples/build_system/cmake/import_prebuilt/prebuilt/components/prebuilt/prebuilt.c From 47e4fe83ba4ddfa3d022f805086d4ffe469a6a4e Mon Sep 17 00:00:00 2001 From: morris Date: Sat, 7 May 2022 15:26:45 +0800 Subject: [PATCH 6/7] ci: enable build pytest ut and examples on esp32c2 --- .gitlab/ci/build.yml | 14 +++++++++++ conftest.py | 4 ++-- examples/provisioning/wifi_prov_mgr/README.md | 2 ++ .../system/ota/native_ota_example/README.md | 2 ++ pytest.ini | 5 ++-- tools/ci/build_pytest_apps.py | 23 ++++++++++--------- 6 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml index 420cb625d0..9169d3d50e 100644 --- a/.gitlab/ci/build.yml +++ b/.gitlab/ci/build.yml @@ -65,6 +65,13 @@ build_pytest_examples_esp32c3: script: - run_cmd python tools/ci/build_pytest_apps.py examples --target esp32c3 --size-info $SIZE_INFO_LOCATION -vv +build_pytest_examples_esp32c2: + extends: + - .build_pytest_template + - .rules:build:example_test-esp32c2 + script: + - run_cmd python tools/ci/build_pytest_apps.py examples --target esp32c2 --size-info $SIZE_INFO_LOCATION -vv + build_pytest_components_esp32: extends: - .build_pytest_template @@ -93,6 +100,13 @@ build_pytest_components_esp32c3: script: - run_cmd python tools/ci/build_pytest_apps.py components --target esp32c3 --size-info $SIZE_INFO_LOCATION -vv +build_pytest_components_esp32c2: + extends: + - .build_pytest_template + - .rules:build:component_ut-esp32c2 + script: + - run_cmd python tools/ci/build_pytest_apps.py components --target esp32c2 --size-info $SIZE_INFO_LOCATION -vv + build_non_test_components_apps: extends: - .build_template diff --git a/conftest.py b/conftest.py index c2833d9012..293778bf3b 100644 --- a/conftest.py +++ b/conftest.py @@ -32,8 +32,8 @@ from _pytest.terminal import TerminalReporter from pytest_embedded.plugin import apply_count, parse_configuration from pytest_embedded.utils import find_by_suffix -SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3'] -PREVIEW_TARGETS = ['linux', 'esp32h2', 'esp32c2'] +SUPPORTED_TARGETS = ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2'] +PREVIEW_TARGETS = ['linux', 'esp32h2'] DEFAULT_SDKCONFIG = 'default' diff --git a/examples/provisioning/wifi_prov_mgr/README.md b/examples/provisioning/wifi_prov_mgr/README.md index e2ecdd7f1c..fbc4ed9a21 100644 --- a/examples/provisioning/wifi_prov_mgr/README.md +++ b/examples/provisioning/wifi_prov_mgr/README.md @@ -1,3 +1,5 @@ +| Supported Targets | ESP32 | ESP32-S2 | ESP32-S3 | ESP32-C3 | +| ----------------- | ----- | -------- | -------- | -------- | # Wi-Fi Provisioning Manager Example (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/examples/system/ota/native_ota_example/README.md b/examples/system/ota/native_ota_example/README.md index be57ce55ec..a53403e847 100644 --- a/examples/system/ota/native_ota_example/README.md +++ b/examples/system/ota/native_ota_example/README.md @@ -1,3 +1,5 @@ +| Supported Targets | ESP32 | ESP32-S2 | ESP32-S3 | ESP32-C3 | +| ----------------- | ----- | -------- | -------- | -------- | # Native OTA example This example is based on `app_update` component's APIs. diff --git a/pytest.ini b/pytest.ini index da5fc442f8..a386445b25 100644 --- a/pytest.ini +++ b/pytest.ini @@ -19,8 +19,9 @@ markers = esp32s2: support esp32s2 target esp32s3: support esp32s3 target esp32c3: support esp32c3 target - supported_targets: support all supported targets ('esp32', 'esp32s2', 'esp32c3', 'esp32s3') - preview_targets: support all preview targets ('linux', 'esp32h2', 'esp32c2') + esp32c2: support esp32c2 target + supported_targets: support all supported targets ('esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2') + preview_targets: support all preview targets ('linux', 'esp32h2') all_targets: support all targets, including supported ones and preview ones # env markers diff --git a/tools/ci/build_pytest_apps.py b/tools/ci/build_pytest_apps.py index 8de9964339..85e43a26bd 100644 --- a/tools/ci/build_pytest_apps.py +++ b/tools/ci/build_pytest_apps.py @@ -18,13 +18,13 @@ from idf_ci_utils import IDF_PATH, get_pytest_cases try: from build_apps import build_apps from find_apps import find_builds_for_app - from find_build_apps import BuildItem, config_rules_from_str, setup_logging + from find_build_apps import BuildItem, CMakeBuildSystem, config_rules_from_str, setup_logging except ImportError: sys.path.append(os.path.join(IDF_PATH, 'tools')) from build_apps import build_apps from find_apps import find_builds_for_app - from find_build_apps import BuildItem, config_rules_from_str, setup_logging + from find_build_apps import BuildItem, CMakeBuildSystem, config_rules_from_str, setup_logging def main(args: argparse.Namespace) -> None: @@ -50,15 +50,16 @@ def main(args: argparse.Namespace) -> None: config_rules = config_rules_from_str(args.config or []) for app_dir in app_dirs: app_dir = os.path.realpath(app_dir) - build_items += find_builds_for_app( - app_path=app_dir, - work_dir=app_dir, - build_dir='build_@t_@w', - build_log=f'{app_dir}/build_@t_@w/build.log', - target_arg=args.target, - build_system='cmake', - config_rules=config_rules, - ) + if args.target in CMakeBuildSystem.supported_targets(app_dir): + build_items += find_builds_for_app( + app_path=app_dir, + work_dir=app_dir, + build_dir='build_@t_@w', + build_log=f'{app_dir}/build_@t_@w/build.log', + target_arg=args.target, + build_system='cmake', + config_rules=config_rules, + ) modified_build_items = [] # auto clean up the binaries if no flag --preserve-all From c626297f81330b5180fda16e5f1d46fbd5abe509 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Thu, 12 May 2022 12:04:28 +0800 Subject: [PATCH 7/7] ci: fix xfail test cases end up failed when existing known failure cases --- conftest.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/conftest.py b/conftest.py index 293778bf3b..374f676b48 100644 --- a/conftest.py +++ b/conftest.py @@ -195,16 +195,20 @@ class IdfPytestEmbedded: ) self._failed_cases: List[ - Tuple[str, bool] - ] = [] # (test_case_name, is_known_failure_cases) + Tuple[str, bool, bool] + ] = [] # (test_case_name, is_known_failure_cases, is_xfail) @property def failed_cases(self) -> List[str]: - return [case for case, is_known in self._failed_cases if not is_known] + return [case for case, is_known, is_xfail in self._failed_cases if not is_known and not is_xfail] @property def known_failure_cases(self) -> List[str]: - return [case for case, is_known in self._failed_cases if is_known] + return [case for case, is_known, _ in self._failed_cases if is_known] + + @property + def xfail_cases(self) -> List[str]: + return [case for case, _, is_xfail in self._failed_cases if is_xfail] @staticmethod def _parse_known_failure_cases_file( @@ -278,7 +282,8 @@ class IdfPytestEmbedded: if report.outcome == 'failed': test_case_name = item.funcargs.get('test_case_name', '') is_known_failure = self._is_known_failure(test_case_name) - self._failed_cases.append((test_case_name, is_known_failure)) + is_xfail = report.keywords.get('xfail', False) + self._failed_cases.append((test_case_name, is_known_failure, is_xfail)) return report @@ -327,6 +332,10 @@ class IdfPytestEmbedded: terminalreporter.section('Known failure cases', bold=True, yellow=True) terminalreporter.line('\n'.join(self.known_failure_cases)) + if self.xfail_cases: + terminalreporter.section('xfail cases', bold=True, yellow=True) + terminalreporter.line('\n'.join(self.xfail_cases)) + if self.failed_cases: terminalreporter.section('Failed cases', bold=True, red=True) terminalreporter.line('\n'.join(self.failed_cases))