From c09a1534959109082424c707a57ac8690dfffa18 Mon Sep 17 00:00:00 2001 From: Balazs Racz Date: Mon, 5 Apr 2021 19:50:16 +0200 Subject: [PATCH] Fix os_thread_create_helper for arduino esp32 (#525) Fix code that runs for task creation when a freertos config that enables static allocation. The previous code was probably never compiled because it had an undeclared variable. --- src/os/os.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/os/os.c b/src/os/os.c index f956cd173..d51c51f60 100644 --- a/src/os/os.c +++ b/src/os/os.c @@ -421,17 +421,15 @@ int __attribute__((weak)) os_thread_create_helper(os_thread_t *thread, void *priv) { HASSERT(thread); -#if (configSUPPORT_STATIC_ALLOCATION == 1) +#if (configSUPPORT_DYNAMIC_ALLOCATION == 1) + xTaskCreate(os_thread_start, (const char *const)name, + stack_size/sizeof(portSTACK_TYPE), priv, priority, thread); +#elif (configSUPPORT_STATIC_ALLOCATION == 1) *thread = xTaskCreateStatic(os_thread_start, (const char *const)name, stack_size/sizeof(portSTACK_TYPE), priv, priority, (StackType_t *)stack_malloc(stack_size), (StaticTask_t *) malloc(sizeof(StaticTask_t))); - task_new->task = *thread; - task_new->name = (char*)pcTaskGetTaskName(*thread); -#elif (configSUPPORT_DYNAMIC_ALLOCATION == 1) - xTaskCreate(os_thread_start, (const char *const)name, - stack_size/sizeof(portSTACK_TYPE), priv, priority, thread); #else #error FREERTOS version v9.0.0 or later required #endif