freertos-smp: Enable static task cleanup

This commit enables Static task cleanup feature for FreeRTOS SMP.
This commit is contained in:
Sudeep Mohanty 2022-10-31 10:39:17 +01:00
parent d861fdc947
commit defd6c4ec1
4 changed files with 17 additions and 4 deletions

View File

@ -155,4 +155,8 @@ else()
if(CONFIG_SPIRAM)
idf_component_optional_requires(PRIVATE esp_psram)
endif()
if(CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP AND CONFIG_FREERTOS_SMP)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=vPortCleanUpTCB")
endif()
endif()

View File

@ -1004,8 +1004,19 @@ void vApplicationMinimalIdleHook( void )
* Hook function called during prvDeleteTCB() to cleanup any
* user defined static memory areas in the TCB.
*/
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
void __real_vPortCleanUpTCB( void *pxTCB );
void __wrap_vPortCleanUpTCB( void *pxTCB )
#else
void vPortCleanUpTCB ( void *pxTCB )
#endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
{
#if ( CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP )
/* Call user defined vPortCleanUpTCB */
__real_vPortCleanUpTCB( pxTCB );
#endif /* CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP */
#if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS )
/* Call TLS pointers deletion callbacks */
vPortTLSPointersDelCb( pxTCB );

View File

@ -303,8 +303,6 @@ menu "FreeRTOS"
off to save space in the TCB memory.
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

@ -6,7 +6,6 @@
#include "sdkconfig.h"
#ifndef CONFIG_FREERTOS_SMP
/*
Note: We disable this test when using the FreeRTOS SMP kernel as the port will already provide
a definition for vApplicationTickHook(). Thus this test cannot be run.
@ -19,6 +18,7 @@ a definition for vApplicationTickHook(). Thus this test cannot be run.
#include "unity.h"
#include "test_utils.h"
#ifndef CONFIG_FREERTOS_SMP
/*
Test FreeRTOS idle hook. Only compiled in if FreeRTOS idle hooks are enabled.
*/
@ -63,6 +63,7 @@ TEST_CASE("FreeRTOS tick hook", "[freertos]")
}
#endif // configUSE_TICK_HOOK
#endif // CONFIG_FREERTOS_SMP
#if CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
@ -91,4 +92,3 @@ TEST_CASE("static task cleanup hook is called based on config", "[freertos]")
}
#endif // CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
#endif // CONFIG_FREERTOS_SMP