cancel
Showing results for 
Search instead for 
Did you mean: 

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

PTiha
Senior

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!

15 REPLIES 15
PTiha
Senior

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!

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!

EDIT:

<REPEATED REPLY BY ACCIDENT>

I'm sorry.

Thank you @Nukat​ for your help!

This seems like an acceptable solution until the bug is fixed.

Herve PIERROT
ST Employee

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.

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 ...