First of all I advice "people not using eclipse already" to use the Product version. This is one install that includes eclipse and the plugin. You can find a download link for your os here: http://eclipse.baeyens.it/download.php. I advise to us the latest version. Mac users must install the latest version due to a change in arduino folder policy on mac.This is a guide to installing and configuring the Eclipse environment on Windows in order to modify and compile the RepRap Firmware for Duet electronics. It may be generally useful for getting Eclipse to play nicely with the Arduino Due board as well.
Note that many printer settings can be changed in g-code within the RepRap firmware and you may not need to edit and compile a new firmware binary to run the RepRap firmware on your printer.
This guide draws from a number of sources: Adrian's initial guide, 3D-ES's post on the RepRap forum and personal experience. I would really appreciate comments and feedback on how this works on other versions of Windows. If anyone is able to do a similar guide for Mac/Linux that would be greatly appreciated.
Installation
32 Bit. Throughout this guide I have stuck with using the 32bit version of Eclipse. This should work in more situations than the 64 bit version however let me know if you are successful with the 64 bit versions.
Paths. To keep it simple I have used C:\arduino, C:\eclipse and C:\workspace\RepRapFirmware as directory paths in this example - other paths should work but ensure you substitute the new paths in the instructions below.
Install Arduino: download 1.5.6-rc2, Extract and move to C:\arduino
Install Eclipse: download Juno C/C++ SR2. Extract and move into C:\eclipse
Create workspace: make directories: C:\workspace, C:\workspace\RepRapFirmware and C:\workspace\RepRapFirmware\Libraries
Run Eclipse: C:\eclipse\eclipse.exe. When prompted for the workspace enter C:\workspace and choose not to be prompted again. Close the welcome help window.
Install the Arduino Eclipse plugin: Select the Help Menu, Install new software. Paste http://www.baeyens.it/eclipse/V2 in the "work with" field and click "Add". It will prompt you to name the repository, use "Arduino Plugin". Uncheck "Group items by category" checkbox then select "Arduino eclipse extensions" item. Click through Next a few times then accept the agreement and finish. Yes to unsigned content, then restart Eclipse.
Setup the Arduino Eclipse plugin: Select Window menu, "Preferences", "General", "Workspace" Check "Save automatically before build". Then click "Arduino" and enter C:\arduino in the Arduino IDE path and C:\workspace\RepRapFirmware\Libraries in the Arduino Library path. Apply the changes.
Note the "bossac" port number: With your Duet board plugged into USB (but not 12V) press the "erase" button (next to the ethernet port), then the reset button (next to the USB port). If you have not done this before on your PC it may start to install the driver for the native USB port. One this is done go to Control Panel, Devices and Printers and you will see the native USB port. For some reason Windows thinks this is a GPS camera for me:
This shows the port as COM8, note this for the next step
Setup the RepRap Firmware project: Select Arduino menu, "New Sketch". Set the project name to "RepRapFirmware". go next then select C:\arduino\hardware\arduino\sam\boards.txt and select Arduino Due (Native USB Port) as the board.
NOTE the Arduino Due (Programming Port) will not work with the Duet.
Set the port to "COM8" or whatever you found in the previous step.
Exit Eclipse
Get the RepRap Firmware source: Get the version of RepRapFirmware you want to work with. Good options are:
- The main version from RepRapPro
- The T3P3 multi extruder experimental branch
- Dc42's version with his improvements
The choice depends on what you are using the firmware for, and you can change to a different branch later. Whichever version you choose, click "Download ZIP" button on the right side of the page and copy the contents of the zip file into C:\workspace\RepRapFirmware
Only overwrite "RepRapFirmware.cpp" and "RepRapFirmware.h" do not overwrite the other files.
Copy the Libraries: Download the Libraries (click download zip on the right hand side). Copy the sub directories of "Arduino-libraries-master" into the C:\workspace\RepRapFirmware\Libraries\
directory. Next copy C:\arduino\hardware\arduino\sam\libraries\Wire
to C:\workspace\RepRapFirmware\Libraries\
Setup the Paths: Open eclipse, in the Project Explorer window on the left click on the "RepRapFirmware" project and select refresh. All the source files should now appear in the project explorer tree. Next right click on the RepRapFirmware project again and select properties. Navigate to C/C++ General, Paths and Symbols:
the core and variant entries will already be there, add the rest making sure you select "Is a workspace path" and "Add to all languages":
Except the "C:\arduino\hardware\arduino\sam\system\libsam\include" path which needs to be added as a filesystem path:
Note If using the Dc42 version on the firmware you must add the "flash" directory as well:
Once they are all added click apply, choose to rebuild the index and select OK to close the window.
Eclipse is now setup and ready to compile the firmware.
Compiling RepRap Firmware: The compilation output is visible on the console tab selected at the bottom center. Choose the Project menu, clean, clean all, OK. Then click on the green tick to "Verify", ie compile the code.
The progress of the compilation will show in the console window and when complete there will output something like this:
Uploading the Firmware: With the Duet plugged into USB if you have not erased the loaded firmware click the erase button, then the reset button on the Duet. Then click the green arrow on the toolbar "Upload Sketch". The upload will start, shoose "always run in background". In the console windown the upload progress and then the verify progress will be shown:
The compiles firmware is now uploaded to the Duet board. Note if you look in devices and printers the port will have changed to the Arduino Due port:
With a different com port, this is the one you use in Pronterface to talk to the firmware over USB.
Firmware Modification
Detailed information modifying the firmware is outside the scope of this blog post. Printer configuration defaults are in Platform.h:
The screenshot above shows part of the platform.h for the Multi Extruder branch which defines all 8 channels for the Duet and Duex4.
I hope this post has been useful!
The screenshot above shows part of the platform.h for the Multi Extruder branch which defines all 8 channels for the Duet and Duex4.
I hope this post has been useful!
During Setup the Arduino Eclipse plugin, when I enter C:\arduino in the Arduino IDE path , there is an error message "Arduino folder is not correct" , C:\workspace\RepRapFirmware\Libraries in the Arduino Library path but Apply changes is inative. use Arduino IDE tools in eclipse is checked and the test seriál dll loads successfully. I´m stuck, please help.
ReplyDeleteRegards
Alfred
Hi Alfred, is Ardunio definitely installed to c:\ardunio?
DeleteHi Tony, for sure it is definitely installed. Would it be possible if you can make a video of the installation process step by step and post it here or on YouTube . Thanks. Alfred
Deleteare you using a mac?
DeleteHi Jan, I use Windows 8.1, 32 bit version and Arduino 1.5.6 R2.
DeleteThank you .
Regards
Alfred
Thanks for the write-up Tony, very useful!
ReplyDeleteAll went as described, apart from warning from Arduino plugin about Arduino version being later than plugin, I guess that doesn't matter too much.
It takes a bit of setting up, but Eclipse is so much more powerful than the Arduino IDE.
Glad it was helpful and thanks for the heads up about the plugin warning. If everything compiles fine then I assume it doesn't matter.
ReplyDeleteBtw, I can confirm the setup works well for Arduino Due as well (I am porting Marlin to Due). I created a new sketch following the same process, except I am using the programming port for programming.
DeleteNow, if I can get a JTAG debugger working with Eclipse as well I will be very happy!
Hi Bob
DeleteThats excellent news about porting Marlin - it will be good to have a variety of firmwares that work with the Due/Duet et al.
I had an olimex debugger working with the Atmel environment but never got it going with Eclipse.
The story on "GPS camera" - a Taiwanese company called Wonde Proud deciding to ship a product using Atmel's VID&PID for SAMBA instead of using their own ID. Whether this was just incompetence or wanting to save the USBIF vendor fee, I don't know.
ReplyDeleteIt seems that they submitted a driver to Microsoft who also charge for inclusion in the Windows driver database, but don't bother checking if the Vendor ID belongs to the submitter.
So now all SAMBA devices come up as a GPS camera :)
Now I know! Cheers :)
ReplyDeleteHi Tony,
ReplyDeletei'm trying to build the firmware from source to start working on delta support for duet, but i cannot get over
../GCodes.cpp:53:14: error: assigning to an array from an initializer list
axisLetters = AXIS_LETTERS;
^
make: *** [GCodes.cpp.o] Error 1 I'm trying the DC42 dev firmware branch. Im on windows using latest arduino 1.5.8 and latest eclipse Juno SR2.
Can you please speculate on what am I doing wrong?
Hi Pajadvor
DeleteCould you let me know if you still have the issue working with the standard branch from RepRapPro:
https://github.com/reprappro/RepRapFirmware/tree/master
I dont get that compile error so it may be todo with the way your Eclipse is setup with C/C++ compilation.
Cheers
Tony
Hi
ReplyDeleteThis is jantje. The author of the arduino eclipse plugin. Though the writeup is correct I think there are a couple of improvements.
First of all I advice "people not using eclipse already" to use the Product version. This is one install that includes eclipse and the plugin. You can find a download link for your os here: http://eclipse.baeyens.it/download.php. I advise to us the latest version. Mac users must install the latest version due to a change in arduino folder policy on mac.
So install eclipse should be install the arduino eclipse plugin product (which is download and unzip)
This also means that the section installing the plugin is no longer needed.
Secondly: you should not create the workspace folders. When eclipse asks the workspace it can be a non existing folder. So drop this section.
Thirdly: I would change the section title "Setup the Arduino Eclipse plugin: " to "Configure the Arduino Eclipse plugin: "
Setting the "Save automatically before build" is no longer needed.
In the section copy the libraries I do not understand the need to copy the wire library. Can you elaborate on why you do this?
In the section setup the paths it is lots easier to select arduino->add library and select all needed libraries there. It is multiple select so this method should be lots faster.
You probably still need to add "C:\arduino\hardware\arduino\sam\system\libsam\include" manually.
Keep up the good work and don't forget to send me a printer (rofl)
Best regards
Jantje
Jantje
DeleteThanks alot for the information to update the post, and for you great work on the plugin - I need to try the new version.
Regarding the wire library - when I wrote the post there were two versions of the wire library one for AVR and one for Sam3x. you had to copy that into the libraries path (or add another path to the setup) all the other libraries that are in the standard path work for either AVR or Sam3X AFAIK.
cheers
Tony
Tony
DeleteThere should be no need to do so. If you select the wire library from windows->add libraries the plugin knows (based on the selected boards.txt file) which libraries to include.
You can verify that easily by selecting the wire folder and look at the properties->resource. In your case you should see c:/arduino/hardware/arduino/sam/libraries/wire
Jantje
Hi, i contacted DC42 as i was using his firmware, the glitch is his firmware works only with arduino1.5.6R2 anything newer is not compiling properly.
ReplyDeleteI managed to compile a working firmware.
I am using the latest Arduino Eclipse IDE V2.3, with the Arduino 1.5.6-r2. I have downloaded the latest DC42 Fork: https://github.com/dc42/RepRapFirmware/tree/dev
ReplyDeleteI am getting this error message:
../Platform.h:221: warning: scoped enums only available with -std=c++0x or -std=gnu++0x
Is there a Component I need to upgrade like the compiler?
Guy, not sure but it may be that the latest version of the Arduino plugin/arduino is not compatible. Try with the old versions from when this blog post was done and see if that fixes the problem. I have not have a chance to test the latest versions.
DeleteCheers
Tony
Hi Tony,
ReplyDeleteI'll also post this on the RepRap forum- the walk through has been immensely helpful and the detail you go into is ideal for a newbie like myself.
However, I've run into a problem that I can't seem to get past- I can verify the project but when I come to upload I get halfway (seeing the green upload text), then I hear the USB device disconnect and change from COM12, Bossac device to COM15, showing as a Arduino DUE board. I then get an error saying:
"Failed to upload,, java.lang.NullPointerException"
I thought it may be related to the fact that I have used a Due on my machine before so completely erased all previous arduino files from my system and then did a complete uninstall of both Eclipse and Arduino (using same versions as linked here.)
Any ideas what may be happening/ things to try as it's very frustrating to not even be able to upload the config file, let alone modify it!!
Cheers
Hi.
ReplyDeleteSo firstly, are you trying to recompile a custom version of the firmware or just upload a config.g file.
If the latter then there is no requirement for eclipse, just load the config.g into the /SYS/ directory on the SD card. The vast majority of configuration options are supported by DC42's latest firmware version.
If you are setting up ecipse to compile a custom version then try verifying in eclipse (this means compile the binary .bin file) then use bossac on the command line to load the file to the board. Ensure you have erased the old firmware and reset the board before trying bossac.
RepRapPro's instructions are a good guide on how to upload but use your binary which will be located in your eclipse project ./release/ directory
https://reprappro.com/documentation/commissioning-introduction/maintenance-duet/#RepRapPro_Firmware
Cheers
Tony
Hi.
ReplyDeleteSo firstly, are you trying to recompile a custom version of the firmware or just upload a config.g file.
If the latter then there is no requirement for eclipse, just load the config.g into the /SYS/ directory on the SD card. The vast majority of configuration options are supported by DC42's latest firmware version.
If you are setting up ecipse to compile a custom version then try verifying in eclipse (this means compile the binary .bin file) then use bossac on the command line to load the file to the board. Ensure you have erased the old firmware and reset the board before trying bossac.
RepRapPro's instructions are a good guide on how to upload but use your binary which will be located in your eclipse project ./release/ directory
https://reprappro.com/documentation/commissioning-introduction/maintenance-duet/#RepRapPro_Firmware
Cheers
Tony