2021-11-12 06:59 AM
Hello All.
I am working on a small project for a friend while learning the STM32 environment.
The project is currently using a STM32F030x4 in a 20 pin TSSOP20.
I have committed a sin; I have run out of Flash Memory.
Is there any way to reduce the RAM allocation and move it to FLASH?
STM makes a chip with the same footprint and pinout with more memory (STM32F042x4) but no one has any stock.
Just curious if there is any 'dirty little secret' to doing this......
Regards to All,
Steve
2021-11-12 07:16 AM
No, RAM and FLASH are not interchangeable.
Make sure your optimization settings are turned up to full. That can buy you some space. You can example the map file to see what code is taking the most space and optimize it where possible.
2021-11-12 07:18 AM
Thanks! I figured but it was worth a shot just in case......
2021-11-12 08:44 AM
If your code was compressable, the tighter data in flash could be unpack to RAM to be run.
Watch for things like the floating point library, or sscanf() / sprintf() type functions eating a lot of space.
2021-11-12 08:54 AM
TDK, I have looked through CubeIDE and can't find the optimization area. Any pointers?
Tesla, I don't think I can compress any of it. I would like to half the RAM and put it in FLASH, oh well.
Ordered a few of the larger memory chips - who knows when they may show up.
2021-11-12 09:03 AM
Right click project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Optimization
> Ordered a few of the larger memory chips - who knows when they may show up.
Good luck. I haven't had any luck with STM32 chips getting sent early.
2021-11-12 09:08 AM
Holy Crap!
I gained some memory!
TDK I will have an Adult Beverage in your Honor (or 2) this evening!
I chose the Os method for space.
2021-11-12 09:10 AM
2021-11-12 10:18 AM
Warning i mean you miss x4 chips have 16k flash both. You need x6 x8 usw for more flash.
And if your code for 030 is over flash in gcc try KEIL , is little better and free for code less 32k
2021-11-13 03:35 AM
Often the smaller chips like the f103x8 arelarger chip in disguise (f103xb) with the upper flash not tested but still available. Some tools may refuse to write above the announced flash. For a a hobby or low security approach, try to use the unannounced flash as a first test.