mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
rework cmake with rtos support add RTOS to family_configure_device/host/dual_example()
This commit is contained in:
parent
bc0d6c7e92
commit
e43387abac
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -32,4 +32,4 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -30,9 +30,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
|
||||
# Add FreeRTOS for this example
|
||||
family_add_freertos(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example with FreeRTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} freertos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -29,9 +29,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
|
||||
# Add FreeRTOS for this example
|
||||
family_add_freertos(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example with FreeRTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} freertos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -26,6 +26,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -29,6 +29,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -88,6 +88,6 @@ elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
|
||||
endif ()
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -29,6 +29,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -34,6 +34,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -28,6 +28,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -23,9 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_dual_usb_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_dual_usb_example(${PROJECT} noos)
|
||||
|
||||
# due to warnings from Pico-PIO-USB
|
||||
target_compile_options(${PROJECT} PUBLIC
|
||||
|
@ -22,9 +22,9 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT} noos)
|
||||
|
||||
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
|
@ -25,9 +25,9 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT} noos)
|
||||
|
||||
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
|
@ -23,9 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT} noos)
|
||||
|
||||
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
|
@ -35,9 +35,9 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${TOP}/lib/embedded-cli
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT} noos)
|
||||
|
||||
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
|
||||
if(FAMILY STREQUAL "rp2040")
|
||||
|
@ -27,6 +27,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -30,11 +30,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// special example that doesn't enable device or host stack
|
||||
// This can cause some TinyUSB API missing, this define hack to allow us to fill those API
|
||||
// to pass the compilation process
|
||||
#define tud_int_handler(x)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------
|
||||
@ -54,6 +49,15 @@
|
||||
// Enable TYPEC stack
|
||||
#define CFG_TUC_ENABLED 1
|
||||
|
||||
|
||||
// special example that doesn't enable device or host stack
|
||||
// This can cause some TinyUSB API missing, this define hack to allow us to fill those API
|
||||
// to pass the compilation process
|
||||
#if CFG_TUD_ENABLED == 0
|
||||
#define tud_int_handler(x)
|
||||
#endif
|
||||
|
||||
|
||||
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
|
||||
// #define CFG_TUSB_DEBUG 0
|
||||
|
||||
|
@ -64,6 +64,8 @@ set(WARNING_FLAGS_GNU
|
||||
|
||||
set(WARNINGS_FLAGS_IAR "")
|
||||
|
||||
|
||||
# Filter example based on only.txt and skip.txt
|
||||
function(family_filter RESULT DIR)
|
||||
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
@ -142,112 +144,136 @@ function(family_initialize_project PROJECT DIR)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add segger rtt to example
|
||||
function(family_add_segger_rtt TARGET)
|
||||
if (NOT TARGET segger_rtt)
|
||||
add_library(segger_rtt STATIC
|
||||
${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c
|
||||
)
|
||||
target_include_directories(segger_rtt PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
|
||||
endif()
|
||||
#-------------------------------------------------------------
|
||||
# Common Target Configure
|
||||
# Most families use these settings except rp2040 and espressif
|
||||
#-------------------------------------------------------------
|
||||
|
||||
target_link_libraries(${TARGET} PUBLIC segger_rtt)
|
||||
# Add RTOS to example
|
||||
function(family_add_rtos TARGET RTOS)
|
||||
if (RTOS STREQUAL "freertos")
|
||||
# freertos config
|
||||
if (NOT TARGET freertos_config)
|
||||
add_library(freertos_config INTERFACE)
|
||||
target_include_directories(freertos_config INTERFACE ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${FAMILY}/FreeRTOSConfig)
|
||||
# add board definition to freertos_config mostly for SystemCoreClock
|
||||
target_link_libraries(freertos_config INTERFACE board_${BOARD})
|
||||
endif()
|
||||
|
||||
# freertos kernel
|
||||
if (NOT TARGET freertos_kernel)
|
||||
add_subdirectory(${TOP}/lib/FreeRTOS-Kernel ${CMAKE_BINARY_DIR}/lib/freertos_kernel)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(${TARGET} PUBLIC freertos_kernel)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
#------------------------------------
|
||||
# Main target configure
|
||||
#------------------------------------
|
||||
|
||||
# Add common configuration to example
|
||||
function(family_configure_common TARGET)
|
||||
function(family_configure_common TARGET RTOS)
|
||||
family_add_rtos(${TARGET} ${RTOS})
|
||||
|
||||
# run size after build
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${TARGET}>
|
||||
)
|
||||
|
||||
# Add warnings flags
|
||||
target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}})
|
||||
|
||||
# Generate linker map file
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
# Generate map file
|
||||
target_link_options(${TARGET} PUBLIC
|
||||
# link map
|
||||
"LINKER:-Map=$<TARGET_FILE:${TARGET}>.map"
|
||||
)
|
||||
target_link_options(${TARGET} PUBLIC "LINKER:-Map=$<TARGET_FILE:${TARGET}>.map")
|
||||
endif()
|
||||
|
||||
# LOGGER
|
||||
if (DEFINED LOGGER)
|
||||
target_compile_definitions(${TARGET} PUBLIC LOGGER_${LOGGER})
|
||||
if(LOGGER STREQUAL "RTT" OR LOGGER STREQUAL "rtt")
|
||||
family_add_segger_rtt(${TARGET})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# ETM Trace
|
||||
# ETM Trace option
|
||||
if (TRACE_ETM STREQUAL "1")
|
||||
target_compile_definitions(${TARGET} PUBLIC TRACE_ETM)
|
||||
endif ()
|
||||
|
||||
endfunction()
|
||||
# LOGGER option
|
||||
if (DEFINED LOGGER)
|
||||
target_compile_definitions(${TARGET} PUBLIC LOGGER_${LOGGER})
|
||||
|
||||
|
||||
# configure an executable target to link to tinyusb in device mode, and add the board implementation
|
||||
function(family_configure_device_example TARGET)
|
||||
# default implementation is empty, the function should be redefined in the FAMILY/family.cmake
|
||||
endfunction()
|
||||
|
||||
|
||||
# configure an executable target to link to tinyusb in host mode, and add the board implementation
|
||||
function(family_configure_host_example TARGET)
|
||||
# default implementation is empty, the function should be redefined in the FAMILY/family.cmake
|
||||
# Add segger rtt to example
|
||||
if(LOGGER STREQUAL "RTT" OR LOGGER STREQUAL "rtt")
|
||||
if (NOT TARGET segger_rtt)
|
||||
add_library(segger_rtt STATIC ${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c)
|
||||
target_include_directories(segger_rtt PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
|
||||
endif()
|
||||
target_link_libraries(${TARGET} PUBLIC segger_rtt)
|
||||
endif ()
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add tinyusb to example
|
||||
function(family_add_tinyusb TARGET OPT_MCU)
|
||||
function(family_add_tinyusb TARGET OPT_MCU RTOS)
|
||||
# tinyusb target is built for each example since it depends on example's tusb_config.h
|
||||
set(TINYUSB_TARGET_PREFIX ${TARGET}-)
|
||||
add_library(${TARGET}-tinyusb_config INTERFACE)
|
||||
|
||||
# path to tusb_config.h
|
||||
target_include_directories(${TARGET}-tinyusb_config INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_MCU=${OPT_MCU})
|
||||
|
||||
if (DEFINED LOG)
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_DEBUG=${LOG})
|
||||
endif()
|
||||
|
||||
# tinyusb's CMakeList.txt
|
||||
add_subdirectory(${TOP}/src ${CMAKE_CURRENT_BINARY_DIR}/tinyusb)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add freeRTOS support to example
|
||||
function(family_add_freertos TARGET)
|
||||
# freeros config
|
||||
if (NOT TARGET freertos_config)
|
||||
add_library(freertos_config INTERFACE)
|
||||
target_include_directories(freertos_config INTERFACE
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${FAMILY}/FreeRTOSConfig
|
||||
)
|
||||
# add board definition to freertos_config mostly for SystemCoreClock
|
||||
target_link_libraries(freertos_config INTERFACE board_${BOARD})
|
||||
endif()
|
||||
|
||||
# freertos kernel should be generic as freertos_config however, CMAKE complains with missing variable
|
||||
# such as CMAKE_C_COMPILE_OBJECT
|
||||
if (NOT TARGET freertos_kernel)
|
||||
add_subdirectory(${TOP}/lib/FreeRTOS-Kernel ${CMAKE_BINARY_DIR}/lib/freertos_kernel)
|
||||
if (RTOS STREQUAL "freertos")
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_OS=OPT_OS_FREERTOS)
|
||||
endif ()
|
||||
|
||||
# Add FreeRTOS option to tinyusb_config
|
||||
target_compile_definitions(${TARGET}-tinyusb_config INTERFACE
|
||||
CFG_TUSB_OS=OPT_OS_FREERTOS
|
||||
)
|
||||
# link tinyusb with freeRTOS kernel
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC freertos_kernel)
|
||||
target_link_libraries(${TARGET} PUBLIC freertos_kernel)
|
||||
# tinyusb's CMakeList.txt
|
||||
add_subdirectory(${TOP}/src ${CMAKE_CURRENT_BINARY_DIR}/tinyusb)
|
||||
|
||||
if (RTOS STREQUAL "freertos")
|
||||
# link tinyusb with freeRTOS kernel
|
||||
target_link_libraries(${TARGET}-tinyusb PUBLIC freertos_kernel)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add bin/hex output
|
||||
function(family_add_bin_hex TARGET)
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin
|
||||
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.hex
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
|
||||
#----------------------------------
|
||||
# Example Target Configure (Default rule)
|
||||
# These function can be redefined in FAMILY/family.cmake
|
||||
#----------------------------------
|
||||
|
||||
function(family_configure_example TARGET RTOS)
|
||||
# empty function, should be redefined in FAMILY/family.cmake
|
||||
endfunction()
|
||||
|
||||
# Configure device example with RTOS
|
||||
function(family_configure_device_example TARGET RTOS)
|
||||
family_configure_example(${TARGET} ${RTOS})
|
||||
endfunction()
|
||||
|
||||
|
||||
# Configure host example with RTOS
|
||||
function(family_configure_host_example TARGET RTOS)
|
||||
family_configure_example(${TARGET} ${RTOS})
|
||||
endfunction()
|
||||
|
||||
|
||||
# Configure host + device example with RTOS
|
||||
function(family_configure_dual_usb_example TARGET RTOS)
|
||||
family_configure_example(${TARGET} ${RTOS})
|
||||
endfunction()
|
||||
|
||||
#----------------------------------
|
||||
# RPI specific: refactor later
|
||||
#----------------------------------
|
||||
function(family_add_default_example_warnings TARGET)
|
||||
target_compile_options(${TARGET} PUBLIC
|
||||
-Wall
|
||||
@ -294,16 +320,6 @@ function(family_add_default_example_warnings TARGET)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add bin/hex output
|
||||
function(family_add_bin_hex TARGET)
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin
|
||||
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.hex
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
|
||||
#----------------------------------
|
||||
# Flashing target
|
||||
#----------------------------------
|
||||
@ -374,6 +390,10 @@ function(family_flash_nxplink TARGET)
|
||||
endfunction()
|
||||
|
||||
|
||||
#----------------------------------
|
||||
# Family specific
|
||||
#----------------------------------
|
||||
|
||||
# family specific: can override above functions
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/${FAMILY}/family.cmake)
|
||||
|
||||
|
@ -94,8 +94,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -115,7 +115,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MIMXRT1XXX)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MIMXRT1XXX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
|
||||
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
|
||||
@ -130,16 +130,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_jlink(${TARGET})
|
||||
#family_flash_nxplink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -78,8 +78,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -99,7 +99,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_KL)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_KL ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_fs/dcd_ci_fs.c
|
||||
${TOP}/src/portable/nxp/khci/hcd_khci.c
|
||||
@ -113,16 +113,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_jlink(${TARGET})
|
||||
#family_flash_nxplink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -70,8 +70,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -91,7 +91,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC18XX)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC18XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
|
||||
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
|
||||
@ -106,16 +106,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_jlink(${TARGET})
|
||||
#family_flash_nxplink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -87,8 +87,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -117,7 +117,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC55XX)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_LPC55XX ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
|
||||
)
|
||||
@ -131,16 +131,3 @@ function(family_configure_example TARGET)
|
||||
#family_flash_nxplink(${TARGET})
|
||||
#family_flash_pyocd(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -79,8 +79,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -100,7 +100,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MCXN9)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_MCXN9 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
# TinyUSB: Port0 is chipidea FS, Port1 is chipidea HS
|
||||
${TOP}/src/portable/chipidea/$<IF:${PORT},ci_hs/dcd_ci_hs.c,ci_fs/dcd_ci_fs.c>
|
||||
@ -115,16 +115,3 @@ function(family_configure_example TARGET)
|
||||
#family_flash_nxplink(${TARGET})
|
||||
#family_flash_pyocd(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -97,8 +97,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -118,7 +118,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_NRF5X)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_NRF5X ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/nordic/nrf5x/dcd_nrf5x.c
|
||||
)
|
||||
@ -132,16 +132,3 @@ function(family_configure_example TARGET)
|
||||
# Flashing
|
||||
family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -11,6 +11,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
|
||||
|
||||
# include basic family CMake functionality
|
||||
set(FAMILY_MCUS RP2040)
|
||||
set(JLINK_DEVICE rp2040_m0_0)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
@ -143,12 +144,23 @@ endif()
|
||||
# Functions
|
||||
#------------------------------------
|
||||
|
||||
function(family_configure_target TARGET)
|
||||
function(family_configure_target TARGET RTOS)
|
||||
if (RTOS STREQUAL noos OR RTOS STREQUAL "")
|
||||
set(RTOS_SUFFIX "")
|
||||
else()
|
||||
set(RTOS_SUFFIX _${RTOS})
|
||||
endif()
|
||||
# export RTOS_SUFFIX to parent scope
|
||||
set(RTOS_SUFFIX ${RTOS_SUFFIX} PARENT_SCOPE)
|
||||
|
||||
pico_add_extra_outputs(${TARGET})
|
||||
pico_enable_stdio_uart(${TARGET} 1)
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib pico_bootsel_via_double_reset tinyusb_board tinyusb_additions)
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib pico_bootsel_via_double_reset tinyusb_board${RTOS_SUFFIX} tinyusb_additions)
|
||||
|
||||
family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(rp2040_family_configure_example_warnings TARGET)
|
||||
if (NOT PICO_TINYUSB_NO_EXAMPLE_WARNINGS)
|
||||
family_add_default_example_warnings(${TARGET})
|
||||
@ -159,19 +171,22 @@ function(rp2040_family_configure_example_warnings TARGET)
|
||||
suppress_tinyusb_warnings()
|
||||
endfunction()
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_target(${TARGET})
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device)
|
||||
|
||||
function(family_configure_device_example TARGET RTOS)
|
||||
family_configure_target(${TARGET} ${RTOS})
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device${RTOS_SUFFIX})
|
||||
rp2040_family_configure_example_warnings(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_add_pico_pio_usb TARGET)
|
||||
target_link_libraries(${TARGET} PUBLIC tinyusb_pico_pio_usb)
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_target(${TARGET})
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_host)
|
||||
|
||||
function(family_configure_host_example TARGET RTOS)
|
||||
family_configure_target(${TARGET} ${RTOS})
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_host${RTOS_SUFFIX})
|
||||
rp2040_family_configure_example_warnings(${TARGET})
|
||||
|
||||
# For rp2040 enable pico-pio-usb
|
||||
@ -183,13 +198,15 @@ function(family_configure_host_example TARGET)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_target(${TARGET})
|
||||
|
||||
function(family_configure_dual_usb_example TARGET RTOS)
|
||||
family_configure_target(${TARGET} ${RTOS})
|
||||
# require tinyusb_pico_pio_usb
|
||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device tinyusb_host tinyusb_pico_pio_usb )
|
||||
rp2040_family_configure_example_warnings(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(check_and_add_pico_pio_usb_support)
|
||||
# check for pico_generate_pio_header (as depending on environment we may be called before SDK is
|
||||
# initialized in which case it isn't available yet), and only do the initialization once
|
||||
@ -243,6 +260,7 @@ endfunction()
|
||||
# when included by the SDK itself)
|
||||
check_and_add_pico_pio_usb_support()
|
||||
|
||||
|
||||
function(family_initialize_project PROJECT DIR)
|
||||
# call the original version of this function from family_common.cmake
|
||||
_family_initialize_project(${PROJECT} ${DIR})
|
||||
@ -253,6 +271,7 @@ function(family_initialize_project PROJECT DIR)
|
||||
check_and_add_pico_pio_usb_support()
|
||||
endfunction()
|
||||
|
||||
|
||||
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
|
||||
function(suppress_tinyusb_warnings)
|
||||
# some of these are pretty silly warnings only occurring in some older GCC versions 9 or prior
|
||||
@ -327,7 +346,3 @@ function(suppress_tinyusb_warnings)
|
||||
COMPILE_FLAGS "-Wno-cast-qual")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# rp2040 does not support freeRTOS example yet
|
||||
function(family_add_freertos TARGET)
|
||||
endfunction()
|
||||
|
@ -84,8 +84,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -105,7 +105,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32F0)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32F0 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
|
||||
)
|
||||
@ -118,16 +118,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
#family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -81,8 +81,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -102,7 +102,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32F1)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32F1 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
|
||||
)
|
||||
@ -115,16 +115,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
#family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -86,8 +86,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -107,7 +107,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32F7)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32F7 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
|
||||
)
|
||||
@ -120,16 +120,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -84,8 +84,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -105,7 +105,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32G0)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32G0 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
|
||||
${TOP}/src/portable/st/typec/typec_stm32.c
|
||||
@ -119,16 +119,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
#family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -84,8 +84,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -105,7 +105,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32G4)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32G4 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
|
||||
${TOP}/src/portable/st/typec/typec_stm32.c
|
||||
@ -119,16 +119,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -89,8 +89,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -110,7 +110,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32H7)
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_STM32H7 ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
|
||||
)
|
||||
@ -123,16 +123,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -86,8 +86,8 @@ endfunction()
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
function(family_configure_example TARGET)
|
||||
family_configure_common(${TARGET})
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
@ -107,7 +107,7 @@ function(family_configure_example TARGET)
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_${FAMILY_MCUS})
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_${FAMILY_MCUS} ${RTOS})
|
||||
target_sources(${TARGET}-tinyusb PUBLIC
|
||||
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
|
||||
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
|
||||
@ -121,16 +121,3 @@ function(family_configure_example TARGET)
|
||||
family_flash_stlink(${TARGET})
|
||||
family_flash_jlink(${TARGET})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_device_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_host_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
||||
function(family_configure_dual_usb_example TARGET)
|
||||
family_configure_example(${TARGET})
|
||||
endfunction()
|
||||
|
@ -128,7 +128,9 @@
|
||||
#define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))
|
||||
#define TU_ATTR_PACKED __attribute__ ((packed))
|
||||
#define TU_ATTR_WEAK __attribute__ ((weak))
|
||||
#define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#ifndef TU_ATTR_ALWAYS_INLINE // allow to override for debug
|
||||
#define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#endif
|
||||
#define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
|
||||
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
||||
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
|
||||
@ -205,7 +207,9 @@
|
||||
#define TU_ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))
|
||||
#define TU_ATTR_PACKED __attribute__ ((packed))
|
||||
#define TU_ATTR_WEAK __attribute__ ((weak))
|
||||
#define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#ifndef TU_ATTR_ALWAYS_INLINE // allow to override for debug
|
||||
#define TU_ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
#endif
|
||||
#define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
|
||||
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
||||
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
|
||||
|
@ -14,16 +14,16 @@ add_executable(${PROJECT})
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -24,6 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
@ -24,6 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||
# in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT})
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_device_example(${PROJECT} noos)
|
||||
|
Loading…
x
Reference in New Issue
Block a user