cancel
Showing results for 
Search instead for 
Did you mean: 

Bigger binary/ with CMake

Andrej Pi�ek
Associate

Hello,

We considered using the STM32 VScode extension for our next project but encountered a strange issue.

In cubeMX, I created an empty project for STM32U5G9J-DK2, with FreeRtos, NeoChrome and everything related.
When I built this project with CMake, flash usage exceeded 2MBs even when built with the "MinSizeRel" flag.

I found it a bit odd, so I tried other compilers.
CubeIDE managed to build it with ~250kB.
IAR with ~220kB

I thought the problem lies in NeoChrome libraries, but CMake and CubeIDE use the same.

No settings were changed during the tests, only project generation in CubeMX.
What could be causing this excess in consumption, which is almost 2MB?

I would much appreciate any advice.

Here are some additional details...
Changing optimisation levels didn't make more than 50kB of difference for any compiler.

IAR with no optimisation:

image-20240529-121554.png

CubeIDE for Debug:

image-20240529-125826.png

 CMake optimised for size:

image-20240529-123910.png

Regards,
Andrej

2 REPLIES 2
Nawres GHARBI
ST Employee

Hi @Andrej Pi�ek 

could you share your project please we are interested to test the build in our env

mattias norlander
ST Employee

@Andrej Pi�ek , did you figure it out?

Can you compare the map-files of the project built with CubeIDE vs the one built with CMake.
In CMake context you can have a look at the compile_commands.json to see how the compiler is invoked for each C-file. Compare that with the invocation to the same file from the compilation output in the build console of CubeIDE. Flags should be the same --> Result should be the same...

...Just two pointers to help you on the way.