Pages: [1]   Go Down
Author Topic: need to reduce sketch size  (Read 706 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Florida, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 146
meow!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are using Arduino 0007, I would recommend trying out the following library patch:

http://www.arduino.cc/playground/Code/LibPatch0007

You may be surprised at how much smaller your sketch will get!
« Last Edit: February 16, 2007, 09:43:17 am by CosineKitty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks,

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

Mr.M
Logged

Pages: [1]   Go Up
Jump to: