Do not use FreeRTOS functions as long as the scheduler is not started

Otherwise interrupts with a logical priority lower than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY are masked after the first call to xTaskResumeAll() (after the first critical section is entered, and never released).
This commit is contained in:
Raphael Coeffic
2021-10-15 21:40:01 +11:00
committed by Peter Feerick
parent 520eac3e4f
commit d77ff2f4e9
2 changed files with 8 additions and 2 deletions
+4
View File
@@ -74,6 +74,10 @@ to exclude the API function. */
#define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelay 1
#if defined(THREADSAFE_MALLOC)
#define INCLUDE_xTaskGetSchedulerState 1
#endif
/* Cortex-M specific definitions. */ /* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS #ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
+4 -2
View File
@@ -53,13 +53,15 @@ extern caddr_t _sbrk(int nbytes)
void __malloc_lock(struct _reent *r) void __malloc_lock(struct _reent *r)
{ {
(void)(r); (void)(r);
vTaskSuspendAll(); if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
vTaskSuspendAll();
}; };
void __malloc_unlock(struct _reent *r) void __malloc_unlock(struct _reent *r)
{ {
(void)(r); (void)(r);
(void)xTaskResumeAll(); if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
(void)xTaskResumeAll();
}; };
#endif #endif