cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE generates redundant prototype

heveskar
Senior

Today I tried migrating our projects to the new STM32CubeIDE release. One thing I noticed is that whenever MPU is enabled, it generates redundant function prototype

 

static void MPU_Initialize(void);

 

in main.c which generates a warning when -Wall is enabled. This function is not even implemented, it seems that only

 

MPU_Config();

 

is called. Steps to reproduce: it is enough to create a new project (I tried for STM32H723VG MCU), enable MPU and this prototype is generated. Here is the build info:

heveskar_0-1689079501995.pngheveskar_1-1689079534448.png

I think it is a bug in the code generation.

EDIT: There already was a post about this yesterday, sorry I could not find it https://community.st.com/t5/stm32cubeide-mcu/stm32cubeide-v1-13-0-compile-warning/td-p/573573 

1 ACCEPTED SOLUTION

Accepted Solutions
Semer CHERNI
ST Employee

Hello @heveskar 

First thank you for posting and mentioning this behavior.

In fact, in this context the "static void MPU_Initialize(void);" prototype should not be called as this function is generated for other purposes.

The temporary solution is to delete it from the code and this will not have any impact on it.

With this been said, the problem is raised internally to be reviewed. I'll keep you posted with the updates. Internal ticket number: 157046 (This is an internal tracking number and is not accessible or usable by customers).

Kind regards,

Semer.

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.

View solution in original post

5 REPLIES 5
Krautermann
Senior II

I have just updated CubeMX also to version 1.13.0 and I can confirm that this issue is happening to me too!

static void MPU_Initialize(void); appears in the main.c file without me adding anything.

And then I get a warning whenever I compile in IDE. "Initialized but not used".

Semer CHERNI
ST Employee

Hello @heveskar 

First thank you for posting and mentioning this behavior.

In fact, in this context the "static void MPU_Initialize(void);" prototype should not be called as this function is generated for other purposes.

The temporary solution is to delete it from the code and this will not have any impact on it.

With this been said, the problem is raised internally to be reviewed. I'll keep you posted with the updates. Internal ticket number: 157046 (This is an internal tracking number and is not accessible or usable by customers).

Kind regards,

Semer.

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.

QLiu.6
Associate II

Upgrade to 1.13.1.

It's still there.

Hello @QLiu.6 

In fact the fix was not included in the 1.13.1 and as it still under investigation.
It should be fixed ASAP.

KR,
Semer.

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.

Proposed solution force to hand patch code on every change in configuration or IOC file.

Better is :

A) make an empty "static void MPU_Initialize(void){;}" in USER CODE 4 section

B) add "MPU_Initialize();" in USER CODE 2

or if you are using AzureRTOS in USER CODE 3 - will never be executed.

and you can re-generate your configuration as many time as you need without warring of this bug.