Skip to content

Commit

Permalink
Merge branch 'main' into vTaskListTasks-prints-affinity-mask
Browse files Browse the repository at this point in the history
  • Loading branch information
kar-rahul-aws authored Oct 23, 2023
2 parents f79f8c1 + a8650b9 commit be31748
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 52 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ See the readme file in the ```./portable``` directory for more information.
- The ```./include``` directory contains the real time kernel header files.

- The ```./sample_configuration``` directory contains a sample `FreeRTOSConfig.h` to help jumpstart a new project.
See the [FreeRTOSConfig.h](sample_configuration/FreeRTOSConfig.h) file for instructions.
See the [FreeRTOSConfig.h](examples/sample_configuration/FreeRTOSConfig.h) file for instructions.

### Code Formatting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)

project(example)

set(FREERTOS_KERNEL_PATH "../")
set(FREERTOS_KERNEL_PATH "../../")

# Add the freertos_config for FreeRTOS-Kernel
add_library(freertos_config INTERFACE)
Expand All @@ -13,7 +13,7 @@ target_include_directories(freertos_config
)

# Select the heap port. values between 1-4 will pick a heap.
# set(FREERTOS_HEAP "4" CACHE STRING "" FORCE)
set(FREERTOS_HEAP "4" CACHE STRING "" FORCE)

# Select the native compile PORT
set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
Expand Down
24 changes: 0 additions & 24 deletions cmake_example/main.c → examples/cmake_example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@
static StaticTask_t exampleTaskTCB;
static StackType_t exampleTaskStack[ configMINIMAL_STACK_SIZE ];

static StaticTask_t xTimerTaskTCB;
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];

static StaticTask_t xIdleTaskTCB;
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];

void exampleTask( void * parameters )
{
/* Unused parameters. */
Expand Down Expand Up @@ -91,21 +85,3 @@ void vApplicationStackOverflowHook( TaskHandle_t xTask,
( void ) xTask;
( void ) pcTaskName;
}

void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
StackType_t ** ppxTimerTaskStackBuffer,
uint32_t * pulTimerTaskStackSize )
{
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}

void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
uint32_t * pulIdleTaskStackSize )
{
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,21 @@
* human readable name. Includes the NULL terminator. */
#define configMAX_TASK_NAME_LEN 16

/* The tick count is held in a variable of type TickType_t. Set
* configUSE_16_BIT_TICKS to 1 to make TickType_t a 16-bit type. Set
* configUSE_16_BIT_TICKS to 0 to make TickType_t either a 32 or 64-bit type
* depending on the architecture. Using a 16-bit type can greatly improve
* efficiency on 8-bit and 16-bit microcontrollers, but at the cost of limiting the
* maximum specifiable block time to 0xffff. */
#define configUSE_16_BIT_TICKS 0
/* Time is measured in 'ticks' - which is the number of times the tick interrupt
* has executed since the RTOS kernel was started.
* The tick count is held in a variable of type TickType_t.
*
* configTICK_TYPE_WIDTH_IN_BITS controls the type (and therefore bit-width) of TickType_t:
*
* Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_16_BITS causes
* TickType_t to be defined (typedef'ed) as an unsigned 16-bit type.
*
* Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_32_BITS causes
* TickType_t to be defined (typedef'ed) as an unsigned 32-bit type.
*
* Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_64_BITS causes
* TickType_t to be defined (typedef'ed) as an unsigned 64-bit type. */
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_64_BITS

/* Set configIDLE_SHOULD_YIELD to 1 to have the Idle task yield to an
* application task if there is an Idle priority (priority 0) application task that
Expand Down Expand Up @@ -388,7 +396,15 @@

/* secureconfigMAX_SECURE_CONTEXTS define the maximum number of tasks that can
* call into the secure side of an ARMv8-M chip. Not used by any other ports. */
#define secureconfigMAX_SECURE_CONTEXTS 5
#define secureconfigMAX_SECURE_CONTEXTS 5

/* Defines the kernel provided implementation of
* vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory()
* to provide the memory that is used by the Idle task and Timer task respectively.
* The application can provide it's own implementation of
* vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory() by
* setting configKERNEL_PROVIDED_STATIC_MEMORY to 0 or leaving it undefined. */
#define configKERNEL_PROVIDED_STATIC_MEMORY 1

/******************************************************************************/
/* Definitions that include or exclude functionality. *************************/
Expand Down
File renamed without changes.
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
3 changes: 3 additions & 0 deletions portable/template/portmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ typedef unsigned char UBaseType_t;
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
typedef uint32_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
typedef uint64_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL
#else
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
#endif
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 be31748

Please sign in to comment.