ARMmbed / ARMmbed/mbed-cli

GCC_ARM compiler reports wrong code size

Open
#972 2 comments 0 reactions 0 assignees View on GitHub
Jira status: OPEN mirrored type: bug
Dominant language
Python
Stars
339
Forks
187
PR merge metrics
No merged PRs in 30d

Description

Hi,
When I tried to down size an app from STM32F401RE to STM32F401RC, I noticed the code size reported by GCC_ARM is usually less than actual code size. For the following blinky code:
```
#include "mbed.h"

int main() {
Watchdog &watchdog = Watchdog::get_instance();
watchdog.start(30000);
printf("system started\r\n");

DigitalOut led(PA_5);

while (1)
{
printf("%d: System running\r\n", time(NULL));
led = !led;
ThisThread::sleep_for(1000);
watchdog.kick();
}
}
```
Running the following command:
```
mbed compile -t gcc_arm -m nucleo_f401re --profile release
```
leads to output:
```
Total Static RAM memory (data + bss): 14320(+48) bytes
Total Flash memory (text + data): 52276(+9736) bytes
```
However, when I open the generated HEX file in STM32CubeProgrammer, the code size reported to be 0xD648 = 54856

In the actual app I am working on, the code size reported by GCC_ARM is usually 70+KB less than actual size, something like 200KB vs 300KB. As a result, I ended up with a small batch of PCB that I don't know what to do with.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.