Today I got my Arduino Due, so I will be starting to play with it.
Reading through the Arduino site, all the pointers in tailoring Eclipse to the Arduino are for the AVR 8-bit processors and not for ARM, therefore, can someone give a link or a tutorial on how to do it here on the Arduino Due forum?
Thanks in advance and have a nice day!
--- Ricky Marek.
Today I tried again to tailor it via the AVR plugin or Arduino plugin, both are for AVR environment and not the SAM3
Any one has done this work?.
Atmel Studio 6 is not suitable for me. (I work in mixed platforms, here in a Windows7, and helping my kid under Linux)
I wrote a procedure to use Eclipse with Arduino Due board.
This procedure is written for Winwdows, but you can adapt it to Linux if you want.
But the problem is that I don't now what software to use to uplaod the program in Arduino Due board ...
I can't do test because I don't have Arduino Due board.
Eclipse installation for Arduino Due on Windows
Introduction
This manual is written for Arduino Due IDE.
This manual will allow you install an Eclipse environment to edit and compile your programs but also to communicate with your Arduino Due Board with USB (serial) and a terminal.
This is not a definitive solution, but works very well.
#1. You must first download the following elements:
Unzip Arduino Due IDE, for example: âC:\arduino-1.5.1r2â.
Unzip Eclipse IDE for C/C++, for example: âC:\ArduinoDue\eclipseâ.
Add Arduino tool chain path in the Windows Path: âC:\arduino-1.5.1r2\hardware\tools\g++_arm_none_eabi\binâ.
#3. Configuration:
Start Eclipse and install the GNU ARM Eclipse Plug-in, click on menu âHelp/Install New SoftwareâŚâ
In the dialog box âInstallâ, click on âAddâ button.
In the âAdd Repositoryâ dialog box, click on âArchiveâŚâ button.
In the this dialog box, select the downloaded plug-in file : âorg.eclipse.cdt.cross.arm.gnu_0.5.4.201202210114.zipâ
In the dialog box âInstallâ, click on âAddâ button.
In the âAdd Repositoryâ dialog box, type âRXTXâ in the âNameâ field and type http://rxtx.qbang.org/eclipse/ in the âLocationâ field and click on the âOkâ button.
With Windows Explorer, create a new folder âTMâ in the âC:\ArduinoDue\eclipse\dropinsâ folder.
Copy âTM-trminal-3.4.1.zipâ file in the âTMâ folder, and unzip this file in this folder. Restart Eclipse.
#4. Create the ArduinoDueCore library Project:
In Eclipse, create a project, click on menu âFile/New/C++ Projectâ.
In the dialog box âC++ Projectâ, type the Project Name : âArduinoDueCoreâ
Disable, âUse default locationâ checkbox.
Click on the âBrowseâ button and select the location of your project.
In the âProject typeâ area, select âARM Cross Target Static Library/Empty Projectâ.
In the âToolchainsâ area, select âARM Windows GCC (Sourcery G++ Lite)â.
Click on the âNextâ button.
On the Configuration area disable the âDebugâ checkbox.
Click on the âFinishâ button.
Check the project, click on the project with right mouse button, in the popup window, click on the âPropertiesâ item.
In the tree area in the left of dialog box, select âC/C++ General/Paths and Symbolsâ
Verify in the âIncludesâ tab than âInclude directoriesâ are filled with the path based added in the Windows Path (in step #2) on the Assembly, GNU C, GNU C++ languages. If the path is not correctly set, you must verify that the path has been correctly set.
Click on the âCancelâ button to close the dialog box.
Create a âsrc\coreâ folder in project, click on the project with right mouse button, click on âNew/Folderâ item of popup menu. Type âsrc\coreâ in âFolder nameâ field and click on the âFinishâ button.
With Windows Explorer select all files in the âC:\arduino-1.5.1r2\hardware\arduino\sam\cores\arduinoâ folder and copy to the âsrc\coreâ folder of the âArduinoDueCoreâ project.
In the âsrc\coreâ folder, remove âmain.cppâ and âsyscalls_sam3.câ files.
In the âsrcâ folder create âlibâ folder.
From the âC:\arduino-1.5.1r2\hardware\arduino\sam\system\â folder copy the followings folders and files to the âsrc\libâ project folder:
âCMSIS\CMSIS\Include*.hâ (with all the include files).
âCMSIS\Device\ATMEL\â with the include files : âsam3.hâ, âsam.hâ.
âCMSIS\Device\ATMEL\sam3xa\include\component*.hâ (with all the include files).
âCMSIS\Device\ATMEL\sam3xa\include\instance*.hâ (with all the include files).
In Eclipse, click on the project with right mouse button, click on the âPropertiesâ item.
Select âC/C++ Build/Settingsâ in the tree area on the left.
In the âTool Settingsâ tab, in âTarget Processorâ select âcortex-m3â value of âProcessorâ property and enable the âThumbâ checkbox.
Select âARM Sourcery Windows GCC C Compiler/Preprocessorâ, in the âDefined symbolsâ area, adds the following items:
SAM3X8E
USB_PID=0x003E
USBCON
Select âARM Sourcery Windows GCC C Compiler/Directoriesâ, in the âInclude pathsâ area, add the followings items: (using the âWorkspaceâŚâ button)
â\src\coreâ.
â\src\lib\CMSIS\Device\ATMELâ.
â\src\lib\CMSIS\CMSIS\Includeâ.
â\src\lib\libsam\includeâ.
â\src\lib\libsamâ.
â\src\lib\CMSIS\Device\ATMEL\sam3xa\includeâ.
â\src\lib\variants\arduino_due_xâ.
Same setting for âARM Sourcery Windows GCC C++ Compiler/Preprocessorâ and âARM Sourcery Windows GCC C Compiler/Directoriesâ, and click on âOKâ button.
To build the ArduinoDueCore library, click on the project with right mouse button, click on the âBuild Projectâ item. In the âReleaseâ folder, the âlibArduinoDueCore.aâ file has been generated.
#6. Create your Arduino Due project:
In Eclipse, create a project, click on menu File/New/C++ Project.
In the dialog box âC++ Projectâ, type the Project Name: âMyProjectâ.
In the âProject typeâ area, select âARM Cross Target Application/Empty Projectâ.
In the âToolchainsâ area, select âARM Windows GCC (Sourcery)â.
Click on the âNextâ button.
On the Configuration area disable the âDebugâ checkbox.
Click on the âFinishâ button.
Create a âsrcâ folder in project, click on the project with right mouse button, click on âNew/Folderâ item of popup menu. Type âsrcâ in âFolder nameâ field and click on the âFinishâ button.
With Windows Explorer select âmain.cppâ and âsyscalls_sam3.câ files in the âC:\arduino-1.5.1r2\hardware\arduino\sam\cores\arduino\â folder and copy to the âsrcâ folder of the âMyProjectâ project.
In Eclipse, click on the project with right mouse button, click on the âRefreshâ item.
The âsrcâ folder appears with its files.
#7. MyProject project Settings:
In Eclipse, click on the project with right mouse button, click on the âPropertiesâ item.
Select âC/C++ Build/Settingsâ in the tree area on the left.
In the âTool Settingsâ tab, in âTarget Processorâ select âcortex-m3â value of âProcessorâ property and enable the âThumbâ checkbox.
Select âARM Sourcery Windows GCC C Compiler/Preprocessorâ, in the âDefined symbolsâ area, adds the following items:
SAM3X8E
USB_PID=0x003E
USBCON
Select âARM Sourcery Windows GCC C Compiler/Directoriesâ, in the âInclude pathsâ area, add âsrcâ folder of âArduinoDueCoreâ : (using the âWorkspaceâŚâ button)
Same setting for âARM Sourcery Windows GCC C++ Compiler/Preprocessorâ and âARM Sourcery Windows GCC C Compiler/Directoriesâ, and click on âOKâ button.
Select âARM Sourcery Windows GCC C++ Linker/Generalâ, in the âScript fileâ field, clicks on the âBrowseâŚâ and select âArduinoDueCore\src\lib\variants\arduino_due_x\linker_scripts\gcc\flash.ldâ file, folder of MyProject.
Select âARM Sourcery Windows GCC C++ Linker/Libraryâ, in the âLibrariesâ area, adds âArduinoDueCoreâ and in âLibrary search pathâ area, adds the path where the ArduinoDueCore library is located, use the âWorkspaceâŚâ button and select the âReleaseâ folder of ArduinoDueCore library project.
Select âProject Referencesâ, in the âProject references for âMyProjectââ enable the âArduinoDueCoreâ checkbox.
To build your project, click on the project with right mouse button, click on the âBuild Projectâ item. In the âReleaseâ folder, the âMyProject.hexâ file has been generated.
To open the terminal view, click on the menu âWindow/Show View/OtherâŚâ.
In the âShow Viewâ dialog box, in the tree area, select âTerminal/Terminalâ and click on the âOKâ button.
In the Terminal view, click on the âSettingsâ icon to open the âTerminal Settingsâ dialog box.
Type âArduino Dueâ on the âView Titleâ, select âSerialâ âConnection Typeâ select box, select the âPortâ, select the âBaud Rateâ to 38400 and click on the âOKâ button.
Click on the âConnectâ button, the âHello Wordâ message appears every second.
Thanks for your message.
Yes, I spent a lot of time, it was not easy.
For example how to uplaod a program in the board.
I used the Arduino IDE Due, I have compiled a sample program and I clicked on upload button.
As I do not have Arduino Due board, the Arduino Due IDE displays the following message: "No device found on COM3".
I did a search for text "No device found on" in the folder of the Arduino Due IDE, and I found the file bossac.exe.
I replaced this file with a small program that just prints on the stdout the arguments that are get in parameter.
I clicked on upload button on the Arduino Due IDE, and the parameter are displayed in the Arduino IDE.
In this way I got the list of parameters to use with bossac.exe.
I make an improvement on a tool chain path configuration described on the #2 Step.
If like me, you use different board with different toolchain (AVR, Teensy 3.0, Arduino Due...), you will need to modify the PATH environment variable in Windows depending on the board you are using. It is heavy!
In Eclipse, it is possible to configure environment variable to a workspace and therefore no need to change the Winwdows PATH environment variable :
Set the tool chain path, click in âWindows/Preferencesâ.
In the tree area in the left of âPreferencesâ dialog box, select âC C++/Build/Environmentâ.
On âPreferences/Environmentâ clicks on the âselectâŚâ button.
In the âSelect variablesâ dialog box, enable checkbox of âPathâ item, and click on the âOKâ button.
Back on the âPreferences/Environmentâ select the âPathâ item added, and click on the âEditâŚâ button.
In the âEdit variablesâ dialog box, add the tool chain path âC:\arduino-1.5.1r2\hardware\tools\g++_arm_none_eabi\binâ without remove the current path values, and click on the âOKâ button.
In the âPreferences/Environmentâ click on the âOKâ button.
Hi Nassa ,
just for further reference, in the file hardware/arduino/sam/board.txt are listed all the parameters needed to upload the firmware on every boards , for example in case of arduino due
thank you very much for this guide. Maybe, you should create a specific page in a "tutorial" form, in order to be easier to read and follow.
However, I've tried it on my Ubuntu machine and I've encountered some problem:
in #5 and #7, I think you mean "Same setting for âARM Sourcery Windows GCC C++ Compiler/Preprocessorâ and âARM Sourcery Windows GCC C++ Compiler/Directoriesâ" (just a typo probably)
in #8 I had to modify the working directory in ${project_loc}/Release/ and set the bossac parameter parameter as â--port=ttyACM0 -U false -e -w -v -b ${project_name}.hex -Râ. In particular, pay attention to the ${project_loc} variable, as opposed to ${project_path} which is just relative and didn't work for me
the hex file is quite large: ~150kB for your "blinking" main.c example, whereas the ArduinoIDE's blink example is just ~10kB when compiled.
The last problem is particularly annoying. Can you give me some more insight?
Thank you very much for your effort!!
For the #5 and #7 steps the correct sentence is :
Same setting for âARM Sourcery Windows GCC C++ Compiler/Directoriesâ and âARM Sourcery Windows GCC C Compiler/Directoriesâ, and click on âOKâ
On the size of the binary, I think there is one or more embedded library are unnecessary. I can verify that.
When I wrote this compilation method for Eclipse, I had no Arduino Due Board. I have not tested.
Today I have an Arduino Due board but the command line Bossac for download only function 1 in 50 on my PC and I do not understand why.
I must first solve this problem.
Bossac doesn't work?! It happened to me, too. Are you using a USB 3 port? This could be the problem.
To fix it, just program the Arduino by using a USB 2 port or, if you don't have it, through a USB 2.0 Hub!
Cheers
I tried to follow to tutorial. But I cant build the static library I think some includes are wrong but I cant find out wich.
I got the following error log (not the complete log just this is just a small part) when trying to build. I'm on osx maybe that got something to do with it
'__disable_irq' was not declared in this scope interrupt_sam_nvic.h /ArduinoDueCore/src/lib/libsam/include line 123
'__DMB' was not declared in this scope interrupt_sam_nvic.h /ArduinoDueCore/src/lib/libsam/include line 123
'__enable_irq' was not declared in this scope interrupt_sam_nvic.h /ArduinoDueCore/src/lib/libsam/include line 135
'_dwIrq' was not declared in this scope USARTClass.cpp /ArduinoDueCore/src/core line 60
'_pUsart' was not declared in this scope USARTClass.cpp /ArduinoDueCore/src/core line 43
'Adc' was not declared in this scope adc.h /ArduinoDueCore/src/lib/libsam/include line 175
'Dacc' was not declared in this scope dacc.h /ArduinoDueCore/src/lib/libsam/include line 67
'IRQn_Type' does not name a type USARTClass.h /ArduinoDueCore/src/core line 35
'NVIC_DisableIRQ' was not declared in this scope USARTClass.cpp /ArduinoDueCore/src/core line 72
'NVIC_EnableIRQ' was not declared in this scope USARTClass.cpp /ArduinoDueCore/src/core line 60
'p_adc' was not declared in this scope adc.h /ArduinoDueCore/src/lib/libsam/include line 173
'p_dacc' was not declared in this scope dacc.h /ArduinoDueCore/src/lib/libsam/include line 66
'p_tc' was not declared in this scope tc.h /ArduinoDueCore/src/lib/libsam/include line 73
'p_tc' was not declared in this scope tc.h /ArduinoDueCore/src/lib/libsam/include line 71
'Pdc' does not name a type dacc.h /ArduinoDueCore/src/lib/libsam/include line 70
'Pio' does not name a type pio.h /ArduinoDueCore/src/lib/libsam/include line 124
'pPio' was not declared in this scope pio.h /ArduinoDueCore/src/lib/libsam/include line 109
'pPwm' was not declared in this scope pwmc.h /ArduinoDueCore/src/lib/libsam/include line 76
I do not think your problem is not OSX.
In my opinion, there are two possibilities :
Either you forgot one of the 3 defines : SAM3X8E
USB_PID=0x003E
USBCON
Either you forgot an include path or one or more files are missing.
Warning, and include Defines Path must be set in the configuration C and C+ + (Tool Settings) :
ARM Sourcery Windows GCC C Compiler
and
ARM Sourcery Windows GCC C + + Compiler
Hi Nassa ,
I played a bit with arduino uno elipse integration and looking at your guide I don't see the define which says which board is beeng compiled.
In case of Aduino due it is -DARDUINO=151.
Zad