feat(build): fixed esp_usb_cdc_rom_console always being included in build

This commit is contained in:
Marius Vikhammer
2026-09-03 15:09:38 +08:00
parent dfe99a4a41
commit 157d6b1669
11 changed files with 252 additions and 162 deletions
+22 -7
View File
@@ -96,16 +96,31 @@ else()
list(APPEND srcs "debug_assist.c")
endif()
set(priv_requires spi_flash esp_timer esp_mm
esp_hal_clock esp_hal_mspi esp_hal_wdt esp_hal_debug_assist
esp_hal_uart esp_hal_dma esp_hal_security
# [refactor-todo] requirements due to init code,
# should be removable once using component init functions
# link-time registration is used.
bootloader_support esp_pm)
if(NOT IDF_BUILD_V2)
# panic.c only calls into the ROM CDC console under CONFIG_ESP_CONSOLE_USB_CDC,
# but requirements are resolved before Kconfig here, so the dependency has to
# be unconditional. Under v2 it is added below based on the config value.
list(APPEND priv_requires esp_usb_cdc_rom_console)
endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS include
PRIV_REQUIRES spi_flash esp_timer esp_mm
esp_hal_clock esp_hal_mspi esp_hal_wdt esp_hal_debug_assist
esp_hal_uart esp_hal_dma esp_hal_security
# [refactor-todo] requirements due to init code,
# should be removable once using component init functions
# link-time registration is used.
bootloader_support esp_pm esp_usb_cdc_rom_console
PRIV_REQUIRES ${priv_requires}
LDFRAGMENTS "linker.lf" "app.lf")
if(IDF_BUILD_V2 AND CONFIG_ESP_CONSOLE_USB_CDC)
idf_component_include(esp_usb_cdc_rom_console)
target_link_libraries(${COMPONENT_LIB} PRIVATE idf::esp_usb_cdc_rom_console)
endif()
add_subdirectory(port)
# After system initialization, `start_app` (and its other cores variant) is called.