Execution starts from Reset_Handler in Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/crt0_STM32x.c - after performing the required run-time initializations to set up a proper environment for C code, it transfers control to main in Demo/CORTEX_STM32F103_Primer_GCC/main.c.
main invokes prvSetupHardware which starts the clocks and performs various other low-level initializations.
main creates various tasks by calling xTaskCreate.
The scheduler is invoked by calling vTaskStartScheduler.
xTaskCreate starts out by allocating a task control block and stack.
tskTCB * pxNewTCB; /* Allocate the memory required by the TCB and stack for the new task. checking that the allocation was successful. */ pxNewTCB = prvAllocateTCBAndStack( usStackDepth );