Skip to content

Commit be31748

Browse files
Merge branch 'main' into vTaskListTasks-prints-affinity-mask
2 parents f79f8c1 + a8650b9 commit be31748

File tree

10 files changed

+51
-52
lines changed

10 files changed

+51
-52
lines changed

CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ cmake_minimum_required(VERSION 3.15)
88
#
99
# DEPRECATED: FREERTOS_CONFIG_FILE_DIRECTORY - but still supported if no freertos_config defined for now.
1010
# May be removed at some point in the future.
11+
#
1112
# User can choose which heap implementation to use (either the implementations
12-
# included with FreeRTOS [1..5] or a custom implementation ) by providing the
13-
# option FREERTOS_HEAP. If the option is not set, the cmake will default to
14-
# using heap_4.c.
13+
# included with FreeRTOS [1..5] or a custom implementation) by providing the
14+
# option FREERTOS_HEAP. When dynamic allocation is used, the user must specify a
15+
# heap implementation. If the option is not set, the cmake will use no heap
16+
# implementation (e.g. when only static allocation is used).
1517

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

40-
# Heap number or absolute path to custom heap implementation provided by user
41-
set(FREERTOS_HEAP "4" CACHE STRING "FreeRTOS heap model number. 1 .. 5. Or absolute path to custom heap source file")
42-
4342
# FreeRTOS port option
4443
if(NOT FREERTOS_PORT)
4544
message(WARNING " FREERTOS_PORT is not set. Please specify it from top-level CMake file (example):\n"
@@ -285,11 +284,16 @@ target_sources(freertos_kernel PRIVATE
285284
stream_buffer.c
286285
tasks.c
287286
timers.c
288-
289-
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
290-
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
291287
)
292288

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

294298
target_link_libraries(freertos_kernel
295299
PUBLIC

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ See the readme file in the ```./portable``` directory for more information.
125125
- The ```./include``` directory contains the real time kernel header files.
126126

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

130130
### Code Formatting
131131

cmake_example/CMakeLists.txt renamed to examples/cmake_example/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
22

33
project(example)
44

5-
set(FREERTOS_KERNEL_PATH "../")
5+
set(FREERTOS_KERNEL_PATH "../../")
66

77
# Add the freertos_config for FreeRTOS-Kernel
88
add_library(freertos_config INTERFACE)
@@ -13,7 +13,7 @@ target_include_directories(freertos_config
1313
)
1414

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

1818
# Select the native compile PORT
1919
set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)

cmake_example/main.c renamed to examples/cmake_example/main.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@
4444
static StaticTask_t exampleTaskTCB;
4545
static StackType_t exampleTaskStack[ configMINIMAL_STACK_SIZE ];
4646

47-
static StaticTask_t xTimerTaskTCB;
48-
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
49-
50-
static StaticTask_t xIdleTaskTCB;
51-
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
52-
5347
void exampleTask( void * parameters )
5448
{
5549
/* Unused parameters. */
@@ -91,21 +85,3 @@ void vApplicationStackOverflowHook( TaskHandle_t xTask,
9185
( void ) xTask;
9286
( void ) pcTaskName;
9387
}
94-
95-
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
96-
StackType_t ** ppxTimerTaskStackBuffer,
97-
uint32_t * pulTimerTaskStackSize )
98-
{
99-
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
100-
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
101-
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
102-
}
103-
104-
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
105-
StackType_t ** ppxIdleTaskStackBuffer,
106-
uint32_t * pulIdleTaskStackSize )
107-
{
108-
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
109-
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
110-
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
111-
}

sample_configuration/FreeRTOSConfig.h renamed to examples/sample_configuration/FreeRTOSConfig.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,21 @@
118118
* human readable name. Includes the NULL terminator. */
119119
#define configMAX_TASK_NAME_LEN 16
120120

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

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

389397
/* secureconfigMAX_SECURE_CONTEXTS define the maximum number of tasks that can
390398
* call into the secure side of an ARMv8-M chip. Not used by any other ports. */
391-
#define secureconfigMAX_SECURE_CONTEXTS 5
399+
#define secureconfigMAX_SECURE_CONTEXTS 5
400+
401+
/* Defines the kernel provided implementation of
402+
* vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory()
403+
* to provide the memory that is used by the Idle task and Timer task respectively.
404+
* The application can provide it's own implementation of
405+
* vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory() by
406+
* setting configKERNEL_PROVIDED_STATIC_MEMORY to 0 or leaving it undefined. */
407+
#define configKERNEL_PROVIDED_STATIC_MEMORY 1
392408

393409
/******************************************************************************/
394410
/* Definitions that include or exclude functionality. *************************/
File renamed without changes.

include/FreeRTOS.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,12 +2120,12 @@
21202120
#define traceRETURN_xTaskGetCurrentTaskHandle( xReturn )
21212121
#endif
21222122

2123-
#ifndef traceENTER_xTaskGetCurrentTaskHandleCPU
2124-
#define traceENTER_xTaskGetCurrentTaskHandleCPU( xCoreID )
2123+
#ifndef traceENTER_xTaskGetCurrentTaskHandleForCore
2124+
#define traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID )
21252125
#endif
21262126

2127-
#ifndef traceRETURN_xTaskGetCurrentTaskHandleCPU
2128-
#define traceRETURN_xTaskGetCurrentTaskHandleCPU( xReturn )
2127+
#ifndef traceRETURN_xTaskGetCurrentTaskHandleForCore
2128+
#define traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn )
21292129
#endif
21302130

21312131
#ifndef traceENTER_xTaskGetSchedulerState

include/task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
35393539
/*
35403540
* Return the handle of the task running on specified core.
35413541
*/
3542-
TaskHandle_t xTaskGetCurrentTaskHandleCPU( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
3542+
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
35433543

35443544
/*
35453545
* Shortcut used by the queue implementation to prevent unnecessary call to

portable/template/portmacro.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ typedef unsigned char UBaseType_t;
3838
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
3939
typedef uint32_t TickType_t;
4040
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
41+
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
42+
typedef uint64_t TickType_t;
43+
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL
4144
#else
4245
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
4346
#endif

tasks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6425,18 +6425,18 @@ static void prvResetNextTaskUnblockTime( void )
64256425
return xReturn;
64266426
}
64276427

6428-
TaskHandle_t xTaskGetCurrentTaskHandleCPU( BaseType_t xCoreID )
6428+
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID )
64296429
{
64306430
TaskHandle_t xReturn = NULL;
64316431

6432-
traceENTER_xTaskGetCurrentTaskHandleCPU( xCoreID );
6432+
traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID );
64336433

64346434
if( taskVALID_CORE_ID( xCoreID ) != pdFALSE )
64356435
{
64366436
xReturn = pxCurrentTCBs[ xCoreID ];
64376437
}
64386438

6439-
traceRETURN_xTaskGetCurrentTaskHandleCPU( xReturn );
6439+
traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn );
64406440

64416441
return xReturn;
64426442
}

0 commit comments

Comments
 (0)