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();
|
||||
// create at low priority on other core
|
||||
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)) {
|
||||
#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;
|
||||
}
|
||||
lockout_state[core_num] = FREERTOS_LOCKOUT_LOCKER_WAITING;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue