Add RPI Pico SDK mutex and locking to multithread#345
Conversation
* Add Twitter and Readthedocs shields Signed-off-by: Pablo Garrido <pablogs9@gmail.com> * Update Signed-off-by: Pablo Garrido <pablogs9@gmail.com> * Fix Signed-off-by: Pablo Garrido <pablogs9@gmail.com> (cherry picked from commit 8b78d22) Co-authored-by: Pablo Garrido <pablogs9@gmail.com>
Signed-off-by: Dwayne Williams <dewilliams0327@gmail.com>
Signed-off-by: Dwayne Williams <dewilliams0327@gmail.com>
| #elif defined(PLATFORM_NAME_FREERTOS) | ||
| #include "FreeRTOS.h" | ||
| #include "semphr.h" | ||
| #elif defined(PLATFORM_NAME_RPIPICO) |
There was a problem hiding this comment.
Where is PLATFORM_NAME_RPIPICO defined?
There was a problem hiding this comment.
I gathered from here #233 that PLATFORM_NAME_FREERTOS was defined by the user so followed the same logic. I stuck add_compile_definitions(PLATFORM_NAME_RPIPICO) at the bottom of the toolchain.cmake file and it works however the its not detecting the "pico/mutex.h" so I am working on linking that.
There was a problem hiding this comment.
You will need to add the include folders of Pico SDK on the CMake toolchain.
There was a problem hiding this comment.
Yeah, I am working on that. The problem is the sdk has all of its include directories scattered and one file is "version.h" is auto-generated and stored in the build folder. I gathered most of what i think is important and trying to compile now but running into some errors that i don't understand like:
/home/.../pico/pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/timer.h:105:33: error: expected declaration specifiers or '...' before string constant
105 | static_assert( NUM_TIMERS == 4, "");
include_directories(
$ENV{PICO_SDK_PATH}/build/generated/pico_base
$ENV{PICO_SDK_PATH}/src/rp2040/hardware_regs/include
$ENV{PICO_SDK_PATH}/src/rp2040/hardware_structs/include
$ENV{PICO_SDK_PATH}/src/rp2_common/hardware_timer/include
$ENV{PICO_SDK_PATH}/src/rp2_common/hardware_base/include
$ENV{PICO_SDK_PATH}/src/rp2_common/hardware_sync/include
$ENV{PICO_SDK_PATH}/src/rp2_common/pico_platform/include
$ENV{PICO_SDK_PATH}/src/common/pico_base/include
$ENV{PICO_SDK_PATH}/src/common/pico_time/include
$ENV{PICO_SDK_PATH}/src/common/pico_sync/include
)
If I comment that line out it works but I'm looking for a better solution than that
There was a problem hiding this comment.
It looks like the problem is the code is being compiled with -std=c99 somewhere but the pico sdk needs c11 to compile with the static_assert function. I cloned the sdk repository branch and patched that and am able to build just fine.
There was a problem hiding this comment.
Actually adding "-DUCLIENT_C_STANDARD=11" to the colcon.meta solved this problem for the microxrcedds_client but i get the same error in rmw_microxrcedds where it looks like the C_STANDARD is hard coded to 99. If this CMakeList file could change that static 99 to an argument with a default of 99 like UCLIENT_C_STANDARD here i think this would not be a problem.
There was a problem hiding this comment.
Thanks, we will merge this asap
Implemented locking for rpi pico sdk per our discussion here:
micro-ROS/micro_ros_raspberrypi_pico_sdk#795
Sorry for PR spam. This is my first time using sign off