Fix: Propagate PICO_SDK_VERSION variables to parent scope in RP2040 port #1326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Description
Problem
The FreeRTOS kernel RP2040 port attempts to automatically include the Pico SDK for users who haven't done so themselves. However, it doesn't propagate SDK version variables to the parent scope, causing
pico_sdk_init()to fail with:Test Steps
Create a CMakeLists.txt like this:
Or
After this fix
Users can either:
Cause
When FreeRTOS is included first, it includes
pico_sdk_import.cmakefor users. However,FreeRTOS_Kernel_import.cmakecallsadd_subdirectory(), creating a child CMake scope. Inside the child scope,pico_sdk_import.cmakesets the SDK version variables (PICO_SDK_VERSION_MAJOR,PICO_SDK_VERSION_MINOR,PICO_SDK_VERSION_REVISION), but these variables are not propagated to the parent scope.When users call
pico_sdk_init()in their ownCMakeLists.txt, thepico_init_pioasm()function tries to construct:Since these variables are undefined in the parent scope, this becomes
"..", causingfind_package()to fail atChecklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.