Loading ...

Translate

Saturday, 22 October 2016

Arduino 1.6.x compiler options...

I'd noticed recently that since I'd upgraded the Arduino IDE to 1.6.x, some programs compiled and were smaller than they used to be. Great!

... the also don't run so fast... not so great.

After some googling around, the compiler options for optimisation had been changed.

So if you need something to compile and run quickly, you can.

Here's how to change it...

Navigate your way to the default Arduino directory in program files, and locate the platform.txt file

On my windows box, it's at C:\Program Files (x86)\Arduino\hardware\arduino\avr
On my Ubuntu box it's Home\Downloads\arduino-1.6.12\hardware\arduino\avr  (Why did I ./install.sh from the downloads folder!!!)

there's also one in the \hardware directory itself. That's not it!

Mine looks like this :



Now I'd rename this to platform.old, so it's there if we screw it up, or wish to revert to slower, but more space-efficient code.

Now, open this file in your favorite text editor (mine's Notepad++ on windows) and do a find and replace on all instances of -Os (that's the letter O) and replace it with -O2 (again, the letter O) There are 3 instances of it in my file...

Bingo, save that as platform.txt in the directory, and you're done.

Here's my modified file...



You can now enjoy faster, but fatter sketches!

.. or not!

No comments:

Post a Comment