Skip to main content
lgacnik97
Associate II
January 25, 2025
Question

STM32CubeMX bug report

  • January 25, 2025
  • 1 reply
  • 587 views

Dear ST support team,

In STM32CubeMX under the "Project Manager - Advanced Settings" path in the "Generated Function Calls" window user can select to make the generated functions' scope static or external. However, the SystemClock_Config() is always static within the main.c where this function is also generated. This is a bit annoying for all of us who do not use the main() function in the main.c and want to call all the required HAL initializations externally. This issue seems MCU family independent.

Another one is the fact that for some MCUs there are issues with linker file generation. The CubeMX-generated linker file is leaving out some linker code. While I'm not seeing this issue on the STM32U535, this remains an issue for the STM32F756. The explanation of the problem and the solution is shown below (answer provided by @grzegorz in the thread https://community.st.com/t5/stm32cubemx-mcus/flash-ld-syntax-error-when-upgrading-to-cubemx-v6-12-1/td-p/722343/page/2)

 

CubeMX forgets about references to RAM

We have:

_estack = ORIGIN() + LENGTH(); /* end of RAM */
Should be

_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
And at the end of .data section definition:

 } > AT> FLASH
Should be:

 } >RAM AT> FLASH
Also for .bss

 } >
Should be:

 } >RAM
And for ._user_heap_stack we have:

 } >
Should be:

 } >RAM

 



Please address these issues in the following STM32CubeMX updates.

Thanks!

1 reply

Andrew Neil
Super User
January 27, 2025

@lgacnik97 wrote:

the SystemClock_Config() is always static within the main.c where this function is also generated. !


I see it in main.c, but it's not static:

AndrewNeil_0-1737968756813.png

 

But is it also not prototyped in any generated header - which does seem inconsistent.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.