Skip to content

Commit

Permalink
Merge branch 'main' into update_example_cmake_path
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-josi-aws authored Oct 23, 2023
2 parents c29b290 + fc7aca7 commit 91156c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ cmake_minimum_required(VERSION 3.15)
#
# DEPRECATED: FREERTOS_CONFIG_FILE_DIRECTORY - but still supported if no freertos_config defined for now.
# May be removed at some point in the future.
#
# User can choose which heap implementation to use (either the implementations
# included with FreeRTOS [1..5] or a custom implementation ) by providing the
# option FREERTOS_HEAP. If the option is not set, the cmake will default to
# using heap_4.c.
# included with FreeRTOS [1..5] or a custom implementation) by providing the
# option FREERTOS_HEAP. When dynamic allocation is used, the user must specify a
# heap implementation. If the option is not set, the cmake will use no heap
# implementation (e.g. when only static allocation is used).

# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
if(NOT TARGET freertos_config )
Expand All @@ -37,9 +39,6 @@ if(NOT TARGET freertos_config )
endif()
endif()

# Heap number or absolute path to custom heap implementation provided by user
set(FREERTOS_HEAP "4" CACHE STRING "FreeRTOS heap model number. 1 .. 5. Or absolute path to custom heap source file")

# FreeRTOS port option
if(NOT FREERTOS_PORT)
message(WARNING " FREERTOS_PORT is not set. Please specify it from top-level CMake file (example):\n"
Expand Down Expand Up @@ -285,11 +284,16 @@ target_sources(freertos_kernel PRIVATE
stream_buffer.c
tasks.c
timers.c

# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
)

if (DEFINED FREERTOS_HEAP )
# User specified a heap implementation add heap implementation to freertos_kernel.
target_sources(freertos_kernel PRIVATE
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
)
endif()


target_link_libraries(freertos_kernel
PUBLIC
Expand Down
8 changes: 4 additions & 4 deletions include/FreeRTOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -2120,12 +2120,12 @@
#define traceRETURN_xTaskGetCurrentTaskHandle( xReturn )
#endif

#ifndef traceENTER_xTaskGetCurrentTaskHandleCPU
#define traceENTER_xTaskGetCurrentTaskHandleCPU( xCoreID )
#ifndef traceENTER_xTaskGetCurrentTaskHandleForCore
#define traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID )
#endif

#ifndef traceRETURN_xTaskGetCurrentTaskHandleCPU
#define traceRETURN_xTaskGetCurrentTaskHandleCPU( xReturn )
#ifndef traceRETURN_xTaskGetCurrentTaskHandleForCore
#define traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn )
#endif

#ifndef traceENTER_xTaskGetSchedulerState
Expand Down
2 changes: 1 addition & 1 deletion include/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -3539,7 +3539,7 @@ TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
/*
* Return the handle of the task running on specified core.
*/
TaskHandle_t xTaskGetCurrentTaskHandleCPU( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;

/*
* Shortcut used by the queue implementation to prevent unnecessary call to
Expand Down
6 changes: 3 additions & 3 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -6425,18 +6425,18 @@ static void prvResetNextTaskUnblockTime( void )
return xReturn;
}

TaskHandle_t xTaskGetCurrentTaskHandleCPU( BaseType_t xCoreID )
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID )
{
TaskHandle_t xReturn = NULL;

traceENTER_xTaskGetCurrentTaskHandleCPU( xCoreID );
traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID );

if( taskVALID_CORE_ID( xCoreID ) != pdFALSE )
{
xReturn = pxCurrentTCBs[ xCoreID ];
}

traceRETURN_xTaskGetCurrentTaskHandleCPU( xReturn );
traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn );

return xReturn;
}
Expand Down

0 comments on commit 91156c7

Please sign in to comment.