cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CUBE V4.21.0 LWIP Bug

mfrank9
Associate III
Posted on July 04, 2017 at 08:14

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.

0690X00000607JBQAY.png

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, &ethernetif_init, &ethernet_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 #cube
3 REPLIES 3
Bino
Senior
Posted on July 04, 2017 at 11:24

You are right and this bug will be fixed in next STM32Cube V4.22.0 release.

Bino
Senior
Posted on July 04, 2017 at 11:44

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.

mfrank9
Associate III
Posted on July 05, 2017 at 15:15

ok, thanks for your help 🙂