Arduino On Eclipse

Posted on  by admin
  • Arduino on eclipse! – Part I – Intallation. Published 21st October 2014 by Eduardo Lezcano. What to install, where to install it and how to configure it. All that you want to know (hopefully). This tutorial is based on a Windows 64 bit system. But the fact that eclipse is multi-platform should ease the things.
  • You now have a fully functioning Arduino UNO development system in Eclipse! Programming the Arduino board in C unlocks the full functionality of the ATmega328p microcontroller! Writing software in C also provides greater flexibility: For example, your C programs could easily be “built” for a different microcontroller!

Update: The newest version of the Arduino Eclipse IDE/Plugin is 2.4. The installation instructions and process particularly for the Teensy boards from is much simpler. These installation instructions are written for users that are already familiar with the Arduino IDE. While these are written for Mac users, other than the file locations and slight.

Arduino On Eclipse

Icon courtesy of


Arduino on eclipse

Program using C and without the Arduino IDE.

  • Program in C/C++ modules
  • Use existing Arduino libraries, e.g. FastLED
  • Use convenient IDE features
  • Optionally use drivers provided by NXP (in the case of Teensy)


  • Arduino and Teensiduino (
  • Eclipse IDE for C/C++ Developers (
  • GNU ARM Eclipse Plugin (
    • Alternatively, Sloeber should include both the Eclipse IDE and GNU ARM plugin (
  • GNU MCU Eclipse Windows Build Tools – for make on Windows (
  • Optionally, GNU ARM Embedded Tools – This is already included as a part of Teensiduino. For the case that you have no interest in using Arduino libraries. (

Create a new project

  • Create a new project in Eclipse, File->New->C++ Project
  • Choose a project name and location
  • Under Project type select “Executable/Empty Project”
  • Under Toolchains select “Cross ARM GCC”
  • Click Next->Next and select “GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc) for Toolchain name:”. The Toolchain path should be “C:Program Files (x86)Arduinohardwaretoolsarmbin” if you used the default Arduino install directory.


  • Right click the Project->Properties
  • Under C/C++ Build->Environment, select PATH and click Edit. Add “C:Program Files (x86)Arduinohardwaretoolsarmbin” if it’s not already there. Use semicolon as delimiter between previous path
  • Under C/C++ Build->Tool Path
    • Build tools folder: C:Program Files (x86)GNU MCU EclipseBuild Tools2.9-20170629-1013binbin
    • Toolchain folder: C:Program Files (x86)Arduinohardwaretoolsarmbin

Adding the teensy3 core and libraries

  • Add the Teensy Core to the project using a linked folder:
    • Right click on the project->New->Folder
    • Click Advanced->Link to alternate location (Linked Folder), and browse to C:Program Files (x86)Arduinohardwareteensyavrcoresteensy3
  • Repeat this for the Libraries you wish to use, e.g FastLEDs C:Program Files (x86)ArduinohardwareteensyavrlibrariesFastLED
  • Remove teensy3/main.cpp from the build process.
    • Right click main.cpp->Resource Configurations->Exclude from Build
  • Similarly exclude the “examples” directory of any libraries from the Build

Add your project files

  • Add a “main.cpp” file to the Project in a directory relative to the project that suits your preferences.
    • Right click the Project->New->Source Files
    • Or create the file in a chosen directory and link it as before.

Configure Include paths

  • Right click on the Project->Properties->C/C++ General->Path and Symbols
  • Under the Includes tab, select GNU C
    • Add, browse to “C:Program Files (x86)Arduinohardwaretoolsarmarm-none-eabiinclude”
    • Add, Workspace, ProjectName->teensy3.
  • Under the Includes tab, select GNU C++
    • Add all Arduino library directories used in your project. (At least all the directories containing .h files)
  • Optionally use the projects meta tag, ${ProjName}, in place of the literal project name to make the project a bit more portable.
    • e.g /${ProjName}/Libraries/teensy3 instead of /MyProject/Libraries/teensy3

Match Arduino IDE build settings

These settings can be viewed in Arduino IDE by turning on verbose. In Arduino, File->Preferences->Show verbose output during: compilation

  • Right click on the Project->Properties->C/C++ General->Path and Symbols, click the Symbols Tab, click GNU C, add the following
    • __MK29DX256__ (for Teensy 3.2)
      • __MK64FX512__ (for Teensy 3.5)
    • ARDUINO=10803
    • F_CPU=48000000 (or one of the other speeds supported)
    • TEENSYDUINO=140 (or current version number)
  • Repeat for GNU C++
  • Switch to C/C++ Build->Settings
  • Under the Tool Settings Tab, verify the follow is set from the previous steps
    • Cross ARM GNU C Compiler->Includes
    • Cross ARM GNU C++ Compiler->Includes
    • Cross ARM GNU C Compiler->Preprocessor
    • Cross ARM GNU C++ Compiler->Preprocessor
  • Under the Tool Settings Tab, select Target Processor, select the following
    • ARM family: cortex-m4
    • Instruction set: Thumb (-mthumb)
  • Under the Tool Settings Tab, select Optimization, select ONLY the following (to match teensyduino settings)
    • Optimization Level Optimize more (-O2)
    • Function sections -ffunction-sections
    • Data sections -fdata-sections
    • Single precision constants -fsingle-precision-constant
  • Under the Tool Settings Tab->Cross ARM GNU C Compiler->Miscellaneous, under Other compiler flags enter:
    • -nostdlib -fno-exceptions
  • Under the Tool Settings Tab->Cross ARM GNU C Compiler->Miscellaneous, under Other compiler flags enter:
    • -nostdlib -fno-exceptions -felide-constructors
  • Under the Tool Settings Tab, select Cross ARM GNU C++ Linker->General,
    • Add the .ld script file corresponding to the Teensy you are using. E.g mk64fx512/ld for Teensy 3.5
    • Check Remove unused sections
  • Select Cross ARM GNU C++ Linker->Miscellaneous
    • Add the Linker flag –defsym=__rtc_localtime=1499566176
    • Check Use newlib-nano

Now the project should build as it does in the Arduino IDE!

Upload the hex file

The Teensy loader can be used to easily upload the hex files. In the case of other Arduino boards, bossac can be used via command line.


There are numerous other tutorials on configuring Eclipse for Arduino. This one from the Arduino homepage, using AVR based Arduinos, for example.

As I said, here's a little how-to on how to setup Eclipse to program the Arduino. It is fairly incomplete, so I'm posting it here for interested people to maybe comment and extend it in order to make a complete step-by-step.

So, first : This have been done on Eclipse 3.3.2 (Europa), on Mac OS X.4. It might work as well on any unix, but I can't guarantee anything for Windows platforms.

Configuring Eclipse and AVR Plugin

Arduino Eclipse Esp32

EclipseC Developpement ToolkitAVR Plugin (Don't hesistate to go for 2.2 beta 1 instead of 2.1 release)Target Management Project (optionnal)

and the AVR-GCC toolchain compiled and ready to go. Tutorials and binaries exists everywhere for many platforms, I'm not going to double them here.

First, configure the AVR Plugin in the Preferences window. This means setting up folders on where to find the different avr binaries and config files. It usually is :

/usr/local/bin for binaries/usr/local/etc for avrdude.conf

You'll also need a folder named PartDescriptionFiles which you can get from an installation of AVR Studio. YOu'll have to install it on a Windows machine, anyway. A friend can easily do it for you and give you back the folder.


Creating an 'Arduino Lib' project

Create a new C/C++ project and copy the following files into it :

From your Arduino installation, the following files located on /hardware/cores/arduino :


From any Arduino project, get the core.a file in the applet subdir and add it, to. I renamed it decimilia_core.a to prevent mistaking and allow handling of multiple Arduino boards. Note you can also build everytime, but this may be a bit longer and is mostly useless, except if you're planning to hack into it.

You're not going to even build your project, it's just a library for your Arduino projects.

Your first Arduino project

Create a new C or C++ project with 'AVR cross-target executable' as a target. Go to your project's preference and set them as the following :

Arduino On Eclipse Tutorial

AVR Target Hardware : For Decimila, Atmel168 with a MCU Clock frequency of 16000000

C++ Build/Settings/AVR C++ Compiler/Optimization : Optimize for size (-Os)(same for the assembler)C++ Build/Settings/AVR C++ Compiler/Directories : Add the folder of the previously created ARduino Library to the list of include dirs

On Assembler and Compiler, you might also want to disable debugging symbols

AVR C++ Linker, change the command line pattern to :


And the 'Command' to avr-gcc instead of avr-g++ (may be already be the default if you're making a C project instead of a C++ one)

It works with default settings, too.

AVR C++ Linker/Objects : Add the core.a file you've imported and maybe renamed from the Arduino library.

Writing code

You must #include 'WProgram.h'No loop() and setup() here, only int main(void); You should NEVER return from main(). The easiest way to do this is :

You must always add a call to init(); as your first instructions. Not doing this will prevent any time-related functions to work.

Uploading to the Arduino

For a Decimilia, the avrdude command looks like this :

Eclipse Ide For Arduino

avrdude -F -pm168 -cstk500v1 -P/dev/cu.usbserial-A4001uwp -b19200 -D -Uflash:w:./your_executable_name.hex:i

You can add it as a post-build command

Serial port monitor

If you have Target Management Project installed, just go to the Window menu / Show View / OTher.. And choose Terminal/Terminal. Open it with a serial link and choose the serial port your Arduino is connected to. Notice you'll probably have to disconnect the terminal while uploading.

Arduino On Eclipse Download

As the RXTX library is a troublemaker for many people, there is a workaround : Just start a SSH or Telnet (please check your security setup before doing this !!!) server on your computer and open it in the Eclipse terminal. Then, on any unix, just type cat /dev/your_serial_port/

This tutorial sucks

Yes, a lot of things are still to do :

Arduino Eclipse Debugger

– Creating a default Arduino project witch will prevent from doing a complete config of each project.– Getting a deeper integration of avrdude

btw, please especially reports if your programs built within Eclipse are bigger than the ones built with the Arduino env. The modified linker call should prevent this, and in fact makes even smaller executables than Arduino.

Installing Arduino On Eclipse

PLEASE, do not reports problems or questions about Arduino on Eclipse anywhere else in this forum than on this thread. Arduino/Eclipse is just a geek's hack, and I don't think Arduino people will want to discuss it or search solutions for it. (Owners/Moderators, if you don't think this is needed, just remove it ^_^)