2023-04-23 03:46 AM
2023-04-23 04: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
2023-04-23 04:56 AM
set optimizer for size , -Os
2023-04-23 06: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.
2023-04-23 06: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
2023-05-02 06: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.
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.