From 0e5adc1b9c3526d14996cc29420774ae3879e439 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Tue, 8 Oct 2024 12:05:39 +0200 Subject: [PATCH] feat(freertos): Add FreeRTOS port layer mocks for CMock tests This commit adds mocks for the FreeRTOS linux port layer for tests which mock the FreeRTOS component and use port layer APIs. --- .../portable/linux/include/freertos/portmacro.h | 4 ++-- tools/mocks/freertos/CMakeLists.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h index 179265b778e..583c568d888 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h @@ -94,8 +94,8 @@ extern void vPortEnableInterrupts( void ); extern BaseType_t xPortSetInterruptMask( void ); extern void vPortClearInterruptMask( BaseType_t xMask ); -extern void vPortEnterCritical( void ); -extern void vPortExitCritical( void ); +void vPortEnterCritical( void ); +void vPortExitCritical( void ); #define portSET_INTERRUPT_MASK_FROM_ISR() xPortSetInterruptMask() #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK() diff --git a/tools/mocks/freertos/CMakeLists.txt b/tools/mocks/freertos/CMakeLists.txt index ce6111260ab..9286bd3d2ce 100644 --- a/tools/mocks/freertos/CMakeLists.txt +++ b/tools/mocks/freertos/CMakeLists.txt @@ -25,7 +25,8 @@ idf_component_mock(INCLUDE_DIRS ${include_dirs} ${original_freertos_dir}/esp_additions/include/freertos/idf_additions.h ${original_freertos_dir}/FreeRTOS-Kernel/include/freertos/task.h ${original_freertos_dir}/FreeRTOS-Kernel/include/freertos/event_groups.h - ${original_freertos_dir}/FreeRTOS-Kernel/include/freertos/queue.h) + ${original_freertos_dir}/FreeRTOS-Kernel/include/freertos/queue.h + ${original_freertos_dir}/FreeRTOS-Kernel/portable/linux/include/freertos/portmacro.h) idf_component_get_property(freertos_lib freertos COMPONENT_LIB) target_compile_definitions(${freertos_lib} PUBLIC "projCOVERAGE_TEST=0")