Improve flash usage with STM32F030F4P6 #2812
Unanswered
evil-gears
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @evil-gears You can try to:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, would like to request a "flash usage improvement" (not really sure what to call it) for STM32F030F4P6.
The issue is that this MCU is already limited in terms of flash size when compared to others of the F030 line by having only 16KB, however the main problem is that in core 2.10.1@Arduino IDE 2.3.4, even using the "smallest with LTO" compiler optimization, a completely empty sketch consumes around 8576 bytes (52%) of the flash and 1328 bytes (32%) of the SRAM, which effectively limits the program size to around 8KB, which is easily taken up completely by a simple sketch if a library or a timer is included.
If I disable U(S)ART support (even though it's not even called/initialized) it gets a bit better at 2708 bytes (16%) of program storage space, so I suspect it has to do with all the HAL libraries it has to load up.
Meanwhile, an AVR board of the same flash size compiles an empty sketch at no more than 1% of the program storage space. I know the architectures are very different, but I think that a 32-bit MCU should be better flash-wise than an 8-bit one, not worse...
In my case, I have a code that runs on HSI, uses TIM3 as an interrupt callback for timing and has a state-machine composed of a half-dozen cases inside a switch-case funtion that toggles 6 outputs based on 2 inputs. This rather simple code takes up 12884 bytes (78%) of the program storage space with LTO and a whooping 15392 bytes (93%) without LTO. These numbers go down to a much nicer 7616 bytes (46%) with LTO and 11612 bytes (70%) without LTO if I disable U(S)ART, and in this case I'm not using it anyway.
However, I still think it's rather absurd the core has to take up so much flash to do these simple tasks. Is there something that could be improved on the next release to fix this? Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions