Go Down

Topic: optimising for size (Read 1 time) previous topic - next topic

eighthave

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

admin

Hello hans

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

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

eighthave

#2
Aug 27, 2006, 04:37 am Last Edit: Aug 27, 2006, 05:20 am by eighthave Reason: 1

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.

mellis

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

ccdust

#4
Aug 28, 2006, 12:03 pm Last Edit: Aug 28, 2006, 12:05 pm by ccdust Reason: 1
could someone post coomands for compiling linking and building!
Code: [Select]
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!

mellis

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.

neillzero

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.

tateu

#7
Dec 01, 2006, 11:59 pm Last Edit: Dec 01, 2006, 11:59 pm by tateu Reason: 1
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

Lionel Lemarie

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.

Go Up