-
Notifications
You must be signed in to change notification settings - Fork 21
Eclipse
The following is a step-by-step guide on how to set up Eclipse to work with the Zolertia zoul-based devices, such as the RE-Mote or the Firefly.
The instructions above are meant for Ubuntu-based systems, any specific configuration for Windows or OSX is out of the scope of these page. Zolertia has released a Virtual Machine image (soon to be published), with Eclipse already configured, using VMWare it can be ran on the aforementioned mentioned OS.
This guide also assumes you have the toolchain and support for the Zolertia RE-Mote
and zoul-based
boards, if not please go through the following guides:
- Download Eclipse and requirements
- Install ARM plugin
- Importing Contiki to Eclipse
- Configuring the toolchain in Eclipse
- Compiling a Contiki application using Eclipse
- Flashing a Zolertia RE-Mote over USB using Eclipse
- Opening a serial console debug output in Eclipse
- Flashing a Zolertia RE-Mote over JTAG using J-Link
- Configuring Contiki for JTAG debugging
At the moment of writing this tutorial the following versions were used:
Download Eclipse Kepler (C/C++)
Or use this permanent link to download Eclipse Kepler SR2 32-bit version for Linux
Then run the following command to unpack:
tar -xzf eclipse-cpp-kepler-SR2-linux-gtk.tar.gz
Run Eclipse and select your workspace
location to whatever you prefer. In the next steps we are going to use the Contiki
location instead as we will import it as an existing project.
Next we need to install the GNU ARM Eclipse plugin. There are several ways to install (check here), we will use Eclipse Marketplace.
Open the Help
menu then Eclipse Marketplace
:
Then find
the GNU ARM Eclipse plugin in the Find
textbox. The current version used at the moment of writing this guide is the 2.12.1
:
Check the options shown on the image, then accept the required licenses
And you are done! It should start installing right away. As a caveat, I had to repeat this process at least two times, perhaps with issues with the Eclipse repository, as it was not resuming the process after an early exit because it was not able to retrieve the packages.
Restart afterwards:
Install also the C/C++ GDB hardware Debugging support
. Open the Help
menu and click on the Install New Software...
option:
Next we are going to import the existing Contiki directory into Eclipse as an Existing Code as Makefile Project
. Open the File
menu and select Import...
:
Name your project as you want (I used contiki
), and select the Cross ARM GCC
toolchain.
The newly imported contiki
project should look like above:
Next we will configure the project and the toolchain options. Open the Project
menu and click on Properties
:
Click and expand the C/C++ Build
tab and go to the Settings
option. In the Toolchains
tab configure as shown below:
Next expand the C/C++ General
menu and click on Paths and Symbols
- In the Includes
tab we are going to add the libraries and locations to include in our project. Click Add...
and then File system
to search for the Contiki directories to add:
Add also the compiler specifics libraries:
Below is a list of the Contiki libraries added:
Next open the Source Location
tab and include the following folders:
Now open the C/C++ Build
menu and click on Build Variables
. We are going to define Contiki-specifics variable to be used when compiling project and examples in Eclipse:
Variable | Type | Value | Description |
---|---|---|---|
BOARD |
String | BOARD=remote-revb | Zoul-based platform |
TARGET |
String | BOARD=zoul | Zolertia Zoul module |
CONTIKI_BUILD_LOC |
String | path_to_example | The location of the application |
CONTIKI_APP |
String | app_name.ext | Application name and binary extension (.bin/.elf) |
The image below shows the above configuration for the zoul-demo
example in the examples/zolertia/zoul
folder:
Next in the C/C++ Build menu
open the Builder Settings
tab and fill as shown:
And in the Behaviour
tab configure as shown:
The following is not mandatory to configure, but I wanted to have editor options enabled such as highlight the current line, see the line number, etc. Open the Windows
menu and then Preferences
. Expand the General
menu and click on Text Editors
:
Right-click on the project and select the Build Project
:
The application will began to compile:
## Flashing a Zolertia RE-Mote over USB using EclipseNow let's configure Eclipse to program the RE-Mote
over USB. Right click on the project and select the Run As
option, then Run Configurations...
. Also you could open the Run
menu and select the Run Configurations...
option:
On the C/C++ Application
menu create a new instance (you can just double-click to create). Select the Main
tab and configure as shown below:
Next on the Arguments
tab on the Program arguments
text box fill as shown below. Notice you will have to specify the binary name to be flashed to the RE-Mote
(the same corresponding to CONTIKI_APP
variable name defined for the builder). I still have not figured a way to share variables across the build/run blocks.
Next to compile and flash an application over USB just click on Run Configurations
and select our newly created configuration, or hit the Run Contiki USB Flash
button in the newly expanded toolbar:
In Contiki we normally use the make login
command to open a console debug connection between the Zolertia devices and our host, allowing to visualise the debug output and any information being printed over the USB. As we did to configure the USB programming now add debug console support:
Open the project Properties
and on the Run/Debug Settings
create a new configuration (in our case we named it Contiki Login
):
Edit and complement in the Main
tab as follows:
In the next Arguments
tab complement as follows:
Running this will create a console connection as shown below:
## Flashing a Zolertia RE-Mote over JTAG using J-LinkCreate a new configuration for the GDB SEGGER J-Link Debugging
:
In the Debugger
tab configure the GDB server
and GDB client
. Note we are using as extension elf
rather than bin
, as this is the supported binary format of J-Link
.
In the Startup
tab configure as shown below. These are the commands the GDB client
will send to the GDB server
Now we have everything set in Eclipse, and we are now capable of compiling and flashing any Contiki application, even run the debug console in Eclipse. To debug our application step by step using the Eclipse debug capabilities over JTAG we need to compile Contiki having into consideration the following:
- Turn off any optimization (
CFLAGS += -O0
) - Generate debugging information (
CFLAGS += -g
) - Debugging information in DWARF version 2 format (
CFLAGS += -gdwarf-2
) - Disable the watchdog (in
platforms/zoul/contiki-main.c
comment out watchdog_init()) - Disable Power savings (Set
LPM_CONF_ENABLE
to zero, see here)
Update (20/06/2016) I currently have the following problem:
-Link is connected.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware: V8.00
S/N: 268006863
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 2.56 V
Listening on TCP/IP port 2331
Connecting to target...ERROR: CC2538 (connect):Can not find ICE-Pick (IDCODE mismatch). Expected 0x0B00002F, found: 0x00000000
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...
This means the JTAG connector is connected in the wrong position, the Target voltage
should be close to 3.3V
.
- Get the Code
- Toolchain and tools
- Getting Started with Zolertia products
- Change to SubGHZ interface
- Program the Zolertia platforms
- Configure Eclipse (IDE)
- Firefly as a Sniffer
- Sensors