Relief is here from long compile times when developing firmware for your Arduino project. [Paul] was puzzled by the fact that every file used in a sketch is fully recompiled every time you hit upload–even if that file didn’t change. To make things more confusing, this behavior isn’t consistent across all Arduino compatible hardware. The Teensy has an additional feature not seen when working with other hardware boards in that it reuses previously compiled code if nothing has changed. It even tells you which files are being reused, as shown in the image above.
After the break we’ve embedded [Paul’s] video that walks us through the process of editing the Arduino IDE to reuse previously compiled files. It’s a one-liner addition to the boards.txt file. For example, if you’re working with the Arduino Uno all that needs to be added is ‘uno.build.dependency=true’. [Paul] had previously submitted a patch to roll this into the Arduino IDE source code, but it was not accepted citing a need for more testing. He’s asking for help with that testing and wants you to post your thoughts, or any bug information, on the new issue he’s opened regarding this feature.[youtube=http://www.youtube.com/watch?v=2dBF1ypQupM&w=470]
Wow its like a … makefile
this is so advanced, like something a Makefile would do :S
Hi, Paul here… the guy who wrote this. I’m thrilled HaD decided to carry my story. I wasn’t sure if they would, since it’s software only.
That first line should probably read “impatient” rather than “puzzled”. ;-)
Sadly, this speedup isn’t nearly as advanced as a Makefile, though it does achieve much of the same time savings. While it does use gcc’s dependency output from previous compiles, and it checks the timestamps on all dependant sources, it doesn’t actually alter Arduino’s build system very much. The is_already_compiled() function just returns a boolean that tells the loop which compiles a set of files if it can skip a particular .o file.
Make is capable of so much more, even if many projects don’t use of its power. One of the most awesome features of modern GNU Make is being able to run more than one compile job at a time! My machine is a quad core processor, and on largish projects with a lot of individually compiled components, running “make -j 4” really does give a substantial speedup (rare 4X as fast, but still good).
Maybe someday I’ll adding that too, though most Arduino sketches are just a single source file (if multiple tabs are used, all the .pde and .ino files are concatenated, so only .cpp ones are compiled as separate files).
But I’ve created so many improvements for Arduino, which are all in Teensyduino of course. It’s just so difficult contributing stuff to Arduino (eg, check out issue #140 – where I submitted code 2 years ago).
This (good work btw) motivated me to add a feature request that has long annoyed me, the ability to have hex files saved in the project directory after compiling. I’ve hated having to go hunt them down in temp files. So be sure to vote for this one as well.
http://code.google.com/p/arduino/issues/detail?id=641
+1 – Vote cast ;-)
That feature was already requested as issue 493, and already accepted but marked “Post-1.0”.
http://code.google.com/p/arduino/issues/detail?id=493
There’s no point voting on issue 641, since it will very certainly be marked a duplicate. There’s also not much point voting on 493 either, since it’s already been accepted.
But posting a patch would be good! ;-)
Oops, nvm then. I did search before posting, but apparently not hard enough.
Post-1.0? That stinks, considering how many people are requesting the feature on forums and other venues.
Yeah, a lot of good ideas are “Post-1.0”, since 1.0 is really about API changes.
Since it’s already accepted, if you create a patch, there’s good chance it’ll actually get used.
I’ve read about this before but I don’t remember someone suggesting a fix. Thanks!
LoL…I read the headline and thought, “That could speed up Teensy programming”…all well. :)
I use a pentium 3, and a sketch that fills up the entire 32k takes a whole 20 seconds to compile. My tri core 2.8 ghz machine can do it in a blink of an eye, so my point is you might have other problems …
How long your your P3 take with this speedup?
What I would love are some shell scripts that compile and upload some arduino code, so I can use my favorite editor environment.
The arduino editor is uncool IMHO, and having a dedicated editor and compile/upload window is messy.
Have you tried Arduino’s “Use external editor” feature? It’s in the preferences. It disables Arduino’s simple but lame editor. Every time you click the upload button, Arduino re-reads the file from disk, compiles and uploads. Whenever I do anything more than a tiny example, I use it and do my editing with vim. Works great!
yes, i do that right now, but I rather have no arduino window, and a makefile.., like the one in the other comment:
http://arduino.cc/playground/uploads/Learning/Makefile
I did the 3 second google search for you:
http://www.arduino.cc/playground/Learning/CommandLine
To my justification, this is a rather recent page, when I looked for it 6 months ago, nothing turned up.
There is also something else you can do to e.g. change optimization level:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278712207
Avr-gcc and Avr dude. . Im not sure what all it’s compatible with… All I know is I have never once used the arduino ide with my attiny85. Nano and shell commands. I’ve never even logged into the graphical environment on the pi fishing it
Hey guys.. I just was given 30 AMD AM29F010B-90PC 1 Megabit (128 K x 8-bit)
CMOS 5.0 Volt-only, Uniform Sector Flash Memory
Would these be able to be used with Arduino or anything similar?
Despite being shown on Hack-a-Day, Adafruit’s blog, Dangerous Prototypes, and the Arduino Forum – and now over 1000 views accourding to YouTube – it appears only a couple people have actually tried this speedup.
As a final followup, I prepared a patch and posted it to issue 638.
http://code.google.com/p/arduino/issues/detail?id=638
I’m not planning any more work to contribute this feature to Arduino. My effort appears to have stalled and failed.
The source is there, if anyone wants to pick it up and do anything with it.
Works !!! Great !!! Saves much of my time
Arduino 1.0.1-rc1 (release candidate #1) was published today, with this speedup.
Mac OS X: http://files.arduino.cc/downloads/arduino-1.0.1-rc1-macosx.zip
Windows: http://files.arduino.cc/downloads/arduino-1.0.1-rc1-windows.zip
Linux (32-bit): http://files.arduino.cc/downloads/arduino-1.0.1-rc1-linux.tgz
Linux (64-bit): http://files.arduino.cc/downloads/arduino-1.0.1-rc1-linux64.tgz
Final release for Arduino 1.0.1 is planned for early April.
I know this thread is a bit old but this update (Final release for Arduino 1.0.1) did not work for me until I moved the “arduino-1.0.1” directory to one without spaces in name(s).
i.e. c:\arduino-1.0.1
After that my compile/upload time went from 1 min. to less than 10 sec.
I’m sure this is a windows issue only, I like to tweak code in small changes so this fix/update saves me a ton of time.