Arduino IDE - Huge memory usage of STM32
Posted: Fri May 21, 2021 12:33 pm
Hi!
Recently I just started using the STM32 bluepill board and I was trying to blink the on-board LED. I programmed the board using Arduino IDE but what shock me was the memory usage is so huge. Merely blinking a LED takes up 17% of the program memory space. Below is my code and the output of the IDE. Is this normal? Does anyone knows how to reduce the memory usage?
Code:
Output:
Also, does the 128KiB means that the flash memory of the chip is 128KiB? I remember the specification written on the website I bought this board was 64kB.
Recently I just started using the STM32 bluepill board and I was trying to blink the on-board LED. I programmed the board using Arduino IDE but what shock me was the memory usage is so huge. Merely blinking a LED takes up 17% of the program memory space. Below is my code and the output of the IDE. Is this normal? Does anyone knows how to reduce the memory usage?
Code:
Code: Select all
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin PC13 as an output.
pinMode(PC13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(PC13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(PC13, LOW); // turn the LED off by making the voltage LOW
delay(200); // wait for a second
}
Code: Select all
Sketch uses 11180 bytes (17%) of program storage space. Maximum is 65536 bytes.
Global variables use 1432 bytes (6%) of dynamic memory, leaving 19048 bytes for local variables. Maximum is 20480 bytes.
stm32flash 0.4
http://stm32flash.googlecode.com/
Using Parser : Raw BINARY
Interface serial_w32: 115200 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote address 0x08002bac (100.00%) Done.
Starting execution at address 0x08000000... done.