ttx330 wrote on Thursday, November 14, 2019:
Hi, Guys
Our project was based on CR5, and used heap4.
As in our project we may do dynamic allocation before the scheduler running (actually before the hw timer being initialized) So i check the dependency between pvPortMalloc API and kernels. pvPortMalloc will call vTaskSuspendAll()/xTaskResumeAll() to ensure thread safety(as I understand), but In FreeRTOS reference manual said, xTaskResumeAll() should not be called before vTaskStartScheduler() being called.
Indeed I saw a yield manipulation in xTaskResumeAll() if the FreeRTOSConfig set preemption to 1. So i confused that, In xTaskCreate API it seems pvPortMalloc being called to create a TCB structure and xTaskCreate could be called before the scheduler start.
So, chould pvPortMalloc being called before scheduler start? If yes, How to explain the xTaskResumeAll() in pvPortMalloc
Thanks in advance
Yun