cancel
Showing results for 
Search instead for 
Did you mean: 

Save flash when using printf and floating-point on STM32F0

istepne
Associate III

Originally a reply to this thread:

https://community.st.com/t5/stm32-mcus-embedded-software/how-generate-hex-file-without-link-files-hal-drivers/td-p/723141

Split as it seems to be a different issue.


Hi,

I have same issue too

I am using STM32F051R8 with STM32CubeIDE Version: 1.18.0

There is limited Flash memory. So when I am checking the memory I found some library names etc definition strings on my hex file. I tried to change some setting according to topics above but no success at all

Please let me know which settings is this. Also I am using optimization "Optimize for size -s"

Regards

Murat

13 REPLIES 13

I just wonder that why the unused text is placed on the hex file and takes space. Anyway I will find a way to handle this situation.

Yes I mean text in my hex file output. I will try to eleminate printf floating point usages in the code (The printf and floating numbers are used already with the older versions of the firmware). Now, we need to add some new features and functions to the firmware with older board (to support new type of LED display ICs), it tooks extra space too.

Thanks for your support, (Keil is not the case for me. Because I am using many kinds of project with same stm32cubeide compiler and same programing interface. Typology and usages are all same. Even if they have similar usages but using a different compiler takes time to find new settings and typings. I mean deep settings like priorities etc)

Thanks @KnarfB I will take a look at your references for alternative impelementations as well

I mean Keil as test for compare. If you use MX switch code to keil is simple click... And Keil compiler with -O3 generate always smaller code as GCC...


@istepne wrote:

istepne_3-1741794250386.png

Flash usage also looks like too much


Really?

That's telling you that you've only used 36% - so you've still got 70% free!

Well over half of your flash is unused!

As I said, it is only a coplete new project results..No any letter my own. It consumes %37 code size even no code my own (code optimization is open too).

My old project was already %96 percent codesize. The last 1K sector space also used for eeprom evaulation too. So, I wonder that if it is possible to remove text links from hex file. I need every bytes if I can.

Anyway I finished the firmware update, added new requiered  functions on it. But I had to remove some features on the firmware