summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-06-27 15:45:38 +0700
committerhathach <[email protected]>2023-06-27 15:45:38 +0700
commite43387abaca2044f96017481ccb00b3b68dbdc2a (patch)
treeb68c583e2c1487e4c5f82723c0b76faf52a89224 /hw
parentbc0d6c7e92f15ba696c795f9f50b308a2281a468 (diff)
rework cmake with rtos support add RTOS to family_configure_device/host/dual_example()
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/family_support.cmake164
-rw-r--r--hw/bsp/imxrt/family.cmake19
-rw-r--r--hw/bsp/kinetis_kl/family.cmake19
-rw-r--r--hw/bsp/lpc18/family.cmake19
-rw-r--r--hw/bsp/lpc55/family.cmake19
-rw-r--r--hw/bsp/mcx/family.cmake19
-rw-r--r--hw/bsp/nrf/family.cmake19
-rw-r--r--hw/bsp/rp2040/family.cmake43
-rw-r--r--hw/bsp/stm32f0/family.cmake19
-rw-r--r--hw/bsp/stm32f1/family.cmake19
-rw-r--r--hw/bsp/stm32f7/family.cmake19
-rw-r--r--hw/bsp/stm32g0/family.cmake19
-rw-r--r--hw/bsp/stm32g4/family.cmake19
-rw-r--r--hw/bsp/stm32h7/family.cmake19
-rw-r--r--hw/bsp/stm32l4/family.cmake19
15 files changed, 160 insertions, 294 deletions
diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake
index 93cab8723..781c67bf7 100644
--- a/hw/bsp/family_support.cmake
+++ b/hw/bsp/family_support.cmake
@@ -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
+#-------------------------------------------------------------
+
+# 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()
- target_link_libraries(${TARGET} PUBLIC segger_rtt)
+ # 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()
-
-
-# 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()
-
+ # LOGGER option
+ if (DEFINED LOGGER)
+ target_compile_definitions(${TARGET} PUBLIC LOGGER_${LOGGER})
-# 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()
+ if (RTOS STREQUAL "freertos")
+ target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUSB_OS=OPT_OS_FREERTOS)
+ endif ()
+
# 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 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()
+# 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()
- # 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)
- 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)
+#----------------------------------
+# 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)
diff --git a/hw/bsp/imxrt/family.cmake b/hw/bsp/imxrt/family.cmake
index 4a9842cf9..aaedfc9d6 100644
--- a/hw/bsp/imxrt/family.cmake
+++ b/hw/bsp/imxrt/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()
diff --git a/hw/bsp/kinetis_kl/family.cmake b/hw/bsp/kinetis_kl/family.cmake
index 5d4165185..4df3d1ed1 100644
--- a/hw/bsp/kinetis_kl/family.cmake
+++ b/hw/bsp/kinetis_kl/family.cmake
@@ -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()
diff --git a/hw/bsp/lpc18/family.cmake b/hw/bsp/lpc18/family.cmake
index 4e6e2b56d..da71a0e5d 100644
--- a/hw/bsp/lpc18/family.cmake
+++ b/hw/bsp/lpc18/family.cmake
@@ -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()
diff --git a/hw/bsp/lpc55/family.cmake b/hw/bsp/lpc55/family.cmake
index e443f47d3..dfd08a732 100644
--- a/hw/bsp/lpc55/family.cmake
+++ b/hw/bsp/lpc55/family.cmake
@@ -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()
diff --git a/hw/bsp/mcx/family.cmake b/hw/bsp/mcx/family.cmake
index 83f44222b..f548ac4f3 100644
--- a/hw/bsp/mcx/family.cmake
+++ b/hw/bsp/mcx/family.cmake
@@ -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()
diff --git a/hw/bsp/nrf/family.cmake b/hw/bsp/nrf/family.cmake
index 825380d0b..30fd41d7b 100644
--- a/hw/bsp/nrf/family.cmake
+++ b/hw/bsp/nrf/family.cmake
@@ -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()
diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake
index 2d37f8be9..b986b3ebb 100644
--- a/hw/bsp/rp2040/family.cmake
+++ b/hw/bsp/rp2040/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32f0/family.cmake b/hw/bsp/stm32f0/family.cmake
index ecf6a8424..73f43de82 100644
--- a/hw/bsp/stm32f0/family.cmake
+++ b/hw/bsp/stm32f0/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32f1/family.cmake b/hw/bsp/stm32f1/family.cmake
index ab46c9872..efe41bc1b 100644
--- a/hw/bsp/stm32f1/family.cmake
+++ b/hw/bsp/stm32f1/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32f7/family.cmake b/hw/bsp/stm32f7/family.cmake
index 3b6ba1a15..30bde9b0d 100644
--- a/hw/bsp/stm32f7/family.cmake
+++ b/hw/bsp/stm32f7/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32g0/family.cmake b/hw/bsp/stm32g0/family.cmake
index fa93566bf..f7b665090 100644
--- a/hw/bsp/stm32g0/family.cmake
+++ b/hw/bsp/stm32g0/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32g4/family.cmake b/hw/bsp/stm32g4/family.cmake
index c89993f6d..3c7633d64 100644
--- a/hw/bsp/stm32g4/family.cmake
+++ b/hw/bsp/stm32g4/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32h7/family.cmake b/hw/bsp/stm32h7/family.cmake
index f3705edb4..1a8c4354c 100644
--- a/hw/bsp/stm32h7/family.cmake
+++ b/hw/bsp/stm32h7/family.cmake
@@ -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()
diff --git a/hw/bsp/stm32l4/family.cmake b/hw/bsp/stm32l4/family.cmake
index 83c51c9bf..da017cdde 100644
--- a/hw/bsp/stm32l4/family.cmake
+++ b/hw/bsp/stm32l4/family.cmake
@@ -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()