Skip to content
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

FreeRTOS: pico_flash/flash.c calls xTaskCreateAffinitySet which is not available using static memory allocation #2120

Open
maqifrnswa opened this issue Dec 3, 2024 · 0 comments

Comments

@maqifrnswa
Copy link

maqifrnswa commented Dec 3, 2024

pico_flash/flash.c uses xTaskCreateAffinitySet, which is only available in FreeRTOS if confiugred to support dynamic allocation.

if (pdPASS != xTaskCreateAffinitySet(flash_lockout_task, "flash lockout", configMINIMAL_STACK_SIZE, (void *)core_num, 0, 1u << (core_num ^ 1), &task_handle)) {

It's defined here:
https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/974351fe4aec19779f5be774007810c6ab36a8ab/tasks.c#L1758

If one was trying to use pure static FreeRTOS

#define configSUPPORT_DYNAMIC_ALLOCATION    0
#define configKERNEL_PROVIDED_STATIC_MEMORY     1

you'll get the following compilation warning:
pico_flash/flash.c:148:23: warning: implicit declaration of function 'xTaskCreateAffinitySet'; did you mean 'vTaskCoreAffinitySet'? [-Wimplicit-function-declaration]

For static allocation, it looks like you'd first have to create the static task then use vTaskCoreAffinitySet.

Perhaps it doesn't need to change (as pico sdk does other dynamic allocation, I believe), so maybe just outputting a warning during compilation that says "pico sdk requires configSUPPORT_DYNAMIC_ALLOCATION to be 1" would be enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant