... Next part :
#5. ArduinoDueCore library 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 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 Modify main.cpp :
#define ARDUINO_MAIN
#include "Arduino.h"
#ifdef USB_SERIAL
usb_serial_class Serial;
#endif
int main(void) {
init();
delay(1);
#if defined(USBCON)
USBDevice.attach();
#endif
pinMode(13, OUTPUT);
for (;;) {
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
delay(950);
}
}
- 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)
- "ArduinoDueCore/src/core"
- "ArduinoDueCore/src/lib/libsam"
- "ArduinoDueCore/src/lib/CMSIS/Device/ATMEL"
- "ArduinoDueCore/src/lib/variants/arduino_due_x"
- "ArduinoDueCore/src/lib/CMSIS/CMSIS/Include"
- "ArduinoDueCore/src/lib/CMSIS/Device/ATMEL/sam3xa/include"
- 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.
Good Luck !
Nassa.