Skip to content

Commit 915c7e0

Browse files
committed
Update default config to use linker definition
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent 3fe0c48 commit 915c7e0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/FreeRTOSConfig_Default.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,23 @@
9393
#include <stdint.h>
9494
extern uint32_t SystemCoreClock;
9595
#endif
96+
extern char _end; /* Defined in the linker script */
97+
extern char _estack; /* Defined in the linker script */
98+
extern char _Min_Stack_Size; /* Defined in the linker script */
9699

97100
#define configUSE_PREEMPTION 1
98101
#define configUSE_IDLE_HOOK 1
99102
#define configUSE_TICK_HOOK 1
100103
#define configCPU_CLOCK_HZ (SystemCoreClock)
101104
#define configTICK_RATE_HZ ((TickType_t)1000)
102105
#define configMAX_PRIORITIES (7)
103-
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
104-
#define configTOTAL_HEAP_SIZE ((size_t)(15 * 1024))
106+
/*
107+
* _Min_Stack_Size is often set to 0x400 in the linker script
108+
* Use it divided by 8 to set minmimal stack size of a task to 128 by default.
109+
* End user will have to properly configure those value depending to their needs.
110+
*/
111+
#define configMINIMAL_STACK_SIZE ((uint16_t)((uint32_t)&_Min_Stack_Size/8))
112+
#define configTOTAL_HEAP_SIZE ((size_t)(&_estack - _Min_Stack_Size - &_end))
105113
#define configMAX_TASK_NAME_LEN (16)
106114
#define configUSE_TRACE_FACILITY 1
107115
#define configUSE_16_BIT_TICKS 0

0 commit comments

Comments
 (0)