Merge pull request #603 from hathach/pico-followup

Pico followup for (ci) building examples
This commit is contained in:
Ha Thach 2021-01-25 17:18:24 +07:00 committed by GitHub
commit c43ac7f1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 746 additions and 169 deletions

View File

@ -29,7 +29,7 @@ jobs:
family:
- 'imxrt'
- 'nrf'
#- 'rp2040'
- 'rp2040'
- 'samd21'
- 'samd51'
- 'stm32f4'
@ -94,35 +94,6 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
- name: Cache MSP430 Toolchain
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
- name: Install MSP430 Toolchain
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
- name: Install Toolchains
run: |
# ARM & RISC-V GCC from xpack
npm install --global xpm
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
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:
@ -134,6 +105,36 @@ jobs:
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: ~/cache/
key: ${{ runner.os }}-21-01-26-${{ env.MSP430_GCC_URL }}
- name: Install MSP430-GCC
if: steps.cache-msp430.outputs.cache-hit != 'true'
run: |
# 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: |
# ARM & RISC-V GCC from xpack
npm install --global xpm
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
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 >> $GITHUB_PATH `echo ~/cache/msp430-gcc/msp430-gcc-*/bin`
- name: Build
run: python3 tools/build_board.py ${{ matrix.example }}

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

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

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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>

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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
)

View File

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

View File

@ -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

View File

@ -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;
}

View File

@ -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 = "-"

View File

@ -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 = "-"

View File

@ -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