Author Topic: Shrink executable size? Disabling HardwareSerial, and other unneeded components.  (Read 2967 times)

psychogenic

  • Newbie
  • *
  • Posts: 4
Greetings all,

I'm attempting to get my code running on a DS, but it's compiling too big. 

I've poked around in the build directory and the resulting core.a... It seems to include a number of components I really don't need, namely HardwareSerial and its lot of dependencies:
  • TinyDebugSerial*
  • Stream
  • Print
  • WString
  • etc.
Obviously,  my code isn't using Serial or anything related.  I tried doing things like:
Code: [Select]
#define HardwareSerial_h
#define TinyDebugSerial_h
#define Stream_h
#define Print_h
in my sketch, in my libs.  I even went into hardware/tiny-digispark/cores/tiny/WProgram.h and manually commented out the only HardwareSerial.h include I could find... no go.


My question: how can I compile my program to ensure the final executable doesn't contain any of the components I'm not using, so I can squeeze it into the Digispark?


BTW/if it's of any help, the contents of the build directory contain:
Code: [Select]
SIZE    File
=========
233K    core.a
89K    myTest.cpp.elf
38K    WString.cpp.o
23K    Print.cpp.o
18K    myTest.cpp.o
18K    myTest.cpp.hex
17K    TinyDebugSerial.cpp.o
15K    wiring.c.o
14K    TinyDebugSerial38400.cpp.o
14K    TinyDebugSerial115200.cpp.o
14K    TinyDebugSerial9600.cpp.o
13K    wiring_digital.c.o
13K    Tone.cpp.o
13K    wiring_analog.c.o
9.6K    TinyDebugSerialErrors.cpp.o
7.6K    wiring_pulse.c.o
7.5K    WInterrupts.c.o
6.9K    wiring_shift.c.o
6.8K    pins_arduino.c.o
5.1K    WMath.cpp.o
5.0K    main.cpp.o
4.5K    new.cpp.o
4.4K    HardwareSerial.cpp.o



Thanks,
PatD
« Last Edit: March 04, 2013, 02:47:05 pm by psychogenic »