-
Notifications
You must be signed in to change notification settings - Fork 935
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
add freertos version of tinyusb tinyusb_device_freertos and tinyusb_host_freertos #1438
base: develop
Are you sure you want to change the base?
Conversation
target_link_libraries(tinyusb_board INTERFACE tinyusb_bsp) | ||
# FreeRTOS: tinyusb_device_freertos, tinyusb_host_freertos | ||
add_tinyusb_library(freertos) | ||
#target_link_libraries(tinyusb_common_freertos INTERFACE freertos_kernel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to link with freeRTOS kernel lib for osal API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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 In 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
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). |
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_FREERTOS
to 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