freertos: Fix SMP FreeRTOS TSLP deletion callback tests

The TLSP deletion callback feature is not compatible with the CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
option. However, the "freertos_options" unit test configuration will enable that option.

This commit disables all CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP related features when compiling with
SMP FreeRTOS.
This commit is contained in:
Darian Leung 2022-06-17 21:57:11 +08:00
parent 73989eb05b
commit 97cf44cbe0
4 changed files with 11 additions and 19 deletions

View File

@ -296,6 +296,7 @@ menu "FreeRTOS"
config FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
# Todo: This is incompatible with SMP FreeRTOS. See if this can be deprecated (IDF-4986)
depends on !FREERTOS_SMP
bool "Enable static task clean up hook"
default n
help

View File

@ -13,7 +13,7 @@ list(APPEND extra_link_flags "-u pthread_include_pthread_cond_impl")
list(APPEND extra_link_flags "-u pthread_include_pthread_local_storage_impl")
list(APPEND extra_link_flags "-u pthread_include_pthread_rwlock_impl")
if(CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP)
if(CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP AND NOT CONFIG_FREERTOS_SMP) # See IDF-4955
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=vPortCleanUpTCB")
endif()

View File

@ -1,16 +1,8 @@
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <pthread.h>
#include <string.h>
@ -150,7 +142,7 @@ static void pthread_local_storage_thread_deleted_callback(int index, void *v_tls
free(tls);
}
#if defined(CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP)
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP && !CONFIG_FREERTOS_SMP // IDF-4955
/* Called from FreeRTOS task delete hook */
void pthread_local_storage_cleanup(TaskHandle_t task)
{
@ -171,7 +163,7 @@ void __wrap_vPortCleanUpTCB(void *tcb)
pthread_local_storage_cleanup(tcb);
__real_vPortCleanUpTCB(tcb);
}
#endif
#endif // CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP && !CONFIG_FREERTOS_SMP
/* this function called from pthread_task_func for "early" cleanup of TLS in a pthread */
void pthread_internal_local_storage_destructor_callback(void)
@ -182,14 +174,14 @@ void pthread_internal_local_storage_destructor_callback(void)
/* remove the thread-local-storage pointer to avoid the idle task cleanup
calling it again...
*/
#if defined(CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP)
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP && !CONFIG_FREERTOS_SMP // IDF-4955
vTaskSetThreadLocalStoragePointer(NULL, PTHREAD_TLS_INDEX, NULL);
#else
vTaskSetThreadLocalStoragePointerAndDelCallback(NULL,
PTHREAD_TLS_INDEX,
NULL,
NULL);
#endif
#endif // CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP && !CONFIG_FREERTOS_SMP
}
}

View File

@ -1094,7 +1094,6 @@ components/protocomm/src/common/protocomm_priv.h
components/protocomm/src/security/security0.c
components/pthread/pthread_cond_var.c
components/pthread/pthread_internal.h
components/pthread/pthread_local_storage.c
components/pthread/test/test_cxx_cond_var.cpp
components/pthread/test/test_cxx_std_future.cpp
components/pthread/test/test_pthread.c