FANDOM


If you are looking to integrate Arduino with eclipse, then check out this page instead, Eclipse.

Eclipse is an Integrated Development Environment (IDE) which can compile (and upload, untested so far) code to the Arduino, the same as the Arduino-0021 software. It has some additional features which make it nice for version control, and some coding tools (visual indication of uncommitted code, more explanatory error messages, tracking and displaying function call structures and #define values, collapsing and expanding functions or loops or comments, etc).

Eclipse has a Mercurial plugin which allows it to work with Google Code. It also has a Bazaar plugin for launchpad, but apparently Eclipse crashes if ssh requests a password - presently on my computer ssh is requesting a password to unlock keys, even when I re-generated the keys without entering a password (I did enter a password the first time, perhaps it wasn't able to overwrite this password encryption).

Installing Eclipse with MercurialEdit

If you want Eclipse to COMPILE (and potentially upload) code for arduino, it's much more complicated, see Eclipse#Arduino_Eclipse_with_Mercurial below. But you can use Eclipse as good syntax highlighter/folding function/visual mercurial indicator by itself with these directions, and use Arduino0022 to test compilation:

  1. Install mercurial. For me this is System->Admin->Add/Remove Software and search for mercurial. Also, there is a windows non-admin version here: http://mercurial.selenic.com/downloads/
  2. Install Eclipse. I have Galileo version on Linux which I like a lot, for windows I've been installing "Eclipse IDE for C/C++ programmers" from the eclipse download site, I don't like the layout as much - not sure what Galileo for windows corresponds to (maybe "Classic Eclipse"?).
  3. Install the Eclipse mercurial plugin, follow directions here http://javaforge.com/project/HGE
    1. Start Eclipse
    2. Help -> Add new software
    3. Copy the address (http://cbes.javaforge.com/update) from the HGE download site into the Work With bar, click Add, give it an informational title (like Mercurial Plugin Repo). After a second the list of software from that repo appears.
    4. Click the checkmark next to Mercurial Eclipse
    5. Click next, accept everything, and finish
    6. Restart eclipse
  4. Create a gmail account, and tell Christine or Val what it is, and she will add you to the googleCode editors list
  5. Follow this tutorial to clone qmast.google.code http://blogs.intland.com/main/entry/39 to your local computer, make edits, commit changes, push to repo.
  6. Change the C/C++ settings to include *.pde files
    1. Window->Preferences->C/C++->File Types->New, enter *.pde as a C++ source file
  7. Make changes.
  8. Commit changes frequently. Wrong click on files -> Team -> Commit. Starting with the file name, make useful brief commit comments on what's changed as the file you're working on is built. Fill in your name or pseudonom into the box.
  9. Once you've been added to the editors list for googleCode you can push changes to the online repository.
  10. First add project to synchronize list. Top right corner -> Open Perspective -> Team Synchronizing -> Synchronize -> Mercurial -> qmast -> enter name and GoogleCode password (NOT gmail password, see http://blogs.intland.com/main/entry/39)
  11. Synchronize tab should now show Incoming, Outgoing, Uncommitted lists. Wrong click Outgoing -> Push


I added a *.pde filetype to eclipse so it would highlight it and treat it as a C++ file: Window->Preferences->C/C++->File Types and then add *.pde as a C++ source file

Using Mercurial Eclipse Edit

Some thoughts about what we've learned from experimenting. Start with a tutorial (above) or ask someone if you haven't used it before!

  • Eclipse seems to be really slow at registering changes of the push/pull/merge variety. Maybe try opening and closing it.
  • Pull any incoming changes from Google Code first (I think it forced you to if there are both incoming and outgoing changes)
  • Merge any needed changes. It should show as a conflict with a double sided red arrow. In normal C/C++ perspective, right click on the file, go to team and select merge. (If there are no conflicts, it should just go fine?) If there are changes to the same function that can't peacefully coexist, you need to do it manually by looking, then copying and pasting as required. Then right click on the file -> Team -> Mark as resolved. Everything useful comes from right clicking the file and going to Team. Dont forget to commit after!
  • Don't worry about the .project file being uncommitted.
  • A project "head" is the top, newest part of the project. If the project has branched from two or more people working on it simultaneously, it has multiple "heads", one from each person's changes. From command-line, we'd fix this with hg merge.

Mercurial Merge Tool in EclipseEdit

Presently, there's no pretty highlighting or anything (other than the diff's on the file versions themselves?) to assist with merging.

Comparison of merge tools Look into kDiff3, which is cross-platform, looks pretty, and appears to be compatible with an eclipse plugin.

adding it without the plugin only works with SVN,

forum post about MercurialEclipse with external diff program

Basically, my research seems to say that it needs to be configured in Mercurial, not in the Eclipse plugin. See the mercurial section of this page. In eclipse, I went to Windows -> Preferences -> Team -> Mercurial and ticked "Use external merge tool" option in Eclipse, and installed kdiff3. This has to still be tested.


Eclipse for ArduinoEdit

Eclipse can compile code and upload it to arduino. To do this, follow the below configuration steps.

To get this to work with version control, follow Eclipse#Arduino_Eclipse_with_Mercurial below.

Presently, we compile code using the Arduino IDE and merge in Eclipse (or your choice of Mercurial googleCode frontend, dont NEED to use Eclipse). Getting Eclipse to compile and upload code to Arduino would be REALLY COOL since it would cut out the Arduino IDE step, but isn't working, hasnt been tested yet it's working now on WINDOWS ONLY.

Some links with instructions:

Sandeep's Guide (this is the one that works!)Edit

This seems newby-friendly!

  1. Following above instructions, had no problems at first, step 12 should say Click on the “Workspace…” button to and add the project directory to be a little less confusing (just click workspace and select your project folder)
  2. The setups for the Compiler directories should just be /Arduino. For linker, it should be /Arduino/Debug (this is backwards in the article, there's a comment at the bottom); probably why it couldnt find Wiring.h; switched
  3. Now it's complaining about not finding -lArduino, and excluding /Eclipse Projects/Arduino because its an invalid path; Moved project workspace to /EclipseProjects/ -> wasnt the path, still same error: skipping incompatible /home/XXX/EclipseProjects2/Arduino/Debug/libArduino.a when searching for -lArduino. This error is discussed on the comments, but no clear solution is shown. I've posted on the comments section of the tutorial.
  4. Fixed! Before compiling BlinkenLights, change the target hardware to the ATmega2560, same as we did for the Arduino project; error was because the library was for the wrong version of Arduino!
  5. -Wl,--gc-sections is the garbled edit for the linker optimization
  6. All ready to try using AVRdude to upload to arduino! :)
  7. Install the Target Management plugin for Eclipse by going to Help -> Add New Software and enter this address:
http://download.eclipse.org/dsdp/tm/updates/3.0/

This will enable Serial Monitor functionality. Youll also need to install the latest RXTX library to set up a serial port:

http://rxtx.qbang.org/eclipse

To use a *.pde file, use the following template in the file Main.cpp:

#include "WProgram.h" //Include arduino headers
//insert *.pde code below:
//   code here! :)
//end *.pde code
///MAIN///
int main()
{
 init();
 setup();
 while(true)
 {
  loop();
 }
  return 0;
}
  1. This seems to be having trouble finding SoftwareSerial.h and Servo.h, which aren't in the /cores/ folder of Arduino0022, and hence arent linked. They are in
/arduino-0022/libraries/

Copy the library files (*.h and *.cpp) for any library used into the static eclipse library (mega2560 on the bay computer).

  1. atof causes errors (used in Parser): http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=97763

Added 3 new libraries to project settings -> C++ Linker -> Libraries: c m c and now it's compiling.

TADA ALL WORKING with alpha5 dropped into the Main.cpp of BlinkenLights, following above template :)

Arduino Eclipse with MercurialEdit

I believe the proper steps would be to pull the qmast project, instead of creating a new BlinkenLights project, wrong-click on the qmast folder, select Convert to C++ project, and then set up all the configurations as you would for BlinkenLights; and add in a Main.cpp function. http://matinrad.com/index.php/2010/02/ns-3-and-eclipse/. But I'd recommend getting BlinkenLights going first.

After blinkenLights is going, here's what you do to hook up with our repo:

  1. Pulled the repo through Eclipse (import->mercurial->give it our googleCode address)
  2. Take the project offline (Team->Disconnect)
  3. Change the project name to qmastoffline (Rename)
  4. Make a new C++ project called qmast (File->New C++ project->AVR Program)
  5. Drag offline files in from qmastoffline
  6. Make all changes as described on Eclipse page of wiki to configure an arduino project in Eclipse
  7. Project should compile, now you're ready to hook it back to the repo.
  8. Select Team->share and select Mercurial, put in our repo settings, it should become a repo again.
  9. Select Team->ignore on the qmast folder and in glob enter .* to ignore the Eclipse project files (we dont want to synch those hidden files) [1]
  10. Select Team->Ignore on the Release folder, and again on the Debug folder (we dont want to synch all the compiled files, just the source code)
  11. In synchronize view, click Synchronize
  12. Pull all changes from repo.
  13. Uncommitted/outgoing should now be just the Main.cpp file.
  14. Commit the Main.cpp file and push to test that it's working.

Generally we don't want to be committing the Main.cpp file, as it will change for every different *.pde file we're working on. Instead, make sure all changes get into the original *.pde file that you copied into Main.cpp. Or if someone wants to figure out how to make it link a specific *.pde file's contents into the Main.cpp template when it builds, that would be sweet.

Uploading for windowsEdit

This is working, see steps below. Follow sandeep's guide.

Initially, not working in Eclipse, 4% upload and then out of sync error (though working on Arduino-0022)

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1290630370

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1291028799

  1. Followed Sandeep's directions
  2. Timed out, out of sync when uploading
  3. Copied avrdude.exe and avrdude.conf from C:\Program Files\arduino-0022\hardware\tools\avr\etc and C:\Program Files\arduino-0022\hardware\tools\avr\bin to C:\WinAVR-20100110\bin , replacing the ones that come with WinAVR with the versions that come with Arduino0022
  4. Changed Programmer to Atmel STK500 v2.x firmware in AVRdude settings in eclipse, baud 115200, \\.\COM3

I did find that I hadn't set the target hardware in AVR settings to the mega; this could have been the actual problem?


Uploading For linuxEdit

This isnt working.

  1. I'm having port trouble with linux, error is: "ser_open() cant open device "/dev/ttyS0": No such file or directory.

/dev/ttyACM0 <- this is the port that shows in the Arduino IDE, though I'm having trouble getting it reliable, says port not found (though it shows in cd /dev ; ls | grep ttyA and disappears when arduino is unplugged). Error is now: The port for the programmer is blocked. Check that nothin is using the port. avrdude: ser_open(). cant open device. input/output error:

Launching /usr/bin/avrdude -pm2560 -carduino -P/dev/ttyACM0 -b115200 -Uflash:w:BlinkenLights.hex:a
Output:
avrdude: ser_open(): can't open device "/dev/ttyACM0": Input/output error
avrdude execution aborted

This cycles (from within eclipse) with avrdude: device not responding

Launching /usr/bin/avrdude -pm2560 -carduino -P/dev/ttyACM0 -b115200 -Uflash:w:BlinkenLights.hex:a
Output:
avrdude: stk500_recv(): programmer is not responding
avrdude done.  Thank you.
avrdude finished

With arduino plugged into the USB port, there's nothing in ls /dev | grep ttyU; arduino loads as /ttyACM0; perhaps a symlink to a ttyUSBx or ttySx port would work?

Maybe eclipse needs to be run as root?

Arduino.cc Instructions (this guide is confusing and needs some work to work!)Edit

Eclipse for arduino on Arduino.cc, which has cvs and svn support

This is the main forum post for getting Eclipse to compile arduino code, with instructions and comments from users.

I run Fedora 13. These are my steps I took to try to get it working. There was a type, codes -> cores in my path; maybe this is also a typo in Eclipse, could be why it failed.

  1. Follow above directions.
  2. Installing eclipse and the toolchain went fine (sudo yum install instead of apt-get install) except a few packages that I searched for using System->Admin->Add/Remove Software and searching for AVR, as they had different names than indicated (avr-xxx instead of xxx-avr). Installed avr-eclipse as described in the linked page.
  3. I found the header files using whereis arduino. They are in /usr/share/arduino/hardware/arduino/cores/arduino from installing the arduino IDE. This information is important for the project properties configuration below.
  4. Opened arduino IDE and Blink example project, verified. core.a was in /tmp/buildxxxxxxxxx.tmp/ folder. Copied to ~/core.a for now, will copy it into a project folder once the project is created in eclipse.
  5. Started a new C++ project, called arduinoMega2560
  6. MCU is ATmega2560, frequency is 16MHz see this reference
  7. The project is now created. On the C/C++ projects tab, select arduinoMega2560. Now Project->Properties is available. Follow directions to edit all variables. The core library is the one copied from the Arduino IDE compilation.
    1. Copy the core.a file to a libxxxx.a file (I used libMega2560.a) into the project directory (for me this was /Documents/EclipseProjects2/arduinoMega2560/ and use that information (file name without the lib or .a, and the directory) in the last step.
  8. To create a source file to add the suggested function code, File->New->Source File->main.c
  9. I added the pedantic flag
  10. I cant find Project Options-> Libraries to enable the floating point printf libraries
  11. I copied contents of main.cpp from /usr/share/arduino/hardware/arduino/cores/arduino to /Documents/EclipseProjects2/arduinoMega2560/main.c
  12. Havnt set up any of the support for uploading code
  13. This has errors when I tried to build (doesnt recognize Serial, and all the functions to have c++ compatibility cause errors). Deleted the c++ functions.
  14. Moved to folder EclipseProjects2 to remove the space in the name. Then deleted the Debug folder from inside eclipse, as there were two definitions of main.cpp, and also deleted main.cpp. Serial error reappeared.
  15. Edited Tones.cpp to have "wiring.h" and "pins_arduino.h" rather than <wiring.h> and <pins_arduino.h>
  16. Still not working, errors.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.