2025-03-10 8:31 AM - last edited on 2025-03-11 1:37 AM by Andrew Neil
Originally a reply to this thread:
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
2025-03-10 8:38 AM - edited 2025-03-10 8:46 AM
@istepne wrote:Please let me know which settings is this.
This one:
PS:
It will be in your stm32xxxx_hal_conf.h file:
/* ########################## Assert Selection ############################## */
/**
* @brief Uncomment the line below to expanse the "assert_param" macro in the
* HAL drivers code
*/
/* #define USE_FULL_ASSERT 1U */
As shown above, it is not defined.
2025-03-11 12:13 AM
@Andrew Neilthank you for the answer.
I realized that it comes from the floating library. I need to use printf with floating point operations enabled.
I made a new project and just compiled it, it tooks 2,99 kbyte memory. After than I enabled the floating feature on settings and compiled again (either debug or release mode) . Then it tooks 23,52kbyte (huge increase). I see the texture on the hex file again with a blank project.
I need Flash memory space on this the older board (can not change the MCU).
Is there a way to disable this strings from hex file to get more space?
Or any other solution like lightweight floating point library etc
Regards
Murat
2025-03-11 1:33 AM - edited 2025-03-11 1:39 AM
This doesn't sound like the same problem as the OP - which was solved as described.
Edit: So split to a separate thread.
@istepne wrote:I see the texture on the hex file again with a blank project
What, exactly, do you mean by that? How are you viewing it?
Please give full details of the tools & procedures used, and show what you're seeing.
@istepne wrote:I need (sic?) to use printf with floating point operations enabled.
Do you really need to?
Both Floating Point and printf can use a lot of flash - so, when flash space is limited, maybe try to avoid both?
2025-03-11 1:54 AM
Look into alternative printf implementations like GitHub - charlesnicholson/nanoprintf: The smallest public printf implementation for its feature set. and avoid using the printf provided in newlib.
hth
KnarfB