Skip to content

Commit d5708b0

Browse files
committed
Add memory allocation configuration options to FreeRTOSConfig.h
- Create configuration section: Memory Allocation Configuration - Add new configuration options - Move configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION into this section - Remove vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory implementations from RTOS2 wrapper (they are now provided by the FreeRTOS kernel)
1 parent fb02ad3 commit d5708b0

3 files changed

Lines changed: 66 additions & 55 deletions

File tree

ARM.CMSIS-FreeRTOS.pdsc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<release version="0.0.0">
1212
FreeRTOS 11.0.1
1313
Active development...
14+
- Add memory allocation configuration options to FreeRTOSConfig.h
1415
- CMSIS-RTOS2 requires CMSIS:OS Tick component
1516
- Drop support for Arm Compiler 5
1617
- Drop support for CMSIS-RTOS1 API
@@ -1308,7 +1309,7 @@
13081309
</RTE_Components_h>
13091310
<files>
13101311
<file category="doc" name="Documentation/html/cre_freertos_proj.html#cmsis_freertos_config"/>
1311-
<file category="header" attr="config" name="CMSIS/RTOS2/FreeRTOS/Config/ARMCM/FreeRTOSConfig.h" version="10.5.0" condition="CoreM"/>
1312+
<file category="header" attr="config" name="CMSIS/RTOS2/FreeRTOS/Config/ARMCM/FreeRTOSConfig.h" version="10.6.0" condition="CoreM"/>
13121313
<file category="header" attr="config" name="CMSIS/RTOS2/FreeRTOS/Config/ARMCA/FreeRTOSConfig.h" version="10.4.0" condition="CoreA"/>
13131314
</files>
13141315
</component>

CMSIS/RTOS2/FreeRTOS/Config/ARMCM/FreeRTOSConfig.h

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* --------------------------------------------------------------------------
2-
* Copyright (c) 2013-2023 Arm Limited. All rights reserved.
2+
* Copyright (c) 2013-2024 Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -17,7 +17,7 @@
1717
*
1818
* --------------------------------------------------------------------------
1919
*
20-
* $Revision: V10.5.0
20+
* $Revision: V10.6.0
2121
*
2222
* Project: CMSIS-FreeRTOS
2323
* Title: FreeRTOS configuration definitions
@@ -51,94 +51,137 @@
5151
// <o>Minimal stack size [words] <0-65535>
5252
// <i> Stack for idle task and default task stack in words.
5353
// <i> Default: 128
54-
#define configMINIMAL_STACK_SIZE ((uint16_t)(128))
54+
#define configMINIMAL_STACK_SIZE ((uint16_t)(128))
5555

5656
// <o>Total heap size [bytes] <0-0xFFFFFFFF>
5757
// <i> Heap memory size in bytes.
5858
// <i> Default: 8192
59-
#define configTOTAL_HEAP_SIZE ((size_t)8192)
59+
#define configTOTAL_HEAP_SIZE ((size_t)8192)
6060

6161
// <o>Kernel tick frequency [Hz] <0-0xFFFFFFFF>
6262
// <i> Kernel tick rate in Hz.
6363
// <i> Default: 1000
64-
#define configTICK_RATE_HZ ((TickType_t)1000)
64+
#define configTICK_RATE_HZ ((TickType_t)1000)
6565

6666
// <o>Timer task stack depth [words] <0-65535>
6767
// <i> Stack for timer task in words.
6868
// <i> Default: 80
69-
#define configTIMER_TASK_STACK_DEPTH 80
69+
#define configTIMER_TASK_STACK_DEPTH 80
7070

7171
// <o>Timer task priority <0-56>
7272
// <i> Timer task priority.
7373
// <i> Default: 40 (High)
74-
#define configTIMER_TASK_PRIORITY 40
74+
#define configTIMER_TASK_PRIORITY 40
7575

7676
// <o>Timer queue length <0-1024>
7777
// <i> Timer command queue length.
7878
// <i> Default: 5
79-
#define configTIMER_QUEUE_LENGTH 5
79+
#define configTIMER_QUEUE_LENGTH 5
8080

8181
// <o>Preemption interrupt priority
8282
// <i> Maximum priority of interrupts that are safe to call FreeRTOS API.
8383
// <i> Default: 16
84-
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 16
84+
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 16
8585

8686
// <q>Use time slicing
8787
// <i> Enable setting to use timeslicing.
8888
// <i> Default: 1
89-
#define configUSE_TIME_SLICING 1
89+
#define configUSE_TIME_SLICING 1
9090

9191
// <q>Use tickless idle
9292
// <i> Enable low power tickless mode to stop the periodic tick interrupt during idle periods or
9393
// <i> disable it to keep the tick interrupt running at all times.
9494
// <i> Default: 0
95-
#define configUSE_TICKLESS_IDLE 0
95+
#define configUSE_TICKLESS_IDLE 0
9696

9797
// <q>Idle should yield
9898
// <i> Control Yield behaviour of the idle task.
9999
// <i> Default: 1
100-
#define configIDLE_SHOULD_YIELD 1
100+
#define configIDLE_SHOULD_YIELD 1
101101

102102
// <o>Check for stack overflow
103103
// <0=>Disable <1=>Method one <2=>Method two
104104
// <i> Enable or disable stack overflow checking.
105105
// <i> Callback function vApplicationStackOverflowHook implementation is required when stack checking is enabled.
106106
// <i> Default: 0
107-
#define configCHECK_FOR_STACK_OVERFLOW 2
107+
#define configCHECK_FOR_STACK_OVERFLOW 2
108108

109109
// <q>Use idle hook
110110
// <i> Enable callback function call on each idle task iteration.
111111
// <i> Callback function vApplicationIdleHook implementation is required when idle hook is enabled.
112112
// <i> Default: 0
113-
#define configUSE_IDLE_HOOK 0
113+
#define configUSE_IDLE_HOOK 0
114114

115115
// <q>Use tick hook
116116
// <i> Enable callback function call during each tick interrupt.
117117
// <i> Callback function vApplicationTickHook implementation is required when tick hook is enabled.
118118
// <i> Default: 0
119-
#define configUSE_TICK_HOOK 0
119+
#define configUSE_TICK_HOOK 0
120120

121121
// <q>Use deamon task startup hook
122122
// <i> Enable callback function call when timer service starts.
123123
// <i> Callback function vApplicationDaemonTaskStartupHook implementation is required when deamon task startup hook is enabled.
124124
// <i> Default: 0
125-
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
125+
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
126126

127127
// <q>Use malloc failed hook
128128
// <i> Enable callback function call when out of dynamic memory.
129129
// <i> Callback function vApplicationMallocFailedHook implementation is required when malloc failed hook is enabled.
130130
// <i> Default: 0
131-
#define configUSE_MALLOC_FAILED_HOOK 0
131+
#define configUSE_MALLOC_FAILED_HOOK 0
132132

133133
// <o>Queue registry size
134134
// <i> Define maximum number of queue objects registered for debug purposes.
135135
// <i> The queue registry is used by kernel aware debuggers to locate queue and semaphore structures and display associated text names.
136136
// <i> Default: 0
137-
#define configQUEUE_REGISTRY_SIZE 0
137+
#define configQUEUE_REGISTRY_SIZE 0
138138

139-
// <h>Event Recorder configuration
140-
// <i> Initialize and setup Event Recorder level filtering.
141-
// <i> Settings have no effect when Event Recorder is not present.
139+
// <h>Memory Allocation Configuration
140+
// <i> Enable and configure memory allocation specific features.
141+
// <i> To configure FreeRTOS heap size use configTOTAL_HEAP_SIZE.
142+
143+
// <q> Support static memory allocation
144+
// <i> Enable or disable static memory allocation.
145+
// <i> When enabled RTOS objects can be created using application provided RAM.
146+
// <i> Default: 1
147+
#define configSUPPORT_STATIC_ALLOCATION 1
148+
149+
// <q> Support dynamic memory allocation
150+
// <i> Enable or disable dynamic memory allocation.
151+
// <i> When enabled RTOS objects can be created using RAM automatically allocated from the FreeRTOS heap.
152+
// <i> Default: 1
153+
#define configSUPPORT_DYNAMIC_ALLOCATION 1
154+
155+
// <q>Use kernel provided static memory
156+
// <i> When enabled FreeRTOS kernel provides static memory for Idle and Timer tasks.
157+
// <i> Otherwise user shall provide implementation of:
158+
// <i> - vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory
159+
// <i> - vApplicationGetPassiveIdleTaskMemory (when kernel uses SMP)
160+
// <i> Default: 1
161+
#define configKERNEL_PROVIDED_STATIC_MEMORY 1
162+
163+
// <q>Use application allocated heap
164+
// <i> Global heap buffer must be provided externally when using application allocated heap.
165+
// <i> The buffer must be declared as: uint8_t ucHeap[ configTOTAL_HEAP_SIZE ].
166+
// <i> Default: 0
167+
#define configAPPLICATION_ALLOCATED_HEAP 0
168+
169+
// <q>Use separate heap for stack allocation
170+
// <i> Enable or disable stack allocation for any task from a separate heap.
171+
// <i> Thread-safe implementation of pvPortMallocStack and vPortFreeStack is required when using separate heap.
172+
// <i> Default: 0
173+
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
174+
175+
// <q>Use heap protector
176+
// <i> Enable or disable bounds checking and obfuscation to heap block pointers.
177+
// <i> This setting only applies to Heap_4 and Heap_5.
178+
// <i> Default: 0
179+
#define configENABLE_HEAP_PROTECTOR 0
180+
// </h>
181+
182+
// <h>Event Recorder Configuration
183+
// <i> Initialize and setup Event Recorder level filtering.
184+
// <i> Settings have no effect when Event Recorder is not present.
142185

143186
// <q>Initialize Event Recorder
144187
// <i> Initialize Event Recorder before FreeRTOS kernel start.
@@ -232,8 +275,6 @@
232275

233276
/* Defines needed by FreeRTOS to implement CMSIS RTOS2 API. Do not change! */
234277
#define configCPU_CLOCK_HZ (SystemCoreClock)
235-
#define configSUPPORT_STATIC_ALLOCATION 1
236-
#define configSUPPORT_DYNAMIC_ALLOCATION 1
237278
#define configUSE_PREEMPTION 1
238279
#define configUSE_TIMERS 1
239280
#define configUSE_MUTEXES 1

CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,34 +2905,3 @@ __WEAK void vApplicationStackOverflowHook (TaskHandle_t xTask, char *pcTaskName)
29052905
configASSERT(0);
29062906
}
29072907
#endif
2908-
2909-
/*---------------------------------------------------------------------------*/
2910-
#if (configSUPPORT_STATIC_ALLOCATION == 1)
2911-
/*
2912-
vApplicationGetIdleTaskMemory gets called when configSUPPORT_STATIC_ALLOCATION
2913-
equals to 1 and is required for static memory allocation support.
2914-
*/
2915-
__WEAK void vApplicationGetIdleTaskMemory (StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize) {
2916-
/* Idle task control block and stack */
2917-
static StaticTask_t Idle_TCB;
2918-
static StackType_t Idle_Stack[configMINIMAL_STACK_SIZE];
2919-
2920-
*ppxIdleTaskTCBBuffer = &Idle_TCB;
2921-
*ppxIdleTaskStackBuffer = &Idle_Stack[0];
2922-
*pulIdleTaskStackSize = (uint32_t)configMINIMAL_STACK_SIZE;
2923-
}
2924-
2925-
/*
2926-
vApplicationGetTimerTaskMemory gets called when configSUPPORT_STATIC_ALLOCATION
2927-
equals to 1 and is required for static memory allocation support.
2928-
*/
2929-
__WEAK void vApplicationGetTimerTaskMemory (StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) {
2930-
/* Timer task control block and stack */
2931-
static StaticTask_t Timer_TCB;
2932-
static StackType_t Timer_Stack[configTIMER_TASK_STACK_DEPTH];
2933-
2934-
*ppxTimerTaskTCBBuffer = &Timer_TCB;
2935-
*ppxTimerTaskStackBuffer = &Timer_Stack[0];
2936-
*pulTimerTaskStackSize = (uint32_t)configTIMER_TASK_STACK_DEPTH;
2937-
}
2938-
#endif

0 commit comments

Comments
 (0)