mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
pico_flash: Support FreeRTOS Static Allocation (#2229)
This commit is contained in:
parent
1ee91e1039
commit
876c09cbfa
1 changed files with 10 additions and 1 deletions
|
|
@ -145,7 +145,16 @@ static int default_enter_safe_zone_timeout_ms(__unused uint32_t timeout_ms) {
|
||||||
uint core_num = get_core_num();
|
uint core_num = get_core_num();
|
||||||
// create at low priority on other core
|
// create at low priority on other core
|
||||||
TaskHandle_t task_handle;
|
TaskHandle_t task_handle;
|
||||||
|
|
||||||
|
// when FreeRTOS dynamic allocation is disabled (configSUPPORT_DYNAMIC_ALLOCATION == 0), the following fails
|
||||||
|
#if configSUPPORT_DYNAMIC_ALLOCATION
|
||||||
if (pdPASS != xTaskCreateAffinitySet(flash_lockout_task, "flash lockout", configMINIMAL_STACK_SIZE, (void *)core_num, 0, 1u << (core_num ^ 1), &task_handle)) {
|
if (pdPASS != xTaskCreateAffinitySet(flash_lockout_task, "flash lockout", configMINIMAL_STACK_SIZE, (void *)core_num, 0, 1u << (core_num ^ 1), &task_handle)) {
|
||||||
|
#else
|
||||||
|
static StackType_t flash_lockout_stack[configMINIMAL_STACK_SIZE];
|
||||||
|
static StaticTask_t flash_lockout_task_tcb;
|
||||||
|
task_handle = xTaskCreateStaticAffinitySet(flash_lockout_task, "flash lockout", configMINIMAL_STACK_SIZE, (void *)core_num, 0, flash_lockout_stack, &flash_lockout_task_tcb, 1u << (core_num ^ 1));
|
||||||
|
if (task_handle == NULL) {
|
||||||
|
#endif
|
||||||
return PICO_ERROR_INSUFFICIENT_RESOURCES;
|
return PICO_ERROR_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
lockout_state[core_num] = FREERTOS_LOCKOUT_LOCKER_WAITING;
|
lockout_state[core_num] = FREERTOS_LOCKOUT_LOCKER_WAITING;
|
||||||
|
|
@ -216,4 +225,4 @@ static int default_exit_safe_zone_timeout_ms(__unused uint32_t timeout_ms) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return PICO_OK;
|
return PICO_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue