Skip to main content
PTiha
Associate III
February 24, 2020
Solved

STM32CubeMX 5.6 bugs: LWIP static IP address missing in lwip.c, generated function calls ranking not working correctly

  • February 24, 2020
  • 9 replies
  • 3632 views

Hi!

I tried to set peripheral initialization order in Project Manager->Advanced Settings.

After I finished sorting the list and saved the project, the function list mixed.

The problem is reproducable. When you save the project, the function list gets a random order.

It would be good if somebody has a solution to this problem.

Thanks!

This topic has been closed for replies.
Best answer by Khouloud ZEMMELI

​Issue appears with the Board , for the moment you can use the MCU F429ZITx (not the Board), it's the same thing , or click on Clear Pinouts under Pinout then configure your project and code will be fine.

Otherwise, issue will be fixed in the next release.

Thanks @PTiha​  for your feedback,

Best Regards,

Khouloud

9 replies

Khouloud ZEMMELI
ST Employee
February 24, 2020

​Hello @PTiha​ ,

With which part number ?

Thanks

Khouloud

PTiha
PTihaAuthor
Associate III
February 24, 2020

Hello,

STM32F429ZI

Simple STM32CubeIDE project for NUCLEO-F429ZI board.

The firmware package version is 1.25.0

Thanks!

Khouloud ZEMMELI
ST Employee
February 24, 2020

​We are deeply sorry for any inconvenience this may have caused!

This's a regression, it will be fixed in the next release.

Sorry again,

Best Regards,

Khouloud

PTiha
PTihaAuthor
Associate III
February 24, 2020

Thank you!

Another issue with CubeMX is that when I create a project that uses a LWIP stack with a fixed IP address, the IP address is empty in lwip.c:

void MX_LWIP_Init(void)
{
 /* IP addresses initialization */
 /* 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]);
...
...
}

In CubeMX LWIP configuration DHCP is disabled; IP address settings are correct.

I have to add the missing code by hand, but unfortunately the next code generation delete it:

void MX_LWIP_Init(void)
{
 /* IP addresses initialization */
	IP_ADDRESS[0] = 192;
	IP_ADDRESS[1] = 168;
	IP_ADDRESS[2] = 0;
	IP_ADDRESS[3] = 5;
	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] = 0;
	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]);
...
...
}

Start a new topic for the problem?

Thank you!

Khouloud ZEMMELI
ST Employee
February 24, 2020

​Hello @PTiha​ did you reproduce the problem with 5.6.0 version ?

Please share the ioc where the problem exist to check it,

Thanks,

Khouloud

PTiha
PTihaAuthor
Associate III
February 24, 2020

I met the problem first in 5.5.0, but in 5.6.0 still exists.

This is my .ioc file:

nucleo-f429zi_lwip-problem.ioc

Thank you very much!

Khouloud ZEMMELI
Khouloud ZEMMELIBest answer
ST Employee
February 24, 2020

​Issue appears with the Board , for the moment you can use the MCU F429ZITx (not the Board), it's the same thing , or click on Clear Pinouts under Pinout then configure your project and code will be fine.

Otherwise, issue will be fixed in the next release.

Thanks @PTiha​  for your feedback,

Best Regards,

Khouloud

PTiha
PTihaAuthor
Associate III
February 24, 2020

It works now!

You helped a lot! Thank you very much!

Nukat
Associate
March 2, 2020

Hello,

I have the same problem - after project generation the IP addresses don't appear in MX_LWIP_Init() function. I tried creating new project for MCU F429ZITx (not the Board) and clearing pinouts but it didn't work.

I've got the STM32CubeIDE (version 1.3.0) for Linux with CubeMX (version 5.6.0) and fimware package STM32_FW_F4 (version 1.25.0).

I attached my .ioc file.

Thank you for any help!

PTiha
PTihaAuthor
Associate III
March 3, 2020

Hello,

You are right!

Unfortunately the IP address settings don't appear in source file.

It seems to it doesn't matter you using board or device during the project setup.

It seemed to work with chip selection, but unfortunately it turned out later that I was using an earlier CubeMX version... :(

Another problem is the initialization code ranking in "Project Manager -> Advanced Settings".

If you make any changes in function call ranking, during code generation it makes a full random call order.

It would be good to have a patch release soon.

I'm currently studying STM32 programming, so I modify the project quite often.

Due to this bugs, the generated code must be corrected after each project change/code generation process.

Thanks for any help!

Nukat
Associate
March 3, 2020

Hello @PTiha​,

Only as a hotfix I figured out you can declare arrays for IP addresses but with their definitions once again in the User Section 2 above MX_LWIP_Init() function, like below. It will be something similar to C++ variable shadowing.

(...)
/* Variables Initialization */
struct netif gnetif;
ip4_addr_t ipaddr;
ip4_addr_t netmask;
ip4_addr_t gw;
uint8_t IP_ADDRESS[4];
uint8_t NETMASK_ADDRESS[4];
uint8_t GATEWAY_ADDRESS[4];
 
/* USER CODE BEGIN 2 */
 
uint8_t IP_ADDRESS[4] = {192, 168, 1, 10};
uint8_t NETMASK_ADDRESS[4] = {255, 255, 255, 0};
uint8_t GATEWAY_ADDRESS[4] = {192, 168, 1, 1};
 
/* USER CODE END 2 */
 
/**
 * LwIP initialization function
 */
void MX_LWIP_Init(void)
{
 /* IP addresses initialization */
 /* Initilialize the LwIP stack without RTOS */
 lwip_init();
(...)

It allows you to avoid code correction after every code generation. It works but I hope that ST will fix it in the next release. Let me know whether it works for you.

Good luck!

Herve PIERROT
ST Employee
April 10, 2020

for the problem of ordering of the function call, a new release of STM32CubeMX (v5.6.1) has been release providing a fix for this. Enjoy and sorry for the inconvenience.

PTiha
PTihaAuthor
Associate III
April 11, 2020

Thanks for the information!

When is the next big version (maybe 6.0) expected?

Will the updates be included in CubeIDE?

The CubeIDE SWV plugin is also pretty buggy, unfortunately ... It still worked in TrueStudio ...