2023-07-11 05:48 AM - edited 2023-07-11 06:44 AM
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:
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
Solved! Go to Solution.
2023-07-11 07:01 AM
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.
2023-07-11 06:42 AM
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".
2023-07-11 07:01 AM
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.
2023-08-15 08:00 PM
Upgrade to 1.13.1.
It's still there.
2023-08-21 01:08 AM
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.
2023-09-15 08:45 AM
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.