On 16/05/2012 20:02, Peter Bigot wrote: > On Wed, May 16, 2012 at 10:14 AM, Adam Ford<adam.f...@braemarinc.com> wrote: >> I'm sorry for bugging people, and I have Googled this question, but the >> answers I'm finding are really old and I know there are updates to >> mspgcc since most of the answers were posted.... >> >> I am trying to port 3 different programs from IAR to MSPGCC for work. >> I'm using the latest released version, but 2 of the 3 won't fit even >> when compiling using optimizations: -mmcu=$(MCU) -g -Os -Wall >> -fdata-sections -ffunction-sections and linked with --no-keep-memory >> -Wl,-gc-sections >> >> Does anyone have any ideas how I can further optimize the compiler >> (other than rewriting - which I've been trying to do)? > > The biggest low-hanging fruit I've found is to avoid printf(3c), which > adds about 2 kB. If you can't avoid it, you can get a few hundred > bytes back by building an msp430-libc that doesn't support printing > 64-bit integers. Look at the README at the top level of msp430-libc > and invoke configure appropriately. > > Beyond that rather unhelpful suggestion, no, there are no magic flags > that I know of. > > Peter >
Is floating point code linked in somewhere? I haven't worked much with msp430-gcc for a while, and I seldom use printf(), but very often unexpected large code size can be traced to including floating point support by mistake. Other things to look for in the map file are if you've accidentally pulled in other large chunks of the C library. Sometimes innocent looking library functions end up forcing in malloc() and friends, or exit(), or other bits and pieces. Adding a stub such as "void exit(void) {}" in the C code can sometimes eliminate this sort of thing. As for "magic flags", does link-time optimisation work for msp430-gcc? If not, then maybe "-combine -fwhole-program" could help? mvh., David ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users