Select one of the symbols to view example projects that use it.
 
Outline
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "esp_system.h"
#include "esp_memory_utils.h"
#include "sdkconfig.h"
FreeRTOS Static Allocation
vApplicationGetIdleTaskMemory(StaticTask_t **, StackType_t **, uint32_t *)
vApplicationGetTimerTaskMemory(StaticTask_t **, StackType_t **, uint32_t *)
Files
FreeRTOS
config
esp_additions
FreeRTOS-Kernel
ESP-IDF
cJSON
SourceVuESP-IDF Framework and ExamplesFreeRTOSport_common.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include <string.h> #include "FreeRTOS.h" #include "task.h" #include "esp_system.h" #include "esp_memory_utils.h" #include "sdkconfig.h"6 includes /* ----------------------------------------- Port Implementations (Common) -------------------------------------------- * - Common FreeRTOS port function implementations * - These functions are common to all FreeRTOS ports (i.e., on all architectures and all FreeRTOS implementations). * ------------------------------------------------------------------------------------------------------------------ *//* ... */ // ------------- FreeRTOS Static Allocation ---------------- /* These function are required by FreeRTOS when configSUPPORT_STATIC_ALLOCATION is enabled and is used by FreeRTOS to obtain memory for its IDLE/Timer tasks. We simply allocate the IDLE/Timer tasks memory from the FreeRTOS heap. *//* ... */ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize) { StaticTask_t *pxTCBBufferTemp; StackType_t *pxStackBufferTemp; /* Allocate TCB and stack buffer from the FreeRTOS heap * * If the stack grows down then allocate the stack then the TCB so the stack * does not grow into the TCB. Likewise if the stack grows up then allocate * the TCB then the stack. *//* ... */ #if (portSTACK_GROWTH > 0) { pxTCBBufferTemp = pvPortMalloc(sizeof(StaticTask_t)); pxStackBufferTemp = pvPortMalloc(configMINIMAL_STACK_SIZE); }/* ... */ {...}#else /* portSTACK_GROWTH */ { pxStackBufferTemp = pvPortMalloc(configMINIMAL_STACK_SIZE); pxTCBBufferTemp = pvPortMalloc(sizeof(StaticTask_t)); }/* ... */ {...}#endif /* portSTACK_GROWTH */ assert(pxTCBBufferTemp != NULL); assert(pxStackBufferTemp != NULL); //Write back pointers *ppxIdleTaskTCBBuffer = pxTCBBufferTemp; *ppxIdleTaskStackBuffer = pxStackBufferTemp; *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; }{ ... } #if ( ( CONFIG_FREERTOS_SMP ) && ( configNUMBER_OF_CORES > 1 ) ) void vApplicationGetPassiveIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t * pulIdleTaskStackSize, BaseType_t xPassiveIdleTaskIndex) { vApplicationGetIdleTaskMemory(ppxIdleTaskTCBBuffer, ppxIdleTaskStackBuffer, pulIdleTaskStackSize); }{...} /* ... */#endif /* ( ( CONFIG_FREERTOS_SMP ) && ( configNUMBER_OF_CORES > 1 ) ) */ #if configUSE_TIMERS void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) { StaticTask_t *pxTCBBufferTemp; StackType_t *pxStackBufferTemp; /* Allocate TCB and stack buffer from the FreeRTOS heap * * If the stack grows down then allocate the stack then the TCB so the stack * does not grow into the TCB. Likewise if the stack grows up then allocate * the TCB then the stack. *//* ... */ #if (portSTACK_GROWTH > 0) { pxTCBBufferTemp = pvPortMalloc(sizeof(StaticTask_t)); pxStackBufferTemp = pvPortMalloc(configTIMER_TASK_STACK_DEPTH); }/* ... */ {...}#else /* portSTACK_GROWTH */ { pxStackBufferTemp = pvPortMalloc(configTIMER_TASK_STACK_DEPTH); pxTCBBufferTemp = pvPortMalloc(sizeof(StaticTask_t)); }/* ... */ {...}#endif /* portSTACK_GROWTH */ assert(pxTCBBufferTemp != NULL); assert(pxStackBufferTemp != NULL); //Write back pointers *ppxTimerTaskTCBBuffer = pxTCBBufferTemp; *ppxTimerTaskStackBuffer = pxStackBufferTemp; *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; }{ ... } #endif/* ... */ //configUSE_TIMERS /* ... */ FreeRTOS Static Allocation#endif // configSUPPORT_STATIC_ALLOCATION == 1
Details