Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 3 months ago.
Why is my simple main() application so large?
I am in the process of building an mbed bootloader application. To start I just want a minimum size application (main) that does nothing other than:
mbed_start_application(POST_APPLICATION_ADDR);
I based this app on what was generated via: mbed new mbed-os-test
After all that the binary for a Release build is still 32K
my mbed_app.json: { "config": { "main_stack_size": { "value": 6000 } }, "target_overrides": { "GRETZKY_DRAGONFLY_L471QG": { "target.restrict_size": "0x020000" } } }
My build output:
TARGET_GRETZKY_DRAGONFLY_L471QG/PeripheralPins.o | 0(+0) | 0(+0) | 0(+0) |
TARGET_GRETZKY_DRAGONFLY_L471QG/device | 446(+446) | 0(+0) | 0(+0) |
TARGET_GRETZKY_DRAGONFLY_L471QG/system_clock.o | 268(+268) | 0(+0) | 0(+0) |
[fill] | 60(+60) | 4(+4) | 11(+11) |
[lib]/c.a | 16596(+16596) | 2472(+2472) | 89(+89) |
[lib]/gcc.a | 3168(+3168) | 0(+0) | 0(+0) |
[lib]/misc | 224(+224) | 4(+4) | 28(+28) |
main.o | 16(+16) | 0(+0) | 0(+0) |
mbed-os/cmsis | 584(+584) | 0(+0) | 84(+84) |
mbed-os/drivers | 74(+74) | 0(+0) | 0(+0) |
mbed-os/hal | 1270(+1270) | 4(+4) | 66(+66) |
mbed-os/platform | 1696(+1696) | 260(+260) | 126(+126) |
mbed-os/targets | 8302(+8302) | 4(+4) | 888(+888) |
Subtotals | 32704(+32704) | 2748(+2748) | 1292(+1292) |
Total Static RAM memory (data + bss): 4040(+4040) bytes Total Flash memory (text + data): 35452(+35452) bytes
What's the purpose of the mbed_os.lib that was part of the mbed new mbed-os-test process? It doesn't know my platform so I would think I can't link against it. My main() does nothing so why is [lib]/c.a 16596(+16596) being pulled in to the binary?
In order to even get this to build I have to exclude all of this in my .mbedignore file (why? I have not explicitly enabled any of these features) My .mbedignore file: mbed-os/features/netsocket/ mbed-os/features/cellular/ mbed-os/features/lwipstack/ mbed-os/features/nanostack/ mbed-os/features/storage/kvstore/ mbed-os/components/802.15.4_RF/ mbed-os/features/mbedtls/ mbed-os/features/lorawan/ mbed-os/features/frameworks/ mbed-os/rtos/ mbed-os/usb/
Thank you!
You may want to take a look at this page and the other's linked from it. https://os.mbed.com/blog/entry/Optimizing-memory-usage-in-mbed-OS-52/
posted by Andy A 17 Jun 2019