Skip to content

Commit 017ae3e

Browse files
committed
Changes for FreeRTOS library
Ensure all the priority bits are assigned to be preempt priority bits by calling NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); before the RTOS is started. See https://www.freertos.org/RTOS-Cortex-M3-M4.html Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent badc4de commit 017ae3e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cores/arduino/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ void initVariant() { }
2929
// Force init to be called *first*, i.e. before static object allocation.
3030
// Otherwise, statically allocated objects that need HAL may fail.
3131
__attribute__(( constructor (101))) void premain() {
32-
init();
32+
33+
// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
34+
#ifdef NVIC_PRIORITYGROUP_4
35+
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
36+
#endif
37+
38+
init();
3339
}
3440

3541
/*

0 commit comments

Comments
 (0)