Build Project shortcut not working in Eclipse 4.2

There is a problem with Eclipse 4.2 and 4.2.1 whereby the “build
project” keyboard shortcut does not work when editing text. The bug
report is here
with a candidate patch, which works for me.

Git diff not working in Eclipse

After manually installing Eclipse 4.2.1 on a fresh install of Ubuntu
12.04 I found that the Team -> Commit command complained that it couldn’t launch a
browser to display the git diff. I’ve documented the (simple) fix on
the Ubuntu
Wiki.

in the step which starts “In Eclipse right click on the
“ArduinoCore” project, select “Properties” and then “C/C++ Build”
you need to then click on “Settings” and you’ll find the
“Directories” setting within the “Tool Settings” tab

Some code includes pre-processor directives like #ifdef ARDUINO
to check whether the user is using the Arduino IDE. If you want add
this ARDUINO symbol then right click on the Arduino
project go to C/C++ build -> Settings and add “ARDUINO=100” to
“Symbols” under both AVR Compiler and AVR C++ Compiler.

If you need the SPI library: Create a new C++ project in a similar
way to the ArduinoCore library, with the same include paths. In your
actual project, make sure that the ArduinoCore library comes last in
C/C++ Build -> Settings -> AVR C++ Linker -> Libraries.

On avr-gcc 4.7 (default on Ubuntu 12.10) I had to remove the --cref option.
Seems to work fine. With the --cref option
in place, the linker exits with an error avr-g++: error: unrecognized command line option ‘–cref’. I’ve struggled to find what the “–cref”
option does. The only hint of an explanation is that it tells the
linker to “add cross reference to map file”. looking at the
Eclipse (4.2.1) console after I build my project, I see this still
includes “-Wl,-Map,.map,–cref” which seems to work fine. So I guess
it is still using the –cref option, it’s just that the syntax for
the –cref option is slightly different.

The Arduino IDE 1.0.1 creates significantly smaller binaries
compared to the Eclilpse setup. I examined the arguments the Arduino
IDE sends to g++ (turn on “show verbose output during compilation”)
and found some differences. To create smaller binaries on Eclipse,
do this on every AVR project (including ArduinoCore): go to C/C++
Build -> Settings -> AVR Compiler -> Optimization and add
-ffunction-sections -fdata-sections to “Other Optimization Flags”. Do the same
for the AVR C++ compiler. In all AVR application projects (i.e.
not static libraries) go to AVR C++ Linker -> General and add
-Wl,--gc-sections to “Other Arguments”. Clean and re-build.
My binary went from 26kbytes (81% full) to 14kbytes (43% full). For
more info on what these switches are doing, see “function sections”
on elinux.org and Stack
Overflow: Query on -ffunction-section & -fdata-sections options of
gcc

Eclipse code checking does wierd stuff but code compiles fine

I was finding that sometimes Eclipse would claim there were issues with
my code (e.g. incorrect arguments being supplied to functions) even
though the compiler was entirely happy. This seems to be fixed by
deleting the project from Eclipse (but leave it on disk) and then
re-importing the project.

Colour preference settings

Aptana Studio > Themes (I like Sunburst; and make sure “Apply to
all (non-Studio) editors” is checked to apply these colours to PyDev

Aptana Studio

Aptana Studio is an Integrated
Development Environment (IDE) for building web apps. It’s based on
Eclipse and is free. This blog post is simply a list of configuration
options that I use to make Aptana Studio 3 comfortable for me:

I try to mitigate climate change using computer science. I am a Research Engineer at DeepMind, mostly working on energy problems. Previously, I worked on energy disaggregation as a post-doc at Imperial College London. Read more about me…