smith84 wrote on Thursday, December 05, 2013:
I am running FreeRTOS 7.4.0 on a Cortex-M3 processor (no MPU).
My initialisation code creates a timer before the OS start, and after the call to xTimerCreate() the BASEPRI is set to block interrupts - this causes other problems in my startup routines.
I have managed to trace the code as follows (showing what I think are the relevant parts only!):
-
xTimerCreate()
-
pvPortMalloc()
-
vTaskSuspendAll()
-
xTaskResumeAll()
-
taskENTER_CRITICAL()
: this increments the uxCriticalNesting counter which was at the init value of 0xaaaaaaaa to 0xaaaaaaab-
portDISABLE_INTERRUPTS()
: sets BASEPRI to block interrupts
-
-
taskEXIT_CRITICAL()
: this decrements uxCriticalNesting back to 0xaaaaaaaa which is greater than 0 so it does not call portENABLE_INTERRUPTS()
-
-
-
-
This mess with uxCriticalNesting is all fixed up when the scheduler is started and uxCriticalNesting is set to 0.
My understanding is that I should be able to create timers and tasks etc before the scheduler is started. However, with this call tree it seems that any call for these types of operations will block the interrupts below the OS masking level.
Any suggestions as to what I can try to resolve this problem? I could simply modify the initialisation value of uxCriticalNesting but that doesn’t seem to be the right thing to do.