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.
9 years, 7 months ago.
Offline compilation of LPC11U24 USB Keyboard example won't fit into flash.
Hi,
I'm trying to compile this example program for the LPC11U24:
It is just a "hello world" USBKeyboard example. When compiled using the online compiler it works fine, and comes in at about 18 kB (the LPC11U24 has 32 kB of flash). However for security reasons I can't use the online compiler for what I want to do, so I am trying to get it to work with ARM GCC.
Unfortunately, the "Export program..." option doesn't work for ARM GCC - I suspect because during the export it tries to compile it and fails (there is no error message shown; this is just a guess).
I've written a Makefile (actually I'm using QBS) for it, but no matter what I do I can't get it to fit into RAM. These are the "Region FLASH overflowed by XXX bytes" that I get:
- Using the precompiled mbed library (board.o, etc.): About 10k
- Using mbed-src: -Os, -gc-sections: 9052 bytes
- Using mbed-src: -Os, -flto: 6584 bytes
- Using mbed-src: -Os, -flto, -gc-sections: 6624 bytes
- Using mbed-src: -O2, -flto: 7248 bytes
As you can see I'm not even close. Why is there such a huge difference between my compilation and the online compiler? I assume the online compiler uses Keil but is it really more than twice as good as GCC?!
I found a "solution" - removing -u _printf_float -u _scanf_float from the build options took me down to 18k. Those functions must be huge! Fortunately I don't need them. I also had to remove -Wl,-wrap=main otherwise I got errors about main being in a discarded section. Oh and I left -flto and -gc-sections on.
posted by Tim H 01 Apr 2015