Там задачи запускаются следующим образом:
CODE
int main(void)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to have a system clock = 168 Mhz */
SystemClock_Config();
/* Init task */
osThreadDef(Start, StartThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE * 2);
osThreadCreate (osThread(Start), NULL);
/* Start scheduler */
osKernelStart (NULL, NULL);
/* We should never get here as control is now taken by the scheduler */
for( ;; );
}
/**
* @brief Main task
* @param pvParameters not used
* @retval None
*/
static void StartThread(void const * argument)
{
/* Initialize LCD and LEDs */
BSP_Config();
/* Create tcp_ip stack thread */
tcpip_init( NULL, NULL );
/* Initilaize the LwIP stack */
Netif_Config();
/* Initialize webserver demo */
http_server_socket_init();
/* Notify user about the netwoek interface config */
User_notification(&gnetif);
#ifdef USE_DHCP
/* Start DHCPClient */
osThreadDef(DHCP, DHCP_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE * 2);
osThreadCreate (osThread(DHCP), &gnetif);
#endif
/* Start toogleLed4 task : Toggle LED4 every 250ms */
osThreadDef(LED4, ToggleLed4, osPriorityLow, 0, configMINIMAL_STACK_SIZE);
osThreadCreate (osThread(LED4), NULL);
for( ;; )
{
/* Delete the Init Thread */
osThreadTerminate(NULL);
}
}
То есть сначала запускается одна задача, из неё запускаются все остальные и первая запускающая задача удаляется, насколько я понимаю...
Мне немножко непонятно, почему сделано так?
Могу предположить что запуск задач LwIP должен производится только когда уже запущена операционка. Кто пояснит?
Или это чтобы порядок запуска обеспечить сделано?