Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC_ARM compiler reports wrong code size #972

Open
zhiyong-ft opened this issue May 27, 2020 · 2 comments
Open

GCC_ARM compiler reports wrong code size #972

zhiyong-ft opened this issue May 27, 2020 · 2 comments

Comments

@zhiyong-ft
Copy link

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.

@ciarmcom
Copy link
Member

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTBTOOL-676

@JojoS62
Copy link

JojoS62 commented Jul 16, 2020

I had reported this recently, but could not fix it completely. ARMmbed/mbed-os#12541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants