Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream synchronization #52

Open
wants to merge 27 commits into
base: release/v0.18
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
19b6baa
Fix potential out of bounds access in msc_disk.c
PwnVerse Jan 9, 2025
c8130af
bump up cmake min to 3.20
hathach Jan 3, 2025
91214b4
zephyr
hathach Jan 16, 2025
6080f89
- change to use CMAKE_SYSTEM_CPU to prevent CMAKE_SYSTEM_PROCESSOR co…
hathach Jan 22, 2025
586d284
Merge branch 'master' into patch-1
HiFiPhile Jan 22, 2025
bd08753
Fix CI.
HiFiPhile Jan 22, 2025
19d28a9
Fix also cdc_msc example.
HiFiPhile Jan 22, 2025
597446f
Merge pull request #2939 from PwnVerse/patch-1
HiFiPhile Jan 22, 2025
31071cc
kind of work with zephyr with pca10056 with cmake -DBUILD_ZEPHYR
hathach Jan 23, 2025
0162d6a
kind of work with zephyr with pca10056 with cmake -DBUILD_ZEPHYR
hathach Jan 23, 2025
9f45e25
msc_dual_lun and cdc_msc work with zephyr on pca10056
hathach Jan 23, 2025
5ca3822
stm32: fix conditional compilation error when not using uart
Jan 23, 2025
201b970
try build zephyr with ci
hathach Jan 23, 2025
b53801a
add cmake RTOS=zephyr (default noos) for zephyr build
hathach Jan 24, 2025
13856af
add -DRTOS=zephyr to ci west build
hathach Jan 24, 2025
1003aba
use board alias for pca10056
hathach Jan 25, 2025
dc514c6
use board alias for pca10056
hathach Jan 25, 2025
6b3a595
cmake remove EXAMPLE-tinyusb target as library
hathach Jan 25, 2025
8c7998b
fix ci
hathach Jan 25, 2025
f6f02f1
correct offset check logic
hathach Jan 25, 2025
37e6f49
Merge pull request #2964 from hathach/fix-2939
hathach Jan 25, 2025
7641060
Merge branch 'master' into zephyr-support
hathach Jan 25, 2025
882cb14
update cmake.xml
hathach Jan 25, 2025
0d4f945
Merge pull request #2962 from hathach/zephyr-support
hathach Jan 25, 2025
67f0d61
Merge branch 'master' into master
HiFiPhile Jan 27, 2025
eca025f
Merge pull request #2959 from ho-ho-ho/master
HiFiPhile Jan 27, 2025
eb1d628
Merge branch 'master' into sync/upstream
roma-jam Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,24 @@ jobs:

- name: Build
run: python3 tools/build.py --one-per-family --toolchain iar $BUILD_ARGS

# ---------------------------------------
# Zephyr
# ---------------------------------------
zephyr:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout TinyUSB
uses: actions/checkout@v4

- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: examples
toolchains: arm-zephyr-eabi

- name: Build
run: |
west build -b pca10056 -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr
west build -b pca10056 -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
6 changes: 4 additions & 2 deletions .idea/cmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

#set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(${CMAKE_CURRENT_SOURCE_DIR}/../hw/bsp/family_support.cmake)
Expand Down
4 changes: 4 additions & 0 deletions examples/build_system/cmake/toolchain/arm_gcc.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if (RTOS STREQUAL zephyr)
return()
endif ()

if (NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
endif ()
Expand Down
5 changes: 3 additions & 2 deletions examples/build_system/cmake/toolchain/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include(CMakePrintHelpers)
# Common
# ----------------------------------------------------------------------------
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_CPU})
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)

# Look for includes and libraries only in the target system prefix.
Expand All @@ -13,8 +14,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# pass TOOLCHAIN_CPU to
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR)
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake)
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_CPU)
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_CPU}.cmake)

# ----------------------------------------------------------------------------
# Compile flags
Expand Down
2 changes: 1 addition & 1 deletion examples/device/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/audio_4_channel_mic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/audio_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/audio_test_freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/audio_test_multi_rate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
15 changes: 10 additions & 5 deletions examples/device/board_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand All @@ -15,18 +15,23 @@ if(FAMILY STREQUAL "espressif")
return()
endif()

add_executable(${PROJECT})
if (RTOS STREQUAL zephyr)
set(EXE_NAME app)
else()
set(EXE_NAME ${PROJECT})
add_executable(${EXE_NAME})
endif()

# Example source
target_sources(${PROJECT} PUBLIC
target_sources(${EXE_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
)

# Example include
target_include_directories(${PROJECT} PUBLIC
target_include_directories(${EXE_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Configure compilation flags and libraries for the example without RTOS.
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT} noos)
family_configure_device_example(${EXE_NAME} ${RTOS})
2 changes: 1 addition & 1 deletion examples/device/cdc_dual_ports/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
19 changes: 12 additions & 7 deletions examples/device/cdc_msc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
Expand All @@ -16,20 +16,25 @@ if(FAMILY STREQUAL "espressif")
return()
endif()

add_executable(${PROJECT})
if (RTOS STREQUAL zephyr)
set(EXE_NAME app)
else()
set(EXE_NAME ${PROJECT})
add_executable(${EXE_NAME})
endif()

# Example source
target_sources(${PROJECT} PUBLIC
target_sources(${EXE_NAME} PRIVATE
${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
target_include_directories(${EXE_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT} noos)
# Configure compilation flags and libraries for the example without RTOS.
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${EXE_NAME} ${RTOS})
6 changes: 6 additions & 0 deletions examples/device/cdc_msc/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CONFIG_GPIO=y
CONFIG_FPU=y
CONFIG_NO_OPTIMIZATIONS=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_NRFX_POWER=y
CONFIG_NRFX_UARTE0=y
9 changes: 8 additions & 1 deletion examples/device/cdc_msc/src/msc_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff
(void) lun;

// out of ramdisk
if ( lba >= DISK_BLOCK_NUM ) return -1;
if ( lba >= DISK_BLOCK_NUM ) {
return -1;
}

// Check for overflow of offset + bufsize
if ( offset + bufsize > DISK_BLOCK_SIZE ) {
return -1;
}

uint8_t const* addr = msc_disk[lba] + offset;
memcpy(buffer, addr, bufsize);
Expand Down
2 changes: 1 addition & 1 deletion examples/device/cdc_msc_freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
9 changes: 8 additions & 1 deletion examples/device/cdc_msc_freertos/src/msc_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,14 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff
(void) lun;

// out of ramdisk
if ( lba >= DISK_BLOCK_NUM ) return -1;
if ( lba >= DISK_BLOCK_NUM ) {
return -1;
}

// Check for overflow of offset + bufsize
if ( offset + bufsize > DISK_BLOCK_SIZE ) {
return -1;
}

uint8_t const* addr = msc_disk[lba] + offset;
memcpy(buffer, addr, bufsize);
Expand Down
2 changes: 1 addition & 1 deletion examples/device/cdc_uac2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/dfu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/dfu_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/dynamic_configuration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/hid_boot_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/hid_composite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/hid_composite_freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/hid_generic_inout/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/hid_multiple_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/midi_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/midi_test_freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
15 changes: 10 additions & 5 deletions examples/device/msc_dual_lun/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand All @@ -15,20 +15,25 @@ if(FAMILY STREQUAL "espressif")
return()
endif()

add_executable(${PROJECT})
if (RTOS STREQUAL zephyr)
set(EXE_NAME app)
else()
set(EXE_NAME ${PROJECT})
add_executable(${EXE_NAME})
endif()

# Example source
target_sources(${PROJECT} PUBLIC
target_sources(${EXE_NAME} PRIVATE
${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
target_include_directories(${EXE_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Configure compilation flags and libraries for the example without RTOS.
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT} noos)
family_configure_device_example(${EXE_NAME} ${RTOS})
6 changes: 6 additions & 0 deletions examples/device/msc_dual_lun/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CONFIG_GPIO=y
CONFIG_FPU=y
CONFIG_NO_OPTIMIZATIONS=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_NRFX_POWER=y
CONFIG_NRFX_UARTE0=y
2 changes: 1 addition & 1 deletion examples/device/net_lwip_webserver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_LIST_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/uac2_headset/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/uac2_speaker_fb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/usbtmc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/video_capture/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/video_capture/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static void fill_color_bar(uint8_t* buffer, unsigned start_position) {

#endif

void video_send_frame(void) {
static void video_send_frame(void) {
static unsigned start_ms = 0;
static unsigned already_sent = 0;

Expand Down
2 changes: 1 addition & 1 deletion examples/device/video_capture_2ch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/device/webusb_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

Expand Down
2 changes: 1 addition & 1 deletion examples/dual/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.20)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)

Expand Down
Loading
Loading