Windows/Linux/Mac Eclipse plugin to compile and upload arduino sketches

Nice to hear you're got it working with the reset work around.
I have a micro now but I don't get it to work on my redhat :frowning:
Best regards
Jantje

For those owning a due and those wanting to use Arduino IDE 1.5.2 beta for other reasons:
I have released beta V2 that supports Arduino IDE 1.5.2. beta.
Read more at http://blog.baeyens.it/#post4

If you do not need Arduino IDE 1.5.2 beta and you already use the plugin I advice to stick to the plugin version as described at Arduino Eclipse IDE named Sloeber - Welcome! untill Arduino IDE 1.5.X is no longer beta.

For people starting with the plugin V2 can be considered.

Best regards
Jantje

Hello Jantje, thank you very much for your great plugin!

I have tested it successfully with gentoo linux now. My environment:

Portage 2.1.11.55 (default/linux/amd64/13.0, gcc-4.6.3, glibc-2.15-r3, 3.7.10-gentoo x86_64)
dev-util/eclipse-sdk-3.7.1-r11 (Indigo, seden overlay)
dev-embedded/arduino-1.0.3-r1
dev-java/icedtea-bin-7.2.3.6
sys-devel/crossdev-20120721 ('-r1' include my local patch for using multilib on AVR's)
-->cross-avr/avr-libc-1.8.0
-->cross-avr/gcc-4.6.3
-->cross-avr/binutils-2.20.1-r1
dev-embedded/avrdude-5.11.1 ('-r1' include my local patch for higher timout in case of manual reset)
!!But for my very first tests avrdude is used from Arduino-IDE!!
Arduino Eclipse Extension 1.2.4 installed via "http://www.baeyens.it/eclipse/update"

Arduino NG rev.c (tested with Blink.cpp und DoubleCounter.cpp)
Arduino Mega2560 rev. 1 (tested with Blink.cpp und DoubleCounter.cpp)
Arduino Pro Mini328 5V/16MHz (not tested yet)

For some further improvements for linux users here example entries for udev rules (will always get device "/dev/arduino"):
#Bus 005 Device 004: ID 2341:0010 Arduino SA Mega 2560 (CDC ACM)
#ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
#ATTRS{product}=="Arduino Mega 2560"
SUBSYSTEMS=="usb", ATTRS{product}=="Arduino Mega 2560", ATTRS{manufacturer}=="Arduino (www.arduino.cc)", NAME="ttyACM%n", SYMLINK+="arduino"

#Bus 005 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
#ATTRS{manufacturer}=="FTDI"
#ATTRS{product}=="FT232R USB UART"
SUBSYSTEMS=="usb", ATTRS{product}=="FT232R USB UART", ATTRS{manufacturer}=="FTDI", NAME="ttyUSB%n", SYMLINK+="arduino"

Good Luck, Thomas

Now I have made some pictures of my running configuration (gentoo linux) to share with you, because I have found only pictures from Windows's and Mac's. Eventually someone could need this to getting started on linux.

Good Luck, Thomas

Thomas
Thanks for the feedback and sharing the images.
For those watching the images. With version 2 of the plugin only the first image is valid. The other configuration pages originated from avrEclipse and no longer exist in V2.

Best regards
Jantje

Hello Jantje, after some further playing around I have some questions and suggestions.

1.) Is there a possibility to configure the name of the automatically generated library f.e. "Arduino_Mega_2560_or_Mega_ADK" --> I would prefer the name "000b_ArduinoMega2560_Core". This will force the libraries to be listed on first position, before all other projects.

2.) Using "Serial Monitor View" give me only "/dev/ttyS0" (instead of "/dev/ttyACM0"), but "/dev/ttyS0" up to "/dev/ttyS3" is already in use on my linux box (eventually on all gentoo linux systems). Is this configurable or hard coded? Eventually you could add "/dev/arduino" in the search list? Than linux users could map any device using the udev rules to "/dev/arduino".

3.) Arduino-Configuration page, renaming suggestion: "test serial dll" --> "test serial library (rxtx)" would be better understandable for linux, mac and windows users

Again, Thank you for the great work! I had fiddling around with the old AVR-Plugin two days without success. Your's worked after 1 hour.

Let me know how I can help you improving the plugin.

Some ideas:
-testing with gentoo (at the moment only indigo is possible)
-write an wiki for gentoo users --> http://en.gentoo-wiki.com
-make some usability test (I'm an usability engineer) --> create issues at git
-translation to german language
-make some small bugfixes
-make a donation for an picaxe :blush:

Thomas

gen2thomas:
1.) Is there a possibility to configure the name of the automatically generated library f.e. "Arduino_Mega_2560_or_Mega_ADK" --> I would prefer the name "000b_ArduinoMega2560_Core". This will force the libraries to be listed on first position, before all other projects.

Version 2 no longer has a separate Arduino project. There is a Arduino folder in each and every sketch and a library folder containing the imported libraries. If this is really important I would advice to go to V2. However this functionality relies on CDT 1.8.1 which needs Juno.
The only option I can think of is to download the code and do the mod yourself.
https://github.com/jantje/arduino-eclipse-plugin/blob/master/it.baeyens.arduino.common/src/it/baeyens/arduino/common/ArduinoConst.java

public static final String CoreProjectNamePrefix = ""; //used to be arduino_ but when chaging from MCU to board replaced by nothing

As you are using version 1.2.4 you do not want this version but the one tagged with Release 1.2.4

gen2thomas:
2.) Using "Serial Monitor View" give me only "/dev/ttyS0" (instead of "/dev/ttyACM0"), but "/dev/ttyS0" up to "/dev/ttyS3" is already in use on my linux box (eventually on all gentoo linux systems). Is this configurable or hard coded? Eventually you could add "/dev/arduino" in the search list? Than linux users could map any device using the udev rules to "/dev/arduino".

I know what you are talking about :~
This is actually a rxtx feature. Arduino has its own version of the rxtx dll. The problem you mention is a Linux only issue and has recently been discussed on the developers list. The only correct way to find the serial devices is to look at /dev/serial. The Arduino team is looking at https://github.com/ffissore/java-simple-serial-connector as a replacement for rxtx. I have not yet (and I'm not planning to) look at what the impact will be on the eclipse plugin.
Workaround is to add following line to your eclipse.ini file

-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0:/dev/ttyACM1:/dev/ttyACM2:/dev/ttyACM3:/dev/ttyUSB0:/dev/ttyUSB1:/dev/ttyUSB2:/dev/ttyUSB3:/dev/ttyUSB4:/dev/arduino

gen2thomas:
3.) Arduino-Configuration page, renaming suggestion: "test serial dll" --> "test serial library (rxtx)" would be better understandable for linux, mac and windows users

Is your objection against the word dll or the lack of rxtx.

gen2thomas:
Let me know how I can help you improving the plugin.

Some ideas:
-testing with gentoo (at the moment only indigo is possible)
-write an wiki for gentoo users --> http://en.gentoo-wiki.com
-make some usability test (I'm an usability engineer) --> create issues at git
-translation to german language
-make some small bugfixes
-make a donation for an picaxe :blush:

Help is welcome. There are however some things to keep in mind.

  1. I'm not planning to release any more V1 versions (Normally Arduino IDE 1.0.3 should have been the last V1 Arduino IDE release.)
  2. V2 is a complete rewrite (both for my plugin as for the Arduino IDE)
  3. I have not foreseen translation functionality in the plugin.
  4. Due to health constraints there is no time for me to spend on the plugin in the coming months. Even adding a picaxe donation button will have to wait.

Best regards
Jantje

Hello Jantje, Thank you for your answers!
I will test your suggestions to solve my little problems.

Q: 1.) Is there a possibility to configure the name of the automatically generated library f.e. "Arduino_Mega_2560_or_Mega_ADK" --> I would prefer the name "000b_ArduinoMega2560_Core". This will force the libraries to be listed on first position, before all other projects.
A: The only option I can think of is to download the code and do the mod yourself.

Now I have modified a little bit the file "Boards.txt" (/usr/share/arduino/hardware/arduino/) which is used to generate the names. Sketch was compilable, downloadable and seems to work.

Jantje:
I would advice to go to V2. However this functionality relies on CDT 1.8.1 which needs Juno.

Yes, that is an problem actually for gentoo users - unfortunately there is no official release for eclipse Juno. Also the Indigo, I'm using, is from an overlay (seden) but quite stable. For the future do you plan to separate the V1 and V2 update site or is this already the case? If yes, how to use it?

Jantje:
The problem you mention is a Linux only issue and has recently been discussed on the developers list.

Please can you post an link to follow this discussion.

Jantje:
Is your objection against the word dll or the lack of rxtx.

The word 'dll' is the name for the file extension/suffix of the library used in windows environment (Dynamic Link Library?). Linux and possible Mac users don't know about that (linux extensions are f.e. ".a", ".so" for libraries).

Jantje:
Even adding a picaxe donation button will have to wait.

Oh sorry, this was only a joke. I hope your answer also.

Jantje:
Help is welcome.

HOW can I help you? Please give me some notes.

Best regards, Thomas

Hey Jantje,

I don't know if it's the right place here for asking for your help, but I don't know further anymore.

When I run avrdude from within eclipse it always gives me:
"AVRDude does not support the project target MCU [ATmega32U4]".
But on the other hand if I'm typing in the exact same command from within console it works fine

avrdude	-patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -Uflash:w:testSerial.hex:a

It makes no difference whether I check the box "use custom configuration file" in the avrdude preferences and giving him the right config file.
I'm using ubuntu 12.10 64 bit with an arduino leonardo.

Do you have any clue about this?

Thanks, Sh4kE

@SH4kE
Try which avrdude and see whether it is the Arduino provided avrdude you are running on the command line.
If it is not the same that explains your problem.

@gen2thomas

For the future do you plan to separate the V1 and V2 update site or is this already the case? If yes, how to use it?

V1 and V2 are on different update sites. This to avoid unwanted upgrades. V2 update site is at
http://www.baeyens.it/eclipse/V2

Please can you post an link to follow this discussion.

The discussion was/is on the Arduino developers mailing list. I do not know whether there is a HTML history version.

The word 'dll' is the name for the file extension/suffix of the library used in windows environment (Dynamic Link Library?). Linux and possible Mac users don't know about that (linux extensions are f.e. ".a", ".so" for libraries).

For me this is a typical cross platform naming discussion. I'll consider writing "Dynamic Link Library" or just "Library". We'll see what happens in 1.5.3 with rxtx.

I hope your answer also.

No joke.

HOW can I help you? Please give me some notes.

Following options you propose are very helpfull

-write an wiki for gentoo users --> http://en.gentoo-wiki.com
-make some usability test (I'm an usability engineer) --> create issues at git

Other things I could use help with are

Note that the website is on github, but I need to check whether that is the latest version.

Best regards
Jantje

Loving V2 so far, just ironing out a few bugs...

1.) The upload ignores build configurations and always tries to upload from the "Release" Directory no matter what build configuration is active.

2.) The only way I've got my Leonardo to work is by setting the project preferences to the bootloader com port then doing a manual reset on upload, if I use the normal com port setting, then upload resets the board (the board led starts flashing and windows re-aquirres the bootloader port) but the process then errors saying "Leonardo upload port is not appearing after reset"

3.) Currently I've not got my Due to work, compile goes fine, upload appears to work fine, but after upload the due freezes and can;t be reset, the only way to make it come back to life is to upload something from the Arduino IDE, then it will work properly - I'm still investigating this one...

As you've said your ill (Get well!) and not going to have much time, do you have V2 on Github so I could take a look?

Deeply appreciate all the work you've done and will be "buying you an arduino" when next month's paycheck comes in, as being able to work in a sensible IDE is wonderful!

Thanks in advance!

katekarnage
Thanks for the nice words

katekarnage:
1.) The upload ignores build configurations and always tries to upload from the "Release" Directory no matter what build configuration is active.

I'm surprised you got it going until the upload.
I took the design decision to hard code "Release" as configuration name. Given the fact that all settings are coming from boards.txt and platform.txt I don't see the usage of more configurations and as such the configuration name is irrelevant. Can you explain your use case for having more or another configuration name?

katekarnage:
2.) The only way I've got my Leonardo to work is by setting the project preferences to the bootloader com port then doing a manual reset on upload, if I use the normal com port setting, then upload resets the board (the board led starts flashing and windows re-aquirres the bootloader port) but the process then errors saying "Leonardo upload port is not appearing after reset"

katekarnage:
3.) Currently I've not got my Due to work, compile goes fine, upload appears to work fine, but after upload the due freezes and can;t be reset, the only way to make it come back to life is to upload something from the Arduino IDE, then it will work properly - I'm still investigating this one...

I just tried due on Linux and tha works fine. Which os are you using?

katekarnage:
As you've said your ill (Get well!) and not going to have much time, do you have V2 on Github so I could take a look?

It's quite some work to upload to github and I still havn't decided how I will treat V1 and V2 in github. I attached the upload code so you can have a look.
Note that I proposed a different upload definition to the arduino team so I didn't touch this code to much (and it is not top quality code)

My console-version is /usr/bin/avrdude and the same goes for arduino-ide itself. But I can't set the /usr/bin/ folder in the preferences. It just tells me that it is not the right arduino-folder. I decided to clone the current arduino-ide from github and gave that folder in the settings. But then the former error appears.

Can you set /usr/bin/ as your arduino folder in the preferences?

Sh4kE
Arduino IDE and the eclipse plugin use the avrdude located at "\hardware\tools\avr\bin"
As the command line uses a different avrdude it is perfectly acceptable that the behavior is different.
On the other hand I completely fail to understand what you are trying to achieve.
Please read This page has been moved and say which part fails for you.
Best regards
Jante

G2T: The word 'dll' is the name for the file extension/suffix of the library used in windows environment (Dynamic Link Library?). Linux and possible Mac users don't know about that (linux extensions are f.e. ".a", ".so" for libraries).
JANTJE: For me this is a typical cross platform naming discussion. I'll consider writing "Dynamic Link Library" or just "Library". We'll see what happens in 1.5.3 with rxtx.

No, this was not my intention! I'm using both (win7 at work and win7+linux at home) with more or less pros and cons of each, dependent of the task to do. The main goal was to help non windows users to understand your plugin's handling in the "usability engineers" point of few. But, yes the absence of rxtx will resolve this issue itself 8).

G2T: I hope your answer also.
JANTJE: No joke.

Ok, why not. Picaxes are inexpensive devices, but you would be missed here =(.

-write an wiki for gentoo users --> http://en.gentoo-wiki.com
-make some usability test (I'm an usability engineer) --> create issues at git

The wiki is now available on the new gentoo wiki page: Arduino - Gentoo Wiki
Feel free to send me suggestions for rework, if you don't want to do it yourself.

Other things I could use help with are

Note that the website is on github, but I need to check whether that is the latest version.

Sorry I'm not familiar with web site development. I will spend some time to measure/rate your plugin against the european norm ISO4291 (ISO 9241 – Wikipedia, ISO 9241 - Wikipedia) and try to make some understandable issues on your git site. (But I'm afraid of the eclipse itself need more help on this topic than your plugin)

Have fun, Thomas

Thomas
Great work on the gentoo wiki. I made some small changes.
Is it really necessary to install the toolchains separately? They are included in the Linux64 bit package on arduino.cc.
Best regards
Jantje

Jantje:
katekarnage
Thanks for the nice words

katekarnage:
1.) The upload ignores build configurations and always tries to upload from the "Release" Directory no matter what build configuration is active.

I'm surprised you got it going until the upload.
I took the design decision to hard code "Release" as configuration name. Given the fact that all settings are coming from boards.txt and platform.txt I don't see the usage of more configurations and as such the configuration name is irrelevant. Can you explain your use case for having more or another configuration name?

This is partially because I'm an old C/C++ programmer and have always been doing debug/release builds and have a lot of serial-emitted output dependent on a defined DEBUG and other symbols, even though, in this case I'm obviously not needing to change optomisations or debug symbol inclusion. Also I have several projects where the same arduino board is being used in a number of slightly different circumstances with a few compiletime directives to control the created code.

Build configurations are the easiest way of handling these, with adding a few -D direcetives to the compiler EXTRAFLAGS.

As, in this case there is only defines and no other changes to the compile environment, then, if this is too hard, then don;t worry as I can always sort it through altering defines in the main project header file and recompiling like that - more of a nicity really.

Jantje:

katekarnage:
2.) The only way I've got my Leonardo to work is by setting the project preferences to the bootloader com port then doing a manual reset on upload, if I use the normal com port setting, then upload resets the board (the board led starts flashing and windows re-aquirres the bootloader port) but the process then errors saying "Leonardo upload port is not appearing after reset"

katekarnage:
3.) Currently I've not got my Due to work, compile goes fine, upload appears to work fine, but after upload the due freezes and can;t be reset, the only way to make it come back to life is to upload something from the Arduino IDE, then it will work properly - I'm still investigating this one...

I just tried due on Linux and tha works fine. Which os are you using?

Win7 64 bit with 32bit Eclipse Juno.

But...

I have done more investigation of this, I had an idea or 2, and have gone back to basics.

A simple blink program uploads and runs fine, so the basic upoloading is fine.

The problem seems to be when I attempt to use the Scheduler. This code will brick the Due from eclipse and need it to be reset with the arduino IDE:

TestSched.cpp:

// Do not remove the include below
#include "SchedTest.h"

#include <Scheduler.h>

int led = 13;

void setup() {
  pinMode(led, OUTPUT);
  Scheduler.startLoop(loop2);
}

void loop() {
  digitalWrite(led, HIGH);
  delay(1000);
}

void loop2() {
  delay(1300);
  digitalWrite(led, LOW);
}

TestSched.h:

// Only modify this file to include
// - function definitions (prototypes)
// - include files
// - extern variable definitions
// In the appropriate section

#ifndef SchedTest_H_
#define SchedTest_H_
#include "Arduino.h"
//add your includes for the project SchedTest here


//end of add your includes here
#ifdef __cplusplus
extern "C" {
#endif
void loop();
void loop2();
void setup();
#ifdef __cplusplus
} // extern "C"
#endif

//add your function definitions for the project SchedTest here

//Do not add code below this line
#endif /* SchedTest_H_ */

I will delve deeper into the build logs and see if I can isolate this a bit more, and check I haven;t made a galringly obvious mistake!

Thanks again for your good work!

This is partially because I'm an old C/C++ programmer and have always been doing debug/release builds and have a lot of serial-emitted output dependent on a defined DEBUG and other symbols, even though, in this case I'm obviously not needing to change optomisations or debug symbol inclusion. Also I have several projects where the same arduino board is being used in a number of slightly different circumstances with a few compiletime directives to control the created code.

I don't consider myself old but I have some decades of experiance in programming C/C++ myself; so I know what you are talking about.
I always had mixed feelings about not supporting multiple configurations. Now with he potential of debugging on the DUE this may become harder.
Point is however that the configuration in Arduino 1.5.X is done in 2 files ( boards.txt platform.txt) external to Eclipse. This is why I removed nearly all compiling options in V2. My current thinking is that if you want multiple configurations you have to modify the boards.txt file.
I currently see 2 options

  1. adding a menu option for debug
  2. adding a debug board (uno debug; mega debug ....)
    Both are very easy to implement and supported by Arduino IDE and my Arduino eclipse plugin V2.
    Do you think this can help you out?

I hope you can pinpoint the Due upload problem you are experiencing. (I see nothing glaringly wrong in the info)
Best regards
Jantje

Jantje:
Great work on the gentoo wiki. I made some small changes.

Thanks for compliment and the complements! I also made some small changes again.

Jantje:
Is it really necessary to install the toolchains separately? They are included in the Linux64 bit package on arduino.cc.

Now I have uninstalled the toolchain (emerge -C sys-devel/crossdev cross-avr/gcc cross-avr/binutils cross-avr/avr-libc). Than unmerge and remerge the arduino (emerge -C arduino, emerge arduino). After successfully open the IDE the compilation result in an error: 'Cannot run program "avr-g++" ...'.

For sure on gentoo the installation of an separate toolchain (f.e. with crossdev) is necessary. Btw. crossdev will be already merged as dependency of arduino.

Good luck, Thomas

First of all: a BIG "thank you" Jantje ! This plug-in is exatly what has been missing. After being accustomed to Eclipse-Style programming (mainly in Java), it was hard for me to type all the code and have no auto-completion, no F3 key, etc. Also compiling in the Arduino IDE takes much too long. I'm very happy you were able to implement the incremental builds. This saves so much time and it (almost) works like a charm! I installed a new Eclipse C++ (Juno) edition, installed V2beta of your plug-in and it worked fine.

There are two things I'm fighting with:

  1. Using the procedure described in http://eclipse.baeyens.it/IDECompatibility.html does not work - no .o file is generated for the .ino file. This is what happens:
"Z:/development/arduino/arduino-1.5.2/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-gcc" -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=152 -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON "-IZ:/development/arduino/arduino-1.5.2/hardware/arduino/sam/system/libsam" "-IZ:/development/arduino/arduino-1.5.2/hardware/arduino/sam/system/CMSIS/CMSIS/Include/" "-IZ:/development/arduino/arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/"   -I"Z:\development\arduino\arduino-1.5.2\hardware\arduino\sam\cores\arduino" -I"Z:\development\arduino\arduino-1.5.2\hardware\arduino\sam\variants\arduino_due_x" -MMD -MP -MF"SensorOnLCD.ino.d" -MT"SensorOnLCD.ino.d" "../SensorOnLCD.ino"  -o  "SensorOnLCD.ino.o"
arm-none-eabi-gcc.exe: ../SensorOnLCD.ino: linker input file unused because linking not done
Finished building: ../SensorOnLCD.ino

Changing the file back to .cpp, calls the compiler like this (note: the g++ compiler is called instead of c++ and some parameters are different):

"Z:/development/arduino/arduino-1.5.2/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-g++" -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=152 -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON "-IZ:/development/arduino/arduino-1.5.2/hardware/arduino/sam/system/libsam" "-IZ:/development/arduino/arduino-1.5.2/hardware/arduino/sam/system/CMSIS/CMSIS/Include/" "-IZ:/development/arduino/arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/"   -I"Z:\development\arduino\arduino-1.5.2\hardware\arduino\sam\cores\arduino" -I"Z:\development\arduino\arduino-1.5.2\hardware\arduino\sam\variants\arduino_due_x" -MMD -MP -MF"SensorOnLCD.cpp.d" -MT"SensorOnLCD.cpp.d" -x c++ "../SensorOnLCD.cpp"  -o  "SensorOnLCD.cpp.o"
Finished building: ../SensorOnLCD.cpp
  1. I wanted to access a LCD shield. I added the path to the library as described earlier for GNU C and GNU C++ under the tab "project properties -> C/C++ General -> Paths and Symbols -> Includes". This allowed me to work with the include files. But the LiquidCrystal.cpp did not get compiled. So I added the same path again under "C/C++ General -> Paths and Symbols -> Source Location" and added an exclusion filter for "examples" for this entry. This worked. Everything got compiled and the excutable works fine. But I'm not sure if this is the correct approach. Would it be possible for you to add a way to add such libraries under "project properties -> Arduino" (or elsewhere where it makes sense) ?

Regards,
Michael