Explorar el Código

Merge pull request #603 from hathach/pico-followup

Pico followup for (ci) building examples
Ha Thach hace 5 años
padre
commit
c43ac7f1d7
Se han modificado 39 ficheros con 740 adiciones y 163 borrados
  1. 25 24
      .github/workflows/build.yml
  2. 40 0
      examples/device/audio_test/CMakeLists.txt
  3. 2 0
      examples/device/audio_test/src/tusb_config.h
  4. 34 55
      examples/device/board_test/CMakeLists.txt
  5. 1 0
      examples/device/board_test/src/CMakeLists.txt
  6. 40 0
      examples/device/cdc_dual_ports/CMakeLists.txt
  7. 36 62
      examples/device/cdc_msc/CMakeLists.txt
  8. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_RP2040
  9. 40 0
      examples/device/dfu_rt/CMakeLists.txt
  10. 2 1
      examples/device/dfu_rt/src/tusb_config.h
  11. 41 0
      examples/device/dynamic_configuration/CMakeLists.txt
  12. 2 1
      examples/device/dynamic_configuration/src/tusb_config.h
  13. 40 0
      examples/device/hid_composite/CMakeLists.txt
  14. 2 1
      examples/device/hid_composite/src/tusb_config.h
  15. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_RP2040
  16. 40 0
      examples/device/hid_generic_inout/CMakeLists.txt
  17. 2 1
      examples/device/hid_generic_inout/src/tusb_config.h
  18. 40 0
      examples/device/hid_multiple_interface/CMakeLists.txt
  19. 2 1
      examples/device/hid_multiple_interface/src/tusb_config.h
  20. 40 0
      examples/device/midi_test/CMakeLists.txt
  21. 2 1
      examples/device/midi_test/src/tusb_config.h
  22. 41 0
      examples/device/msc_dual_lun/CMakeLists.txt
  23. 2 1
      examples/device/msc_dual_lun/src/tusb_config.h
  24. 87 0
      examples/device/net_lwip_webserver/CMakeLists.txt
  25. 2 1
      examples/device/net_lwip_webserver/src/tusb_config.h
  26. 40 0
      examples/device/uac2_headset/CMakeLists.txt
  27. 2 0
      examples/device/uac2_headset/src/tusb_config.h
  28. 41 0
      examples/device/usbtmc/CMakeLists.txt
  29. 2 1
      examples/device/usbtmc/src/tusb_config.h
  30. 40 0
      examples/device/webusb_serial/CMakeLists.txt
  31. 2 1
      examples/device/webusb_serial/src/tusb_config.h
  32. 2 0
      examples/host/cdc_msc_hid/src/tusb_config.h
  33. 33 3
      hw/bsp/rp2040/family.cmake
  34. 0 1
      hw/bsp/rp2040/family_extra.cmake
  35. 2 1
      src/common/tusb_types.h
  36. 1 1
      src/host/usbh.c
  37. 1 1
      tools/build_board.py
  38. 1 1
      tools/build_esp32s2.py
  39. 10 4
      tools/build_family.py

+ 25 - 24
.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 }}

+ 40 - 0
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()

+ 2 - 0
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

+ 34 - 55
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)
+if(FAMILY STREQUAL "esp32s2")
+  cmake_minimum_required(VERSION 3.5)
+  include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+  project(${PROJECT})
+
+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})
+
+  include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+  # Example source
+  target_sources(${PROJECT} PUBLIC
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/main.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()
-
-include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
-project(${PROJECT})
-
-if(FAMILY STREQUAL "rp2040")
-
-pico_sdk_init()
-
-add_executable(${PROJECT})
-
-# 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
-  src/main.c
-  ${TOP}/hw/bsp/${FAMILY}/family.c
-  ${SRC_TINYUSB}
-)
-
-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})
-
-endif()

+ 1 - 0
examples/device/board_test/src/CMakeLists.txt

@@ -1,3 +1,4 @@
+# FAMILY = "esp32s2"
 idf_component_register(SRCS "main.c"
                     INCLUDE_DIRS "."
                     REQUIRES freertos soc)

+ 40 - 0
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()

+ 36 - 62
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)
+if(FAMILY STREQUAL "esp32s2")
+  cmake_minimum_required(VERSION 3.5)
+  include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+  project(${PROJECT})
+
+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})
+
+  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()
-
-include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
-project(${PROJECT})
-
-if(FAMILY STREQUAL "rp2040")
-
-pico_sdk_init()
-
-add_executable(${PROJECT})
-
-# 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
-set(SRC_EXAMPLE
-  src/main.c
-  src/msc_disk.c
-  src/usb_descriptors.c
-)
-
-target_sources(${PROJECT} PUBLIC
-  ${SRC_EXAMPLE}
-  ${TOP}/hw/bsp/${FAMILY}/family.c
-  ${SRC_TINYUSB}
-)
-
-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})
-
-endif()

+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_RP2040


+ 40 - 0
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()

+ 2 - 1
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

+ 41 - 0
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()

+ 2 - 1
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

+ 40 - 0
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()

+ 2 - 1
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

+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_RP2040


+ 40 - 0
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()

+ 2 - 1
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

+ 40 - 0
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()

+ 2 - 1
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

+ 40 - 0
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()

+ 2 - 1
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

+ 41 - 0
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()

+ 2 - 1
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

+ 87 - 0
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()

+ 2 - 1
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

+ 40 - 0
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()

+ 2 - 0
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>

+ 41 - 0
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()

+ 2 - 1
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

+ 40 - 0
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()

+ 2 - 1
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

+ 2 - 0
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

+ 33 - 3
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
+)

+ 0 - 1
hw/bsp/rp2040/family_extra.cmake

@@ -1 +0,0 @@
-pico_sdk_init()

+ 2 - 1
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

+ 1 - 1
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;
 }
 

+ 1 - 1
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 = "-"

+ 1 - 1
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 = "-"

+ 10 - 4
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