STM32G030K6T6 FLASH MEMORY SIZE
I am using a STM32G030K6T6 with ST32CubeIDE and HAL. Is there any way to reduce the flash memory usage? Need to reduce the fasl memory usage by 1kbyte.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-23 3:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-23 4:28 AM
Open the linker script - stm32????_FLASH.ld file
Reduce the FLASH size:
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
- change from the default value (32K above) to whatever you want, like 31K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-23 4:56 AM
set optimizer for size , -Os
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-23 6:28 AM
If you need to use less you'll likely need to remove something or do it more efficiently.
Optimization for size might shrink it sufficiently.
Remove any floating point code/math where possible.
There's a free Keil compiler for STM32 CM0(+) devices, it might do a more aggressive job at code optimization or dead-code removal.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-23 6:37 AM
Thanks
Is possible to use the Keil compiler with STM32CubeIDE? Any instructions on how to replace the toolchain would be helpful.
BR
Gilberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-05-02 6:48 AM
Hi @GErma.1​ ,
STM32CubeIDE is a toolchain like Keil. If your request is to generate code then compile it with Keil, so this is possible.
You need to use STM32CubeMX to generate code and you select Keil project as output.
May you explain why you need to switch from STM32CubeIDE to Keil?
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-01 10:29 AM
The HAL Libraries are memory hogs. You can make a significant reduction by writing your own drivers "bare metal". As an example, my current project reads a message from a UART, and turns on (or off) the requested GPIO pin. Using the HAL Libraries the code (flash) size was 24K. Eliminaring the HAL Library calls, the code size was 4K.
