Eclipse for Arduino

Preamble

After watching Curious Marc‘s video on the Teletyper console for Linux, see Using a 1930 Teletype as a Linux Terminal, I realised that I should be using Eclipse to program the Arduino, rather than the noddy and limited Arduino IDE.

However, this turns out to be not as easy as one would think. There are a number of different methods, all of which are a bit lengthy, especially if you aren’t familiar with Eclipse, and some of which are dead ends, out of date and/or deprecated.

Nevertheless, there is one method that stands out amongst them all… Sloeber!!!!

Links

Processes

There seem to be four main methods which you could use to get Eclipse working with the Arduino:

  1. Eclipse C++ IDE for Arduino plugin – deprecated
  2. Sloeber (plugin and product (i.e. standalone application)) – looks promising (previously known as Arduino Eclipse plugin)
  3. CuriousMarc’s method, Eclipse – Development Environment Setup, which uses AVR CrossPack and AVRStudio (v5), although the instructions would seem to be somewhat out of date
  4. Arduino Playground’s method – Arduino Playground – Eclipse.
  5. Tutorial: Using Arduino In Eclipse – Juno Eclipse, uses Sloeber

I will look at each method in turn.

First attempted process (ignore this)

I used the Eclipse IDE for C/C++ Developers installer by Oomph which seemed to hang at the mid point of the G in INSTALLING, whilst fetching the JRE. Even copying the installer to the Applications folder didn’t help. It seemed to just be a very slow download. The 2020-09 version finally installed, after accepting to trust the Eclipse certificates.

Accept the default workspace

Launch the Marketplace from within Eclipse, the link is on the Welcome page. The recommended (from the above link) Eclipse C++ IDE for Arduino is no longer maintained.

Then you have to install the platform, using the Arduino Download Manager. It took me a while to find it. In fact I couldn’t find it and the link above is shite is describing how to find it.

Eclipse isn’t installed in the Applications folder, its in a folder in your home directory. Brilliant. It also takes ages to load. It was starting to piss me off at this point. Plus I lost the welcome screen upon launch and wasn’t able to find how to reenable it [Edit – The Welcome screen can be accessed from the Help menu, there is also an “Always show” checkbox on the Welcome page].

I gave up. Bollocks to it.

According to this more descriptive link, Arduino Development with the Eclipse Photon C/C++ IDE, the Arduino Download Manager is in the Help menu.

Upon opening the Arduino Download Manager, both my Platforms and Libraries lists were empty. You have to click Add button and select the platforms you need, i.e. Arduino AVR boards. There’s a hovering help next to each select checkbox, and you have to hit F2 (Fn+F2) to be able to read the info in the hovering help dialog. The UI is just shite. When I selected Arduino AVR boards and hit Ok, it still didn’t appear in my Platform list.

I gave up again.

According to the second link, any selected platforms must be downloaded, so maybe the download is just slow. I dunno, and I don’t care any more.

This bug report, Bug 552861 – Arduino Download Manager -> Selected Platforms do not install, seems to imply that the Arduino Download Manager is no longer maintained:

Thank you for taking the time to file a bug report about the Arduino component of the CDT project. The Arduino component is no longer maintained and will be removed from CDT 10 (Bug 562498). The final Eclipse CDT version that will include Arduino support is the CDT 9.11 series. 

Please consider using The Arduino Eclipse IDE and plug-ins named Sloeber (https://marketplace.eclipse.org/node/2637354) for your future Eclipse CDT powered Arduino development.

JSON locations

From Problem with Arduino Download Manager, the JSON URL paths for the Arduino Download Manager are set in this menu: Eclipse>Preferences>C++>Arduino

How about the suggested replacement plugin (Sloeber)?

The Eclipse C++ IDE for Arduino plugin (above) suggests using Sloeber, written by Jantje.

From The Arduino Eclipse IDE named Sloeber (Product), the review isn’t exactly glowing:

This is the worst plugin ever as it is not possible to install it from market place.
The amount of dependency errors is a joke!
This is tried on a fresh install with Eclipse 2020-03 and CDT 9.11 and also tested with CDT 9.5
It should be taken off Market place!

However, this answer to the question, New Arduino project and empty folder in Project Explorer by Eclipse, suggests that Sloeber is OK.

See the videos on Where Arduino meets Eclipse:

The first video explains why you should use Eclipse, Why would you want to use the arduino eclipse plugin?, which (ignoring the weird intro) demonstrates that it makes a lot more sense to use Eclipse rather than the standard Arduino IDE.

Some advantages over the Arduino IDE:

  1. Projects listed in Project Explorer
  2. Code Outline, methods listed
  3. On the fly Object description, by hover
  4. On the fly method definitions displayed, by hover
  5. Suggested include files
  6. Call trees – Who is calling a particular method
  7. Include browser – in which files is a header included
  8. Auto-complete, and method suggestion
  9. Auto code check – spelling check
  10. Refactor/rename – throughout all occurrences in all files
  11. Full screen file (double click file title)
  12. Perspectives (Java, C++, Arduino)
  13. Auto comment by selection (Shift + Ctrl)
  14. Greyed out code if not defined
  15. Collapsable comments
  16. Version control : Jazz and Github integration
  17. File Compare (with (local) previous versions, even if you don’t have version control). Also remote compare, if you do have version control. Also unrelated file compare.
  18. Task List (“TODO” commented items automatically added to task list)
  19. Location markers in scroll bar (Warnings, ToDo)
  20. Linking view (jumps to file in Explorer side bar) – annoying feature
  21. New Class dialog, method implementing automatic
  22. Spell checking
  23. Warnings and Errors shown in Problems tab, in addition to the standard Console
  24. Project Explorer shows files with Links and Warnings

See also the presentation Introduction to the Arduino Eclipse plugin video

Installation of Sloeber

From MacOS 4.3.3 Latest Stable runs smoothly and nicely, there is a Product (Arduino Eclipse) and a plugin URL. Just download the product, if you are just getting started and don’t have Eclipse already installed. I downloaded it, unpacked it, moved it to different folder, ran the sudo xattr -r -d com.apple.quarantine Sloeber.app and then got the error

Before running the command line, I did just double click it and got a this file is damaged error. I had downloaded it using Chrome.

I tried with Firefox download, the same thing happened. However, Java 8 is required. Now I’ve already had issues with Java see Java and NetBeans on OS X. So using Homebrew to install would seem to be the easiest method, rather than having to deal with the Oracle web site.

From How to install Java 8 on Mac,

brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8

The above commands worked, although I did get this warning

Warning: Calling brew cask install is deprecated! Use brew install [--cask] instead.

Now, Firefox download worked fine (apart from spaces in the path):

Soldiering on regardless, the workspace opened and a welcome screen and then a configure error

I retried, but this time without spaces in the path, by copying the google download to the Applications folder and then double clicking. The same error was thrown up (which is reported here, Sloeber fails to install because it can’t get data from a specific URL #1264):

Failed to configer Sloeber
Failed to install [DEPRECATED] Arduino mbed-enabled Boards
Failed to download "http://downloads.arduino.cc/cores/ArduinoCore-mbed-nonexistant.tar.bz2".
Failed to download url http://downloads.arduino.cc/cores/ArduinoCore-mbed-nonexistant.tar.bz2 error code is: 404

Ignoring that, I created a New Project>Arduino Sketch and then got a no boards error (which is probably related to the configure error above):

I gave up at this point. I did notice that there was not any AVR button on the workspace toolbar.

You have to select the boards yourself, according to Jantje’s reply to the bug report, from Sloeber>Preferences>Arduino>Boards and Platforms:

Note that you can’t select a whole top level group of boards (i.e. “Arduino AVR boards”), you have to drill down and they have to be selected individually. Or rather, a version number must be selected. However, which is the Uno and which is the Mega, Pro Mini, etc.? Or are the version numbers just versions of the boards.txt file? The numbers do appear to correspond to Arduino IDE versions. [Edit: See Jante’s comment for clarification at the bottom of the page]

I selected the highest version 1.8.3 and then the configuring continues (downloading gcc, etc.) This takes quite a while.

Once that was done then sure enough, once New Project>Arduino was selected and a name provided, the following wizard dialog showed all of the boards. Basically it worked fine!!!

However, I did notice a few things:

  1. Each time Sloeber is restarted, it does another configure
  2. No Java was included (maybe the Java plugin needs to be added from the marketplace).

Using the Sloeber plugin

Using the previous Eclipse install 2020-09 (that I had installed for the deprecated Eclipse C/C++ IDE for Arduino), I went to the marketplace and added the Sloeber plugin. This suffered from the same platforms install error noted above. This was fixed in the same way, Pref>Arduino>Boards&Platforms, select the version of the boards that you want… Once installed, it did allow an Arduino project to be created, with the boards showing up and an Arduino perspective was enabled.

I noted that the platform wasn’t displayed in the Project Explorer (as it is in the Product) – this maybe due to additional configuration being required. It was noted by Jantje that the Plugin requires a lot more post install configuration than the Product. [Edit – Actually the Platform was displayed].

The Product was also listed as one of the installed packages, alongside the Plugin, in the marketplace, which is a bit weird.

I’m not sure if there was a conflict with the previously installed Eclipse C++ IDE for Arduino plugin (this can be uninstalled, via the Marketplace, list installed packages).

Off topic – Adding Java Support

Again no Java support was to be found in the 2020-09 Eclipse – as the Eclipse welcome screen is showing Eclipse for C/C++ Developers, maybe another different install of Eclipse is required for Java, i.e. Eclipse IDE for Java Developers (as shown on the download packages page), although this would seem to be not particularly integrated – surely you don’t require multiple instances of Eclipse installed, one for each programming language? Looking through the Marketplace, I couldn’t find a Java plugin.

Actually you can, See Eclipse IDE for C/C++ and Java. You can add Java via the menu Help>Install new Software, select “2020-09” from the “Work with” drop down, uncheck “group items by category”, select “Eclipse IDE for Java Developers”. However, I wasn’t able to change perspective to Java (Window>Perspective>Open Perspective>Other…).

I then added “Eclipse Java Development Tools”, again via the menu Help>Install new Software. This did allow the perspective to change. Once I had changed it to Java using the Window>Perspective>Open Perspective>Other… menu, then there appeared three perspective buttons on the right hand side (C++, Arduino, Java) whereas, prior to that Window menu perspective change, only the Arduino button was shown. However, the Welcome screen was now irrevocably changed to the (less populated) Java welcome screen. I could not get the C++ welcome screen back, even after changing perspective to Arduino or C++.

Marketplace observations

It is possible to open multiple market place windows, by multiple clicks on the Launch the Eclipse Marketplace link on the Welcome screen, which is a bit daft.

Following CuriousMarc’s process

CuriousMarc details his method here, Eclipse – Development Environment Setup. However, this could be a very out of date set of instructions.

It should be a three step process:

  1. Install the AVR cross compile tools and libraries for your platform
  2. Install Eclipse C/C++ version for your platform
  3. Install the AVR plugin from within Eclipse (which requires the PartsDescriptionFiles folder from AVRStudio)

Arduino Playground’s process

From Arduino Playground – Eclipse, the AVR plugin is suggested (Help menu > Market Place)

An AVR button was added to the workspace, in the top right corner.

Chav Michael Process

From Tutorial: Using Arduino In Eclipse, written in 2013. Whilst this method works, the Arduino code isn’t fully integrated, that is to say that Arduino library calls will not be displayed correctly as they aren’t recognised.

Installation

Note: Use the 32 bit versions of Eclipse and Java, as the Sloeber plugin recommended 32 bit (at that time in 2013).

Install Eclipse

Download Eclipse Juno SR2 32 bit. Choose Eclipse IDE for C/C++ Developers.

Install Java

Java SE SDK v7u25 32 bit, although he used a directory called “jre7”, which implies a runtime environment.

Paste the Java folder into the Eclipse folder, rename to “jre”.

Install Sloeber

He uses a very early version of Sloeber, install it like this, via the menu Help>Install New Software

Enter in Work with field: http://www.baeyens.it/eclipse/update

Uncheck Group items by category.

Select Arduino eclipse extensions

Hit Next, Next, and accept license

Note: The AVR button (shown above) is installed

Additional setup

Preferences>General>Workspace>Save automatically before build

Preferences>Arduino>Arduino>Arduino IDE path

Use Arduino IDE v1.0.1

Pref>Arduino>Arduino>Private Library path (create a new custom library folder if required)

Check Use Arduino IDE in Eclipse

Apply

Click test serial dll

Pref>Arduino>AVRdude – leave as is

Pref>Arduino>Paths – leave as is

Then make a project!!!!!

File > New Project > Arduino, Next, choose board and port (check with Windows Device Manager)

Hit Finish

Two folders created under the Project folder, one from the board and one for the sketch code.

To import a (custom) library, right click on sketch folder, Import…, Arduino>Import Arduino Library in the current project. This will show “Arduino Libs” and “Personal Libs”, select your custom library listed under Personal Libs, hit Next, Finish.

A new folder for the library will be added under the Project folder.

You will also (maybe) need to add other Arduino Libraries (i.e. Wire), as above, add Arduino library listed under Arduino Libs.

Then you have to manually link it, right click project folder, Properties, C/C++ General>Paths and Symbols, GNU C, Add…, and navigate to the Arduino IDE/libraries/Wire/utility folder (select and copy path) and OK. Do the same for GNU C++, Add… and paste the path, and OK.

Add some code (blah) 17:12 – 21:52, theres a few gotchas, watch the relevant five minutes of video.

To add the serial monitor

Window>Show view>Other…

Select Arduino>Serial monitor view, hit OK

Hit the green plus, select COM port and baud rate (9600)

Moving hard disk

I used Carbon Copy Cloner to clone my hard disk, and thereafter when booting from the new clone, Eclipse will refuse to start and leave a massive log file:

!SESSION 2021-07-27 22:00:50.318 -----------------------------------------------
eclipse.buildId=4.18.0.I20201202-1800
java.version=15.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_TH
Framework arguments:  -product org.eclipse.epp.package.java.product -keyring /Users/macbook/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/macbook/.eclipse_keyring

!ENTRY org.eclipse.cdt.build.gcc.ui 4 0 2021-07-27 22:00:53.470
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.build.gcc.ui [94]
  Unresolved requirement: Require-Bundle: org.eclipse.ui
    -> Bundle-SymbolicName: org.eclipse.ui; bundle-version="3.118.100.v20201123-0719"; singleton:="true"
...

!ENTRY org.eclipse.cdt.codan.checkers.ui 4 0 2021-07-27 22:00:53.475
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.codan.checkers.ui [101]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.codan.ui.cxx
    -> Bundle-SymbolicName: org.eclipse.cdt.codan.ui.cxx; bundle-version="3.6.0.202008310002"; singleton:="true"
...

!ENTRY org.eclipse.cdt.codan.ui.cxx 4 0 2021-07-27 22:00:53.477
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.codan.ui.cxx [105]
  Unresolved requirement: Require-Bundle: org.eclipse.ui.ide
    -> Bundle-SymbolicName: org.eclipse.ui.ide; bundle-version="3.18.0.v20201119-1132"; singleton:="true"
...

!ENTRY org.eclipse.cdt.debug.ui.memory.floatingpoint 4 0 2021-07-27 22:00:53.479
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.debug.ui.memory.floatingpoint [117]
  Unresolved requirement: Require-Bundle: org.eclipse.ui; bundle-version="3.8.0"
    -> Bundle-SymbolicName: org.eclipse.ui; bundle-version="3.118.100.v20201123-0719"; singleton:="true"
...

!ENTRY org.eclipse.cdt.debug.ui.memory.search 4 0 2021-07-27 22:00:53.481
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.debug.ui.memory.search [119]
  Unresolved requirement: Import-Package: org.eclipse.debug.ui.memory
    -> Export-Package: org.eclipse.debug.ui.memory; bundle-symbolic-name="org.eclipse.debug.ui"; bundle-version="3.14.700.v20201123-0650"; version="0.0.0"
...

!ENTRY org.eclipse.cdt.debug.ui.memory.transport 4 0 2021-07-27 22:00:53.482
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.debug.ui.memory.transport [121]
  Unresolved requirement: Require-Bundle: org.eclipse.debug.ui
    -> Bundle-SymbolicName: org.eclipse.debug.ui; bundle-version="3.14.700.v20201123-0650"; singleton:="true"
...

!ENTRY org.eclipse.cdt.gdb.ui 4 0 2021-07-27 22:00:53.484
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.gdb.ui [130]
  Unresolved requirement: Require-Bundle: org.eclipse.ui; bundle-version="3.6.0"
    -> Bundle-SymbolicName: org.eclipse.ui; bundle-version="3.118.100.v20201123-0719"; singleton:="true"
...

and so on…

A reinstall 2020-12

I had to reinstall, (I had Carbon Copy Cloned my hard disk and Eclipse refused to start when booting from the new disk (although the same installation worked booting back into the old disk, even though the home directory was on the new disk), so I installed 2020-12.

Everything was fine (apart from the first stalled installation (I had to hit back and try again)). The contexts were missing though, so I had to reinstall them:

  • EPIC – via Market place
  • Java – via Help->Install New Software… this time only selecting “Eclipse Java Development Tools”, see Off topic – Adding Java Support above.
  • Sloeber
  • TCL (DLTK)
  • PyDev

However, I got a few errors when opening Eclipse, which are Sloeber related I think (they only seem to happen after Sloeber is installed), which appear in the following order:

Eclipse 2020-12 - Multiple problems have occurred

and

Eclipse 2020-12 - Failed to configure Sloeber

I had thought that initially it was related to having installed both the Product and the plugin:

Eclipse - Sloeber - both product and plugin installed

But after uninstalling the Product only, the issues persisted.

I re-installed a new installation of 2020-12 and tried to install the plugin on that, but just after hitting Finish on the license agreement dialog, this error appears:

Eclipse 2020-12 - Sloeber - install error

I went back and re-installed 2020-09, and tried to install the plugin on that, but just after hitting Finish on the license agreement dialog, this error appears:

Eclipse 2020-09 - Sloeber - install error

So that is disappointing. I don’t seem to be able to install Sloeber any more. Is this due to multiple installations. of Eclipse.?

 

2 thoughts on “Eclipse for Arduino”

  1. Thanks for the extensive writeup 🙂
    “However, which is the Uno and which is the Mega, Pro Mini, etc.? Or are the version numbers just versions of the boards.txt file? The numbers do appear to correspond to Arduino IDE versions.”

    If you hover over the package name you can see the boards in the package.
    The version numbers are exactly the same you see in Arduino IDE. However in Arduino IDE you can only install 1 version in Sloeber you can install all of them.

    Jantje

    Like

    1. Excellent, many thanks for the clarification. I’ll update my notes to mention your comment. BTW, thank you for the great work in creating a fantastic piece of software. Please keep up the good work. 🙂

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s