2022-04-25 11:22 AM
I'm working on an STM32L031 project together with a client, me being on an old V1.4 and him on V1.9. He's been able to compile my firmware for quite some time, but now I'm running close to the end of my flash (70%) he's unable to properly compile the code, running out of flash by 88 bytes.
The project settings all seem the same, only the IDE installation is different - Installing V1.9.0 on my machine has the same problem.
Looking at the memory details there seem to be a number of extra functions taking space, for example _vfiprintf_r and _vfprintf_r.
Does anyone know what's up here? And how to circumvent this? I'd love to stay on an up to date version of the IDE but I have to be able to compile my code.
Thanks!
2022-04-25 12:17 PM
Check you have same compiler settings.
Paul
2022-04-25 12:30 PM
Not sure about the details on the c libraries without having a project to look at.
But, what strikes me is that if you only want to have "an up to date version of the IDE", then you can use the 1.9.0 version of the "IDE". But stick with the old toolchain.
The toolchain manager allows you to de-couple "IDE" from "toolchain". Very useful when you want to "freeze your code and tools".
Have a look at Window > Preferences > STM32Cube > Toolchain Manager, allows you to download old toolchains.
You can do that if you wish also to just build with the different toolchain version and compare GCC7 / GCC9 / GCC10.
Have a look at UM2609 and the Toolchain Manager chapter.
Between some IDE version the "integration" of the toolchain (on IDE side) has also changed. So it is possible that we have new default settings that will slightly enlarge the code too (even if you use the same GCC version).
Conequently it is not entirely true to say that the IDE is fully de-coupled from the toolchain.
You can fully decouple by writing your own makefile and use whatever make + toolchain version you want. But that is not your original question... :)
2022-04-26 03:01 AM
Cannot find anything in the toolchain integration that would change this. The safe bet is to use CubIDE 1.9.0 with GCC7 if you want to re-produce the same sized binary.
Let us know if that solves your issue or not.
2022-04-26 04:46 AM
C or C++ project?
Does the STM32L031 have the 16 or 32KByte flash memory?
Bare-metal or RTOS application?
2022-04-26 05:17 AM
Thanks for all the replies Mattias!
Installing and selecting the "GNU Tools for STM32 (7-2018-q2-update)" as a toolchain in the IDE V1.9.0 results in the exact same file size as on the IDE V1.4.0. I've never known how this worked, thanks for shedding a lot of light on this for me as well as circumventing my problem. :)
For the rest, it's a Bare-metal C++ project on the 32kB flash version. I'm still curious why the file size would increase by over 30% with the same optimization, but at least I can continue working in the new IDE knowing what does what.
Much appreciated!
David
2022-04-26 03:06 PM
Also take a look on additional information about printf() functions and firmware size optimization overall:
https://community.st.com/s/question/0D53W00001FT7OdSAL/problem-with-optimal-code-size