mirror of
https://github.com/hathach/tinyusb.git
synced 2025-12-01 12:24:17 +00:00
update espressif cmake
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
mcu:ESP32P4
|
|
||||||
mcu:LPC175X_6X
|
mcu:LPC175X_6X
|
||||||
mcu:LPC177X_8X
|
mcu:LPC177X_8X
|
||||||
mcu:LPC18XX
|
mcu:LPC18XX
|
||||||
@ -15,5 +14,6 @@ mcu:STM32F7
|
|||||||
mcu:STM32H7
|
mcu:STM32H7
|
||||||
mcu:STM32H7RS
|
mcu:STM32H7RS
|
||||||
mcu:STM32N6
|
mcu:STM32N6
|
||||||
|
family:espressif
|
||||||
family:samd21
|
family:samd21
|
||||||
family:samd5x_e5x
|
family:samd5x_e5x
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
mcu:CH32V20X
|
mcu:CH32V20X
|
||||||
mcu:ESP32S2
|
|
||||||
mcu:ESP32S3
|
|
||||||
mcu:ESP32P4
|
|
||||||
mcu:KINETIS_KL
|
mcu:KINETIS_KL
|
||||||
mcu:LPC175X_6X
|
mcu:LPC175X_6X
|
||||||
mcu:LPC177X_8X
|
mcu:LPC177X_8X
|
||||||
@ -21,5 +18,6 @@ mcu:STM32F7
|
|||||||
mcu:STM32H7
|
mcu:STM32H7
|
||||||
mcu:STM32H7RS
|
mcu:STM32H7RS
|
||||||
mcu:STM32N6
|
mcu:STM32N6
|
||||||
|
family:espressif
|
||||||
family:samd21
|
family:samd21
|
||||||
family:samd5x_e5x
|
family:samd5x_e5x
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
idf_build_get_property(target IDF_TARGET)
|
idf_build_get_property(target IDF_TARGET)
|
||||||
|
include(CMakePrintHelpers)
|
||||||
|
|
||||||
set(srcs)
|
set(tusb_src ${CMAKE_CURRENT_LIST_DIR}/../../../../../src)
|
||||||
set(includes_public)
|
get_filename_component(tusb_src ${tusb_src} ABSOLUTE)
|
||||||
set(compile_options)
|
include(${tusb_src}/CMakeLists.txt)
|
||||||
set(tusb_src "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src")
|
|
||||||
|
|
||||||
string(TOUPPER OPT_MCU_${target} tusb_mcu)
|
string(TOUPPER OPT_MCU_${target} tusb_mcu)
|
||||||
list(APPEND compile_definitions
|
set(compile_definitions
|
||||||
CFG_TUSB_MCU=${tusb_mcu}
|
CFG_TUSB_MCU=${tusb_mcu}
|
||||||
CFG_TUSB_OS=OPT_OS_FREERTOS
|
CFG_TUSB_OS=OPT_OS_FREERTOS
|
||||||
BOARD_TUD_RHPORT=${RHPORT_DEVICE}
|
BOARD_TUD_RHPORT=${RHPORT_DEVICE}
|
||||||
@ -14,7 +14,7 @@ list(APPEND compile_definitions
|
|||||||
BOARD_TUH_RHPORT=${RHPORT_HOST}
|
BOARD_TUH_RHPORT=${RHPORT_HOST}
|
||||||
BOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED}
|
BOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED}
|
||||||
)
|
)
|
||||||
|
cmake_print_variables(compile_definitions)
|
||||||
if (target STREQUAL esp32p4)
|
if (target STREQUAL esp32p4)
|
||||||
# P4 change alignment to 64 (DCache line size) for possible DMA configuration
|
# P4 change alignment to 64 (DCache line size) for possible DMA configuration
|
||||||
list(APPEND compile_definitions
|
list(APPEND compile_definitions
|
||||||
@ -23,36 +23,11 @@ if (target STREQUAL esp32p4)
|
|||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
tinyusb_sources_get(srcs)
|
||||||
list(APPEND srcs
|
list(APPEND srcs
|
||||||
# common
|
|
||||||
${tusb_src}/tusb.c
|
|
||||||
${tusb_src}/common/tusb_fifo.c
|
|
||||||
# device
|
|
||||||
${tusb_src}/device/usbd.c
|
|
||||||
${tusb_src}/device/usbd_control.c
|
|
||||||
${tusb_src}/class/audio/audio_device.c
|
|
||||||
${tusb_src}/class/cdc/cdc_device.c
|
|
||||||
${tusb_src}/class/dfu/dfu_device.c
|
|
||||||
${tusb_src}/class/dfu/dfu_rt_device.c
|
|
||||||
${tusb_src}/class/hid/hid_device.c
|
|
||||||
${tusb_src}/class/midi/midi_device.c
|
|
||||||
${tusb_src}/class/msc/msc_device.c
|
|
||||||
${tusb_src}/class/mtp/mtp_device.c
|
|
||||||
${tusb_src}/class/net/ecm_rndis_device.c
|
|
||||||
${tusb_src}/class/net/ncm_device.c
|
|
||||||
${tusb_src}/class/usbtmc/usbtmc_device.c
|
|
||||||
${tusb_src}/class/vendor/vendor_device.c
|
|
||||||
${tusb_src}/class/video/video_device.c
|
|
||||||
${tusb_src}/portable/synopsys/dwc2/dcd_dwc2.c
|
${tusb_src}/portable/synopsys/dwc2/dcd_dwc2.c
|
||||||
${tusb_src}/portable/synopsys/dwc2/hcd_dwc2.c
|
${tusb_src}/portable/synopsys/dwc2/hcd_dwc2.c
|
||||||
${tusb_src}/portable/synopsys/dwc2/dwc2_common.c
|
${tusb_src}/portable/synopsys/dwc2/dwc2_common.c
|
||||||
# host
|
|
||||||
${tusb_src}/host/usbh.c
|
|
||||||
${tusb_src}/host/hub.c
|
|
||||||
${tusb_src}/class/cdc/cdc_host.c
|
|
||||||
${tusb_src}/class/hid/hid_host.c
|
|
||||||
${tusb_src}/class/msc/msc_host.c
|
|
||||||
${tusb_src}/class/vendor/vendor_host.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# use max3421 as host controller
|
# use max3421 as host controller
|
||||||
@ -74,7 +49,6 @@ if(DEFINED CFLAGS_CLI)
|
|||||||
list(APPEND compile_definitions ${CFLAGS_CLI})
|
list(APPEND compile_definitions ${CFLAGS_CLI})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
idf_component_register(SRCS ${srcs}
|
idf_component_register(SRCS ${srcs}
|
||||||
INCLUDE_DIRS ${tusb_src}
|
INCLUDE_DIRS ${tusb_src}
|
||||||
REQUIRES src
|
REQUIRES src
|
||||||
@ -82,4 +56,3 @@ idf_component_register(SRCS ${srcs}
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC ${compile_definitions})
|
target_compile_definitions(${COMPONENT_LIB} PUBLIC ${compile_definitions})
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-error=format)
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ set(UF2CONV_PY ${TOP}/tools/uf2/utils/uf2conv.py)
|
|||||||
|
|
||||||
#-------------------------------------------------------------
|
#-------------------------------------------------------------
|
||||||
# Toolchain
|
# Toolchain
|
||||||
# Can be changed via -DTOOLCHAIN=gcc|iar or -DCMAKE_C_COMPILER=
|
# Can be changed via -DTOOLCHAIN=gcc|iar or -DCMAKE_C_COMPILER= or ENV{CC}=
|
||||||
#-------------------------------------------------------------
|
#-------------------------------------------------------------
|
||||||
function(detect_compiler COMPILER_PATH RESULT)
|
function(detect_compiler COMPILER_PATH RESULT)
|
||||||
string(FIND ${COMPILER_PATH} "iccarm" IS_IAR)
|
string(FIND ${COMPILER_PATH} "iccarm" IS_IAR)
|
||||||
@ -319,8 +319,8 @@ endfunction()
|
|||||||
|
|
||||||
# Add tinyusb to target
|
# Add tinyusb to target
|
||||||
function(family_add_tinyusb TARGET OPT_MCU)
|
function(family_add_tinyusb TARGET OPT_MCU)
|
||||||
# tinyusb's CMakeList.txt
|
# tinyusb's CMakeLists.txt
|
||||||
add_subdirectory(${TOP}/src ${CMAKE_CURRENT_BINARY_DIR}/tinyusb)
|
include(${TOP}/src/CMakeLists.txt)
|
||||||
|
|
||||||
# Add TinyUSB sources, include and common define
|
# Add TinyUSB sources, include and common define
|
||||||
tinyusb_target_add(${TARGET})
|
tinyusb_target_add(${TARGET})
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
# Add tinyusb to a existing target, DCD and HCD drivers are not included
|
# Get TinyUSB sources. Note: DCD and HCD drivers are not included
|
||||||
function(tinyusb_target_add TARGET)
|
function(tinyusb_sources_get OUTPUT_VAR)
|
||||||
target_sources(${TARGET} PRIVATE
|
set(${OUTPUT_VAR}
|
||||||
# common
|
# common
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tusb.c
|
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tusb.c
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/common/tusb_fifo.c
|
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/common/tusb_fifo.c
|
||||||
@ -32,7 +32,14 @@ function(tinyusb_target_add TARGET)
|
|||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_host.c
|
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_host.c
|
||||||
# typec
|
# typec
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/typec/usbc.c
|
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/typec/usbc.c
|
||||||
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Add tinyusb to a existing target
|
||||||
|
function(tinyusb_target_add TARGET)
|
||||||
|
tinyusb_sources_get(TINYUSB_SRC)
|
||||||
|
target_sources(${TARGET} PRIVATE ${TINYUSB_SRC})
|
||||||
target_include_directories(${TARGET} PUBLIC
|
target_include_directories(${TARGET} PUBLIC
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||||
# TODO for net driver, should be removed/changed
|
# TODO for net driver, should be removed/changed
|
||||||
|
|||||||
Reference in New Issue
Block a user