54 lines
1.5 KiB
CMake
54 lines
1.5 KiB
CMake
idf_build_get_property(target IDF_TARGET)
|
|
|
|
set(tusb_family "esp32sx")
|
|
|
|
if(target STREQUAL "esp32s3")
|
|
set(tusb_mcu "OPT_MCU_ESP32S3")
|
|
elseif(target STREQUAL "esp32s2")
|
|
set(tusb_mcu "OPT_MCU_ESP32S2")
|
|
endif()
|
|
|
|
set(compile_options
|
|
"-DCFG_TUSB_MCU=${tusb_mcu}"
|
|
)
|
|
|
|
idf_component_get_property(freertos_component_dir freertos COMPONENT_DIR)
|
|
|
|
set(includes_private
|
|
"hw/bsp/"
|
|
"src/"
|
|
"src/device"
|
|
)
|
|
|
|
set(includes_public
|
|
"src/"
|
|
# The FreeRTOS API include convention in tinyusb is different from esp-idf
|
|
"${freertos_component_dir}/FreeRTOS-Kernel/include/freertos"
|
|
)
|
|
|
|
set(srcs
|
|
"src/portable/espressif/${tusb_family}/dcd_${tusb_family}.c"
|
|
"src/class/cdc/cdc_device.c"
|
|
"src/class/hid/hid_device.c"
|
|
"src/class/midi/midi_device.c"
|
|
"src/class/msc/msc_device.c"
|
|
"src/class/vendor/vendor_device.c"
|
|
"src/class/dfu/dfu_rt_device.c"
|
|
"src/common/tusb_fifo.c"
|
|
"src/device/usbd_control.c"
|
|
"src/device/usbd.c"
|
|
"src/tusb.c"
|
|
)
|
|
|
|
idf_component_register(SRCS ${srcs}
|
|
INCLUDE_DIRS ${includes_public}
|
|
PRIV_INCLUDE_DIRS ${includes_private}
|
|
PRIV_REQUIRES driver
|
|
REQUIRED_IDF_TARGETS esp32s2 esp32s3
|
|
)
|
|
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC ${compile_options})
|
|
|
|
# when no builtin class driver is enabled, an uint8_t data compared with `BUILTIN_DRIVER_COUNT` will always be false
|
|
set_source_files_properties("src/device/usbd.c" PROPERTIES COMPILE_FLAGS "-Wno-type-limits")
|