Go Down

Topic: need to reduce sketch size (Read 1 time) previous topic - next topic


Hello there,

I have written a rather complex sketch for the atmega168, which compiles to ~14.300 bytes, which means that there is no space left for more logic. However, I need approimately 300 - 500 bytes more.

Until now I did the following:
* Shared (very short) string-constants
* Maximized code-reuse
* Used the smallest possible datatypes (and no floats)
* Disabled some of the unused (non-decimal) serial-commands in wiring.c

(I use arduino 0007)

(I don't fear modifying some of the .c files for the board)

Now to my questions:
* Is it possible to switch arduino 0007 to C instead of C++?
* I found out that there are many string-functions like atoi, itoa, strcmp, strlen, ... compiled in. Many of them I do not use. Is there a possibility to disable them?
* I do not use shiftOut, pulseIn, min, max, abs, constrain and external interrupts. What is the best way to disable them?
* Is there any other way to get the sketch smaller?

Note: I do not want to overwrite the bootloader.

Thanks, Mr.M


Feb 16, 2007, 03:42 pm Last Edit: Feb 16, 2007, 03:43 pm by CosineKitty Reason: 1
If you are using Arduino 0007, I would recommend trying out the following library patch:


You may be surprised at how much smaller your sketch will get!



I had found the patch for the 0005er, but not the one for the 0007er. I'll try it out during the next week.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131