2017-07-03 11:14 PM
Hello everybody,
i have found a bug in STM32Cube V4.21.0.
I use the STM32F429BITx
When i select the following settings the generated code have some RTOS functions.
Please fix it.
void MX_LWIP_Init(void)
{ /* IP addresses initialization */ IP_ADDRESS[0] = 192; IP_ADDRESS[1] = 168; IP_ADDRESS[2] = 11; IP_ADDRESS[3] = 181; NETMASK_ADDRESS[0] = 255; NETMASK_ADDRESS[1] = 255; NETMASK_ADDRESS[2] = 255; NETMASK_ADDRESS[3] = 0; GATEWAY_ADDRESS[0] = 192; GATEWAY_ADDRESS[1] = 168; GATEWAY_ADDRESS[2] = 11; GATEWAY_ADDRESS[3] = 1; /* Initilialize the LwIP stack without RTOS */ lwip_init();/* IP addresses initialization without DHCP (IPv4) */
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]); IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]); IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);/* add the network interface (IPv4/IPv6) without RTOS */
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, ðernet_input);/* Registers the default network interface */
netif_set_default(&gnetif);if (netif_is_link_up(&gnetif))
{ /* When the netif is fully configured this function must be called */ netif_set_up(&gnetif); } else { /* When the netif link is down this function must be called */ netif_set_down(&gnetif); }/* Set the link callback function, this function is called on change of link status*/
netif_set_link_callback(&gnetif, ethernetif_update_config);/* create a binary semaphore used for informing ethernetif of frame reception */
osSemaphoreDef(Netif_SEM);
Netif_LinkSemaphore = osSemaphoreCreate(osSemaphore(Netif_SEM) , 1 );
link_arg.netif = &gnetif;
link_arg.semaphore = Netif_LinkSemaphore;
/* Create the Ethernet link handler thread */
osThreadDef(LinkThr, ethernetif_set_link, osPriorityNormal, 0, configMINIMAL_STACK_SIZE * 2);
osThreadCreate (osThread(LinkThr), &link_arg);
/* USER CODE BEGIN 3 */
/* USER CODE END 3 */
}#stm32cube-bug #bug #cube2017-07-04 02:24 AM
You are right and this bug will be fixed in next STM32Cube V4.22.0 release.
2017-07-04 02:44 AM
The solution for you is to directly patch the following ftl file:
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\db\templates\lwip_c_f2f4f7h7.ftl
Line 548: replace [#if series != 'stm32h7'] by
[#if (series != 'stm32h7') && (with_rtos == 1)]
Then generate again the code and it will be ok.
2017-07-05 06:15 AM
ok, thanks for your help :)