Merge branch 'feat/cmakev2_ulp_legacy_shim' into 'master'

feat(ulp): build all legacy ULP projects through CMakev2

See merge request espressif/esp-idf!50143
This commit is contained in:
Renz Christian Bagaporo
2026-07-31 07:10:43 +08:00
44 changed files with 670 additions and 184 deletions
+9
View File
@@ -6,6 +6,15 @@ endif()
set(includes "include" "interface" "${target}/include") set(includes "include" "interface" "${target}/include")
# TODO(IDF-15983): potentially remove __ULP_BUILDV2 handling from esp_adc
if(__ULP_BUILDV2)
# LP-core ADC shared code includes esp_adc/adc_oneshot.h from
# ulp/lp_core/shared/include/ulp_lp_core_lp_adc_shared.h.
idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES esp_hal_ana_conv)
return()
endif()
set(srcs) set(srcs)
if(CONFIG_SOC_ADC_SUPPORTED) if(CONFIG_SOC_ADC_SUPPORTED)
+3 -3
View File
@@ -1,7 +1,7 @@
idf_build_get_property(target IDF_TARGET) idf_build_get_property(target IDF_TARGET)
# TODO(IDF-15945): potentially remove __ULP_BUILD handling from esp_common # TODO(IDF-15945): potentially remove __ULP_BUILDV2 handling from esp_common
if(${target} STREQUAL "linux" OR __ULP_BUILD) if(${target} STREQUAL "linux" OR __ULP_BUILDV2)
# ULP sources include esp_err.h from components/ulp public and shared headers. # ULP sources include esp_err.h from components/ulp public and shared headers.
set(ldfragments) set(ldfragments)
else() else()
@@ -10,7 +10,7 @@ endif()
set(srcs) set(srcs)
if(NOT __ULP_BUILD) if(NOT __ULP_BUILDV2)
set(srcs "src/esp_err_to_name.c") set(srcs "src/esp_err_to_name.c")
endif() endif()
+9
View File
@@ -8,6 +8,15 @@ set(srcs)
set(include "include") set(include "include")
set(priv_requires esp_driver_gpio esp_driver_dma esp_pm esp_mm esp_hal_clock) set(priv_requires esp_driver_gpio esp_driver_dma esp_pm esp_mm esp_hal_clock)
# TODO(IDF-15984): potentially remove __ULP_BUILDV2 handling from esp_driver_i2s
if(__ULP_BUILDV2)
# LP-core VAD shared code includes driver/lp_i2s_vad.h from
# ulp/lp_core/shared/include/ulp_lp_core_lp_vad_shared.h.
idf_component_register(INCLUDE_DIRS ${include}
REQUIRES esp_hal_i2s)
return()
endif()
if(${target} STREQUAL "esp32") if(${target} STREQUAL "esp32")
# ADC on esp32 is routed to I2S0, I2S driver needs to operate ADC to ensure the I2S function. # ADC on esp32 is routed to I2S0, I2S driver needs to operate ADC to ensure the I2S function.
list(APPEND priv_requires esp_hal_ana_conv) list(APPEND priv_requires esp_hal_ana_conv)
+2 -2
View File
@@ -3,8 +3,8 @@ idf_build_get_property(target IDF_TARGET)
set(srcs) set(srcs)
set(public_include "include") set(public_include "include")
# TODO(IDF-15946): potentially remove __ULP_BUILD handling from esp_driver_uart # TODO(IDF-15946): potentially remove __ULP_BUILDV2 handling from esp_driver_uart
if(__ULP_BUILD) if(__ULP_BUILDV2)
# LP-core UART wakeup shared code includes driver/uart_wakeup.h from # LP-core UART wakeup shared code includes driver/uart_wakeup.h from
# ulp/lp_core/shared/include/ulp_lp_core_lp_uart_shared.h. # ulp/lp_core/shared/include/ulp_lp_core_lp_uart_shared.h.
set(ulp_srcs) set(ulp_srcs)
+14 -1
View File
@@ -4,7 +4,9 @@ if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator return() # This component is not supported by the POSIX/Linux simulator
endif() endif()
set(requires soc hal esp_hal_dma) # Public ADC and temperature sensor HAL headers include hal/regi2c_ctrl.h on
# several targets, so CMake v2 builds need esp_hal_regi2c explicitly.
set(requires soc hal esp_hal_dma esp_hal_regi2c)
if(${target} STREQUAL "esp32") if(${target} STREQUAL "esp32")
list(APPEND requires esp_hal_i2s) list(APPEND requires esp_hal_i2s)
endif() endif()
@@ -15,6 +17,17 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND includes "${target}/include") list(APPEND includes "${target}/include")
endif() endif()
# TODO(IDF-15985): potentially remove __ULP_BUILDV2 handling from esp_hal_ana_conv
if(__ULP_BUILDV2)
# ULP ADC code includes ADC HAL headers from
# ulp/ulp_riscv/ulp_core/ulp_riscv_adc.c and
# ulp/lp_core/shared/include/ulp_lp_core_lp_adc_shared.h. Some target
# ADC/temperature sensor headers include hal/regi2c_ctrl.h.
idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES ${requires})
return()
endif()
# ADC related source files # ADC related source files
if(CONFIG_SOC_ADC_SUPPORTED) if(CONFIG_SOC_ADC_SUPPORTED)
list(APPEND srcs "${target}/adc_periph.c" "adc_hal_common.c" "adc_oneshot_hal.c") list(APPEND srcs "${target}/adc_periph.c" "adc_hal_common.c" "adc_oneshot_hal.c")
+2 -2
View File
@@ -14,8 +14,8 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND includes "${target}/include") list(APPEND includes "${target}/include")
endif() endif()
# TODO(IDF-15947): potentially remove __ULP_BUILD handling from esp_hal_clock # TODO(IDF-15947): potentially remove __ULP_BUILDV2 handling from esp_hal_clock
if(__ULP_BUILD) if(__ULP_BUILDV2)
# LP-core timer shared code includes hal/clk_tree_ll.h from # LP-core timer shared code includes hal/clk_tree_ll.h from
# ulp/lp_core/shared/ulp_lp_core_lp_timer_shared.c. Some target # ulp/lp_core/shared/ulp_lp_core_lp_timer_shared.c. Some target
# clk_tree_ll.h headers include hal/regi2c_ctrl.h. # clk_tree_ll.h headers include hal/regi2c_ctrl.h.
+9
View File
@@ -10,6 +10,15 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND public_include "${target}/include") list(APPEND public_include "${target}/include")
endif() endif()
# TODO(IDF-15991): potentially remove __ULP_BUILDV2 handling from esp_hal_dma
if(__ULP_BUILDV2)
# LP-core SPI uses components/esp_hal_gpspi/include/hal/spi_slave_hd_hal.h,
# whose public headers include DMA HAL descriptor types.
idf_component_register(INCLUDE_DIRS ${public_include}
REQUIRES soc hal)
return()
endif()
if(CONFIG_SOC_GDMA_SUPPORTED) if(CONFIG_SOC_GDMA_SUPPORTED)
list(APPEND srcs "gdma_hal_top.c" "${target}/gdma_periph.c") list(APPEND srcs "gdma_hal_top.c" "${target}/gdma_periph.c")
+5 -5
View File
@@ -10,20 +10,20 @@ endif()
# ULP GPIO helpers include GPIO/RTC IO HAL headers from # ULP GPIO helpers include GPIO/RTC IO HAL headers from
# ulp/ulp_riscv/ulp_core/include/ulp_riscv_gpio.h and # ulp/ulp_riscv/ulp_core/include/ulp_riscv_gpio.h and
# ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h. # ulp/lp_core/lp_core/include/ulp_lp_core_gpio.h.
# TODO(IDF-15948): potentially remove __ULP_BUILD source exclusions from esp_hal_gpio # TODO(IDF-15948): potentially remove __ULP_BUILDV2 source exclusions from esp_hal_gpio
if(CONFIG_SOC_GPIO_PORT GREATER 0 AND NOT __ULP_BUILD) if(CONFIG_SOC_GPIO_PORT GREATER 0 AND NOT __ULP_BUILDV2)
list(APPEND srcs "gpio_hal.c") list(APPEND srcs "gpio_hal.c")
endif() endif()
if(CONFIG_SOC_RTCIO_PIN_COUNT GREATER 0 AND NOT __ULP_BUILD) if(CONFIG_SOC_RTCIO_PIN_COUNT GREATER 0 AND NOT __ULP_BUILDV2)
list(APPEND srcs "rtc_io_hal.c" "${target}/rtc_io_periph.c") list(APPEND srcs "rtc_io_hal.c" "${target}/rtc_io_periph.c")
endif() endif()
if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED AND NOT __ULP_BUILD) if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED AND NOT __ULP_BUILDV2)
list(APPEND srcs "${target}/dedic_gpio_periph.c") list(APPEND srcs "${target}/dedic_gpio_periph.c")
endif() endif()
if(CONFIG_SOC_SDM_SUPPORTED AND NOT __ULP_BUILD) if(CONFIG_SOC_SDM_SUPPORTED AND NOT __ULP_BUILDV2)
list(APPEND srcs "sdm_hal.c" "${target}/sdm_periph.c") list(APPEND srcs "sdm_hal.c" "${target}/sdm_periph.c")
endif() endif()
+9
View File
@@ -7,6 +7,15 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND includes "${target}/include") list(APPEND includes "${target}/include")
endif() endif()
# TODO(IDF-15986): potentially remove __ULP_BUILDV2 handling from esp_hal_gpspi
if(__ULP_BUILDV2)
# LP-core SPI code includes SPI HAL headers from
# ulp/lp_core/lp_core/lp_core_spi.c.
idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES soc hal esp_hal_dma)
return()
endif()
if(CONFIG_SOC_GPSPI_SUPPORTED) if(CONFIG_SOC_GPSPI_SUPPORTED)
list(APPEND srcs list(APPEND srcs
"${target}/spi_periph.c" "${target}/spi_periph.c"
+10
View File
@@ -8,6 +8,16 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
endif() endif()
list(APPEND includes "include") list(APPEND includes "include")
# TODO(IDF-15987): potentially remove __ULP_BUILDV2 handling from esp_hal_i2c
if(__ULP_BUILDV2)
# ULP I2C code includes hal/i2c_ll.h and hal/i2c_types.h from
# ulp/ulp_riscv/ulp_core/ulp_riscv_i2c.c and
# ulp/lp_core/lp_core/lp_core_i2c.c.
idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES soc hal esp_common)
return()
endif()
set(target_folder "${target}") set(target_folder "${target}")
# I2C related source files # I2C related source files
+9
View File
@@ -11,6 +11,15 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND includes "${target}/include") list(APPEND includes "${target}/include")
endif() endif()
# TODO(IDF-15988): potentially remove __ULP_BUILDV2 handling from esp_hal_i2s
if(__ULP_BUILDV2)
# LP-core VAD shared code includes LP I2S HAL headers from
# ulp/lp_core/shared/ulp_lp_core_lp_vad_shared.c.
idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES soc hal)
return()
endif()
# I2S related source files # I2S related source files
if(CONFIG_SOC_I2S_SUPPORTED) if(CONFIG_SOC_I2S_SUPPORTED)
list(APPEND srcs "i2s_hal.c" "${target}/i2s_periph.c") list(APPEND srcs "i2s_hal.c" "${target}/i2s_periph.c")
+2 -2
View File
@@ -9,8 +9,8 @@ set(public_include "include" "${target}/include")
# targets, so CMake v2 builds need esp_hal_regi2c explicitly. # targets, so CMake v2 builds need esp_hal_regi2c explicitly.
set(requires soc hal esp_rom esp_hal_regi2c) set(requires soc hal esp_rom esp_hal_regi2c)
# TODO(IDF-15949): potentially remove __ULP_BUILD handling from esp_hal_pmu # TODO(IDF-15949): potentially remove __ULP_BUILDV2 handling from esp_hal_pmu
if(__ULP_BUILD) if(__ULP_BUILDV2)
# LP-core runtime code includes hal/pmu_ll.h from # LP-core runtime code includes hal/pmu_ll.h from
# ulp/lp_core/lp_core/lp_core_utils.c. Some target brownout/VBAT headers # ulp/lp_core/lp_core/lp_core_utils.c. Some target brownout/VBAT headers
# include hal/regi2c_ctrl.h. # include hal/regi2c_ctrl.h.
+2 -2
View File
@@ -11,8 +11,8 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND includes "${target}/include") list(APPEND includes "${target}/include")
endif() endif()
# TODO(IDF-15950): potentially remove __ULP_BUILD handling from esp_hal_regi2c # TODO(IDF-15950): potentially remove __ULP_BUILDV2 handling from esp_hal_regi2c
if(__ULP_BUILD) if(__ULP_BUILDV2)
# ULP ADC support reaches REGI2C headers through ADC HAL includes used by # ULP ADC support reaches REGI2C headers through ADC HAL includes used by
# ulp/ulp_riscv/ulp_core/ulp_riscv_adc.c. # ulp/ulp_riscv/ulp_core/ulp_riscv_adc.c.
idf_component_register(INCLUDE_DIRS ${includes} idf_component_register(INCLUDE_DIRS ${includes}
@@ -6,6 +6,15 @@ endif()
set(srcs) set(srcs)
set(public_include "include" "${target}/include") set(public_include "include" "${target}/include")
# TODO(IDF-15992): potentially remove __ULP_BUILDV2 handling from esp_hal_rtc_timer
if(__ULP_BUILDV2)
# LP-core timer shared code includes hal/rtc_timer_ll.h from
# ulp/lp_core/shared/ulp_lp_core_lp_timer_shared.c.
idf_component_register(INCLUDE_DIRS ${public_include}
REQUIRES soc hal esp_rom)
return()
endif()
idf_component_register(SRCS ${srcs} idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include} INCLUDE_DIRS ${public_include}
REQUIRES soc hal esp_rom) REQUIRES soc hal esp_rom)
@@ -8,8 +8,5 @@ components/esp_hal_security/test_apps/crypto:
- esp_security - esp_security
components/esp_hal_security/test_apps/tee: components/esp_hal_security/test_apps/tee:
disable+:
- if: IDF_BUILD_V2 == "1"
reason: Legacy ULP apps are covered by CMake v1; buildv2 covers full_subproject ULP apps.
disable: disable:
- if: IDF_TARGET not in ["esp32c6", "esp32h2", "esp32c5", "esp32c61", "esp32p4"] - if: IDF_TARGET not in ["esp32c6", "esp32h2", "esp32c5", "esp32c61", "esp32p4"]
@@ -12,6 +12,16 @@ endif()
# "include" should be behind "${target}/include", because `include_next` has sequence requirement # "include" should be behind "${target}/include", because `include_next` has sequence requirement
list(APPEND includes "include") list(APPEND includes "include")
# TODO(IDF-15989): potentially remove __ULP_BUILDV2 handling from esp_hal_touch_sens
if(__ULP_BUILDV2)
# ULP touch support includes touch sensor HAL headers from
# ulp/ulp_riscv/ulp_core/ulp_riscv_touch.c and
# ulp/lp_core/lp_core/lp_core_touch.c.
idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES soc)
return()
endif()
# Touch Sensor related source files # Touch Sensor related source files
if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED) if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
# Source files for the legacy touch hal driver # Source files for the legacy touch hal driver
+16
View File
@@ -8,6 +8,22 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${target}/include")
list(APPEND includes "${target}/include") list(APPEND includes "${target}/include")
endif() endif()
# TODO(IDF-15990): potentially remove __ULP_BUILDV2 handling from esp_hal_uart
if(__ULP_BUILDV2)
# LP-core UART and print code includes UART HAL headers from
# ulp/lp_core/lp_core/lp_core_uart.c and
# ulp/lp_core/lp_core/lp_core_print.c.
set(ulp_srcs)
if(ULP_TYPE STREQUAL "lp_core" AND CONFIG_SOC_UART_SUPPORTED)
list(APPEND ulp_srcs "uart_hal.c" "uart_hal_iram.c")
endif()
idf_component_register(SRCS ${ulp_srcs}
INCLUDE_DIRS ${includes}
REQUIRES esp_common soc hal)
return()
endif()
if(CONFIG_SOC_UART_SUPPORTED) if(CONFIG_SOC_UART_SUPPORTED)
list(APPEND srcs "uart_hal.c" "uart_hal_iram.c" "${target}/uart_periph.c") list(APPEND srcs "uart_hal.c" "uart_hal_iram.c" "${target}/uart_periph.c")
endif() endif()
+2 -2
View File
@@ -30,8 +30,8 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/port/${target}/include")
) )
endif() endif()
# TODO(IDF-15951): potentially remove __ULP_BUILD handling from esp_hw_support # TODO(IDF-15951): potentially remove __ULP_BUILDV2 handling from esp_hw_support
if(__ULP_BUILD) if(__ULP_BUILDV2)
# ULP headers and LP-core runtime include esp_intr_alloc.h and esp_cpu.h from # ULP headers and LP-core runtime include esp_intr_alloc.h and esp_cpu.h from
# ulp/ulp_riscv/include/ulp_riscv.h and # ulp/ulp_riscv/include/ulp_riscv.h and
# ulp/lp_core/lp_core/lp_core_ubsan.c. # ulp/lp_core/lp_core/lp_core_ubsan.c.
@@ -103,8 +103,6 @@ components/esp_hw_support/test_apps/vad_wakeup:
- ulp - ulp
- soc - soc
disable: disable:
- if: IDF_BUILD_V2 == "1"
reason: Legacy ULP apps are covered by CMake v1; buildv2 covers full_subproject ULP apps.
- if: SOC_LP_VAD_SUPPORTED != 1 - if: SOC_LP_VAD_SUPPORTED != 1
components/esp_hw_support/test_apps/wakeup_tests: components/esp_hw_support/test_apps/wakeup_tests:
@@ -14,5 +14,4 @@ endif()
idf_component_register(SRCS ${sources} idf_component_register(SRCS ${sources}
INCLUDE_DIRS "." INCLUDE_DIRS "."
PRIV_REQUIRES unity esp_pm ulp esp_timer esp_psram esp_driver_gptimer vfs esp_hal_gpio PRIV_REQUIRES unity esp_pm ulp esp_timer esp_psram esp_driver_gptimer vfs esp_hal_gpio
esp_driver_gpio
WHOLE_ARCHIVE) WHOLE_ARCHIVE)
+2 -2
View File
@@ -7,8 +7,8 @@ set(include_dirs "include"
"${target_folder}/include/${target_folder}" "${target_folder}/include/${target_folder}"
"${target_folder}") "${target_folder}")
# TODO(IDF-15952): potentially remove __ULP_BUILD handling from esp_rom # TODO(IDF-15952): potentially remove __ULP_BUILDV2 handling from esp_rom
if(__ULP_BUILD) if(__ULP_BUILDV2)
# LP-core runtime and print code include ROM headers from # LP-core runtime and print code include ROM headers from
# ulp/lp_core/lp_core/lp_core_startup.c and # ulp/lp_core/lp_core/lp_core_startup.c and
# ulp/lp_core/lp_core/lp_core_print.c. # ulp/lp_core/lp_core/lp_core_print.c.
+2 -2
View File
@@ -14,8 +14,8 @@ list(APPEND includes "include")
# ULP runtime code includes generic HAL headers, for example hal/lp_core_ll.h # ULP runtime code includes generic HAL headers, for example hal/lp_core_ll.h
# from ulp/lp_core/lp_core/lp_core_interrupt.c. # from ulp/lp_core/lp_core/lp_core_interrupt.c.
# TODO(IDF-15953): potentially remove __ULP_BUILD handling from hal # TODO(IDF-15953): potentially remove __ULP_BUILDV2 handling from hal
if(__ULP_BUILD) if(__ULP_BUILDV2)
idf_component_register(INCLUDE_DIRS ${includes} idf_component_register(INCLUDE_DIRS ${includes}
PRIV_INCLUDE_DIRS ${priv_include} PRIV_INCLUDE_DIRS ${priv_include}
REQUIRES esp_common ${requires}) REQUIRES esp_common ${requires})
+2 -2
View File
@@ -1,8 +1,8 @@
idf_build_get_property(target IDF_TARGET) idf_build_get_property(target IDF_TARGET)
idf_build_get_property(non_os_build NON_OS_BUILD) idf_build_get_property(non_os_build NON_OS_BUILD)
# TODO(IDF-15954): potentially remove __ULP_BUILD handling from log # TODO(IDF-15954): potentially remove __ULP_BUILDV2 handling from log
if(__ULP_BUILD) if(__ULP_BUILDV2)
# LP-core UART wakeup support builds components/esp_driver_uart/src/uart_wakeup.c, # LP-core UART wakeup support builds components/esp_driver_uart/src/uart_wakeup.c,
# which includes ESP log headers. # which includes ESP log headers.
idf_component_register(INCLUDE_DIRS "include" idf_component_register(INCLUDE_DIRS "include"
+4 -4
View File
@@ -2,19 +2,19 @@ idf_build_get_property(target IDF_TARGET)
idf_build_get_property(arch IDF_TARGET_ARCH) idf_build_get_property(arch IDF_TARGET_ARCH)
idf_build_get_property(esp_tee_build ESP_TEE_BUILD) idf_build_get_property(esp_tee_build ESP_TEE_BUILD)
# TODO(IDF-15955): potentially remove __ULP_BUILD handling from riscv # TODO(IDF-15955): potentially remove __ULP_BUILDV2 handling from riscv
if(NOT "${arch}" STREQUAL "riscv" AND NOT (__ULP_BUILD AND "${ULP_TYPE}" STREQUAL "riscv")) if(NOT "${arch}" STREQUAL "riscv" AND NOT (__ULP_BUILDV2 AND "${ULP_TYPE}" STREQUAL "riscv"))
return() return()
endif() endif()
if(__ULP_BUILD AND "${ULP_TYPE}" STREQUAL "riscv") if(__ULP_BUILDV2 AND "${ULP_TYPE}" STREQUAL "riscv")
# RISC-V ULP interrupt support includes riscv/interrupt.h from # RISC-V ULP interrupt support includes riscv/interrupt.h from
# ulp/ulp_riscv/ulp_core/include/ulp_riscv_interrupt.h. # ulp/ulp_riscv/ulp_core/include/ulp_riscv_interrupt.h.
idf_component_register(INCLUDE_DIRS "include") idf_component_register(INCLUDE_DIRS "include")
return() return()
endif() endif()
# When __ULP_BUILD and ULP_TYPE is lp_core, keep the normal RISC-V helper sources for headers # When __ULP_BUILDV2 and ULP_TYPE is lp_core, keep the normal RISC-V helper sources for headers
# used by ulp/lp_core/lp_core/lp_core_pmp.c and vector.S. # used by ulp/lp_core/lp_core/lp_core_pmp.c and vector.S.
if(BOOTLOADER_BUILD) if(BOOTLOADER_BUILD)
+2 -2
View File
@@ -31,8 +31,8 @@ else()
endif() endif()
endif() endif()
# TODO(IDF-15956): potentially remove __ULP_BUILD handling from soc # TODO(IDF-15956): potentially remove __ULP_BUILDV2 handling from soc
if(__ULP_BUILD) if(__ULP_BUILDV2)
idf_component_register(INCLUDE_DIRS ${includes} idf_component_register(INCLUDE_DIRS ${includes}
REQUIRES esp_common) REQUIRES esp_common)
+185 -31
View File
@@ -3,20 +3,38 @@ set(includes "")
set(requires "") set(requires "")
set(priv_requires "") set(priv_requires "")
if(__ULP_BUILD) if(__ULP_BUILDV2)
if(ULP_TYPE STREQUAL "riscv") if(ULP_TYPE STREQUAL "riscv")
list(APPEND includes list(APPEND includes
ulp_common/include
ulp_riscv/include
ulp_riscv/shared/include ulp_riscv/shared/include
ulp_riscv/ulp_core/include) ulp_riscv/ulp_core/include)
list(APPEND srcs list(APPEND srcs
"ulp_riscv/ulp_core/ulp_riscv_vectors.S" "ulp_riscv/ulp_core/ulp_riscv_vectors.S"
"ulp_riscv/ulp_core/start.S" "ulp_riscv/ulp_core/start.S"
"ulp_riscv/ulp_core/ulp_riscv_utils.c") "ulp_riscv/ulp_core/ulp_riscv_adc.c"
"ulp_riscv/ulp_core/ulp_riscv_lock.c"
"ulp_riscv/ulp_core/ulp_riscv_uart.c"
"ulp_riscv/ulp_core/ulp_riscv_print.c"
"ulp_riscv/ulp_core/ulp_riscv_i2c.c"
"ulp_riscv/ulp_core/ulp_riscv_utils.c"
"ulp_riscv/ulp_core/ulp_riscv_touch.c"
"ulp_riscv/ulp_core/ulp_riscv_gpio.c"
"ulp_riscv/ulp_core/ulp_riscv_interrupt.c")
list(APPEND requires list(APPEND requires
esp_common
esp_hal_ana_conv
esp_hal_gpio
esp_hal_i2c
esp_hal_touch_sens
esp_hw_support
riscv riscv
soc) soc)
elseif(ULP_TYPE STREQUAL "lp_core") elseif(ULP_TYPE STREQUAL "lp_core")
list(APPEND includes list(APPEND includes
ulp_common/include
lp_core/include
lp_core/lp_core/include lp_core/lp_core/include
lp_core/shared/include) lp_core/shared/include)
list(APPEND srcs list(APPEND srcs
@@ -27,16 +45,15 @@ if(__ULP_BUILD)
"lp_core/lp_core/lp_core_startup.c" "lp_core/lp_core/lp_core_startup.c"
"lp_core/lp_core/lp_core_pmp.c" "lp_core/lp_core/lp_core_pmp.c"
"lp_core/lp_core/lp_core_utils.c" "lp_core/lp_core/lp_core_utils.c"
"lp_core/lp_core/lp_core_print.c"
"lp_core/lp_core/lp_core_panic.c" "lp_core/lp_core/lp_core_panic.c"
"lp_core/lp_core/lp_core_interrupt.c" "lp_core/lp_core/lp_core_interrupt.c"
"lp_core/shared/ulp_lp_core_lp_uart_shared.c" "lp_core/lp_core/lp_core_ubsan.c"
"lp_core/lp_core/lp_core_uart.c" "lp_core/lp_core/lp_core_mailbox.c"
"lp_core/shared/ulp_lp_core_lp_timer_shared.c"
"lp_core/shared/ulp_lp_core_critical_section_shared.c") "lp_core/shared/ulp_lp_core_critical_section_shared.c")
list(APPEND requires list(APPEND requires
esp_common esp_common
esp_driver_uart
esp_hal_gpio esp_hal_gpio
esp_hal_uart esp_hal_uart
esp_rom esp_rom
@@ -44,12 +61,55 @@ if(__ULP_BUILD)
riscv riscv
soc) soc)
list(APPEND priv_requires list(APPEND priv_requires
esp_hal_clock
esp_hal_i2s
esp_hal_rtc_timer
esp_hal_pmu esp_hal_pmu
esp_hw_support) esp_hw_support)
if(CONFIG_SOC_RTC_TIMER_V2 OR CONFIG_SOC_RTC_TIMER_V3)
list(APPEND srcs "lp_core/shared/ulp_lp_core_lp_timer_shared.c")
list(APPEND priv_requires
esp_hal_clock
esp_hal_rtc_timer)
endif()
if(CONFIG_SOC_LP_CORE_SUPPORT_I2C)
list(APPEND srcs "lp_core/lp_core/lp_core_i2c.c")
list(APPEND requires esp_hal_i2c)
endif()
if(CONFIG_SOC_LP_SPI_SUPPORTED)
list(APPEND srcs "lp_core/lp_core/lp_core_spi.c")
list(APPEND priv_requires esp_hal_gpspi)
endif()
if(CONFIG_SOC_ULP_LP_UART_SUPPORTED)
list(APPEND srcs
"lp_core/shared/ulp_lp_core_lp_uart_shared.c"
"lp_core/lp_core/lp_core_uart.c")
list(APPEND requires esp_driver_uart)
endif()
if(CONFIG_SOC_LP_MAILBOX_SUPPORTED)
list(APPEND srcs "lp_core/lp_core/port/lp_core_mailbox_impl_hw.c")
else()
list(APPEND srcs "lp_core/lp_core/port/lp_core_mailbox_impl_sw.c")
endif()
if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
list(APPEND srcs "lp_core/lp_core/lp_core_touch.c")
list(APPEND requires esp_hal_touch_sens)
endif()
if(CONFIG_SOC_LP_ADC_SUPPORTED)
list(APPEND srcs "lp_core/shared/ulp_lp_core_lp_adc_shared.c")
list(APPEND requires
esp_adc
esp_hal_ana_conv)
endif()
if(CONFIG_SOC_LP_VAD_SUPPORTED)
list(APPEND srcs "lp_core/shared/ulp_lp_core_lp_vad_shared.c")
list(APPEND requires esp_driver_i2s)
endif()
elseif(ULP_TYPE STREQUAL "fsm") elseif(ULP_TYPE STREQUAL "fsm")
list(APPEND includes list(APPEND includes
ulp_common/include ulp_common/include
@@ -57,10 +117,16 @@ if(__ULP_BUILD)
ulp_fsm/include/${target}) ulp_fsm/include/${target})
list(APPEND requires soc) list(APPEND requires soc)
else() else()
message(FATAL_ERROR "__ULP_BUILD requires ULP_TYPE to be one of: riscv, lp_core, fsm.") message(FATAL_ERROR "__ULP_BUILDV2 requires ULP_TYPE to be one of: riscv, lp_core, fsm.")
endif() endif()
else() else()
if(CONFIG_ULP_COPROC_ENABLED) # TODO(IDF-15993): Keep esp_driver_gpio and esp_adc public for compatibility
# with the CMake v1 dependency graph until downstream users are fixed.
list(APPEND requires
esp_adc
esp_driver_gpio)
if(CONFIG_ULP_COPROC_ENABLED OR CONFIG_IDF_DOC_BUILD)
list(APPEND includes list(APPEND includes
ulp_common/include) ulp_common/include)
list(APPEND requires list(APPEND requires
@@ -68,49 +134,127 @@ else()
soc) soc)
endif() endif()
if(CONFIG_ULP_COPROC_TYPE_FSM) if(CONFIG_ULP_COPROC_TYPE_FSM OR (CONFIG_IDF_DOC_BUILD AND CONFIG_SOC_ULP_FSM_SUPPORTED))
list(APPEND includes list(APPEND includes
ulp_fsm/include ulp_fsm/include
ulp_fsm/include/${target}) ulp_fsm/include/${target})
list(APPEND srcs
"ulp_common/ulp_common.c"
"ulp_fsm/ulp.c"
"ulp_fsm/ulp_macro.c")
list(APPEND requires esp_hw_support) list(APPEND requires esp_hw_support)
endif() endif()
if(CONFIG_ULP_COPROC_TYPE_RISCV) if(CONFIG_ULP_COPROC_TYPE_RISCV OR CONFIG_IDF_DOC_BUILD)
list(APPEND includes list(APPEND includes
ulp_riscv/include ulp_riscv/include
ulp_riscv/shared/include ulp_riscv/shared/include
ulp_riscv/ulp_core/include) ulp_riscv/ulp_core/include)
list(APPEND requires esp_hw_support)
endif()
if(CONFIG_ULP_COPROC_TYPE_LP_CORE OR CONFIG_IDF_DOC_BUILD)
list(APPEND includes
lp_core/include
lp_core/lp_core/include
lp_core/shared/include)
endif()
if(CONFIG_ULP_COPROC_TYPE_FSM OR CONFIG_ULP_COPROC_TYPE_RISCV)
list(APPEND srcs list(APPEND srcs
"ulp_common/ulp_common.c" "ulp_common/ulp_common.c"
"ulp_riscv/ulp_riscv.c") "ulp_common/ulp_adc.c")
list(APPEND requires
esp_hw_support if(CONFIG_ULP_COPROC_TYPE_FSM)
esp_hal_pmu) list(APPEND srcs
"ulp_fsm/ulp.c"
"ulp_fsm/ulp_macro.c")
endif()
if(CONFIG_ULP_COPROC_TYPE_RISCV)
list(APPEND srcs
"ulp_riscv/ulp_riscv.c"
"ulp_riscv/ulp_riscv_lock.c"
"ulp_riscv/ulp_riscv_i2c.c")
list(APPEND priv_requires esp_driver_gpio)
list(APPEND requires
# ulp/ulp_riscv/ulp_core/include/ulp_riscv_touch_ulp_core.h
# includes hal/touch_sens_types.h.
esp_hal_touch_sens
esp_hal_i2c
hal)
endif()
endif() endif()
if(CONFIG_ULP_COPROC_TYPE_LP_CORE) if(CONFIG_ULP_COPROC_TYPE_LP_CORE)
list(APPEND includes
lp_core/include
lp_core/lp_core/include
lp_core/shared/include)
list(APPEND srcs list(APPEND srcs
"lp_core/lp_core.c" "lp_core/lp_core.c"
"lp_core/shared/ulp_lp_core_memory_shared.c" "lp_core/shared/ulp_lp_core_memory_shared.c"
"lp_core/shared/ulp_lp_core_lp_timer_shared.c"
"lp_core/shared/ulp_lp_core_critical_section_shared.c") "lp_core/shared/ulp_lp_core_critical_section_shared.c")
list(APPEND requires list(APPEND requires
esp_hw_support esp_common
esp_hal_clock
esp_hal_pmu esp_hal_pmu
esp_hal_rtc_timer
esp_rom esp_rom
hal hal
riscv riscv
soc) soc)
if(CONFIG_SOC_ULP_LP_UART_SUPPORTED)
list(APPEND srcs
"lp_core/lp_core_uart.c"
"lp_core/shared/ulp_lp_core_lp_uart_shared.c")
list(APPEND requires
esp_driver_gpio
esp_driver_uart)
endif()
if(CONFIG_SOC_LP_CORE_SUPPORT_I2C)
list(APPEND srcs "lp_core/lp_core_i2c.c")
list(APPEND requires
esp_driver_gpio
esp_hal_i2c)
endif()
if(CONFIG_SOC_RTC_TIMER_V2 OR CONFIG_SOC_RTC_TIMER_V3)
list(APPEND srcs "lp_core/shared/ulp_lp_core_lp_timer_shared.c")
list(APPEND requires
esp_hal_clock
esp_hal_rtc_timer)
endif()
if(CONFIG_SOC_LP_SPI_SUPPORTED)
list(APPEND srcs "lp_core/lp_core_spi.c")
list(APPEND requires
esp_driver_gpio
esp_hal_gpspi)
endif()
if(CONFIG_SOC_LP_CORE_SUPPORT_ETM)
list(APPEND srcs "lp_core/lp_core_etm.c")
endif()
if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
list(APPEND requires esp_hal_touch_sens)
endif()
if(CONFIG_SOC_LP_ADC_SUPPORTED)
list(APPEND srcs "lp_core/shared/ulp_lp_core_lp_adc_shared.c")
list(APPEND priv_requires esp_hw_support)
endif()
if(CONFIG_SOC_LP_VAD_SUPPORTED)
list(APPEND srcs "lp_core/shared/ulp_lp_core_lp_vad_shared.c")
list(APPEND requires esp_driver_i2s)
endif()
list(APPEND srcs "lp_core/lp_core_mailbox.c")
if(CONFIG_SOC_LP_MAILBOX_SUPPORTED)
list(APPEND srcs "lp_core/lp_core_mailbox_impl_hw.c")
else()
list(APPEND srcs "lp_core/lp_core_mailbox_impl_sw.c")
endif()
endif()
if(srcs)
list(APPEND priv_requires
bootloader_support
esp_mm)
endif() endif()
endif() endif()
@@ -122,14 +266,24 @@ if(priv_requires)
list(REMOVE_DUPLICATES priv_requires) list(REMOVE_DUPLICATES priv_requires)
endif() endif()
set(whole_archive)
if(__ULP_BUILDV2)
# Legacy ULP child builds added the LP-core runtime sources directly to the
# executable. Preserve that behavior so strong handlers such as
# ulp_lp_core_panic_handler are not dropped in favor of weak defaults from
# other runtime objects.
set(whole_archive WHOLE_ARCHIVE)
endif()
idf_component_register(SRCS ${srcs} idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes} INCLUDE_DIRS ${includes}
REQUIRES ${requires} REQUIRES ${requires}
PRIV_REQUIRES ${priv_requires}) PRIV_REQUIRES ${priv_requires}
${whole_archive})
# In the parent app build, the ulp component only provides the host-side API. # In the parent app build, the ulp component only provides the host-side API.
# The executable/linker setup below is for native ULP child projects. # The executable/linker setup below is for native ULP child projects.
if(NOT __ULP_BUILD) if(NOT __ULP_BUILDV2)
idf_define_esp_err_codes(HEADERS ulp_fsm/include/ulp_fsm_common.h) idf_define_esp_err_codes(HEADERS ulp_fsm/include/ulp_fsm_common.h)
return() return()
endif() endif()
+5
View File
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
if(IDF_BUILD_V2)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists_v2.txt)
return()
endif()
include(${IDF_PATH}/tools/cmake/idf.cmake) include(${IDF_PATH}/tools/cmake/idf.cmake)
project(${ULP_APP_NAME}) project(${ULP_APP_NAME})
add_executable(${ULP_APP_NAME}) add_executable(${ULP_APP_NAME})
+69
View File
@@ -0,0 +1,69 @@
# CMake v2 default ULP project for ulp_embed_binary() callers. The ULP runtime
# is built from the ulp component graph, and the legacy source list is attached
# directly to the executable, matching the CMake v1 link semantics.
include(${CMAKE_CURRENT_LIST_DIR}/ulp_project.cmake)
if("${ULP_TYPE}" STREQUAL "fsm")
project(${ULP_APP_NAME} ASM)
else()
project(${ULP_APP_NAME} C CXX ASM)
endif()
ulp_project_init()
# A single executable is built, so DEFERRED optional-requires resolution is
# safe and keeps the linked component set minimal.
idf_build_set_property(IDF_COMPONENT_OPTIONAL_REQUIRES_MODE DEFERRED)
# CMake v1 linked the ulp_embed_binary() call-site sources before the ULP runtime.
# In CMake v2 the runtime's WHOLE_ARCHIVE is emitted as a link option, before
# executable objects, so attaching these sources directly would reverse that
# order. Keep them in a separate archive that can be placed before the runtime,
# preserving legacy code placement and strong-over-weak symbol resolution.
function(__ulp_embed_binary_add_legacy_sources executable)
set(legacy_sources_lib "${executable}_legacy_sources")
add_library(${legacy_sources_lib} STATIC ${ULP_S_SOURCES})
target_link_libraries(${legacy_sources_lib} PRIVATE "library_${executable}")
if(ADD_PICOLIBC_SPECS)
target_compile_options(${legacy_sources_lib} PRIVATE $<$<COMPILE_LANG_AND_ID:C,GNU>:-specs=picolibc.specs>)
target_compile_options(${legacy_sources_lib} PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,GNU>:-specs=picolibcpp.specs>)
endif()
if(ULP_PARENT_SDKCONFIG_HEADER)
# Legacy ulp_embed_binary() sources are authored against the parent app's
# sdkconfig, including project-local Kconfig.projbuild symbols.
get_filename_component(parent_sdkconfig_dir "${ULP_PARENT_SDKCONFIG_HEADER}" DIRECTORY)
target_include_directories(${legacy_sources_lib} BEFORE PRIVATE "${parent_sdkconfig_dir}")
endif()
if(COMPONENT_INCLUDES)
target_include_directories(${legacy_sources_lib} PRIVATE ${COMPONENT_INCLUDES})
endif()
# CMake v1 exposed COMPONENT_DIR only to the FSM assembly preprocessing, not to
# the compilation of ULP C sources. The v2 FSM toolchain preprocesses inside
# the compile rule, which takes its include flags from the target, so keep the
# directory on the target for FSM builds only.
if(BUILD_FSM AND COMPONENT_DIR)
target_include_directories(${legacy_sources_lib} PRIVATE ${COMPONENT_DIR})
endif()
__idf_build_link_whole_archive(${executable} PRIVATE ${legacy_sources_lib} BEFORE)
endfunction()
set(executable_args COMPONENTS ulp)
if(NOT BUILD_FSM)
list(APPEND executable_args MAPFILE_TARGET ${ULP_APP_NAME}_mapfile)
endif()
ulp_build_executable(${ULP_APP_NAME} ${executable_args})
__ulp_embed_binary_add_legacy_sources(${ULP_APP_NAME})
if(DEFINED ULP_VAR_PREFIX AND NOT "${ULP_VAR_PREFIX}" STREQUAL "")
ulp_build_binary(${ULP_APP_NAME} PREFIX ${ULP_VAR_PREFIX})
else()
ulp_build_binary(${ULP_APP_NAME})
endif()
idf_build_generate_metadata(EXECUTABLE ${ULP_APP_NAME})
if(TARGET "${ULP_APP_NAME}_mapfile")
idf_create_size_report("${ULP_APP_NAME}_mapfile" TARGET size)
endif()
idf_build_generate_depgraph("${ULP_APP_NAME}")
+8
View File
@@ -9,6 +9,14 @@
include(${IDF_PATH}/tools/cmakev2/idf.cmake) include(${IDF_PATH}/tools/cmakev2/idf.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/IDFULPProjectCommon.cmake) include(${CMAKE_CURRENT_LIST_DIR}/IDFULPProjectCommon.cmake)
# __ULP_BUILDV2 is only set by the IDF_BUILD_V2 ULP child path for now.
if(__ULP_BUILDV2)
set(NON_OS_BUILD 1)
# Clearing common components below only prevents automatic app-component closure.
# Explicitly included ULP dependencies still read NON_OS_BUILD to select their no-OS shape.
idf_build_set_property(NON_OS_BUILD 1)
endif()
# Reset the compile/link state inherited from the parent app build and select # Reset the compile/link state inherited from the parent app build and select
# ULP-specific build behavior. Idempotent within a child configure. # ULP-specific build behavior. Idempotent within a child configure.
function(__ulp_prepare_build) function(__ulp_prepare_build)
+25 -7
View File
@@ -1,4 +1,4 @@
if(IDF_BUILD_V2 AND __ULP_BUILD) if(IDF_BUILD_V2 AND __ULP_BUILDV2)
return() return()
endif() endif()
@@ -131,11 +131,15 @@ function(__setup_ulp_project app_name project_path prefix prefix_append_bin_name
# subprojects). Do not warn about the ones a given child ignores. # subprojects). Do not warn about the ones a given child ignores.
--no-warn-unused-cli --no-warn-unused-cli
-DIDF_DEFAULT_PROJECT_NAME=${app_name} -DIDF_DEFAULT_PROJECT_NAME=${app_name}
-DULP_APP_NAME=${app_name}
-DIDF_BUILD_V2=y -DIDF_BUILD_V2=y
# Internal marker for the ULP child project component graph. -DCMAKE_MODULE_PATH=${ulp_cmake_dir}
-D__ULP_BUILD=1 # Internal marker for ULP child component graphs. Only the
# IDF_BUILD_V2 path sets it for now.
-D__ULP_BUILDV2=1
-DIDF_PARENT_BUILD_DIR=${build_dir} -DIDF_PARENT_BUILD_DIR=${build_dir}
-DULP_PREFIX_APPEND_BIN_NAME=${prefix_append_bin_name} -DULP_PREFIX_APPEND_BIN_NAME=${prefix_append_bin_name}
-DULP_PARENT_SDKCONFIG_HEADER=${SDKCONFIG_HEADER}
-DSDKCONFIG=${sdkconfig} -DSDKCONFIG=${sdkconfig}
-DSDKCONFIG_HEADER=${SDKCONFIG_HEADER} -DSDKCONFIG_HEADER=${SDKCONFIG_HEADER}
-DSDKCONFIG_CMAKE=${SDKCONFIG_CMAKE} -DSDKCONFIG_CMAKE=${SDKCONFIG_CMAKE}
@@ -196,10 +200,24 @@ function(__setup_ulp_project app_name project_path prefix prefix_append_bin_name
BUILD_ALWAYS 1 BUILD_ALWAYS 1
) )
# Only the CMake v1 path reads this property when passing ULP_S_SOURCES if(IDF_BUILD_V2)
# to the child project. Leaving it set for v2 is harmless and keeps the foreach(binary_name IN LISTS binary_names)
# post-ExternalProject artifact wiring common. Can be dropped when set(ulp_compat_dir "${CMAKE_CURRENT_BINARY_DIR}/${binary_name}")
# v1 support is dropped. foreach(extension IN ITEMS bin ld h map sym elf)
set(ulp_compat_artifact "${ulp_compat_dir}/${binary_name}.${extension}")
set(ulp_source_artifact "${ulp_binary_dir}/${binary_name}.${extension}")
add_custom_command(OUTPUT "${ulp_compat_artifact}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${ulp_compat_dir}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${ulp_source_artifact}" "${ulp_compat_artifact}"
DEPENDS "${ulp_source_artifact}"
VERBATIM)
endforeach()
endforeach()
endif()
# Both build system versions pass ULP_S_SOURCES to the child project
# through this property; see the generator expression above.
set_property(TARGET ${app_name} PROPERTY ULP_SOURCES "${sources}") set_property(TARGET ${app_name} PROPERTY ULP_SOURCES "${sources}")
spaces2list(exp_dep_srcs) spaces2list(exp_dep_srcs)
@@ -1,12 +1,6 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps # Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
.ulp_legacy_buildv2_disable: &ulp_legacy_buildv2_disable
if: IDF_BUILD_V2 == "1"
reason: Legacy ULP apps are covered by CMake v1; buildv2 covers full_subproject ULP apps.
components/ulp/test_apps/lp_core/lp_core_basic_tests: components/ulp/test_apps/lp_core/lp_core_basic_tests:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: SOC_LP_CORE_SUPPORTED != 1 - if: SOC_LP_CORE_SUPPORTED != 1
- if: CONFIG_NAME == "xtal" and SOC_CLK_LP_FAST_SUPPORT_XTAL != 1 - if: CONFIG_NAME == "xtal" and SOC_CLK_LP_FAST_SUPPORT_XTAL != 1
@@ -26,8 +20,6 @@ components/ulp/test_apps/lp_core/lp_core_basic_tests:
components/ulp/test_apps/lp_core/lp_core_gpio_wakeup_tests: components/ulp/test_apps/lp_core/lp_core_gpio_wakeup_tests:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: (SOC_LP_CORE_SUPPORTED == 1) and (SOC_RTCIO_PIN_COUNT > 0) and (SOC_DEEP_SLEEP_SUPPORTED == 1) and (SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED == 1) - if: (SOC_LP_CORE_SUPPORTED == 1) and (SOC_RTCIO_PIN_COUNT > 0) and (SOC_DEEP_SLEEP_SUPPORTED == 1) and (SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED == 1)
depends_components: depends_components:
@@ -39,8 +31,6 @@ components/ulp/test_apps/lp_core/lp_core_gpio_wakeup_tests:
components/ulp/test_apps/lp_core/lp_core_hp_mem: components/ulp/test_apps/lp_core/lp_core_hp_mem:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: SOC_LP_CORE_SUPPORTED != 1 - if: SOC_LP_CORE_SUPPORTED != 1
depends_components: depends_components:
@@ -51,8 +41,6 @@ components/ulp/test_apps/lp_core/lp_core_hp_mem:
components/ulp/test_apps/lp_core/lp_core_hp_uart: components/ulp/test_apps/lp_core/lp_core_hp_uart:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: SOC_LP_CORE_SUPPORTED != 1 - if: SOC_LP_CORE_SUPPORTED != 1
depends_components: depends_components:
@@ -63,8 +51,6 @@ components/ulp/test_apps/lp_core/lp_core_hp_uart:
components/ulp/test_apps/ulp_fsm: components/ulp/test_apps/ulp_fsm:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_ULP_FSM_SUPPORTED == 1 - if: SOC_ULP_FSM_SUPPORTED == 1
depends_components: depends_components:
@@ -75,8 +61,6 @@ components/ulp/test_apps/ulp_fsm:
components/ulp/test_apps/ulp_riscv: components/ulp/test_apps/ulp_riscv:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: SOC_RISCV_COPROC_SUPPORTED != 1 - if: SOC_RISCV_COPROC_SUPPORTED != 1
depends_components: depends_components:
@@ -72,7 +72,7 @@ idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "lp_core" INCLUDE_DIRS "lp_core"
REQUIRES ulp unity esp_timer test_utils REQUIRES ulp unity esp_timer test_utils
PRIV_REQUIRES esp_driver_gptimer esp_driver_i2c esp_driver_tsens esp_hal_rtc_timer PRIV_REQUIRES esp_driver_gptimer esp_driver_i2c esp_driver_tsens esp_hal_rtc_timer
esp_driver_gpio hal esp_driver_gpio esp_hal_pmu hal
WHOLE_ARCHIVE WHOLE_ARCHIVE
EMBED_FILES "test_vad_8k.pcm") EMBED_FILES "test_vad_8k.pcm")
-58
View File
@@ -6,20 +6,12 @@
- esp_hw_support - esp_hw_support
- esp_hal_pmu - esp_hal_pmu
.ulp_legacy_buildv2_disable: &ulp_legacy_buildv2_disable
if: IDF_BUILD_V2 == "1"
reason: Legacy ULP apps are covered by CMake v1; buildv2 covers full_subproject ULP apps.
examples/system/ulp/lp_core/build_system: examples/system/ulp/lp_core/build_system:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_CORE_SUPPORTED == 1 - if: SOC_LP_CORE_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/lp_core/debugging: examples/system/ulp/lp_core/debugging:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_CORE_SUPPORTED == 1 - if: SOC_LP_CORE_SUPPORTED == 1
disable_test: disable_test:
@@ -29,8 +21,6 @@ examples/system/ulp/lp_core/debugging:
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/lp_core/gpio: examples/system/ulp/lp_core/gpio:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: SOC_DEEP_SLEEP_SUPPORTED != 1 - if: SOC_DEEP_SLEEP_SUPPORTED != 1
enable: enable:
@@ -40,8 +30,6 @@ examples/system/ulp/lp_core/gpio:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/lp_core/gpio_intr_pulse_counter: examples/system/ulp/lp_core/gpio_intr_pulse_counter:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: (SOC_LP_CORE_SUPPORTED == 1) and (SOC_ULP_LP_UART_SUPPORTED == 1 and SOC_DEEP_SLEEP_SUPPORTED == 1) - if: (SOC_LP_CORE_SUPPORTED == 1) and (SOC_ULP_LP_UART_SUPPORTED == 1 and SOC_DEEP_SLEEP_SUPPORTED == 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -49,8 +37,6 @@ examples/system/ulp/lp_core/gpio_intr_pulse_counter:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/lp_core/gpio_wakeup: examples/system/ulp/lp_core/gpio_wakeup:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: (SOC_LP_CORE_SUPPORTED == 1) and (SOC_RTCIO_PIN_COUNT > 0) and (SOC_DEEP_SLEEP_SUPPORTED == 1) and (SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED == 1) # TODO: [ESP32S31] IDF-15884 SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED not declared yet - if: (SOC_LP_CORE_SUPPORTED == 1) and (SOC_RTCIO_PIN_COUNT > 0) and (SOC_DEEP_SLEEP_SUPPORTED == 1) and (SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED == 1) # TODO: [ESP32S31] IDF-15884 SOC_RTC_GPIO_EDGE_WAKEUP_SUPPORTED not declared yet
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -59,22 +45,16 @@ examples/system/ulp/lp_core/gpio_wakeup:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/lp_core/inter_cpu_critical_section/: examples/system/ulp/lp_core/inter_cpu_critical_section/:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_CORE_SUPPORTED == 1 - if: SOC_LP_CORE_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/lp_core/interrupt: examples/system/ulp/lp_core/interrupt:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_CORE_SUPPORTED == 1 - if: SOC_LP_CORE_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/lp_core/lp_adc: examples/system/ulp/lp_core/lp_adc:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: (SOC_LP_ADC_SUPPORTED != 1) - if: (SOC_LP_ADC_SUPPORTED != 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -84,8 +64,6 @@ examples/system/ulp/lp_core/lp_adc:
- esp_hal_uart - esp_hal_uart
examples/system/ulp/lp_core/lp_i2c: examples/system/ulp/lp_core/lp_i2c:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_CORE_SUPPORT_I2C == 1 and (SOC_DEEP_SLEEP_SUPPORTED == 1 and SOC_LP_CORE_SUPPORTED == 1) - if: SOC_LP_CORE_SUPPORT_I2C == 1 and (SOC_DEEP_SLEEP_SUPPORTED == 1 and SOC_LP_CORE_SUPPORTED == 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -93,15 +71,11 @@ examples/system/ulp/lp_core/lp_i2c:
- esp_hal_i2c - esp_hal_i2c
examples/system/ulp/lp_core/lp_mailbox: examples/system/ulp/lp_core/lp_mailbox:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_CORE_SUPPORTED == 1 - if: SOC_LP_CORE_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/lp_core/lp_spi: examples/system/ulp/lp_core/lp_spi:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_LP_SPI_SUPPORTED == 1 and SOC_DEEP_SLEEP_SUPPORTED == 1 - if: SOC_LP_SPI_SUPPORTED == 1 and SOC_DEEP_SLEEP_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -109,15 +83,11 @@ examples/system/ulp/lp_core/lp_spi:
- esp_hal_gpspi - esp_hal_gpspi
examples/system/ulp/lp_core/lp_timer_interrupt: examples/system/ulp/lp_core/lp_timer_interrupt:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: (SOC_LP_CORE_SUPPORTED != 1) or (SOC_LP_TIMER_SUPPORTED != 1) - if: (SOC_LP_CORE_SUPPORTED != 1) or (SOC_LP_TIMER_SUPPORTED != 1)
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/lp_core/lp_touch: examples/system/ulp/lp_core/lp_touch:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_TOUCH_SENSOR_SUPPORTED == 1 and (SOC_DEEP_SLEEP_SUPPORTED == 1 and SOC_LP_CORE_SUPPORTED == 1) - if: SOC_TOUCH_SENSOR_SUPPORTED == 1 and (SOC_DEEP_SLEEP_SUPPORTED == 1 and SOC_LP_CORE_SUPPORTED == 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -126,8 +96,6 @@ examples/system/ulp/lp_core/lp_touch:
- esp_hal_touch_sens - esp_hal_touch_sens
examples/system/ulp/lp_core/lp_uart/lp_uart_char_seq_wakeup: examples/system/ulp/lp_core/lp_uart/lp_uart_char_seq_wakeup:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: (SOC_ULP_LP_UART_SUPPORTED != 1) or (SOC_DEEP_SLEEP_SUPPORTED != 1) - if: (SOC_ULP_LP_UART_SUPPORTED != 1) or (SOC_DEEP_SLEEP_SUPPORTED != 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -135,8 +103,6 @@ examples/system/ulp/lp_core/lp_uart/lp_uart_char_seq_wakeup:
- esp_hal_uart - esp_hal_uart
examples/system/ulp/lp_core/lp_uart/lp_uart_echo: examples/system/ulp/lp_core/lp_uart/lp_uart_echo:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: (SOC_ULP_LP_UART_SUPPORTED != 1) or (SOC_DEEP_SLEEP_SUPPORTED != 1) - if: (SOC_ULP_LP_UART_SUPPORTED != 1) or (SOC_DEEP_SLEEP_SUPPORTED != 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -144,8 +110,6 @@ examples/system/ulp/lp_core/lp_uart/lp_uart_echo:
- esp_hal_uart - esp_hal_uart
examples/system/ulp/lp_core/lp_uart/lp_uart_print: examples/system/ulp/lp_core/lp_uart/lp_uart_print:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: (SOC_ULP_LP_UART_SUPPORTED != 1) or (SOC_DEEP_SLEEP_SUPPORTED != 1) - if: (SOC_ULP_LP_UART_SUPPORTED != 1) or (SOC_DEEP_SLEEP_SUPPORTED != 1)
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -153,15 +117,11 @@ examples/system/ulp/lp_core/lp_uart/lp_uart_print:
- esp_hal_uart - esp_hal_uart
examples/system/ulp/ulp_fsm/ulp: examples/system/ulp/ulp_fsm/ulp:
disable+:
- *ulp_legacy_buildv2_disable
disable: disable:
- if: SOC_ULP_FSM_SUPPORTED != 1 - if: SOC_ULP_FSM_SUPPORTED != 1
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/ulp_fsm/ulp_adc: examples/system/ulp/ulp_fsm/ulp_adc:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: IDF_TARGET in ["esp32", "esp32s3"] - if: IDF_TARGET in ["esp32", "esp32s3"]
temporary: true temporary: true
@@ -172,8 +132,6 @@ examples/system/ulp/ulp_fsm/ulp_adc:
- esp_hal_ana_conv - esp_hal_ana_conv
examples/system/ulp/ulp_riscv/adc: examples/system/ulp/ulp_riscv/adc:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -182,8 +140,6 @@ examples/system/ulp/ulp_riscv/adc:
- esp_hal_ana_conv - esp_hal_ana_conv
examples/system/ulp/ulp_riscv/ds18b20_onewire: examples/system/ulp/ulp_riscv/ds18b20_onewire:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: IDF_TARGET == "esp32s2" - if: IDF_TARGET == "esp32s2"
temporary: true temporary: true
@@ -193,8 +149,6 @@ examples/system/ulp/ulp_riscv/ds18b20_onewire:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/ulp_riscv/gpio: examples/system/ulp/ulp_riscv/gpio:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -202,8 +156,6 @@ examples/system/ulp/ulp_riscv/gpio:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/ulp_riscv/gpio_interrupt: examples/system/ulp/ulp_riscv/gpio_interrupt:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -212,8 +164,6 @@ examples/system/ulp/ulp_riscv/gpio_interrupt:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/ulp_riscv/gpio_pulse_counter: examples/system/ulp/ulp_riscv/gpio_pulse_counter:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -221,8 +171,6 @@ examples/system/ulp/ulp_riscv/gpio_pulse_counter:
- esp_hal_gpio - esp_hal_gpio
examples/system/ulp/ulp_riscv/i2c: examples/system/ulp/ulp_riscv/i2c:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -230,15 +178,11 @@ examples/system/ulp/ulp_riscv/i2c:
- esp_hal_i2c - esp_hal_i2c
examples/system/ulp/ulp_riscv/interrupts: examples/system/ulp/ulp_riscv/interrupts:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
examples/system/ulp/ulp_riscv/touch: examples/system/ulp/ulp_riscv/touch:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -247,8 +191,6 @@ examples/system/ulp/ulp_riscv/touch:
- esp_hal_touch_sens - esp_hal_touch_sens
examples/system/ulp/ulp_riscv/uart_print: examples/system/ulp/ulp_riscv/uart_print:
disable:
- *ulp_legacy_buildv2_disable
enable: enable:
- if: SOC_RISCV_COPROC_SUPPORTED == 1 - if: SOC_RISCV_COPROC_SUPPORTED == 1
<<: *ulp_default_depends <<: *ulp_default_depends
@@ -30,8 +30,16 @@ ulp_add_build_binary_targets(${ULP_APP_NAME})
# Therefore '-Os' can be overridden here with '-O0' for this example for convenient debugging. # Therefore '-Os' can be overridden here with '-O0' for this example for convenient debugging.
target_compile_options(${ULP_APP_NAME} PRIVATE -fsanitize=undefined -fno-sanitize=shift-base) target_compile_options(${ULP_APP_NAME} PRIVATE -fsanitize=undefined -fno-sanitize=shift-base)
if(IDF_PARENT_BUILD_DIR)
set(ulp_gdbinit_dir "${IDF_PARENT_BUILD_DIR}/gdbinit")
else()
set(ulp_gdbinit_dir "$<TARGET_FILE_DIR:${ULP_APP_NAME}>/../../../gdbinit")
endif()
add_custom_command( add_custom_command(
TARGET ${ULP_APP_NAME} POST_BUILD TARGET ${ULP_APP_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
${ulp_gdbinit_dir}
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${ULP_APP_NAME}> COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${ULP_APP_NAME}>
$<TARGET_FILE_DIR:${ULP_APP_NAME}>/../../../gdbinit/$<TARGET_FILE_NAME:${ULP_APP_NAME}> ${ulp_gdbinit_dir}/$<TARGET_FILE_NAME:${ULP_APP_NAME}>
) )
@@ -1,7 +1,4 @@
examples/system/ulp/ulp_fsm_riscv_combined/counter: examples/system/ulp/ulp_fsm_riscv_combined/counter:
disable:
- if: IDF_BUILD_V2 == "1"
reason: Legacy ULP apps are covered by CMake v1; buildv2 covers full_subproject ULP apps.
enable: enable:
- if: SOC_ULP_FSM_SUPPORTED == 1 and SOC_RISCV_COPROC_SUPPORTED == 1 and IDF_TARGET in ["esp32s2", "esp32s3"] - if: SOC_ULP_FSM_SUPPORTED == 1 and SOC_RISCV_COPROC_SUPPORTED == 1 and IDF_TARGET in ["esp32s2", "esp32s3"]
temporary: false temporary: false
@@ -1,5 +1,6 @@
idf_component_register(SRCS "ulp_fsm_riscv_combined_main.c" idf_component_register(SRCS "ulp_fsm_riscv_combined_main.c"
INCLUDE_DIRS "") INCLUDE_DIRS ""
REQUIRES ulp)
# #
# ULP FSM support additions to component CMakeLists.txt. # ULP FSM support additions to component CMakeLists.txt.
@@ -6,8 +6,8 @@ The buildv2 build child pipeline is generated by ``idf-ci gitlab build-child-pip
from the same manifest as the default pipeline. This script post-processes that from the same manifest as the default pipeline. This script post-processes that
generated YAML so the cmakev2 path is exercised end to end: generated YAML so the cmakev2 path is exercised end to end:
1. Point child build jobs at the buildv2 generator artifacts, then inject 1. Inject ``IDF_BUILD_V2`` into each child build job so cmake activates the
``IDF_BUILD_V2`` so cmake activates the cmakev2 shim. cmakev2 shim.
2. Inject ``PIPELINE_COMMIT_SHA: ${PIPELINE_COMMIT_SHA}_buildv2`` into each child 2. Inject ``PIPELINE_COMMIT_SHA: ${PIPELINE_COMMIT_SHA}_buildv2`` into each child
build job. idf-ci reads ``PIPELINE_COMMIT_SHA`` when computing the s3 build job. idf-ci reads ``PIPELINE_COMMIT_SHA`` when computing the s3
@@ -27,13 +27,6 @@ import argparse
import yaml import yaml
PIPELINE_COMMIT_SHA_V2 = '${PIPELINE_COMMIT_SHA}_buildv2' PIPELINE_COMMIT_SHA_V2 = '${PIPELINE_COMMIT_SHA}_buildv2'
BUILDV2_GENERATOR_JOB = 'generate_build_child_pipeline_buildv2'
def _use_buildv2_generator_artifacts(job: dict) -> None:
for need in job.get('needs', []):
if isinstance(need, dict) and need.get('job') == 'generate_build_child_pipeline':
need['job'] = BUILDV2_GENERATOR_JOB
def patch(path: str) -> None: def patch(path: str) -> None:
@@ -43,7 +36,6 @@ def patch(path: str) -> None:
injected = [] injected = []
for k, v in d.items(): for k, v in d.items():
if isinstance(v, dict) and 'extends' in v: if isinstance(v, dict) and 'extends' in v:
_use_buildv2_generator_artifacts(v)
v.setdefault('variables', {})['IDF_BUILD_V2'] = '1' v.setdefault('variables', {})['IDF_BUILD_V2'] = '1'
v['variables']['PIPELINE_COMMIT_SHA'] = PIPELINE_COMMIT_SHA_V2 v['variables']['PIPELINE_COMMIT_SHA'] = PIPELINE_COMMIT_SHA_V2
injected.append(k) injected.append(k)
+25 -1
View File
@@ -39,7 +39,12 @@ function(idf_build_set_property property value)
cmake_parse_arguments(ARG "${options}" "${one_value}" "${multi_value}" ${ARGN}) cmake_parse_arguments(ARG "${options}" "${one_value}" "${multi_value}" ${ARGN})
if("${property}" STREQUAL MINIMAL_BUILD) if("${property}" STREQUAL MINIMAL_BUILD)
idf_warn("Build property 'MINIMAL_BUILD' is obsolete and will be ignored") # TODO: Remove this MINIMAL_BUILD compatibility block once CMake v1 is fully deprecated.
# V1 compatibility shims may still set MINIMAL_BUILD; warn only for native CMake v2 projects.
idf_build_get_property(_v1_compat __V1_COMPAT_SHIM)
if(NOT _v1_compat)
idf_warn("Build property 'MINIMAL_BUILD' is obsolete and will be ignored")
endif()
endif() endif()
set(append) set(append)
@@ -293,6 +298,25 @@ function(__dump_library_properties libraries)
endforeach() endforeach()
endfunction() endfunction()
function(__idf_build_link_whole_archive target scope library)
idf_build_get_property(linker_type LINKER_TYPE)
if(linker_type STREQUAL "GNU")
set(link_option "SHELL:-Wl,--whole-archive $<TARGET_FILE:${library}> -Wl,--no-whole-archive")
elseif(linker_type STREQUAL "Darwin")
set(link_option "SHELL:-Wl,-force_load $<TARGET_FILE:${library}>")
elseif(linker_type STREQUAL "ULP_FSM")
set(link_option "SHELL:--whole-archive $<TARGET_FILE:${library}> --no-whole-archive")
else()
target_link_libraries(${target} ${scope} ${library})
return()
endif()
# ARGN may contain BEFORE to place the archive ahead of existing link options.
# Also link the target normally so CMake tracks its build and relink dependencies.
target_link_options(${target} ${ARGN} ${scope} "${link_option}")
target_link_libraries(${target} ${scope} ${library})
endfunction()
#[[api #[[api
.. cmakev2:function:: idf_build_library .. cmakev2:function:: idf_build_library
+5 -1
View File
@@ -193,7 +193,7 @@ endfunction()
with the ``PROCESS`` option, it is logical to provide only a single with the ``PROCESS`` option, it is logical to provide only a single
``scriptfile`` as a template. ``scriptfile`` as a template.
#]] #]]
function(target_linker_script target deptype scriptfiles) function(target_linker_script target deptype)
# The linker script files, templates, and their output filenames are stored # The linker script files, templates, and their output filenames are stored
# only as component properties. The script files are generated and added to # only as component properties. The script files are generated and added to
# the library link interface in the idf_build_library function. # the library link interface in the idf_build_library function.
@@ -201,6 +201,10 @@ function(target_linker_script target deptype scriptfiles)
set(one_value PROCESS FLAGS) set(one_value PROCESS FLAGS)
set(multi_value) set(multi_value)
cmake_parse_arguments(ARG "${options}" "${one_value}" "${multi_value}" ${ARGN}) cmake_parse_arguments(ARG "${options}" "${one_value}" "${multi_value}" ${ARGN})
set(scriptfiles ${ARG_UNPARSED_ARGUMENTS})
if(NOT scriptfiles)
message(FATAL_ERROR "target_linker_script requires at least one linker script file")
endif()
foreach(scriptfile ${scriptfiles}) foreach(scriptfile ${scriptfiles})
get_filename_component(scriptfile "${scriptfile}" ABSOLUTE) get_filename_component(scriptfile "${scriptfile}" ABSOLUTE)
idf_msg("Adding linker script ${scriptfile}") idf_msg("Adding linker script ${scriptfile}")
+1 -10
View File
@@ -1102,16 +1102,7 @@ function(idf_component_include name)
elseif("${component_real_target_type}" STREQUAL "STATIC_LIBRARY") elseif("${component_real_target_type}" STREQUAL "STATIC_LIBRARY")
idf_component_get_property(whole_archive "${component_name}" WHOLE_ARCHIVE) idf_component_get_property(whole_archive "${component_name}" WHOLE_ARCHIVE)
if(whole_archive) if(whole_archive)
idf_build_get_property(linker_type LINKER_TYPE) __idf_build_link_whole_archive("${component_interface}" INTERFACE "${component_real_target}")
if(linker_type STREQUAL "GNU")
target_link_options("${component_interface}" INTERFACE
"SHELL:-Wl,--whole-archive $<TARGET_FILE:${component_real_target}> -Wl,--no-whole-archive")
target_link_libraries("${component_interface}" INTERFACE "${component_real_target}")
elseif(linker_type STREQUAL "Darwin")
target_link_options("${component_interface}" INTERFACE
"SHELL:-Wl,-force_load $<TARGET_FILE:${component_real_target}>")
target_link_libraries("${component_interface}" INTERFACE "${component_real_target}")
endif()
else() else()
target_link_libraries("${component_interface}" INTERFACE "${component_real_target}") target_link_libraries("${component_interface}" INTERFACE "${component_real_target}")
endif() endif()
@@ -194,9 +194,6 @@ tools/test_apps/system/ram_loadable_app:
reason: cannot pass # TODO: IDF-15525 reason: cannot pass # TODO: IDF-15525
tools/test_apps/system/rtc_mem_reserve: tools/test_apps/system/rtc_mem_reserve:
disable:
- if: IDF_BUILD_V2 == "1"
reason: Legacy ULP apps are covered by CMake v1; buildv2 covers full_subproject ULP apps.
enable: enable:
- if: IDF_TARGET in ["esp32p4"] - if: IDF_TARGET in ["esp32p4"]
reason: only P4 has a potential conflict due to using rtc mem for lp rom data/stack reason: only P4 has a potential conflict due to using rtc mem for lp rom data/stack
+189
View File
@@ -1,11 +1,200 @@
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import hashlib
import os
import subprocess
from pathlib import Path from pathlib import Path
import pytest import pytest
from test_build_system_helpers import IdfPyFunc from test_build_system_helpers import IdfPyFunc
from test_build_system_helpers import replace_in_file from test_build_system_helpers import replace_in_file
FULL_PROJECT_APIS = (
'ulp_project_init',
'ulp_project_default',
'ulp_build_executable',
)
LEGACY_PROJECT_APIS = (
'ulp_apply_default_options',
'ulp_apply_default_sources',
)
ALL_APIS = FULL_PROJECT_APIS + LEGACY_PROJECT_APIS
def _cmake_path(path: Path) -> str:
return path.resolve().as_posix()
def _write_api_probe_project(project_dir: Path, entry_point: str, add_native_executable: bool) -> None:
native_executable = 'add_executable(${ULP_APP_NAME} main.c)' if add_native_executable else ''
if entry_point.endswith('ulp_project.cmake'):
pre_project_include = f'include({entry_point})'
post_project_include = ''
else:
pre_project_include = ''
post_project_include = f'include({entry_point})'
(project_dir / 'sdkconfig.h').write_text('', encoding='utf-8')
(project_dir / 'main.c').write_text('int main(void) { return 0; }\n', encoding='utf-8')
(project_dir / 'sdkconfig.cmake').write_text(
'\n'.join(
(
'set(CONFIG_ULP_COPROC_ENABLED y)',
'set(CONFIG_ULP_COPROC_TYPE_LP_CORE y)',
'',
)
),
encoding='utf-8',
)
(project_dir / 'CMakeLists.txt').write_text(
f"""
cmake_minimum_required(VERSION 3.22)
{pre_project_include}
project(ulp_api_probe C CXX ASM)
{native_executable}
{post_project_include}
set(api_commands_file "${{CMAKE_BINARY_DIR}}/api_commands.txt")
file(WRITE "${{api_commands_file}}" "")
foreach(name IN ITEMS {' '.join(ALL_APIS)})
if(COMMAND ${{name}})
file(APPEND "${{api_commands_file}}" "${{name}}=1\\n")
else()
file(APPEND "${{api_commands_file}}" "${{name}}=0\\n")
endif()
endforeach()
""",
encoding='utf-8',
)
def _read_api_commands(commands_file: Path) -> dict[str, bool]:
return {
name: value == '1'
for name, value in (line.split('=', 1) for line in commands_file.read_text(encoding='utf-8').splitlines())
}
def _sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
@pytest.mark.parametrize(
'entry_point,add_native_executable,expected_available,expected_unavailable',
(
(
'${IDF_PATH}/components/ulp/cmake/ulp_project.cmake',
False,
FULL_PROJECT_APIS,
LEGACY_PROJECT_APIS,
),
(
'IDFULPProject',
True,
LEGACY_PROJECT_APIS,
FULL_PROJECT_APIS,
),
),
ids=('full_project_entry_point', 'legacy_project_entry_point'),
)
def test_ulp_cmake_api_availability(
tmp_path: Path,
entry_point: str,
add_native_executable: bool,
expected_available: tuple[str, ...],
expected_unavailable: tuple[str, ...],
) -> None:
# Full ULP subprojects and legacy ULP child projects intentionally expose
# different CMake API surfaces. Configure a minimal child project through
# each entry point and verify that only the expected commands exist.
idf_path = Path(os.environ['IDF_PATH'])
project_dir = tmp_path / 'project'
build_dir = tmp_path / 'build'
project_dir.mkdir()
_write_api_probe_project(project_dir, entry_point, add_native_executable)
ulp_cmake_dir = idf_path / 'components' / 'ulp' / 'cmake'
cmake_args = (
'cmake',
'-G',
'Ninja',
'-S',
_cmake_path(project_dir),
'-B',
_cmake_path(build_dir),
f'-DCMAKE_MODULE_PATH={_cmake_path(ulp_cmake_dir)}',
f'-DCMAKE_TOOLCHAIN_FILE={_cmake_path(ulp_cmake_dir / "toolchain-lp-core-riscv.cmake")}',
f'-DIDF_PATH={_cmake_path(idf_path)}',
'-DIDF_TARGET=esp32c6',
f'-DSDKCONFIG_CMAKE={_cmake_path(project_dir / "sdkconfig.cmake")}',
f'-DSDKCONFIG_HEADER={_cmake_path(project_dir / "sdkconfig.h")}',
'-D__ULP_BUILDV2=1',
'-DULP_APP_NAME=ulp_api_probe',
'-DULP_TYPE=lp_core',
'-DIDF_BUILD_V2=y',
'-DIDF_CUSTOM_TOOLCHAIN=1',
)
result = subprocess.run(
cmake_args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
check=False,
)
assert result.returncode == 0, result.stdout
command_availability = _read_api_commands(build_dir / 'api_commands.txt')
for name in expected_available:
assert command_availability[name], f'{name} should be available'
for name in expected_unavailable:
assert not command_availability[name], f'{name} should not be available'
@pytest.mark.test_app_copy('components/ulp/test_apps/ulp_fsm')
def test_ulp_embed_binary_builds_v2_child_project(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
# Legacy ulp_embed_binary() callers are built through the builtin ULP child
# project as a CMake v2 subproject. The child references parent-owned ULP
# sources by path, so editing those sources must still rebuild the child
# artifact on the next parent build.
assert test_app_copy.exists()
idf_py('-DIDF_TARGET=esp32', '-DSDKCONFIG=build/sdkconfig', 'build')
ulp_binary_dirs = sorted(p for p in Path('build/subprojects').glob('*') if p.is_dir())
assert len(ulp_binary_dirs) == 1
ulp_binary_dir = ulp_binary_dirs[0]
ulp_binary = ulp_binary_dir / f'{ulp_binary_dir.name}.bin'
assert ulp_binary.exists()
original_ulp_binary_hash = _sha256(ulp_binary)
ulp_source = test_app_copy / 'main/ulp/test_jumps.S'
ulp_source.write_text(
ulp_source.read_text(encoding='utf-8')
+ '\n\t.global rebuild_dependency_probe\n'
+ 'rebuild_dependency_probe:\n'
+ '\t.long 0x1234\n',
encoding='utf-8',
)
idf_py('build')
assert _sha256(ulp_binary) != original_ulp_binary_hash
@pytest.mark.test_app_copy('examples/system/ulp/ulp_riscv/interrupts')
def test_ulp_embed_binary_uses_parent_project_config(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
# Legacy ulp_embed_binary() sources are compiled as part of the builtin ULP
# child project, but still rely on project-local CONFIG_* symbols from the
# parent app's Kconfig.projbuild.
assert test_app_copy.exists()
idf_py('-DIDF_TARGET=esp32s2', '-DSDKCONFIG=build/sdkconfig', 'build')
@pytest.mark.test_app_copy('tools/test_apps/system/ulp/full_subproject/lp_core') @pytest.mark.test_app_copy('tools/test_apps/system/ulp/full_subproject/lp_core')
def test_ulp_full_project_regenerates_config_from_parent_sdkconfig(idf_py: IdfPyFunc, test_app_copy: Path) -> None: def test_ulp_full_project_regenerates_config_from_parent_sdkconfig(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
+5 -2
View File
@@ -346,8 +346,11 @@ def idf_py_terminal_env() -> typing.Generator[None, None, None]:
@pytest.fixture(name='default_idf_env') @pytest.fixture(name='default_idf_env')
def fixture_default_idf_env() -> EnvDict: def fixture_default_idf_env(request: FixtureRequest) -> EnvDict:
return get_idf_build_env(os.environ['IDF_PATH']) # type: ignore env = get_idf_build_env(os.environ['IDF_PATH']) # type: ignore
if request.config.getoption('buildv2', False):
env['IDF_BUILD_V2'] = '1'
return env
@pytest.fixture @pytest.fixture
+5 -2
View File
@@ -72,9 +72,12 @@ def get_subdirs_absolute_paths(path: Path) -> list[str]:
@pytest.mark.usefixtures('test_app_copy') @pytest.mark.usefixtures('test_app_copy')
@pytest.mark.test_app_copy('examples/get-started/blink') @pytest.mark.test_app_copy('examples/get-started/blink')
def test_compile_commands_json_updated_by_reconfigure(idf_py: IdfPyFunc) -> None: def test_compile_commands_json_updated_by_reconfigure(idf_py: IdfPyFunc, request: pytest.FixtureRequest) -> None:
output = idf_py('reconfigure') output = idf_py('reconfigure')
assert 'Building ESP-IDF components for target esp32' in output.stdout if request.config.getoption('buildv2', False):
assert 'IDF Build System V2 (cmakev2) activated' in output.stdout
else:
assert 'Building ESP-IDF components for target esp32' in output.stdout
snapshot_1 = get_snapshot(['build/compile_commands.json']) snapshot_1 = get_snapshot(['build/compile_commands.json'])
snapshot_2 = get_snapshot(['build/compile_commands.json']) snapshot_2 = get_snapshot(['build/compile_commands.json'])
snapshot_2.assert_same(snapshot_1) snapshot_2.assert_same(snapshot_1)