PDA

View Full Version : Anyone using Eclipse for development?



JBeale
11-30-2012, 08:59 PM
This is not really specific to Teensy, but maybe someone here can help...
I've been using the basic Arduino environment with Arduinos, and now with Teensy. I've heard about Eclipse, so I decided to try it out, using this tutorial:
http://horrorcoding.altervista.org/arduino-development-with-eclipse-a-step-by-step-tutorial-to-the-basic-setup/

I set up the paths as suggested for a basic Arduino (ATmega328P at 16 MHz) using the "stock arduino" side of Paul's Arduino 1.0.2 / Teensy 3 Beta 8 distribution. So I was setting up a lot of paths in Eclipse like
C:\Program Files\arduino102b8\hardware\tools\avr\bin
C:\Program Files\arduino102b8\hardware\tools\avr\utils\bin
C:\Program Files\arduino102b8\hardware\tools\avr\avr\include
C:\Program Files\arduino102b8\hardware\arduino\variants\stand ard
...and importing all the files (except for main.ccp) in
C:\Program Files\arduino102b8\hardware\arduino\cores\arduino

The above tutorial then says to build the basic "ArduinoCore" library, which in my case fails with many errors like IPAddress.cpp : '_address' was not declared in this scope

I realize this is tangential to Teensy development. I was just wondering if anyone here knows of a working tutorial for setting up Eclipse for Arduino, or if I should have expected the one I was using to work? I suppose the logical first step would be to restart with a fresh, stock, non-Teensy Arduino 1.0.2 tree and go from there.

Avenue33
11-30-2012, 10:04 PM
Have you had a look and the Arduino plug-in for Eclipse?

Learn more at http://www.baeyens.it/eclipse/.

JBeale
11-30-2012, 11:08 PM
Thank you, yes that one does work! Much easier to configure, as I only had to type in one directory, instead of about six.

Jantje
12-01-2012, 11:15 AM
Have you had a look and the Arduino plug-in for Eclipse?

Learn more at http://www.baeyens.it/eclipse/.
Hi
I have been working on Teensy support some time ago. But due to changes like Teensy3 and Arduino 2.5 IDE I decided to wait a while till things cooled down to decide on which direction to take.
Paul informed me that teensy3 is still Arduino 1.X compatible. As usual great work from Paul. So I'll look into the changes for Teensy3 he reported to me in the coming weeks.
There is a download place where you can download an alfa version tested by 3 people which has support for Teensy2. It needs some extra setup which is not (good) documented.
If there is interest for this version reply to this post and I'll give post the location and instructions on getting it to work with Teensy2.
Best regards
Jantje

Nassarane
12-08-2012, 08:48 PM
Hello,
For those who do not want to wait the arrival of Santa Claus, here's how to use Eclipse with the Teensy 3.0 Board.
There may be things to fix, but it works.
If you have any problems with this procedure, please let me know.

Sorry for my bad english ... I'm French!

Thanks.
Teensy 3.0 and Eclipse installation on Windows

#1. You must first download the following elements:
- Arduino IDE for Teensy 3.0 Beta 8 provided by Paul : http://forum.pjrc.com/threads/430-Teensy-3-0-quot-beta8-quot-Software
- Elicpe IDE for C/C++ Developers Juno SR1 : http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr1
- GNU ARM Eclipse Plug-in : http://sourceforge.net/projects/gnuarmeclipse/files/Current%20Releases/0.5.4/

#2. Installation:
- Unzip Arduino IDE for Teensy, for example : “C:\Teensy3\arduino-1.0.2”
- Unzip Eclipse IDE for C/C++, for example : “C:\Teensy3\eclipse”
- Add Teensy tool chain path in the Windows Path : “C:\Teensy3\arduino-1.0.2\hardware\tools\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 other 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”

#4. Create the TeensyCore3 library Project:
- In Eclipse, create a project, click on menu “File/New/C++ Project”.
- In the dialog box “C++ Project”, type the Project Name : “TeensyCore3”
- 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 (Yagarto)”.
- 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” 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 all files in the “C:\Teensy3\arduino-1.0.2\hardware\teensy\cores\teensy3 \” folder and copy to the “src” folder of the “TeensyCore3” project.
- In the “src” folder remove “Makefile”, “main.cpp”, “mk20dx128.c” files.
- In Eclipse, click on the project with right mouse button, click on the “Refresh” item.
- The “src” folder appears with its files and the sub folder “avr”…

#5. TeensyCore3 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, verify than “Target Processor” property the Processor selected is “cortex-m4” and the “Thumb” checkbox are enabled.
- Select “ARM Yagarto Windows GCC C Compiler/Preprocessor”, in the “Defined symbols” area, add the following items : F_CPU=48000000, USB_SERIAL, LAYOUT_US_ENGLISH
- Select “ARM Yagarto Windows GCC C Compiler/Directories”, in the “Include paths” area, add “src” folder using the “Workspace…” button.
- Same setting for “ARM Yagarto Windows GCC C++ Compiler/Preprocessor” and “ARM Yagarto Windows GCC C Compiler/Directories”, and click on “OK” button.
- To build the TeensyCore3 library, click on the project with right mouse button, click on the “Build Project” item. In the “Release” folder, the “libTeensyCore3.a” file has been generated.

#6. Create your Teensy 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 (Yagarto)”.
- 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 “min.cpp”, “mk20dx128.c” and “mk20dx128.ld” files in the “C:\Teensy3\arduino-1.0.2\hardware\teensy\cores\teensy3 \” 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, verify than “Target Processor” property the Processor selected is “cortex-m4” and the “Thumb” checkbox are enabled.
- Select “ARM Yagarto Windows GCC C Compiler/Preprocessor”, in the “Defined symbols” area, add the following items : F_CPU=48000000, USB_SERIAL, LAYOUT_US_ENGLISH
- Select “ARM Yagarto Windows GCC C Compiler/Directories”, in the “Include paths” area, add “src” folder of “TeensyCore3” using the “Workspace…” button.
- Same setting for “ARM Yagarto Windows GCC C++ Compiler/Preprocessor” and “ARM Yagarto Windows GCC C Compiler/Directories”, and click on “OK” button.
- Select “ARM Yagarto Windows GCC C++ Linker/General”, in the “Script file” field, click on the “Browse…” and select “mk20dx128.ld” file in the “src” folder of MyProject.
- Select “ARM Yagarto Windows GCC C++ Linker/Library”, in the “Libraries” area, add “TeensyCore3” and in “Library search path” area, add the path where the TeensyCore3 library is located, use the “Workspace…” button and select the “Release” folder of TeensyCore3 library project.
- Select “Project References”, in the “Project references for ‘MyProject’” enable the “TeensyCore3” checkbox.
- Temporary, to avoid a crash, Select “ARM Yagarto Windows GCC Create Listing”, in the “Command” field, type “echo” to replace the default command, and click on “OK” button.
- 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.

#8. Teensy program loader settings:
- In Eclipse, on the menu “Run/External Tools/External Tools Configurations…”
- In the dialog box select on the “Program” item in the tree area, and click on the “New launch configuration” icon.
- In the “Name” field, type “Teensy 3.0”.
- In the “Main” tab, in the “Location” field, type the path : “C:/Teensy3/arduino-1.0.2/hardware/tools/teensy_post_compile.exe”.
- In the “Working Directory” field, type the path : “C:\ Teensy3\arduino-1.0.2\hardware\tools”
- In the “Arguments” field, type : “-file=${project_name} -path=${project_loc}\Release -tools=C:/Teensy3/arduino-1.0.2/hardware/tools”
- In the “Common” tab, enable the checkbox “External Tools”, and click on the “Apply” button.

#9. Upload program to the Teensy board:
- In Eclipse, select your project, “MyProject”.
- Click on the button “Run Teensy 3.0” of the tools bar to start loader provided by Paul. For example : http://docs.joomla.org/images/0/0f/Screenshot_eclipse_external_tools3_20090122.png
- Push the reset button of the board to upload your program.

Good luck !

Nassa.

Nassarane
12-10-2012, 07:26 PM
Hello,

Here is a new version of the installation manual for the Eclipse Board Teensy 3.0.
I added the installation of the Serial Terminal.

Teensy 3.0 and Eclipse installation on Windows

Introduction
This manual is written for Arduino IDE for Teensy beta 8 and beta 9 provided by Paul.
This manual will allow you install an Eclipse environment to edit and compile your programs but also to communicate with your Teensy 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:
- Arduino IDE for Teensy 3.0 Beta 8 provided by Paul : http://forum.pjrc.com/threads/430-Teensy-3-0-quot-beta8-quot-Software
- Elicpe IDE for C/C++ Developers Juno SR1 32 bits : http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/junosr1
- GNU ARM Eclipse Plug-in : http://sourceforge.net/projects/gnuarmeclipse/files/Current%20Releases/0.5.4/
- TM-terminal 3.4.1 : http://www.eclipse.org/downloads/download.php?file=/tm/downloads/drops/R-3.4.1-201209191030/TM-terminal-3.4.1.zip

#2. Installation:
- Unzip Arduino IDE for Teensy, for example : “C:\Teensy3\arduino-1.0.2”.
- Unzip Eclipse IDE for C/C++, for example : “C:\Teensy3\eclipse”.
- Add Teensy tool chain path in the Windows Path : “C:\Teensy3\arduino-1.0.2\hardware\tools\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:\Teensy3\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 TeensyCore3 library Project:
- In Eclipse, create a project, click on menu “File/New/C++ Project”.
- In the dialog box “C++ Project”, type the Project Name : “TeensyCore3”
- 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 (Yagarto)”.
- 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” 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 all files in the “C:\Teensy3\arduino-1.0.2\hardware\teensy\cores\teensy3 \” folder and copy to the “src” folder of the “TeensyCore3” project.
- In the “src” folder remove “Makefile”, “main.cpp”, “mk20dx128.c” files.
- In Eclipse, click on the project with right mouse button, click on the “Refresh” item.
- The “src” folder appears with its files and the sub folder “avr”…

#5. TeensyCore3 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, verify than “Target Processor” property the Processor selected is “cortex-m4” and the “Thumb” checkbox are enabled.
- Select “ARM Yagarto Windows GCC C Compiler/Preprocessor”, in the “Defined symbols” area, add the following items : F_CPU=48000000, USB_SERIAL, LAYOUT_US_ENGLISH
- Select “ARM Yagarto Windows GCC C Compiler/Directories”, in the “Include paths” area, add “src” folder using the “Workspace…” button.
- Same setting for “ARM Yagarto Windows GCC C++ Compiler/Preprocessor” and “ARM Yagarto Windows GCC C Compiler/Directories”, and click on “OK” button.
- To build the TeensyCore3 library, click on the project with right mouse button, click on the “Build Project” item. In the “Release” folder, the “libTeensyCore3.a” file has been generated.

#6. Create your Teensy 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 (Yagarto)”.
- 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”, “mk20dx128.c” and “mk20dx128.ld” files in the “C:\Teensy3\arduino-1.0.2\hardware\teensy\cores\teensy3 \” 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, verify than “Target Processor” property the Processor selected is “cortex-m4” and the “Thumb” checkbox are enabled.
- Select “ARM Yagarto Windows GCC C Compiler/Preprocessor”, in the “Defined symbols” area, adds the following items: F_CPU=48000000, USB_SERIAL, LAYOUT_US_ENGLISH.
- Select “ARM Yagarto Windows GCC C Compiler/Directories”, in the “Include paths” area, add “src” folder of “TeensyCore3” using the “Workspace…” button.
- Same setting for “ARM Yagarto Windows GCC C++ Compiler/Preprocessor” and “ARM Yagarto Windows GCC C Compiler/Directories”, and click on “OK” button.
- Select “ARM Yagarto Windows GCC C++ Linker/General”, in the “Script file” field, clicks on the “Browse…” and select “mk20dx128.ld” file in the “src” folder of MyProject.
- Select “ARM Yagarto Windows GCC C++ Linker/Library”, in the “Libraries” area, adds “TeensyCore3” and in “Library search path” area, adds the path where the TeensyCore3 library is located, use the “Workspace…” button and select the “Release” folder of TeensyCore3 library project.
- Select “Project References”, in the “Project references for ‘MyProject’” enable the “TeensyCore3” checkbox.
- Temporary, to avoid a crash, Select “ARM Yagarto Windows GCC Create Listing”, in the “Command” field, type “echo” to replace the default command, and click on “OK” button.
- 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.

#8. Teensy program loader settings:
- In Eclipse, on the menu “Run/External Tools/External Tools Configurations…”
- In the dialog box select on the “Program” item in the tree area, and click on the “New launch configuration” icon.
- In the “Name” field, type “Teensy 3.0”.
- In the “Main” tab, in the “Location” field, type the path : “C:/Teensy3/arduino-1.0.2/hardware/tools/teensy_post_compile.exe”.
- In the “Working Directory” field, type the path : “C:\ Teensy3\arduino-1.0.2\hardware\tools”
- In the “Arguments” field, type : “-file=${project_name} -path=${project_loc}\Release -tools=C:/Teensy3/arduino-1.0.2/hardware/tools”
- In the “Common” tab, enable the checkbox “External Tools”, and click on the “Apply” button.

#9. Upload program to the Teensy board:
- In Eclipse, select your project, “MyProject”.
- Click on the button “Run Teensy 3.0” of the tools bar to start loader provided by Paul. For example : http://ekawas.blogspot.fr/2009/04/google-app-engine-eclipse.html
- Push the reset button of the board to upload your program.

#10. Connect the terminal to the Teensy board:
- To test the terminal, copy/paste the “Hello Word” example program in the “C:\ARM\arduino-1.0.2\examples\Teensy\Tutorial3\HelloSerialMonitor \HelloSerialMonitor.pde” file :


#include "WProgram.h"

#ifdef USB_SERIAL
usb_serial_class Serial;
#endif

int main(void) {

Serial.begin(38400);
pinMode(13, OUTPUT);

for (;;) {
digitalWrite(13, HIGH);
Serial.println("Hello World");
delay(50);
digitalWrite(13, LOW);
delay(950);
}
}

- Compile and upload this program.
- 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 “Teensy 3.0” 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.



Good Luck !

Nassa.

Nassarane
12-17-2012, 03:35 PM
Hi,

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:\Teensy3\arduino-1.0.2\hardware\tools\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.

Good luck

Nassa.

cTn
01-06-2013, 07:12 PM
Hi Nassa, i was wondering, if you would be willing to write a similar tutorial for compiling outside the arduino IDE, but in Notepad++
I find Eclipse rather confusing, "overkill" for my needs, but i would really like to compile / upload directly from Notepad++

linuxgeek
01-23-2013, 05:58 AM
Thanks Nassa. Just got my Teensy 3.0 and was hoping to find a tut to get it working with Eclipse.

jubeor
01-26-2013, 12:30 AM
Thanks so much, I was looking exactly for that. This is my first entry for a long time in a forum and I think is going to be a nice way with you all.

Note for Paul: I was amazed by the size of this little wonder :D

jubeor
01-26-2013, 07:25 PM
Hi Nassarane,

I'm taking your guide, that is very helpful, to start stepping into the teensy word but I find a problem. I'm sure that it's only something that I passed over.

When I get into the 5th step, in the moment of building I get the an error message that says: 'Program "make" not found in PATH'

Well, I get this in the console:


20:06:27 **** Incremental Build of configuration Release for project TeensyCore3 ****
make all
Cannot run program "make": Launching failed

Error: Program "make" not found in PATH
PATH=[C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\ System32\Wbem;C:\Windows\System32\WindowsPowerShel l\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\MATLAB\R2008a\bin;C:\Program Files\MATLAB\R2008a\bin\win64;C:\Program Files (x86)\SMLNJ\bin\;D:\Teensy3\arduino-1.0.3-teensy3-beta10-windows\arduino-1.0.3\hardware\tools\arm-none-eabi\bin;C:\Program Files (x86)\Java\jre7\bin]

20:06:28 Build Finished (took 298ms)

I know that this is a newbie question, but... Is the step where I am :)

jubeor
01-26-2013, 11:56 PM
Nice, I just realice what the problem is. The only thing that fail is my own eclipse. I'll explain myself. Literaly, the error said that there is no make in the locations the PATH point to and that is true.


In software development, Make is a utility that automatically builds executable programs and libraries from source code by reading files called makefiles which specify how to derive the target program. http://en.wikipedia.org/wiki/Make_(software)

So basically for solving that while I was taking a look in propieties/C/C++ Build: I elect Internal Builder.

After that I'm ready to jump to the step 6.

;)

jubeor
01-27-2013, 02:06 AM
Hi again guys,

This is my last problem tonight:

After creating a new project and linked everything at the time of build Ecplipse gives me those problems which I'm surprised about:



Description Resource Path Location Type
The type 'HardwareSerial' must implement the inherited pure virtual method 'Print::write' HardwareSerial.h /TeensyCore3/src line 68 Code Analysis Problem
The type 'HardwareSerial3' must implement the inherited pure virtual method 'Print::write' HardwareSerial.h /TeensyCore3/src line 98 Code Analysis Problem
The type 'HardwareSerial2' must implement the inherited pure virtual method 'Print::write' HardwareSerial.h /TeensyCore3/src line 83 Code Analysis Problem


Any Idea? I don't understand what's going on here :/

I know that I can just start working with arduino's interface, but I'm triying to get out of this. I want to use the cortex-m4 for signal processing for some little applications.

Roger Parkinson
03-20-2013, 02:22 AM
I just worked through Nassa's guide and it works for me.
A couple of changes to share though because I'm running on Ubuntu I used ARM Sourcery rather than Yagarto.
Also I'm still using Indigo so the terminal didn't install. But that's easily worked around using putty from a term window.
(I'll take a look at Juno tomorrow).
Anyway, well done Nassa
(and well done Paul, of course).

Jantje
05-24-2013, 03:30 PM
I'm looking for alfa testers for the V2.1 version of the arduino eclipse plugin. This version supports Teensy 3 (with some aditional configuration - read download and unzip)
Read more at http://blog.baeyens.it/#post5
Best regards
Jantje

linuxgeek
05-24-2013, 07:01 PM
I'm interested. I emailed you.

Headroom
05-25-2013, 02:17 AM
Last year at the beginning of May I had already been working with the Teensy++2 for a while but got frustrated with the Arduino IDE. I searched the Arduino Forum for alternatives to the Arduino IDE and found the Arduino Eclipse plugin.
Installation on my iMac was easy and in no time I had an Arduino UNO running. Sweet!
Of course there was no menu item for a Teensy++2 in the project setup, so I wrote an email to Jantje and to Paul and asked if they could imagine making this work for the Teensy++2 and off they went at high speed. After some relatively easy to following configuration steps I was programming a Teensy++2 two weeks later.

Then the Teensy3 arrived and Arduino 1.5.x entered the scene and things got a little more complicated. However, Paul and Jantje did not stop and continued to work through difficult and frustrating issues. However, with relatively minor copying of some files and a little paths renaming I can now also program a Teensy3 through the Arduino Eclipse plugin.

A big kudos from me to Jantje and Paul for making this work!

stevech
06-16-2013, 06:43 AM
based on Headroom's success for Teensy3, are there instructions for setup of Eclipse (or emIDE or code::blocks) or even Programmer's Notepad, for Teensy3?

Headroom
06-16-2013, 01:21 PM
If you want to be a alfa tester for the new 2.1 version of the Arduino Eclipse plugin, you can write Jantje an email (http://blog.baeyens.it/#category1).

I got it to work with the 2.0 version but did not write down every step. I will have to try a fresh Eclipse and Arduino Installation with the new 2.1 alfa of the Arduino Eclipse plugin and write down within the next week and will post it here.

stevech
06-16-2013, 07:26 PM
thanks... I'll be watching for how-to's.
And I emailed re beta testing 2.1.

Jantje
07-02-2013, 01:20 AM
Santa claus is early this year ;-)
I released V 2.1.0.4 of my arduino eclipse plugin. It has Teensy3 support.
Generic installation instructions can be found at http://eclipse.baeyens.it/Install.html
For this version you need Eclipse Juno; Arduino IDE 1.5.2 beta and Arduino eclipse plugin 2.1.0.4 you can install in eclipse with the url http://www.baeyens.it/eclipse/V2
For teensy to work download and unzip following file in hardware folder of the Arduino IDE 1.5.2 (make sure the files are allowed to execute) http://baeyens.it/eclipse/download/teensy%201.15%20mac%201.14.zip (http://baeyens.it/eclipse/download/teensy%201.15%20mac%201.14.zip>)
Best regards
Jantje

chow
08-14-2013, 08:14 PM
For those looking to get Nassarane's instructions working on a Windows7 64-bit environment. This is what worked for me (note I used F_CPU=96000000 to overclock):

I have been looking for an alternative environment and I seem to have this Eclipse-based method working:
Based on this post - http://forum.pjrc.com/threads/1474-Anyone-using-Eclipse-for-development?p=6203&viewfull=1#post6203
Modified for the specific build that worked for me (on Windows7 - 64-bit)
using Teensyduino & Loader v1.15 and Arduino IDE v1.0.5

Teensy 3.0 and Eclipse installation on Windows

#1. You must first download the following elements:
- Arduino IDE - http://www.arduino.cc/en/Main/Software
- Teensyduino - http://www.pjrc.com/teensy/td_download.html
- Eclipse Standard, (use 32-bit version !!! as RXTX is not available for 64-bit platform) - http://www.eclipse.org/downloads/
- Cygwin (use 32-bit version !!! for compatability with eclipse) - http://cygwin.com/setup-x86.exe
- Java 7 JRE (x86) - http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html

#2. Installation:
- Install Java 7 JRE
- Install Cygwin
- Install the Arduino IDE, changing the target location to "C:\Arduino".
If using an archive rather than the installer then unzip to "C:\" and change uncompressed folder to be "C:\Arduino"
- Install Teensyduino
- Unzip Eclipse IDE to “C:\”
Create a desktop shortcut named "Eclipse" pointed to "C:\eclipse\eclipse.exe"
- Start Eclipse
- Help->Install New Software->Add:
Name: GNU ARM
Location: http://gnuarmeclipse.sourceforge.net/updates
Press OK
Select "CDT GNU Cross Development Tools"
Press Next and complete the install
- Help->Install New Software->Add:
Name: RXTX
Location: RXTX - http://rxtx.qbang.org/eclipse/
Press OK
Select "RXTX 2.1-7r4"
Press Next and complete the install
- Help->Install New Software->Add:
Name: TM Terminal
Location: http://download.eclipse.org/tm/updates/3.5/
Press OK
Expand "TM and RSE 3.5 Main Features" and select "Target Management Terminal"
Press Next and complete the install
- (Optional) Help->Eclipse Marketplace
Find: Subclipse
Click Install on the entry named exactly: Subclipse
Confirm and complete the install
(If unable to install, temporarily disable Anti-Virus and retry the install)

#3. Eclipse Configuration:
- 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\hardware\tools\arm-none-eabi\bin;C:\cygwin\bin;” infront of the existing path values, and click on the “OK” button.
- In the “Preferences/Environment” click on the “OK” button.
- restart Eclipse

#4. Create the TeensyCore3 library Project:
- In Eclipse, create a project, click on menu “File/New/C++ Project”.
- In the dialog box “C++ Project”, type the Project Name : “TeensyCore3”
- 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 (Yagarto)”.
- 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” 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 all files in the “C:\Arduino\hardware\teensy\cores\teensy3\” folder and copy to the “src” folder of the “TeensyCore3” project.
- In the “src” folder remove “Makefile”, “main.cpp”, “mk20dx128.c” files.
- In Eclipse, click on the project with right mouse button, click on the “Refresh” item.
- The “src” folder appears with its files and the sub folder “avr”…

#5. TeensyCore3 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, verify than “Target Processor” property the Processor selected is “cortex-m4” and the “Thumb” checkbox are enabled.
- Select “ARM Yagarto Windows GCC C Compiler/Preprocessor”
in the “Defined symbols” area, add: F_CPU=96000000
in the “Defined symbols” area, add: USB_SERIAL
in the “Defined symbols” area, add: LAYOUT_US_ENGLISH
- Select “ARM Yagarto Windows GCC C Compiler/Directories”, in the “Include paths” area, add “src” folder using the “Workspace…” button.
- Same setting for “ARM Yagarto Windows GCC C++ Compiler/Preprocessor” and “ARM Yagarto Windows GCC C Compiler/Directories”, and click on “OK” button.
- To build the TeensyCore3 library, click on the project with right mouse button, click on the “Build Project” item. In the “Release” folder, the “libTeensyCore3.a” file has been generated.

#6. Create your Teensy 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 (Yagarto)”.
- 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”, “mk20dx128.c” and “mk20dx128.ld” files in the “C:\Arduino\hardware\teensy\cores\teensy3\” 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.
- Modify main.cpp:
#include <WProgram.h>

extern "C" int main(void)
{
setup();

while (1) {
loop();
yield();
}
}

void setup()
{
}

void loop()
{
}

#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, verify than “Target Processor” property the Processor selected is “cortex-m4” and the “Thumb” checkbox are enabled.
- Select “ARM Yagarto Windows GCC C Compiler/Preprocessor”
in the “Defined symbols” area, add: F_CPU=96000000
in the “Defined symbols” area, add: USB_SERIAL
in the “Defined symbols” area, add: LAYOUT_US_ENGLISH
- Select “ARM Yagarto Windows GCC C Compiler/Directories”, in the “Include paths” area, add “src” folder of “TeensyCore3” using the “Workspace…” button.
- Same setting for “ARM Yagarto Windows GCC C++ Compiler/Preprocessor” and “ARM Yagarto Windows GCC C Compiler/Directories”, and click on “OK” button.
- Select “ARM Yagarto Windows GCC C++ Linker/General”, in the “Script file” field, clicks on the “Browse…” and select “mk20dx128.ld” file in the “src” folder of MyProject.
- Select “ARM Yagarto Windows GCC C++ Linker/Library”
in the “Libraries” area, add “TeensyCore3”
in “Library search path” area, add the path where the TeensyCore3 library is located, use the “Workspace…” button and select the “Release” folder of TeensyCore3 library project.
- Select “Project References”, in the “Project references for ‘MyProject’” enable the “TeensyCore3” 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.

#8. Teensy program loader settings:
- In Eclipse, on the menu “Run/External Tools/External Tools Configurations…”
- In the dialog box select on the “Program” item in the tree area, and click on the “New launch configuration” icon.
- In the “Name” field, type “Teensy 3.0”.
- In the “Main” tab, in the “Location” field, type the path : “C:/Arduino/hardware/tools/teensy_post_compile.exe”.
- In the “Working Directory” field, type the path : “C:\Arduino\hardware\tools”
- In the “Arguments” field, type : “-file=${project_name} -path=${project_loc}\Release -tools=C:/Arduino/hardware/tools”
- In the “Common” tab, enable the checkbox “External Tools”, and click on the “Apply” button.

#9. Upload program to the Teensy board:
- In Eclipse, select your project, “MyProject”.
- Click on the button “Run Teensy 3.0” of the tools bar to start loader provided by Paul
- Push the reset button of the board to upload your program.
- The Teensy LED should start blinking

#10. Connect the terminal to the Teensy board:
- To test the terminal, copy/paste the setup() and loop() functions of “Hello Word” example program in the “C:\Arduino\examples\Teensy\Tutorial3\HelloSerialM onitor\HelloSerialMonitor.pde” (overwriting the existing empty functions)
- main.cpp should then look like this:

Code:
#include <WProgram.h>

extern "C" int main(void)
{
setup();

while (1) {
loop();
yield();
}
}

void setup()
{
Serial.begin(38400);
pinMode(13, OUTPUT);
}

void loop()
{
digitalWrite(13, HIGH);
Serial.println("Hello World");
delay(50);
digitalWrite(13, LOW);
delay(950);
}

- Compile and upload this program.
- 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 “Teensy 3.0” 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.

stevech
08-14-2013, 08:36 PM
I've been using Eclipse for Teensy on WIn 7 64 bit.. there was a simpler process posted.

chow
08-14-2013, 08:55 PM
I've been using Eclipse for Teensy on WIn 7 64 bit.. there was a simpler process posted.

Some people may prefer this process. I am not advocating one over the other. Only that I have this process working. Those who wish to use the plugin are free to go do that.

stevech
08-15-2013, 12:21 AM
thank you very much for taking the time to upload the instructions.
Very helpful.

Jantje
01-19-2014, 07:32 PM
V 2.2 of the plugin has arrived.
We now have a scope like functionality.
Coooool
Best regards
Jantje

neilh20
02-20-2014, 09:04 PM
Thankyou Nassarane for your guide for your post http://forum.pjrc.com/threads/1474-A...ull=1#post6203.
Absolutely excellent for getting going.
Edit: I did like the sound of the Arduino Eclipse Plugin by Jantje integrated with Eclipse Juno and requiring Arduino IDE 1.5.2 - but as I've already got Eclipse Kepler SR1, I thought I should try and keep the number of permutations low as possible by sticking with IDE Teensy 1.18 using Arduino 1.0.5

I've got a few issues come up, I'm wondering if anybody with some deep ARM compiler knowledge can point me at something to look at.

I've got the Teensy31 board (very nice) and on a Win8 portable and got it downloading OK with the standard Arduino 1.0 toolchain
I have Eclipse Kepler SR1 from another project using the MK20 (and Eclipse code editor is so nice...) thought I'd follow your instructions for a TeensyCore3 library and myProject(called remMonPrj).
I've removed the other projects references in PATH and made sure it strictly references the PJRC toos in c:/program files/arduino/hardware/tools/arm-none-eabi/bin

I've got the the Teensy31 so making modifications for the processor memory using mk20dx256

Basically its worked for the compiling - with a number of issues resolved due to Kepler variations - but now stumped on a linker error.

It looks like some arm related undefined references to _kill_r and _getpid_r

make all
'Building target: remMonPrj.elf'
'Invoking: Cross ARM C++ Linker'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mthumb-interwork -DF_CPU=48000000 -D__MK20DX256__ -DUSB_SERIAL -DLAYOUT_US_ENGLISH -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g -T ../src/mk20dx256.ld -Xlinker --gc-sections -L"C:\Users\neilh77\n\c\w\teensy3core\Release" -Wl,-Map,"remMonPrj.map" -o "remMonPrj.elf" ./src/main.o ./src/mk20dx128.o -lTeensyCore3
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/bin/ld.exe: section .ARM.extab loaded at [00003080,000030af] overlaps section .data loaded at [00003080,0000362b]
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-signalr.o): In function `_kill_r':
signalr.c:(.text+0x14): undefined reference to `_kill'
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-signalr.o): In function `_getpid_r':
signalr.c:(.text+0x28): undefined reference to `_getpid'
collect2.exe: error: ld returned 1 exit status

I've tried adding in libraries gcc and gcov from "C:\Program Files\Arduino\hardware\tools\arm-none-eabi\lib\gcc\arm-none-eabi\4.7.2\thumb2"

if I add in stubs in mk20dx128.c - it solves the thumb2 issue but not the .ARM.extab
int _kill(int pid, int sig) {
/*errno = EINVAL; */
return (-1);
}

int _getpid() { return 1;}

Another wrinkle just in case it has some bearing,
The Eclipse Kepler New "C++ Project" had extra linker flags filled in with --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lc -lm -lrdimon -Wl,--end-group
which couldn't be found - and its something to do with startup so I've removed it on the assumption that it was handled by the teensy3 startup mk20dx128.c

So .. just in case I've repeated the above linker output with the Verbose flag turned on (C/C++ Build - settings - Tool Settings - C++ Linker - Miscellaneous )
I don't think it adds much extra value
12:33:49 **** Incremental Build of configuration Release for project remMonPrj ****
make all
'Building target: remMonPrj.elf'
'Invoking: Cross ARM C++ Linker'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mthumb-interwork -DF_CPU=48000000 -D__MK20DX256__ -DUSB_SERIAL -DLAYOUT_US_ENGLISH -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g -T ../src/mk20dx256.ld -Xlinker --gc-sections -L"C:\Users\neilh77\n\c\w\teensy3core\Release" -Wl,-Map,"remMonPrj.map" -v -o "remMonPrj.elf" ./src/main.o ./src/mk20dx128.o -lTeensyCore3
Using built-in specs.
COLLECT_GCC=arm-none-eabi-g++
COLLECT_LTO_WRAPPER=c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../libexec/gcc/arm-none-eabi/4.7.2/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /home/paul/arm/workdir/gcc-4.7-2012.09/configure --prefix=/usr/local --target=arm-none-eabi --build=x86_64-unknown-linux-gnu --host=i586-mingw32msvc --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --with-specs='%{save-temps: -fverbose-asm} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --disable-shared --enable-lto --with-newlib --with-pkgversion='PJRC Build of GNU Toolchain from CodeSourcery' --with-bugurl=http://forum.pjrc.com/ --disable-nls --with-headers=yes --with-sysroot=/usr/local/arm-none-eabi --with-build-sysroot=/home/paul/arm/arm-none-eabi/arm-none-eabi --with-gmp=/home/paul/arm/staticlib --with-mpfr=/home/paul/arm/staticlib --with-mpc=/home/paul/arm/staticlib --with-ppl=/home/paul/arm/staticlib --with-host-libstdcxx='-lstdc++ -lsupc++ -lm' --with-cloog=/home/paul/arm/staticlib --with-libelf=/home/paul/arm/staticlib --disable-libgomp --disable-libitm --enable-poison-system-directories --with-build-time-tools=/home/paul/arm/arm-none-eabi/arm-none-eabi/bin
Thread model: single
gcc version 4.7.2 (PJRC Build of GNU Toolchain from CodeSourcery)
COMPILER_PATH=c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../libexec/gcc/arm-none-eabi/4.7.2/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../libexec/gcc/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb2/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/thumb2/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../arm-none-eabi/lib/thumb2/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/;c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-mcpu=cortex-m4' '-mthumb' '-mthumb-interwork' '-D' 'F_CPU=48000000' '-D' '__MK20DX256__' '-D' 'USB_SERIAL' '-D' 'LAYOUT_US_ENGLISH' '-Os' '-fmessage-length=0' '-fsigned-char' '-ffunction-sections' '-fdata-sections' '-Wall' '-g' '-T' '../src/mk20dx256.ld' '-LC:\Users\neilh77\n\c\w\teensy3core\Release' '-v' '-o' 'remMonPrj.elf'
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../libexec/gcc/arm-none-eabi/4.7.2/collect2.exe --sysroot=c:\program files\arduino\hardware\tools\arm-none-eabi\bin\../arm-none-eabi -X -o remMonPrj.elf c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb2/crti.o c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb2/crtbegin.o -LC:\Users\neilh77\n\c\w\teensy3core\Release -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb2 -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/thumb2 -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../arm-none-eabi/lib/thumb2 -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2 -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib -Lc:/program files/arduino/hardware/tools/arm-none-eabi/bin/../arm-none-eabi/lib --gc-sections -Map remMonPrj.map ./src/main.o ./src/mk20dx128.o -lTeensyCore3 -lstdc++ -lm --start-group -lgcc -lc --end-group c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb2/crtend.o c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb2/crtn.o -T ../src/mk20dx256.ld
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/bin/ld.exe: section .ARM.extab loaded at [00003080,000030af] overlaps section .data loaded at [00003080,0000362b]
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-signalr.o): In function `_kill_r':
signalr.c:(.text+0x14): undefined reference to `_kill'
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-signalr.o): In function `_getpid_r':
signalr.c:(.text+0x28): undefined reference to `_getpid'
collect2.exe: error: ld returned 1 exit status
make: *** [remMonPrj.elf] Error 1

Headroom
02-20-2014, 09:45 PM
You could make your life much easier by installing the Arduino Eclipse plugin. Installation instructions are on one of my blogs at trippylighting.com following the obvious menu entries.

Edit: who is Nassarane ?

neilh20
02-21-2014, 12:39 AM
Hello Headroom - I just added some info to my previous post.
I've just read up on your blog - http://trippylighting.com/teensy-arduino-ect/arduino-eclipse-plugin/arduino-eclipse-ide-and-plugin-v2-2-installation/ - thankyou for putting up the detail instructions.
(I had only seen the earlier Arduino Eclipse details)

The Arduino Eclipse plugin sounds interesting, however Eclipse standard has so many levels that I wanted the simplest and most standard for a simple stable development environment (Kepler SR1?), which seems to me to be Teensy31/Arduino1.0.5.
So I haven't figure out exactly what an Eclipse Arduino Plugin in does on top of the other CDT plugins, and how stable the whole tool chain is. Sorry don't see any details one way or the other.
Maybe I'll tryit on an Ubuntu machine with a fresh install as per your instructions.

So now I have a build Teensy31/mk20dx256.ld with some overlapping memory - so trying to increment the tools forward, learn to toddle, and then actually do some Teensy31/MK20 programming.

Cheers
Neil

neilh20
02-22-2014, 01:24 AM
Well here is some info on "getting lost in the weeds" and I can figure out where I've gone wrong. Any insights much appreciated.

Looking at the mk20dx256.ld these are two sections cmds that seem like they should be directing into different memory regions


.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
__exidx_end = .;
} > FLASH
_etext = .;

.usbstuff ...: { } > RAM

.data : AT (_etext) {
. = ALIGN(4);
_sdata = .;
*(.data*)
. = ALIGN(4);
_edata = .;
} > RAM

and the ld says they are overlapping. Which just doesn't seem to be what the commands are telling it to do.
ld.exe: section .ARM.extab loaded at [00003080,000030af] overlaps section .data loaded at [00003080,0000362b]

So in Eclipse Kepler I created a new workspace for core/Teensy3 with a new C++ Project and hello world C++, and copied in cores/Teensy3 and built it again.
Now got a similar error, but different values and this funny mangled "HarwareSerial5" of which there is no such thing
ld.exe: section .ARM.extab.text._ZN14HardwareSerial5writeEh loaded at [00012324,0001232f] overlaps section .data loaded at [00012324,0001295b]
Interesting eh, like a hole in the head. I guess somehow I think I've taken a wrong turning somewhere and can't figure out where.

Headroom
02-22-2014, 03:34 AM
The Arduino Eclipse plugin works with Kepler, not just with Juno. Also in case you don't want to mess with your current installation there is an Arduino Eclipse IDE , which bundles Kepler and the Plugin so no separate download and installation are necessary.

Here is the LINK (http://trippylighting.com/teensy-arduino-ect/arduino-eclipse-plugin/installation-of-the-arduino-eclipse-ide-teensyduino-win-7/) to those installation instructions.

It should not take more than 10-15 minutes to install including the download.

I am not denying that there is a great learning experience in what you are doing, but I personally prefer to get on with my projects.

neilh20
02-22-2014, 05:39 AM
Hi Headroom - thanks for link.
Yes I would rather get on with my project - its just making a guess as to what the best methods are and where the trip wires are :).
I do appreciate the help and suggestions :), however I'm cautious as to where Teensy31 is on the issue of using Arduino 1.5.2 - howevever if the end result is upgrading the gcc then that is what I've done going from Teensy3 1.18 with gcc 4.7 to gcc 4.8.3 (2013q4) (BTW a friend using 4.8.3 had some issues with symbols/JTAG )

I'm thankful to report that I've got a working build - for whatever reason and I'm trying a number of options - when I switched gcc to 2013q4 and it worked.
All I did was change on path to the 2013q4 compiler and it linked OK.
Still haven't tried testing it so thats the next stage.
In case its useful for anybody I include some traces I took.
cheers

21:17:01 **** Incremental Build of configuration Release for project remMon **** WORKED
make all
'Building file: ../src/usb_inst.cpp'
'Invoking: Cross ARM C++ Compiler'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -D__MK20DX256__ -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I"C:\Users\neilh77\n\c\w3\remMon\src" -MMD -MP -MF"src/usb_inst.d" -MT"src/usb_inst.d" -c -o "src/usb_inst.o" "../src/usb_inst.cpp"
In file included from ../src/Print.h:38:0,
from ../src/Stream.h:24,
from ../src/HardwareSerial.h:143,
from ../src/WProgram.h:16,
from ../src/usb_inst.cpp:31:
../src/WString.h: In constructor 'String::String(double, unsigned char)':
../src/WString.h:67:72: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
String(double num, unsigned char digits=2) : String((float)num, digits) {}
^
'Finished building: ../src/usb_inst.cpp'

'Building file: ../src/yield.c'
'Invoking: Cross ARM C Compiler'
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -D__MK20DX256__ -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I"C:\Users\neilh77\n\c\w3\remMon\src" -MMD -MP -MF"src/yield.d" -MT"src/yield.d" -c -o "src/yield.o" "../src/yield.c"
'Finished building: ../src/yield.c'
'Building target: remMon.elf'
'Invoking: Cross ARM C++ Linker'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -T ../src/mk20dx256.ld -Xlinker --gc-sections -Wl,-Map,"remMon.map" -v -o "remMon.elf" ./src/HardwareSerial1.o ./src/HardwareSerial2.o ./src/HardwareSerial3.o ./src/IPAddress.o ./src/IntervalTimer.o ./src/Print.o ./src/Stream.o ./src/Tone.o ./src/WMath.o ./src/WString.o ./src/analog.o ./src/avr_emulation.o ./src/eeprom.o ./src/keylayouts.o ./src/main.o ./src/math_helper.o ./src/mk20dx128.o ./src/new.o ./src/nonstd.o ./src/pins_teensy.o ./src/serial1.o ./src/serial2.o ./src/serial3.o ./src/touch.o ./src/usb_desc.o ./src/usb_dev.o ./src/usb_flightsim.o ./src/usb_inst.o ./src/usb_joystick.o ./src/usb_keyboard.o ./src/usb_mem.o ./src/usb_midi.o ./src/usb_mouse.o ./src/usb_rawhid.o ./src/usb_seremu.o ./src/usb_serial.o ./src/yield.o
Using built-in specs.
COLLECT_GCC=arm-none-eabi-g++
COLLECT_LTO_WRAPPER=c:/program\ files/gnu\ tools\ arm\ embedded/4.8\ 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-8-build/src/gcc/configure --build=i686-linux-gnu --host=i586-mingw32 --target=arm-none-eabi --prefix=/home/build/work/GCC-4-8-build/install-mingw --libexecdir=/home/build/work/GCC-4-8-build/install-mingw/lib --infodir=/home/build/work/GCC-4-8-build/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-8-build/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-8-build/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-8-build/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-8-build/install-mingw/arm-none-eabi --with-libiconv-prefix=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-gmp=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-mpfr=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-mpc=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-isl=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-cloog=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-libelf=/home/build/work/GCC-4-8-build/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r
Thread model: single
gcc version 4.8.3 20131129 (release) [ARM/embedded-4_8-branch revision 205641] (GNU Tools for ARM Embedded Processors)
COMPILER_PATH=c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7e-m/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../arm-none-eabi/lib/armv7e-m/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/;c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-mcpu=cortex-m4' '-mthumb' '-O0' '-fmessage-length=0' '-fsigned-char' '-ffunction-sections' '-fdata-sections' '-Wall' '-g3'
'-T' '../src/mk20dx256.ld' '-v'
'-o' 'remMon.elf'
c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/collect2.exe --sysroot=c:\program files\gnu tools arm embedded\4.8 2013q4\bin\../arm-none-eabi -X -o remMon.elf c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7e-m/crti.o c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7e-m/crtbegin.o c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m/crt0.o -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7e-m -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../arm-none-eabi/lib/armv7e-m -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3 -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib -Lc:/program files/gnu tools arm embedded/4.8 2013q4/bin/../arm-none-eabi/lib --gc-sections -Map remMon.map ./src/HardwareSerial1.o ./src/HardwareSerial2.o ./src/HardwareSerial3.o ./src/IPAddress.o ./src/IntervalTimer.o ./src/Print.o ./src/Stream.o ./src/Tone.o ./src/WMath.o ./src/WString.o ./src/analog.o ./src/avr_emulation.o ./src/eeprom.o ./src/keylayouts.o ./src/main.o ./src/math_helper.o ./src/mk20dx128.o ./src/new.o ./src/nonstd.o ./src/pins_teensy.o ./src/serial1.o ./src/serial2.o ./src/serial3.o ./src/touch.o ./src/usb_desc.o ./src/usb_dev.o ./src/usb_flightsim.o ./src/usb_inst.o ./src/usb_joystick.o ./src/usb_keyboard.o ./src/usb_mem.o ./src/usb_midi.o ./src/usb_mouse.o ./src/usb_rawhid.o ./src/usb_seremu.o ./src/usb_serial.o ./src/yield.o -lstdc++ -lm --start-group -lgcc -lg -lc --end-group c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7e-m/crtend.o c:/program files/gnu tools arm embedded/4.8 2013q4/bin/../lib/gcc/arm-none-eabi/4.8.3/armv7e-m/crtn.o -T ../src/mk20dx256.ld
'Finished building target: remMon.elf'
' '
'Invoking: Cross ARM GNU Create Flash Image'
arm-none-eabi-objcopy -O ihex "remMon.elf" "remMon.hex"
'Finished building: remMon.hex'
' '
'Invoking: Cross ARM GNU Print Size'
arm-none-eabi-size --format=berkeley "remMon.elf"
text data bss dec hex filename
76632 2356 4052 83040 14460 remMon.elf
'Finished building: remMon.siz'


21:03:45 **** Incremental Build of configuration Release for project remMon **** FAILED
make all
'Building file: ../src/usb_inst.cpp'
'Invoking: Cross ARM C++ Compiler'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -D__MK20DX256__ -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I"C:\Users\neilh77\n\c\w3\remMon\src" -MMD -MP -MF"src/usb_inst.d" -MT"src/usb_inst.d" -c -o "src/usb_inst.o" "../src/usb_inst.cpp"
In file included from ../src/Print.h:38:0,
from ../src/Stream.h:24,
from ../src/HardwareSerial.h:143,
from ../src/WProgram.h:16,
from ../src/usb_inst.cpp:31:
../src/WString.h: In constructor 'String::String(double, unsigned char)':
../src/WString.h:67:72: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
'Finished building: ../src/usb_inst.cpp'
' '
'Invoking: Cross ARM C Compiler'
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -D__MK20DX256__ -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I"C:\Users\neilh77\n\c\w3\remMon\src" -MMD -MP -MF"src/yield.d" -MT"src/yield.d" -c -o "src/yield.o" "../src/yield.c"
'Finished building: ../src/yield.c'
' '
'Building target: remMon.elf'
'Invoking: Cross ARM C++ Linker'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -T ../src/mk20dx256.ld -Xlinker --gc-sections -Wl,-Map,"remMon.map" -o "remMon.elf" ./src/HardwareSerial1.o ./src/HardwareSerial2.o ./src/HardwareSerial3.o ./src/IPAddress.o ./src/IntervalTimer.o ./src/Print.o ./src/Stream.o ./src/Tone.o ./src/WMath.o ./src/WString.o ./src/analog.o ./src/avr_emulation.o ./src/eeprom.o ./src/keylayouts.o ./src/main.o ./src/math_helper.o ./src/mk20dx128.o ./src/new.o ./src/nonstd.o ./src/pins_teensy.o ./src/serial1.o ./src/serial2.o ./src/serial3.o ./src/touch.o ./src/usb_desc.o ./src/usb_dev.o ./src/usb_flightsim.o ./src/usb_inst.o ./src/usb_joystick.o ./src/usb_keyboard.o ./src/usb_mem.o ./src/usb_midi.o ./src/usb_mouse.o ./src/usb_rawhid.o ./src/usb_seremu.o ./src/usb_serial.o ./src/yield.o
c:/program files/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/bin/ld.exe: section .ARM.extab.text._ZN14HardwareSerial5beginEm loaded at [00014284,0001428f] overlaps section .data loaded at [00014284,000148bf]
collect2.exe: error: ld returned 1 exit status
make: *** [remMon.elf] Error 1

nox771
02-22-2014, 06:13 AM
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 -D__MK20DX256__ -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I"C:\Users\neilh77\n\c\w3\remMon\src" -MMD -MP -MF"src/usb_inst.d" -MT"src/usb_inst.d" -c -o "src/usb_inst.o" "../src/usb_inst.cpp"

Some of your options seem a bit dubious. Unless you have some kind of DIY JTAG setup the -O0 and -g3 seem odd (they make sense in the case of hardware debug, but otherwise -g3 puts in debug symbols you can't use, and code size would be better with -Os).

As a comparison these are the options I usually compile with:
-D__MK20DX256__ -DF_CPU=96000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DARDUINO=105 -Os -ffunction-sections -fdata-sections -Wall -std=gnu++0x -Wa,-adhlns="$@.lst" -fno-exceptions -fno-rtti -c -fmessage-length=0 -mcpu=cortex-m4 -mthumb

For the linker I have this:
-T"X:\someInstallPath\arduino-1.0.5\hardware\teensy\cores\teensy3\mk20dx256.ld" -Xlinker --gc-sections -Wl,-Map,test_code.map -mcpu=cortex-m4 -mthumb

It's been a while since I checked but IIRC my code sizes are almost identical to the Arduino build.

I'm also using Eclipse with only the ARM plugin (not Arduino). I started with Nassarane's setup near the top of this thread, but changed around some things (made it simpler IMO). I didn't like having to separate compile the core each time the teensyduino install was updated. With the project setup I have now I can just drop in a new Teensyduino and projects will recompile against it w/o changes (although the base Arduino is 1.0.5, not 1.5.x). If there is interest I could writeup the project setup, just let me know. Otherwise I suppose the plugin is a good alternative.

neilh20
02-23-2014, 04:25 AM
hi nox - that would be great to hear what you found to work.
The compile options was just trying out some variations based on another project with the gcc 4.8.3 . It turns out the gcc 4.7 wasn't accepting -Og.
(While mentioning -Og symbolics, a friend said that the Seeger JTAG was having issues with debug symbol extraction on gcc 4.8.3 on an MK25 )
Cheers

hexodin
02-23-2014, 02:18 PM
I'm using Sublime Text 2: http://www.sublimetext.com/ and Stino 1.2: https://github.com/Robot-Will/Stino

You can easyly set a new build system if you prefer to work with AVR Libc.

1502

nox771
02-25-2014, 07:28 AM
Ok, I'll try to outline the steps I used. This is all written after the fact, so it may be missing a bit or two. One thing I try to do with this setup is make it so my primary project file (project.cpp) can be renamed to a .ino and will compile in Arduino. This takes a bit of work on the library setup, but if this is not a concern of yours then modify the procedure to whatever suits your setup.

For the install I'm using Juno, but Kepler should be similar. Note that Juno should use the 0.5.4 ARM plugin. I tried newer versions of the plugin but they did not work well (they are probably for Kepler, so use whatever is appropriate). Downloads and install is largely the same as above, but Eclipse setup is different.

Downloads:

Arduino 1.0.5 base:
http://www.arduino.cc/en/Main/Software#toc2
Teensyduino:
http://www.pjrc.com/teensy/td_download.html
Eclipse IDE for C/C++ Developers (Juno 32-bit):
http://www.eclipse.org/downloads/packages/release/juno/sr2
http://portableapps.com/node/32861 (I actually use this one due to my setup)
GNU ARM Eclipse Plug-in (0.5.4):
http://sourceforge.net/projects/gnuarmeclipse/files/Current%20Releases/0.5.4/ (top download link: org.eclipse.cdt.cross.arm.gnu_0.5.4.201202210114. zip, dated 2012-02-25)


Install procedure:

Unzip Arduino: C:\<somepath>\arduino-1.0.5
Install Teensyduino over base Arduino install
Install Eclipse: C:\<somepath>\eclipse
Install GNU ARM Eclipse plugin:

Start Eclipse, click on menu Help->Install New Software...
At top of dialog, click Add...
In the dialog box, click on “Archive…” button
Select the plugin file: org.eclipse.cdt.cross.arm.gnu_0.5.4.201202210114. zip



Project Creation:
This might seem a bit long, but it's really not too bad. This is where I do things differently than above. First off is PATH setup. There are two ways to go about this, either add the tool path to the main Windows path or add it inside Eclipse. I do it inside Eclipse for portability reasons. Here is how to do it both ways:


Windows:
Open the following: Start->Control Panel->System->Advanced system settings->Advanced Tab->Environment Variables...
Edit the PATH variable and add to the end: C:\<somepath>\arduino-1.0.5\hardware\tools\arm-none-eabi\bin
Eclipse:
From the menu go to: Window->Preferences->C/C++->Build->Environment
Add to the end of PATH: C:\<somepath>\arduino-1.0.5\hardware\tools\arm-none-eabi\bin
(note: use semicolon as delimiter between previous path)


Next will be creating a new project. Usually once I get it working I use the first one as a template and simply copy it to generate new ones, instead of redoing all this.

In Eclipse, create a project, click on menu File->New->C++ Project
Enter a project name: NewProject
Optional - I always uncheck the "Use default location" and browse to my project directory
(Note!!: if you do browse to a directory, make sure to add a new directory with your project name, otherwise it will dump all the new stuff right in the base directory)
In the "Project type" area, select "ARM Cross Target Application/Empty Project"
In the "Toolchains" area, select "ARM Windows GCC (Yagarto)".
Click Next
Uncheck Debug
Click Finish

Now a key step, instead of building Teensyduino into a static core library, we will simply link the Teensyduino folder into our project. Do this as follows:

In the left-hand "Project Explorer" pane, right-click on the project name, click on New->Folder item of popup menu.
Click "Advanced" button
Select "Link to alternate location (Linked Folder)", and browse to C:\<somepath>\arduino-1.0.5\hardware\teensy\cores\teensy3

Next comes the libraries setup. I'll admit I don't have a great solution here. The problem stems from wanting to be able to build identical .cpp/.ino files in both Arduino and Eclipse. Arduino as everyone knows has it's own unique way of handling libraries, in Eclipse it is a bit more manual. I'm not sure if the Arduino plugin assists with this.

So the basic idea is the same as above, link to any library folders that will be used. However I don't recommend linking to the main Arduino libraries folder as during compile time it will try to compile all the libraries (and all the examples). What I usually do is link to my sketchbook/libraries folder, to which I copy any libraries I'm working with (this also allows Arduino compiles to work). This has a side benefit, in that when I make edits to the libraries, both Arduino and Eclipse see the edits. So in my system it would be done something like this:


In the left-hand "Project Explorer" pane, right-click on the project name, click on New->Folder item of popup menu.
Click "Advanced" button
Select "Link to alternate location (Linked Folder)", and browse to C:\<sketchbookLocation>\libraries
(note: sketchbookLocation is the path you see when in Arduino you do File->Preferences)


Now for any library that has examples, it needs to be excluded from the build. This is done as follows:
In the left-hand "Project Explorer" pane, expand "libraries", then expand the library containing the examples.
Right-click the "examples" folder and click "Resource Configurations->Exclude from Build..."
Check the "Release" checkbox and click OK. It will not compile anything in that folder during the build. You should see a slash through the folder icon, like this:
1510

Now to create a source folder:

In the left-hand "Project Explorer" pane, right-click on the project name, click on New->Folder item of popup menu.
Type "src" in the "Folder name", and click Finish.

Now to create the sketch. You have options here, but if I were trying to make a program that can be distributed, then I would stick to Arduino conventions (cpp file with no header file, and setup() and loop() functions). An example:

To create a new .cpp file: Right-click on the "src" directory, click on New->File item of popup menu.
Enter "newproject.cpp"
Double-click the "newproject.cpp" file and it will open in an editor.
Just for testing it at the end, enter the simple blink sketch:


#include "Arduino.h"
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}


Project Settings:
Now the files should all be ready. The next step is to configure the project settings:

Click on the project with right mouse button, select Properties->C/C++ Build->Settings
In the "Tool Settings" tab, verify "Target Processor" is "cortex-m4" and the "Thumb" checkbox are enabled.
Select "ARM Yagarto Windows GCC C Compiler", in "Preprocessor", in the "Defined symbols" area, add the following items:

__MK20DX256__ (use __MK20DX128__ for Teensy 3.0)
F_CPU=96000000
USB_SERIAL
LAYOUT_US_ENGLISH
ARDUINO=105

In "Optimization":

Set "Optimize Size (-Os)"
Check "Function sections (-ffunction-sections)"
Check "Data sections (-fdata-sections)"

Repeat the above for "ARM Yagarto Windows GCC C++ Compiler" section.
In the "ARM Yagarto Windows GCC C++ Compiler" section, in "Miscellaneous":

Set "ISO 2009 C++ with GNU Extensions (-std=gnu++0x)"
Check "Do not use exceptions (-fno-exceptions)"
Check "Do not use RTTI (-fno-rtti)"

Select "ARM Yagarto Windows GCC C++ Linker", in "General", in the "Script file" field, browse to
"C:\<somepath>\arduino-1.0.5\hardware\teensy\cores\teensy3\mk20dx256.ld" file. (use mk20dx128.ld for Teensy 3.0)
Check "Remove unused sections (-Xlinker --gc-sections)"
Click OK/Apply to make it all stick.


Next, click on the project with right mouse button, select Properties->C/C++ General->Paths and Symbols
On the "Includes" tab, select "GNU C"
Click "Add", click "Workspace...", select "teensy3" directory in project, click "Ok"
On the "Includes" tab, select "GNU C++"
Click "Add", click "Workspace...", select "teensy3" directory in project, click "Ok"


Now for another tedious library bit. In order to find the include files, the libraries used must be explicitly listed here. In the same place, do the following:

Click "Add", click "File System...", browse to whatever libraries you include. For instance, using my i2c_t3 library I would have the following entry:
C:\<sketchbookLocation>\libraries\i2c_t3
Similarly add in paths to any other libraries used. If you don't do this, the include files won't work. Now you might ask why not include the base libraries directory instead of each specific one. Again this is for the Arduino compatibility. If I included the base library then instead of #include "i2c_t3.h" I would have to write #include "i2c_t3/i2c_t3.h".



So final step is to build the project, click on the little hammer icon and it should build and spit out a hex file. Also, as outlined in a earlier post, you can set it up so that the Teensyduino loader can be executed via a button. I use this quite a lot. Just make sure to put your cursor in the project.cpp file before hitting the button otherwise it will complain it can't find the project name (apparently uses the current file to determine what project to upload).

Now one nice thing of this setup is it does not require modification when Teensyduino is updated. No rebuilding the core, or maintaining the 3.0 vs 3.1 separation, just swap in the new Teensyduino in the same path as the old one and rebuild the project. Oh one bit regarding 3.0/3.1 - if you retarget a project to a different device, after changing the #define and .ld, right-click on the "Release" directory and delete it, then rebuild. Eclipse is not good at fully rebuilding when that happens.

And again, once you do this setup once, just copy it to make new projects.

Also I would be interested if someone knows how to make Eclipse build an .ino as a .cpp (when porting a project out to Arduino the copy/rename can get tiresome).

Mevon
04-22-2014, 02:52 PM
Hi everyone,

I didn't check into the Arduin Eclipse Plugin too much yet, but can anyone here tell me if the HEX files needed for the Teensy loader is Motorola or Intel (s-rec vs intel hex)?

Thanks,
Mevon

DaQue
08-25-2016, 05:25 PM
I wondering if I should start with the Arduino IDE or just jump in to using eclipse? Does Paul (PJRC) just use the Arduino IDE for all the wonderful library support he gives?

PaulStoffregen
08-25-2016, 06:18 PM
Yes. At least start with the Arduino IDE. Even if you never really use it, just having it installed can be really handy to check whether a problem you're having in some other environment also happens in Arduino.

DaQue
08-25-2016, 06:45 PM
Thanks Paul. I'll get it installed tonight and will likely buy a 3.2 so I can get started before the Kickstarter ships. I came soooo close to getting a 3.x so many times but waned something with a floating point unit in it. I ended up never getting pass buying the boards with my ST boards. Doesn't matter how fast FP math is if you don't get passed ordering the board.

Jantje
08-25-2016, 10:24 PM
Paul is absolutely right. Start with the Arduino IDE. For Teensy you have to install Arduino iDE and add Teensyduino to it before you can tell the Arduino eclipse plugin named sloeber where the teensy hardware information is located on your system.
Jantje

DaQue
08-26-2016, 11:22 PM
Thanks Paul. I'll get it installed tonight and will likely buy a 3.2 so I can get started before the Kickstarter ships. I came soooo close to getting a 3.x so many times but waned something with a floating point unit in it. I ended up never getting pass buying the boards with my ST boards. Doesn't matter how fast FP math is if you don't get passed ordering the board.

I did in fact order a 3.2 the same day and I just wanted to say you shipped it incredibly fast.I ordered using my phone while I should have been working and before my next break at work I had a couple emails including one with the tracking number. It already had shipped. I'm impressed and just wanted to say well done and thanks.

Timtodie
07-03-2017, 09:46 AM
Good day Nassa

I see that you did this in 2012 with the Teensy 3 ( implying the Teensy 3.0) but will it work with the Teensy 3.5 and 3.6?
I am looking at purchasing one of then as they have more pins than Teensy 3.1 and 3.2. I also not allowed to the Arduino IDE.

You Answer would be greatly appreciated.

Kind regards,
Timtodie

Timtodie
07-03-2017, 10:01 AM
Good day chow

I have also interested your method and would like to know if it will work with the Teensy 3.5 and 3.6?
Your answer would be greatly appreciated as well.

Kind regards,
Timtodie

Jantje
07-03-2017, 11:05 AM
I didn't test this out yet. But I support Teensy so if there is a problem make a issue and I'll fix it.
Jantje

Timtodie
07-03-2017, 05:30 PM
Good day Jantje

I tried to follow step 4 of the post on page 1 posted by Nassarane on 12-08-2012, 09:48 PM.

I followed all the steps up to the below mentioned steps but I cant seem to find the “ARM Cross Target Static Library/Empty Project”. in the “Project type” area or the “ARM Windows GCC (Yagarto)” in the “Toolchains” area. I however could not download the zip folder for the ARM GNU plugin and thus installed it via the install new software option in the help tab of Eclipse.

- In the dialog box “C++ Project”, type the Project Name : “TeensyCore3”
- 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 (Yagarto)”.

I was not 100% sure what was meant by (Add Teensy tool chain path in the Windows Path : “C:\Teensy3\arduino-1.0.2\hardware\tools\arm-none-eabi\bin”) so what i did was install the teensyduino software in the Teensy3 folder and then pasted the application into the Windows Path : “C:\Teensy3\arduino-1.0.2\hardware\tools\arm-none-eabi\bin”.

Any assistance or updated instructions would be greatly appreciated.

Kind regards
Timtodie

Jantje
07-03-2017, 05:41 PM
That is really old advice. Here is the updated info http://eclipse.baeyens.it/how_to.shtml#/i

Timtodie
07-03-2017, 06:18 PM
Thank you for your quick response.

I will try the steps in the posted link.

Ryno
07-03-2017, 07:18 PM
Did you manage to download the V3 file from the posted link timtodie, i seem to be having problems downloading it. My download will reach a maximum download speed of 23 kb/s before decreasing and staying on 0b/s after a few seconds. It is not my imternet as I have tested the upload and download speeds numerous times to confirm.

Could someone please suggest a fix or provide an alternative download link?

Jantje
07-03-2017, 09:15 PM
Did you manage to download the V3 file from the posted link timtodie, i seem to be having problems downloading it. My download will reach a maximum download speed of 23 kb/s before decreasing and staying on 0b/s after a few seconds. It is not my imternet as I have tested the upload and download speeds numerous times to confirm.

Could someone please suggest a fix or provide an alternative download link?

check http:\\sloeber.io
I had to move all download files

Ryno
07-04-2017, 10:04 AM
Hi Jantje,

I managed to download the V3 zip files. I extracted the files using 7-zip and when I try to open the eclipseArduinoIDE application in the extracted folder, i keep getting the bash and .sh in the same folder error. Is there a solution to this problem or do I have to download a different version?

Many thanks
Ryno

Jantje
07-04-2017, 10:23 AM
Why didn't you install 4.1?

Timtodie
07-04-2017, 10:41 AM
Good day Jantje,

Sorry to bother you again, but I would like to make sure that I can program in C on the teensy and not in the Arduino language. I am aware that the "Arduino language" is very similar to C as it is derived from it.
I just have to make sure that the language I programme the board in is C, as I am prohibited from using the Arduino IDE or language for my project.

Kind regards,
Timtodie

PaulStoffregen
07-04-2017, 10:48 AM
as I am prohibited from using the Arduino IDE or language for my project.


Why? Is this a school project? ...that's ok - just trying to understand *why* you can't use Arduino...

The "Arduino language" is really just C++ with a slight pre-processing step to automatically add includes and function declarations. If you take away that very small preprocessing step, it is just C++.

Timtodie
07-04-2017, 11:05 AM
Good day PaulStoffregen

Yes, this is for a University project under electronic engineering. The Teensy 3.5 is the perfect platform for the robot that I have to build. One of the Exit Level Outcomes is that we are not allowed to use any hobbyist tools as it is an engineering project and the Arduino platform falls under that criterion.

Will the Eclipse Arduino plugin allow me to program the Teensy with C without the pre-processing steps automatically being done by this eclipse plugin?

Does the Arduino Eclipse plugin include a debugging tool as well?

Kind regards
Timtodie

Jantje
07-04-2017, 11:06 AM
Why? Is this a school project? ...that's ok - just trying to understand *why* you can't use Arduino...

The "Arduino language" is really just C++ with a slight pre-processing step to automatically add includes and function declarations. If you take away that very small preprocessing step, it is just C++.

I would say :
A "arduino sketch" (contained in one or more ino files) is C++ with a slight pre-processing step to automatically add includes and function declarations.
The "Arduino language" is really just a C++ library (called "core" in arduino land) that implements a API and includes a main() calling setup() and loop(). The main implementation makes that a "arduino sketch" needs to implement setup() and loop(). The API allows you to use methods like digitalWrite on any supported hardware.
A "Arduino Library" is really just a C++ library.
Note that I use C++ here as a collection of C, C++ and assembly files except for the ino file that needs to be c++.

Timtodie
07-04-2017, 05:48 PM
Can I, as the programmer, use only C to program the Teensy 3.5 board with the IDE as well as step through my code in debug mode?

Jantje
07-04-2017, 07:10 PM
Can I, as the programmer, use only C to program the Teensy 3.5 board with the IDE as well as step through my code in debug mode?

I'm not sure you can do it.
I'm pretty sure Sloeber is not the best way to do this.
As you are training to become an engineer: a tip from a engineer: managers ask questions engineers rtfm. It seems to me you have not yet made up your mind what you want to be.

thefirebrandforge
07-10-2017, 03:59 AM
Motivation
I know there are those of us who prefer to program using C and without the Arduino IDE. Personally I come from using Keil (which appears unable to compile using GNU GCC, arm-none-eabi-gcc, and GNU G++, arm-none-eabi-g++ at the same time). The most complete directions I found were from this thread which is a bit dated, and now missing some details.

We wish to do the following:
Program in C/C++ modules
Use existing Arduino libraries, e.g. FastLED
Use convenient IDE features
Optionally use drivers provided by NXP

Downloads/Installation
Arduino and Teensiduino (https://www.pjrc.com/teensy/td_download.html)
Eclipse IDE for C/C++ Developers (http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/oxygenr)
GNU ARM Eclipse Plugin (http://gnuarmeclipse.github.io/plugins/install/)
Alternatively, Sloeber should include both the Eclipse IDE and GNU ARM plugin (http://eclipse.baeyens.it/stable.php?OS=Windows)
GNU MCU Eclipse Windows Build Tools - for make on Windows (https://github.com/gnu-mcu-eclipse/windows-build-tools/releases)
Optionally, GNU ARM Embedded Tools - This is already included as a part of Teensiduino. For the case that you have no interest in using Arduino libraries. (https://developer.arm.com/open-source/gnu-toolchain/gnu-rm)

Create a new project
Create a new project in Eclipse, File->New->C++ Project
Choose a project name and location
Under Project type select “Executable/Empty Project”
Under Toolchains select “Cross ARM GCC”
Click Next->Next and select “GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc) for Toolchain name:”. The Toolchain path should be “C:\Program Files (x86)\Arduino\hardware\tools\arm\bin” if you used the default Arduino install directory.

Configurations
Right click the Project->Properties
Under C/C++ Build->Environment, select PATH and click Edit. Add “C:\Program Files (x86)\Arduino\hardware\tools\arm\bin” if it's not already there. Use semicolon as delimiter between previous path
Under C/C++ Build->Tool Path
Build tools folder: C:\Program Files (x86)\GNU MCU Eclipse\Build Tools\2.9-20170629-1013\bin\bin
Toolchain folder: C:\Program Files (x86)\Arduino\hardware\tools\arm\bin

Adding the teensy3 core and libraries
Add the Teensy Core to the project using a linked folder:
Right click on the project->New->Folder
Click Advanced->Link to alternate location (Linked Folder), and browse to C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3
Repeat this for the Libraries you wish to use, e.g FastLEDs C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\FastLE D
Remove teensy3/main.cpp from the build process.
Right click main.cpp->Resource Configurations->Exclude from Build
Similarly exclude the “examples” directory of any libraries from the Build

Add your project files
Add a “main.cpp” file to the Project in a directory relative to the project that suits your preferences.
Right click the Project->New->Source Files
Or create the file in a chosen directory and link it as before.

Configure Include paths
Right click on the Project->Properties->C/C++ General->Path and Symbols
Under the Includes tab, select GNU C
Add, browse to “C:\Program Files (x86)\Arduino\hardware\tools\arm\arm-none-eabi\include”
Add, Workspace, ProjectName->teensy3.
Repeat and add all directories used in your project. (At least all the directories containing .h files)
Repeat for GNU C++

Match Arduino IDE build settings
These settings can be viewed in Arduino IDE by turning on verbose. In Arduino, File->Preferences->Show verbose output during: compilation

Right click on the Project->Properties->C/C++ General->Path and Symbols, click the Symbols Tab, click GNU C, add the following
__MK64FX512__ (for Teensy 3.5)
ARDUINO=10803
F_CPU=48000000 (or one of the other speeds supported)
LAYOUT_US_ENGLISH
TEENSYDUINO=137
USB_SERIAL
Repeat for GNU C++
Switch to C/C++ Build->Settings
Under the Tool Settings Tab, verify the follow is set from the previous steps
Cross ARM GNU C Compiler->Includes
Cross ARM GNU C++ Compiler->Includes
Cross ARM GNU C Compiler->Preprocessor
Cross ARM GNU C++ Compiler->Preprocessor
Under the Tool Settings Tab, select Target Processor, select the following
ARM family: cortex-m4
Instruction set: Thumb (-mthumb)
Under the Tool Settings Tab, select Cross ARM GNU C++ Linker->General,
Add the .ld script file corresponding to the Teensy you are using. E.g mk64fx512/ld for Teensy 3.5
Check Remove unused sections
Select Cross ARM GNU C++ Linker->Miscellaneous
Add the Linker flag --defsym=__rtc_localtime=1499566176
Check Use newlib-nano


Now the project should build as it does in the Arduino IDE!

jwatte
07-10-2017, 06:30 AM
You know what would be cool?
If someone made a Visual Studio Code plug-in to drive the Teensyduino toolchain.
There's an Arduino one, but that doesn't recognize the Teensy board support, and I'd rather have a Teensy-specific one.

In the end, it's "just" GCC with the support library/files and the user's project source. It "should" be "easy..."

Jantje
07-10-2017, 11:22 AM
You know what would be cool?
If someone made a Visual Studio Code plug-in to drive the Teensyduino toolchain.
There's an Arduino one, but that doesn't recognize the Teensy board support, and I'd rather have a Teensy-specific one.

In the end, it's "just" GCC with the support library/files and the user's project source. It "should" be "easy..."
That is what sloeber does for eclipse.