Eclipse Desktop IDE for Linux
This article helps you set up an Eclipse development and cross-compilation environment on a Linux-based PC. The procedure has been tested on the Ubuntu 14.04 64-bit OS.
The procedures described here are mostly performed on your development PC, in order to create a binary file that you can copy to and run on your target ARTIK board.
Prerequisites
The following steps need to be performed on the development PC to install the required dependencies.
General packages
Install the basic package set as follows.
sudo apt-get install git rsync build-essential
Java
A Java JDK 8 is required for latest version of Eclipse. From Ubuntu 14.10 onwards it can be installed as follows:
sudo apt-get install openjdk-8-jdk
For older versions, do:
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
GCC cross-compile toolchain
Many cross-compilation toolchains may be used to compile for the ARTIK platforms. This guide will use a specific one that has been tested to work well.
Download and install the toolchain to your development PC as follows..
-
Go to this Linaro Releases site:
https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabihf/ -
Download the latest release in
x86_64_arm
format. As of this writing, it is:
gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
-
Make a directory on your PC.
sudo mkdir -p /opt/toolchains
-
Extract the files into the directory (using the filename you downloaded earlier).
sudo tar xvf gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf.tar.xz -C /opt/toolchains
Eclipse Installation
Go to http://www.eclipse.org/downloads/ and select the Eclipse Neon download for Linux (eclipse-inst-linux64.tar.gz).
cd /tmp
tar xvf ~/Downloads/eclipse-inst-linux64.tar.gz
eclipse-installer/eclipse-inst
Follow the installation steps as described below.
-
Select the indicated installation package.
-
Select the Installation folder where you want to put Eclipse. Here we'll choose /home/user/eclipse and will later refer to it as such.
-
Follow the installation steps from the installer until the installation succeeds.
-
When it is done, it should automatically launch Eclipse. You can later launch Eclipse by typing the command:
./eclipse/eclipse &
-
When Eclipse asks for a workspace directory, name it as
/home/<user-name>/workspace
You are now ready to create a project under Linux for ARTIK modules.
Create “Hello World” Project
-
Create a new project.
-
Specify Project name, Project type, and select Toolchains as shown below, then click Next.
-
Specify author name and click Next.
-
Accept the default configurations and click Next.
-
Specify the cross compiler prefix and path as shown and click Finish.
-
Build the application. Right-click on the application project and select “Build Project” to build the hello world executable.
The resulting binary file can be found at the Debug directory of the project workspace. For example:
/home/user-name/workspace/hello_world/Debug/hello_world
Deploy to Target ARTIK Device
Connect your ARTIK board as usual through a terminal emulator as described here. You will need to be Wi-Fi®-connected as described in the Configuring Wi-Fi article. Your development PC and ARTIK board will need to be connected to the same network in order to copy over and run your programs using scp
(secure copy) as noted here.
To prepare for copying, change directories to the binary file location noted above.
Now enter the scp
command line. For example:
$ scp hello_world root@192.168.1.195:./.
The follow-on article will discuss a more convenient method for moving the files to the ARTIK board.
Run the Program
In your terminal emulator window, run ls -l
to make sure the file is where you expect it to be. Then change the file permissions to make it executable:
# `chmod 755 hello_world
Now you can finally run it! The terminal output should look like this.
[root@localhost ~]# ./hello_world Hello ARM World! [root@localhost ~]#
Spend some time adding and changing code to get familiar with the IDE operation.
Bringing in Libraries
Having given the IDE a test run, let's look into building applications using the ARTIK SDK and other open-source libraries available on ARTIK modules. Proceed now to the Eclipse and ARTIK SDK article, which will guide you through this process using ARTIK SDK example projects as a reference.