-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Rp2040 freertos #1993
base: master
Are you sure you want to change the base?
Rp2040 freertos #1993
Conversation
To use FreeRTOS with RP2040, you must install the FreeRTOS-Kernel source in a way that family.cmake can find it. Easiest place to put it is ${PICO_SDK_PATH}/../FreeRTOS-Kernel Make sure to use the smp branch. That is: cd ${PICO_SDK_PATH}/../FreeRTOS-Kernel git checkout smp In your project's CMakeFiles.txt, use libraries tinyusb_board_freertos, tinyusb_device_freertos, and tinyusb_host_freertos instead of the libraries without the '_freertos' suffix At some point, the FreeRTOS-Kernel smp branch will merge with the main branch. Hopefully, the large number of compiler warnings will be cleared by then.
I spelled continue() wrong. If the FreeRTOS-Kernel directory was not installed, this would break the build.
For backward compatibility with projects that set TINYUSB_OPT_OS in the CMakeLists.txt to OPT_OS_FREERTOS to create libraries without the _freertos suffix, only add the contents of TINYUSB_OPT_OS to the supported OS list.
endif() | ||
set(PROJ_SUFFIX "") | ||
foreach(SUPPORTED_OS IN LISTS SUPPORTED_OS_LIST) |
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.
why did you copy this here when you have FreeRTOS_Kernel_import.cmake too?
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.
Because FreeRTOS_Kernel_import.cmake has a fatal error message lines 47-49.
if (NOT FREERTOS_KERNEL_PATH)
message(FATAL_ERROR "FreeRTOS location was not specified. Please set FREERTOS_KERNEL_PATH.")
endif()
As I understand it, we do not want pico-sdk to fail to build if FreeRTOS-Kernel is not installed.
@hathach The build pre-comit is failing. I do not understand why file |
You need to leave an empty line at the end of the file to make ci check happy. On my editor the |
I am making some chagnes to the cmake as well to better support both esp32 and rp2040 as well as others later on. https://github.com/hathach/tinyusb/tree/cmake . I am currently busy, but once I get that merged first, I will hep to sync up this branch |
still haven't decided which is best way to do this, but I may follow the approach using by FreeRTOS-kernel https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/CMakeLists.txt which also requires an external file config I.e adding CMakelists.txt that define tinyusb as a lib but requires an target that expose tusb_config.h in the include path. Pico-sdk can define both no os and freertos config, and one that does not speciy the freertos config in the library link will use the no os one. Let me know what you think about this approach. |
@hathach That works for a single, stand-alone project but I think it does not work if you build the project from the pico-examples project? The top level CMakeLists.txt contains |
yeah, you are right, I think I will need to add |
fyi, i have been crazy busy, and will be for a bit longer, so apologies for not getting to this yet. |
No problems, we are all busy, I am actually working to add cmake build to tinyusb repo as well (for src/ and all other mcu families). Also latest freertos-kernel is adding support for CMake as well https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/CMakeLists.txt |
Thank you for making PR, after doing quite a bit of works to support cmake for other mcus, I am getting better with it. I agree that adding tinyusb_device_freertos and tinyusb_host_freertos is best approach. Though I think we should do it in pico-sdk, I also think the freertos-kernel lib should be also added there rather than within tinyusb. That will help pico user by just simply link with freertos-kernel and or tinyusb_device_freertos. Check out my PR to pico-sdk here raspberrypi/pico-sdk#1438 . @kilograham @rppicomidi would you mind review/comment and move our discussion to that. |
Describe the PR
This draft pull request shows a possible way to implement FreeRTOS support for RP2040.
To use FreeRTOS with RP2040, you must install the FreeRTOS-Kernel source in a way that family.cmake can find it. Easiest place to put it is
Make sure to use the smp branch. That is:
In your project's CMakeFiles.txt, use libraries
instead of the libraries without the '_freertos' suffix
At some point, the FreeRTOS-Kernel smp branch will merge with the main branch. Hopefully, the large number of compiler warnings will be cleared by then.
Additional context
See discussion #1951.
Edit: I meant to make this a draft pull request. Anyone know how to change it?