Skip to main content
AAlis.23
Associate III
March 7, 2025
Question

CubeMX uncheck "Generate Code" not working. BUG

  • March 7, 2025
  • 2 replies
  • 411 views

When unchecking "Generate Code" for MX_LWIP_Init, the code is still generated anyway. It's very annoying because I have to delete the generated function every time I generate code. Using CubeMX version 6.14.

2 replies

Ghofrane GSOURI
Technical Moderator
March 7, 2025

Hello @AAlis.23 

First let me thank you for posting.

When you configure peripherals and middleware in STM32CubeMX, the tool generates initialization code for these components. By default, STM32CubeMX includes function calls to initialize the configured peripherals in the main.c   file. The "Do not generate function call" option allows you to exclude these function calls from the generated code.

Using STM32H743AGIx and CubeMX 6.14.0 

when the option is checked

GhofraneGSOURI_0-1741346531823.png

The generated code is : 

GhofraneGSOURI_1-1741346562933.png

When the option is unchecked 

GhofraneGSOURI_2-1741346622105.png

==> CubeMX works correctly

 

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
AAlis.23
AAlis.23Author
Associate III
March 7, 2025

Hi,

AAlis23_0-1741360127679.png

As you can see, I have "Generate Code" disabled, but when generating the code, CubeMX overwrites the lwip.c file, adding the function void MX_LWIP_Init(void). This causes a compiler error because I already have this function declared (I need to use my own function).

My goal is to use my own function and call it normally.

AAlis23_1-1741360354364.png

CubeMX fails.

In fact, I now have the function declared three times! Every time I generate the code, CubeMX adds a new copy.

AAlis23_0-1741361166107.png