add freertos version of tinyusb tinyusb_device_freertos and tinyusb_host_freertos #1438
No reviewers
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk!1438
Loading…
Reference in a new issue
No description provided.
Delete branch "hathach/add-tinyusb-freertos"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR intends to add freertos version of tinyusb to make it easier for user application to use tinyusb with freertos.
CFG_TUSB_OS=OPT_OS_FREERTOSto tinyusb_common_freertos and should have no impact on existing user codeHowver, this PR is not complete since tinyusb make use of freeRTOS API and should be linked with freeRTOS-kernel. However, current pico-sdk does not define freertos lib. I don't know if RPI team plan to add rp2_common/freertos but I think this is a good chance to do so. Considering the popular of freeRTOS, adding a CMakelists.txt to pico-sdk make sense since kernel is pretty static. There is only 1 gotcha, like tinyusb freertos need to find path to FreeRTOSConfig.h and port source. Though with latest FreeRTOS, user can simply define freertos-config with include path to config file https://github.com/FreeRTOS/FreeRTOS-Kernel#to-consume-freertos-kernel
If you think adding freertos kernel to pico-sdk makes sense, I can help to make an PR for it (have been adding that for other mcus in the tinyusb repo). Afterwards we can start to add some basic blinky_freertos and hid_composite_freertos to the pico-examples repo.
PS: preping changes in rp2040/family.cmake in tinyusb already done https://github.com/hathach/tinyusb/pull/2128/files#diff-f54d038db87a30de40119b5a78952d17b8464c6de753d37d3b180ce82fa59ad3
need to link with freeRTOS kernel lib for osal API.
Lets try to get this in in the 1.6.0 release (we won't be picking up a TinyUSB before that anyway)...
Note that in the
pico-sdk, we include libraries that will work with FreeRTOS (e.g. WiFi/BT stuff) but we don't actually include FreeRTOS itself; so we'd do the same for TinyUSB.In
pico-examples, we include examples using FreeRTOS, but again you have to setFREERTOS_KERNEL_PATHto include them.I will need to understand a little more about FreeRTOS/TinyUSB - e.g. how/if the threading model is changed.
oh, sorry, I wasn't paying attention much to wifi/b and didn't know freeRTOS is meant to be used with
FREERTOS_KERNEL_PATH, was thinking about the lib approach. I will checkout those example real quick and update PR if needed.TinyUSB will use freeRTOS API (semaphore/queue) for its internal usage instead of spinlock provided by pico-sdk
However, stdio_usb may need some changes, e.g instead of usign svc interrupt to call tud_task() and cdc_flush() you should put it in an dedicated thread with decent priority. Since freeRTOS API is different in thread and ISR context (could cause kernel panic if not right).
@hathach function add_tinyusb_library as written has default freertos and exception noos. I think line 27 should be if (RTOS STREQUAL freertos) and the logic that follows should be reversed. Reason is that until now, FreeRTOS has not really been supported for the RP2040.
that is for adding other rtos if pico intend to do that in the future, just upper and add the OPT_OS_RTOS to common.
What is the status of this? I updated my sdk a month ago to match this commit while refactoring the code for one of our products to use freertos. Today I was going to update my sdk to 2.1.0 but it doesn't look like this change has made it in yet.
Michael
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.