summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-01-25 17:18:24 +0700
committerGitHub <[email protected]>2021-01-25 17:18:24 +0700
commitc43ac7f1d79b25dae2d5ab073dc7d397fd9dedec (patch)
tree8086106787ab4b044deca2a5682d74e2f09eec1d
parent469ca2f1559800f4b1eabc860336ff33ed118718 (diff)
parent6e027b1c4b454a573c6bcb9599d016d98bb6d05a (diff)
Merge pull request #603 from hathach/pico-followup
Pico followup for (ci) building examples
-rw-r--r--.github/workflows/build.yml49
-rw-r--r--examples/device/audio_test/CMakeLists.txt40
-rw-r--r--examples/device/audio_test/src/tusb_config.h2
-rw-r--r--examples/device/board_test/CMakeLists.txt77
-rw-r--r--examples/device/board_test/src/CMakeLists.txt1
-rw-r--r--examples/device/cdc_dual_ports/CMakeLists.txt40
-rw-r--r--examples/device/cdc_msc/CMakeLists.txt86
-rw-r--r--examples/device/cdc_msc_freertos/.skip.MCU_RP20400
-rw-r--r--examples/device/dfu_rt/CMakeLists.txt40
-rw-r--r--examples/device/dfu_rt/src/tusb_config.h3
-rw-r--r--examples/device/dynamic_configuration/CMakeLists.txt41
-rw-r--r--examples/device/dynamic_configuration/src/tusb_config.h3
-rw-r--r--examples/device/hid_composite/CMakeLists.txt40
-rw-r--r--examples/device/hid_composite/src/tusb_config.h3
-rw-r--r--examples/device/hid_composite_freertos/.skip.MCU_RP20400
-rw-r--r--examples/device/hid_generic_inout/CMakeLists.txt40
-rw-r--r--examples/device/hid_generic_inout/src/tusb_config.h3
-rw-r--r--examples/device/hid_multiple_interface/CMakeLists.txt40
-rw-r--r--examples/device/hid_multiple_interface/src/tusb_config.h3
-rw-r--r--examples/device/midi_test/CMakeLists.txt40
-rw-r--r--examples/device/midi_test/src/tusb_config.h3
-rw-r--r--examples/device/msc_dual_lun/CMakeLists.txt41
-rw-r--r--examples/device/msc_dual_lun/src/tusb_config.h3
-rw-r--r--examples/device/net_lwip_webserver/CMakeLists.txt87
-rw-r--r--examples/device/net_lwip_webserver/src/tusb_config.h3
-rw-r--r--examples/device/uac2_headset/CMakeLists.txt40
-rw-r--r--examples/device/uac2_headset/src/tusb_config.h2
-rw-r--r--examples/device/usbtmc/CMakeLists.txt41
-rw-r--r--examples/device/usbtmc/src/tusb_config.h3
-rw-r--r--examples/device/webusb_serial/CMakeLists.txt40
-rw-r--r--examples/device/webusb_serial/src/tusb_config.h3
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h2
-rw-r--r--hw/bsp/rp2040/family.cmake36
-rw-r--r--hw/bsp/rp2040/family_extra.cmake1
-rw-r--r--src/common/tusb_types.h3
-rw-r--r--src/host/usbh.c2
-rw-r--r--tools/build_board.py2
-rw-r--r--tools/build_esp32s2.py2
-rw-r--r--tools/build_family.py14
39 files changed, 728 insertions, 151 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f1732027f..bf1c63d3f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -29,7 +29,7 @@ jobs:
family:
- 'imxrt'
- 'nrf'
- #- 'rp2040'
+ - 'rp2040'
- 'samd21'
- 'samd51'
- 'stm32f4'
@@ -94,22 +94,34 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
- - name: Cache MSP430 Toolchain
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v2
+ with:
+ submodules: 'true'
+
+ - name: Checkout Sub-Submodules
+ run: |
+ # some submodule has it own submodules that need to be fetched as well
+ git submodule update --init --recursive hw/mcu/microchip
+ git submodule update --init --recursive lib/FreeRTOS
+
+ # Add msp430-gcc url to env
+ echo >> $GITHUB_ENV MSP430_GCC_URL=http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2
+
+ - name: Cache MSP430-GCC
uses: actions/cache@v2
id: cache-msp430
with:
- path: /tmp/dl/
- # Increment gcc version number at end when updating downloads
- key: ${{ runner.os }}-msp430-9.2.0.50
+ path: ~/cache/
+ key: ${{ runner.os }}-21-01-26-${{ env.MSP430_GCC_URL }}
- - name: Install MSP430 Toolchain
+ - name: Install MSP430-GCC
if: steps.cache-msp430.outputs.cache-hit != 'true'
- env:
- MSP430GCC_URL: http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2
run: |
- mkdir -p /tmp/dl/
- [ -f "/tmp/dl/msp430-gcc.tar.bz2" ] || wget --progress=dot:mega $MSP430GCC_URL -O /tmp/dl/msp430-gcc.tar.bz2
- tar -C $HOME -xaf /tmp/dl/msp430-gcc.tar.bz2
+ # MSP430 GCC
+ mkdir -p ~/cache/msp430-gcc
+ wget --progress=dot:mega $MSP430_GCC_URL -O msp430-gcc.tar.bz2
+ tar -C ~/cache/msp430-gcc -xaf msp430-gcc.tar.bz2
- name: Install Toolchains
run: |
@@ -119,20 +131,9 @@ jobs:
xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest
echo `echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
echo `echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` >> $GITHUB_PATH
-
+
# TI MSP430 GCC
- echo `echo $HOME/msp430-gcc-*_linux64/bin` >> $GITHUB_PATH
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v2
- with:
- submodules: 'true'
-
- - name: Checkout Sub-Submodules
- run: |
- # some submodule has it own submodules that need to be fetched as well
- git submodule update --init --recursive hw/mcu/microchip
- git submodule update --init --recursive lib/FreeRTOS
+ echo >> $GITHUB_PATH `echo ~/cache/msp430-gcc/msp430-gcc-*/bin`
- name: Build
run: python3 tools/build_board.py ${{ matrix.example }}
diff --git a/examples/device/audio_test/CMakeLists.txt b/examples/device/audio_test/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/audio_test/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/audio_test/src/tusb_config.h b/examples/device/audio_test/src/tusb_config.h
index 5d94858ea..61e63f073 100644
--- a/examples/device/audio_test/src/tusb_config.h
+++ b/examples/device/audio_test/src/tusb_config.h
@@ -45,7 +45,9 @@ extern "C" {
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#endif
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
#ifndef CFG_TUSB_DEBUG
#define CFG_TUSB_DEBUG 0
diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt
index 54a4009fe..68577ba73 100644
--- a/examples/device/board_test/CMakeLists.txt
+++ b/examples/device/board_test/CMakeLists.txt
@@ -1,5 +1,3 @@
-cmake_minimum_required(VERSION 3.5)
-
# use directory name for project id
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
@@ -8,58 +6,39 @@ set(TOP "../../..")
get_filename_component(TOP "${TOP}" REALPATH)
# Check for -DFAMILY=
-if(NOT DEFINED FAMILY)
- message(FATAL_ERROR "Invalid FAMILY specified")
-endif()
-
-include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
-project(${PROJECT})
+if(FAMILY STREQUAL "esp32s2")
+ cmake_minimum_required(VERSION 3.5)
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+ project(${PROJECT})
-if(FAMILY STREQUAL "rp2040")
+elseif(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
-pico_sdk_init()
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
-add_executable(${PROJECT})
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ )
-# TinyUSB Stack source
-set(SRC_TINYUSB
- ${TOP}/src/tusb.c
- ${TOP}/src/common/tusb_fifo.c
- ${TOP}/src/device/usbd.c
- ${TOP}/src/device/usbd_control.c
- ${TOP}/src/class/audio/audio_device.c
- ${TOP}/src/class/cdc/cdc_device.c
- ${TOP}/src/class/dfu/dfu_rt_device.c
- ${TOP}/src/class/hid/hid_device.c
- ${TOP}/src/class/midi/midi_device.c
- ${TOP}/src/class/msc/msc_device.c
- ${TOP}/src/class/net/net_device.c
- ${TOP}/src/class/usbtmc/usbtmc_device.c
- ${TOP}/src/class/vendor/vendor_device.c
- ${TOP}/src/portable/raspberrypi/${FAMILY}/dcd_rp2040.c
- ${TOP}/src/portable/raspberrypi/${FAMILY}/rp2040_usb.c
-)
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
-target_sources(${PROJECT} PUBLIC
- src/main.c
- ${TOP}/hw/bsp/${FAMILY}/family.c
- ${SRC_TINYUSB}
-)
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
-target_include_directories(${PROJECT} PUBLIC
- src/
- ${TOP}/hw
- ${TOP}/src
- ${TOP}/hw/bsp/${FAMILY}/boards/${BOARD}
-)
-
-target_compile_definitions(${PROJECT} PUBLIC
- CFG_TUSB_MCU=OPT_MCU_RP2040
- CFG_TUSB_OS=OPT_OS_PICO
-)
-
-target_link_libraries(${PROJECT} pico_stdlib)
-
-pico_add_extra_outputs(${PROJECT})
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
endif()
diff --git a/examples/device/board_test/src/CMakeLists.txt b/examples/device/board_test/src/CMakeLists.txt
index 29ae46a33..e59661069 100644
--- a/examples/device/board_test/src/CMakeLists.txt
+++ b/examples/device/board_test/src/CMakeLists.txt
@@ -1,3 +1,4 @@
+# FAMILY = "esp32s2"
idf_component_register(SRCS "main.c"
INCLUDE_DIRS "."
REQUIRES freertos soc)
diff --git a/examples/device/cdc_dual_ports/CMakeLists.txt b/examples/device/cdc_dual_ports/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/cdc_dual_ports/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt
index ada122b62..7f5d5a998 100644
--- a/examples/device/cdc_msc/CMakeLists.txt
+++ b/examples/device/cdc_msc/CMakeLists.txt
@@ -1,5 +1,3 @@
-cmake_minimum_required(VERSION 3.5)
-
# use directory name for project id
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
@@ -8,65 +6,41 @@ set(TOP "../../..")
get_filename_component(TOP "${TOP}" REALPATH)
# Check for -DFAMILY=
-if(NOT DEFINED FAMILY)
- message(FATAL_ERROR "Invalid FAMILY specified")
-endif()
-
-include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
-project(${PROJECT})
-
-if(FAMILY STREQUAL "rp2040")
+if(FAMILY STREQUAL "esp32s2")
+ cmake_minimum_required(VERSION 3.5)
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+ project(${PROJECT})
-pico_sdk_init()
+elseif(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
-add_executable(${PROJECT})
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
-# TinyUSB Stack source
-set(SRC_TINYUSB
- ${TOP}/src/tusb.c
- ${TOP}/src/common/tusb_fifo.c
- ${TOP}/src/device/usbd.c
- ${TOP}/src/device/usbd_control.c
- ${TOP}/src/class/audio/audio_device.c
- ${TOP}/src/class/cdc/cdc_device.c
- ${TOP}/src/class/dfu/dfu_rt_device.c
- ${TOP}/src/class/hid/hid_device.c
- ${TOP}/src/class/midi/midi_device.c
- ${TOP}/src/class/msc/msc_device.c
- ${TOP}/src/class/net/net_device.c
- ${TOP}/src/class/usbtmc/usbtmc_device.c
- ${TOP}/src/class/vendor/vendor_device.c
- ${TOP}/src/portable/raspberrypi/${FAMILY}/dcd_rp2040.c
- ${TOP}/src/portable/raspberrypi/${FAMILY}/rp2040_usb.c
-)
+ # 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
+ )
-# Example source
-set(SRC_EXAMPLE
- src/main.c
- src/msc_disk.c
- src/usb_descriptors.c
-)
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
-target_sources(${PROJECT} PUBLIC
- ${SRC_EXAMPLE}
- ${TOP}/hw/bsp/${FAMILY}/family.c
- ${SRC_TINYUSB}
-)
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
-target_include_directories(${PROJECT} PUBLIC
- src/
- ${TOP}/hw
- ${TOP}/src
- ${TOP}/hw/bsp/${FAMILY}/boards/${BOARD}
-)
-
-target_compile_definitions(${PROJECT} PUBLIC
- CFG_TUSB_MCU=OPT_MCU_RP2040
- CFG_TUSB_OS=OPT_OS_PICO
-)
-
-target_link_libraries(${PROJECT} pico_stdlib)
-
-pico_add_extra_outputs(${PROJECT})
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
endif()
diff --git a/examples/device/cdc_msc_freertos/.skip.MCU_RP2040 b/examples/device/cdc_msc_freertos/.skip.MCU_RP2040
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/cdc_msc_freertos/.skip.MCU_RP2040
diff --git a/examples/device/dfu_rt/CMakeLists.txt b/examples/device/dfu_rt/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/dfu_rt/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/dfu_rt/src/tusb_config.h b/examples/device/dfu_rt/src/tusb_config.h
index 226573263..abdbe7526 100644
--- a/examples/device/dfu_rt/src/tusb_config.h
+++ b/examples/device/dfu_rt/src/tusb_config.h
@@ -46,8 +46,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/dynamic_configuration/CMakeLists.txt b/examples/device/dynamic_configuration/CMakeLists.txt
new file mode 100644
index 000000000..f26465729
--- /dev/null
+++ b/examples/device/dynamic_configuration/CMakeLists.txt
@@ -0,0 +1,41 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # 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
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/dynamic_configuration/src/tusb_config.h b/examples/device/dynamic_configuration/src/tusb_config.h
index 2f8072f89..23073faf3 100644
--- a/examples/device/dynamic_configuration/src/tusb_config.h
+++ b/examples/device/dynamic_configuration/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/hid_composite/CMakeLists.txt b/examples/device/hid_composite/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/hid_composite/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/hid_composite/src/tusb_config.h b/examples/device/hid_composite/src/tusb_config.h
index d8e6b73e8..3e608ed37 100644
--- a/examples/device/hid_composite/src/tusb_config.h
+++ b/examples/device/hid_composite/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/hid_composite_freertos/.skip.MCU_RP2040 b/examples/device/hid_composite_freertos/.skip.MCU_RP2040
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/device/hid_composite_freertos/.skip.MCU_RP2040
diff --git a/examples/device/hid_generic_inout/CMakeLists.txt b/examples/device/hid_generic_inout/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/hid_generic_inout/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/hid_generic_inout/src/tusb_config.h b/examples/device/hid_generic_inout/src/tusb_config.h
index 347cb06d6..1b8b91c41 100644
--- a/examples/device/hid_generic_inout/src/tusb_config.h
+++ b/examples/device/hid_generic_inout/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/hid_multiple_interface/CMakeLists.txt b/examples/device/hid_multiple_interface/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/hid_multiple_interface/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/hid_multiple_interface/src/tusb_config.h b/examples/device/hid_multiple_interface/src/tusb_config.h
index 412f9b004..a0aa17a90 100644
--- a/examples/device/hid_multiple_interface/src/tusb_config.h
+++ b/examples/device/hid_multiple_interface/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/midi_test/CMakeLists.txt b/examples/device/midi_test/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/midi_test/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/midi_test/src/tusb_config.h b/examples/device/midi_test/src/tusb_config.h
index d0c327e27..61b9b6552 100644
--- a/examples/device/midi_test/src/tusb_config.h
+++ b/examples/device/midi_test/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/msc_dual_lun/CMakeLists.txt b/examples/device/msc_dual_lun/CMakeLists.txt
new file mode 100644
index 000000000..084565400
--- /dev/null
+++ b/examples/device/msc_dual_lun/CMakeLists.txt
@@ -0,0 +1,41 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/msc_disk_dual.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/msc_dual_lun/src/tusb_config.h b/examples/device/msc_dual_lun/src/tusb_config.h
index e153a7967..44da21e54 100644
--- a/examples/device/msc_dual_lun/src/tusb_config.h
+++ b/examples/device/msc_dual_lun/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/net_lwip_webserver/CMakeLists.txt b/examples/device/net_lwip_webserver/CMakeLists.txt
new file mode 100644
index 000000000..695dd7c59
--- /dev/null
+++ b/examples/device/net_lwip_webserver/CMakeLists.txt
@@ -0,0 +1,87 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # lwip Stack source
+ set(SRC_LWIP
+ ${TOP}/lib/lwip/src/core/altcp.c
+ ${TOP}/lib/lwip/src/core/altcp_alloc.c
+ ${TOP}/lib/lwip/src/core/altcp_tcp.c
+ ${TOP}/lib/lwip/src/core/def.c
+ ${TOP}/lib/lwip/src/core/dns.c
+ ${TOP}/lib/lwip/src/core/inet_chksum.c
+ ${TOP}/lib/lwip/src/core/init.c
+ ${TOP}/lib/lwip/src/core/ip.c
+ ${TOP}/lib/lwip/src/core/mem.c
+ ${TOP}/lib/lwip/src/core/memp.c
+ ${TOP}/lib/lwip/src/core/netif.c
+ ${TOP}/lib/lwip/src/core/pbuf.c
+ ${TOP}/lib/lwip/src/core/raw.c
+ ${TOP}/lib/lwip/src/core/stats.c
+ ${TOP}/lib/lwip/src/core/sys.c
+ ${TOP}/lib/lwip/src/core/tcp.c
+ ${TOP}/lib/lwip/src/core/tcp_in.c
+ ${TOP}/lib/lwip/src/core/tcp_out.c
+ ${TOP}/lib/lwip/src/core/timeouts.c
+ ${TOP}/lib/lwip/src/core/udp.c
+ ${TOP}/lib/lwip/src/core/ipv4/autoip.c
+ ${TOP}/lib/lwip/src/core/ipv4/dhcp.c
+ ${TOP}/lib/lwip/src/core/ipv4/etharp.c
+ ${TOP}/lib/lwip/src/core/ipv4/icmp.c
+ ${TOP}/lib/lwip/src/core/ipv4/igmp.c
+ ${TOP}/lib/lwip/src/core/ipv4/ip4.c
+ ${TOP}/lib/lwip/src/core/ipv4/ip4_addr.c
+ ${TOP}/lib/lwip/src/core/ipv4/ip4_frag.c
+ ${TOP}/lib/lwip/src/netif/ethernet.c
+ ${TOP}/lib/lwip/src/netif/slipif.c
+ ${TOP}/lib/lwip/src/apps/http/httpd.c
+ ${TOP}/lib/lwip/src/apps/http/fs.c
+ ${TOP}/lib/networking/dhserver.c
+ ${TOP}/lib/networking/dnserver.c
+ ${TOP}/lib/networking/rndis_reports.c
+ )
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ ${SRC_LWIP}
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${TOP}/lib/lwip/src/include
+ ${TOP}/lib/lwip/src/include/ipv4
+ ${TOP}/lib/lwip/src/include/lwip/apps
+ ${TOP}/lib/networking
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ PBUF_POOL_SIZE=2
+ TCP_WND=2*TCP_MSS
+ HTTPD_USE_CUSTOM_FSDATA=0
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h
index b6d0e7a86..262d4ebce 100644
--- a/examples/device/net_lwip_webserver/src/tusb_config.h
+++ b/examples/device/net_lwip_webserver/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/uac2_headset/CMakeLists.txt b/examples/device/uac2_headset/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/uac2_headset/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/uac2_headset/src/tusb_config.h b/examples/device/uac2_headset/src/tusb_config.h
index d19feeb86..ebf181671 100644
--- a/examples/device/uac2_headset/src/tusb_config.h
+++ b/examples/device/uac2_headset/src/tusb_config.h
@@ -46,7 +46,9 @@ extern "C" {
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#endif
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
#ifndef CFG_TUSB_DEBUG
// Can be set during compilation i.e.: make LOG=<value for CFG_TUSB_DEBUG> BOARD=<bsp>
diff --git a/examples/device/usbtmc/CMakeLists.txt b/examples/device/usbtmc/CMakeLists.txt
new file mode 100644
index 000000000..03bb04389
--- /dev/null
+++ b/examples/device/usbtmc/CMakeLists.txt
@@ -0,0 +1,41 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usbtmc_app.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/usbtmc/src/tusb_config.h b/examples/device/usbtmc/src/tusb_config.h
index 603e67453..a192d0dbc 100644
--- a/examples/device/usbtmc/src/tusb_config.h
+++ b/examples/device/usbtmc/src/tusb_config.h
@@ -46,8 +46,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/webusb_serial/CMakeLists.txt b/examples/device/webusb_serial/CMakeLists.txt
new file mode 100644
index 000000000..99ee77bd3
--- /dev/null
+++ b/examples/device/webusb_serial/CMakeLists.txt
@@ -0,0 +1,40 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/webusb_serial/src/tusb_config.h b/examples/device/webusb_serial/src/tusb_config.h
index 48c9ddad6..26b81b389 100644
--- a/examples/device/webusb_serial/src/tusb_config.h
+++ b/examples/device/webusb_serial/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index d8cf993be..fabc7765c 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -45,7 +45,9 @@
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST
#endif
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake
index 8a3882cc0..edd57a39b 100644
--- a/hw/bsp/rp2040/family.cmake
+++ b/hw/bsp/rp2040/family.cmake
@@ -1,3 +1,33 @@
-cmake_minimum_required(VERSION 3.12)
-set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
-include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+# TinyUSB Stack source
+set(SRC_TINYUSB
+ ${TOP}/src/tusb.c
+ ${TOP}/src/common/tusb_fifo.c
+ ${TOP}/src/device/usbd.c
+ ${TOP}/src/device/usbd_control.c
+ ${TOP}/src/class/audio/audio_device.c
+ ${TOP}/src/class/cdc/cdc_device.c
+ ${TOP}/src/class/dfu/dfu_rt_device.c
+ ${TOP}/src/class/hid/hid_device.c
+ ${TOP}/src/class/midi/midi_device.c
+ ${TOP}/src/class/msc/msc_device.c
+ ${TOP}/src/class/net/net_device.c
+ ${TOP}/src/class/usbtmc/usbtmc_device.c
+ ${TOP}/src/class/vendor/vendor_device.c
+ ${TOP}/src/portable/raspberrypi/${FAMILY}/dcd_rp2040.c
+ ${TOP}/src/portable/raspberrypi/${FAMILY}/rp2040_usb.c
+)
+
+target_sources(${PROJECT} PUBLIC
+ ${TOP}/hw/bsp/${FAMILY}/family.c
+ ${SRC_TINYUSB}
+)
+
+target_include_directories(${PROJECT} PUBLIC
+ ${TOP}/hw
+ ${TOP}/src
+ ${TOP}/hw/bsp/${FAMILY}/boards/${BOARD}
+)
+
+target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_MCU=OPT_MCU_RP2040
+)
diff --git a/hw/bsp/rp2040/family_extra.cmake b/hw/bsp/rp2040/family_extra.cmake
deleted file mode 100644
index 661845844..000000000
--- a/hw/bsp/rp2040/family_extra.cmake
+++ /dev/null
@@ -1 +0,0 @@
-pico_sdk_init()
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index 5ab15aa3c..2b4ceb69c 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -48,7 +48,8 @@ typedef enum
{
TUSB_SPEED_FULL = 0,
TUSB_SPEED_LOW ,
- TUSB_SPEED_HIGH
+ TUSB_SPEED_HIGH,
+ TUSB_SPEED_INVALID = 0xff,
}tusb_speed_t;
/// defined base on USB Specs Endpoint's bmAttributes
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 10ae991f4..f278f4d94 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -153,7 +153,7 @@ tusb_device_state_t tuh_device_get_state (uint8_t const dev_addr)
tusb_speed_t tuh_device_get_speed (uint8_t const dev_addr)
{
- TU_ASSERT( dev_addr <= CFG_TUSB_HOST_DEVICE_MAX, TUSB_DEVICE_STATE_UNPLUG);
+ TU_ASSERT( dev_addr <= CFG_TUSB_HOST_DEVICE_MAX, TUSB_SPEED_INVALID);
return (tusb_speed_t) _usbh_devices[dev_addr].speed;
}
diff --git a/tools/build_board.py b/tools/build_board.py
index cf3a8fb94..464ee68cf 100644
--- a/tools/build_board.py
+++ b/tools/build_board.py
@@ -44,7 +44,7 @@ filter_with_input(all_boards)
all_boards.sort()
def build_board(example, board):
- global success_count, fail_count, skip_count
+ global success_count, fail_count, skip_count, exit_status
start_time = time.monotonic()
flash_size = "-"
sram_size = "-"
diff --git a/tools/build_esp32s2.py b/tools/build_esp32s2.py
index cff0cc33b..9823e8c53 100644
--- a/tools/build_esp32s2.py
+++ b/tools/build_esp32s2.py
@@ -42,7 +42,7 @@ filter_with_input(all_boards)
all_boards.sort()
def build_board(example, board):
- global success_count, fail_count, skip_count
+ global success_count, fail_count, skip_count, exit_status
start_time = time.monotonic()
flash_size = "-"
sram_size = "-"
diff --git a/tools/build_family.py b/tools/build_family.py
index 7f2c1a706..ae1bf078d 100644
--- a/tools/build_family.py
+++ b/tools/build_family.py
@@ -55,7 +55,7 @@ def build_family(example, family):
build_board(example, board)
def build_board(example, board):
- global success_count, fail_count, skip_count
+ global success_count, fail_count, skip_count, exit_status
start_time = time.monotonic()
flash_size = "-"
sram_size = "-"
@@ -95,18 +95,24 @@ def build_size(example, board):
def skip_example(example, board):
ex_dir = 'examples/' + example
+
+ # family.mk
board_mk = 'hw/bsp/{}/family.mk'.format(family)
+
+ # family.cmake
+ if not os.path.exists(board_mk):
+ board_mk = 'hw/bsp/{}/family.cmake'.format(family)
with open(board_mk) as mk:
mk_contents = mk.read()
# Skip all OPT_MCU_NONE these are WIP port
- if '-DCFG_TUSB_MCU=OPT_MCU_NONE' in mk_contents:
+ if 'CFG_TUSB_MCU=OPT_MCU_NONE' in mk_contents:
return 1
# Skip if CFG_TUSB_MCU in board.mk to match skip file
for skip_file in glob.iglob(ex_dir + '/.skip.MCU_*'):
- mcu_cflag = '-DCFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
+ mcu_cflag = 'CFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
if mcu_cflag in mk_contents:
return 1
@@ -114,7 +120,7 @@ def skip_example(example, board):
only_list = list(glob.iglob(ex_dir + '/.only.MCU_*'))
if len(only_list) > 0:
for only_file in only_list:
- mcu_cflag = '-DCFG_TUSB_MCU=OPT_' + os.path.basename(only_file).split('.')[2]
+ mcu_cflag = 'CFG_TUSB_MCU=OPT_' + os.path.basename(only_file).split('.')[2]
if mcu_cflag in mk_contents:
return 0
return 1