Pages: [1]   Go Down
Author Topic: optimising for size  (Read 1381 times)
0 Members and 1 Guest are viewing this topic.
Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am working with Jamie Allen on the next generation of the Pduino firmware that is meant to be used for all sorts of software packages.  We want to include software PWM, pulseIn, and servo logic, but its looking like its going to be tough to fit all that into the ATMega8's code space.

Does anyone have any advice as to how to reduce the size?  Does Arduino already use the -Os gcc flag (optimize for size)?

You can see the code in question here:

http://pure-data.cvs.sourceforge.net/pure-data/externals/hardware/arduino/Pd_firmware/Pd_firmware.pde
Logged

Forum Administrator
Offline Offline
Newbie
*****
Karma: 3
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello hans

I'm glad you're working on pduino "next generation" smiley

arduino has the -Os flag but there is some strange issue with linking that we are still investigating.

We could just shift to plain c for the pduino firmware... i see it as something you provide pre complied
and people find it pre installed on any arduino they buy.
we can add a menu item to arduino 0005 that will download the firmware into the board in case it is erased.

this way  we can squeeze much more out of it.

what do you think?

massimo
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I am still thinking that we can get this to work in Arduino code.  Then maybe some assembly hacker can make it really fast.  But the plans you mention above sound good.
« Last Edit: August 26, 2006, 10:20:34 pm by eighthave » Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, the Arduino core should be much smaller in Arduino 0005, as we've cut some of the fat out.
Logged

Slovenia
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

could someone post coomands for compiling linking and building!
Code:
tools/avr/bin/avr-gcc -c -g -Os -IC:\Programiranje\arduino-0004\lib\targets\arduino -w -mmcu=atmega8 -DF_CPU=16000000L C:\Programiranje\arduino-0004\lib\targets\arduino\buffer.c -oC:\DOCUME~1\Janez\LOCALS~1\Temp\build48482.tmp\buffer.c.o

I did find only those! Why I need them? Someone would ask! I need them for buildng my own IDE for Arduino. Work is allmost done i just need compiling commands becouse i don't want to use make! Thanks for help!
« Last Edit: August 28, 2006, 05:05:48 am by ccdust » Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I posted some here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1157400799 and am in the process of creating a proper tutorial (and Makefile) for building and uploading Arduino sketches from the command line.
Logged

London
Offline Offline
Newbie
*
Karma: 0
Posts: 47
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Wolf Paulus mentions a small hack to save 450 bytes - remove the legacy serial code support in arduino/lib/targets/arduino/wiring.c

Quote
Arduino's standard library still supports some legacy serial code, which can be removed by editing arduino/lib/targets/arduino/wiring.c (Arduino Version 0006):
Start commenting out code at line 241, insert /* just before void beginSerial(long baud)
This will reduce the size of a deployable program and increase the available memory for custom code by 450 Bytes, which doesn't sound like much but is equivalent to 6.3%.
-- http://wolfpaulus.com/journal/embedded/arduino.html

Not really so relevant for you guys working on pduino, but for us beginners reading this thread it's a nice tip.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
l'oisivete est mere de tous les vices
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

also, check out this post, it might help.
saved me almost 1k...
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1164904468/2#2
« Last Edit: December 01, 2006, 05:59:55 pm by tateu » Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Impressive !
Using a combination of the patch and removing the legacy serial code, my code went from 4.4KB to 1.8KB. And it still works, bonus.

Thanks guys,
Lion.
Logged

Pages: [1]   Go Up
Jump to: