Skip to content

Using the Eclipse IDE

JUBIN SEBASTIAN E edited this page Aug 29, 2016 · 47 revisions

Installation Guide

The installation guide describes the setup of the Eclipse IDE of the gcc toolchain for coding, flashing and debugging the emb6 targets.

##Supported Targets In the following table you will have an overview of the available targets with related information.

TARGET MCU Transceiver TOOLCHAIN DEBUGGER
Atany900 ATMEGA1281 AT86RF212 avr-gcc AVaRICE
Atany900-Basic ATMEGA1281 AT86RF212b avr-gcc AVaRICE
Efm32stk3600 EFM32LG990F256 AT86RF212b arm-none-eabi-gcc J-Link
Efm32stk3600 EFM32LG990F256 TI CC1120 arm-none-eabi-gcc J-Link
Efm32stk3600 EFM32LG990F256 TI CC1200 arm-none-eabi-gcc J-Link
SamD20XplainedPro SAMD20J18 AT86RF212b arm-none-eabi-gcc OpenOCD
Atany900pro SAMD20G18 AT86RF212b arm-none-eabi-gcc OpenOCD
X86 Linux Native (LCM) gcc gdb
Supported Targets

Eclipse IDE

Eclipse is an open source development environment and is used to develop the C/C++ based applications. Eclipse offers the possibilities to expand the functionality with plugins to the users need. For the selected targets a cross-compiler and linker has to be installed. The emb6-Stack uses the gcc-toolchain. To complete the environment a board dependent debugger has to be installed.

GCC Toolchain

GCC Toolchain for ARM and AVR architecture

Download and install GCC toolchains for ARM and AVR architectures from Launchpad (https://launchpad.net/gcc-arm-embedded/+download) for your OS:

GNU ARM Eclipse plugin

With the GNU ARM Eclipse plugin a add-on is provided for the developer to setup and perform the compiling, linking and debugging. The GNU ARM Eclipse plugin can be installed directly using the Eclipse IDE with the included software update procedure at "Help/Install New Software...".
Add following software repository to have the plug in available:
http://gnuarmeclipse.sourceforge.net/updates

GNU_ARM_PlugIn Installation of GNU ARM PlugIn

Open the property dialog at "Project->Properties->C/C++-Build->Environment" and add the path of GNU ARM tool chain or the AVR Atmel Studio to the PATH variable of the belonging configuration.

Architecture Path
ARM \GNU Tools ARM Embedded\4.9 2014q4\bin
AVR \Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin
Path for GNU ARM and AVR Toolchain

MinGW_Path Path for GNU ARM Toolchain

##SCons SCons is a replacement for make with improved features. SCons is based on Python what makes the tool very powerful for the build process. To install SCons an installation of Phyton and the Phyton- Win32-Extensions for Windows is required. Download the from following URL:

###Setup the target cofigurations SCons provide the possibility to set up the several required target configuration in the SConsTarget file. This configuration can be build as described in the chapter below.
Example setup:

Setting Value
Application coap as server
Board samd20xpro_rf212
MAC Address 0x20B0
Transmission Power 11dBm
Receive Sensitivity -100dBm
Type of Modulation MODULATION_QPSK100
Example for target configuration
trg += [{
    'id'        : 'cs_xpro_212',
    'apps_conf' : [ coap_srv, udp_alive ],
    'bsp'       : get_descr(bsp, 'samd20xpro_rf212')
}]

Supported target configurations with SCons can be found in root/targets.scons. Detailed descriptions on emb6's SCons building system are provided here.

###SCons setup for the configurations To build the configurations using SCons the build command and the path has to be adapted as follow:
Windows: The default 'Build command' has to be modified exactly as shown in Figure below with the '.bat' extension, i.e. Build command: 'scons.bat --target=cs_xpro_212'.

SCons_Config_BuildCmd_BuilderSettings Setup for SCons builder settings

SCons_Config_BuildCmd_Behavior Setup for SCons build behavior

SCons_Config_Path Path for the SCons build procedure for Windows
Attention: Do not add the path to the global Windows PATH environment variable. Use the Eclipse specific PATH variable as shown in figure above to get access to the tool chain. Adapt the settings described above to your local settings and add this path setting to all used configurations.
Linux: The build command is accordingly 'scons target=cs_xpro_212'. A special path setting is not necessary in the Linux environment.

Errors

'The command line is too long' on Windows

The error occurred because input of a command line during building process is too long. Information on command line string limitation is described here. A solution to this problem is to shorten identifier name of the target. Example below demonstrates the solution. The upper script uses a long identifier name, which causes the error. The lower script fixes the error with a short name.

trg += [{
    'id'        : 'dc_stk3600_cc112x_long_name', # causes the error 'The command line is too long' on Windows
    ...
}]
trg += [{
    'id'        : 'dcStk1120',	# a shorter name that fixes the error
    ...
}]

Errors on some versions of GNU ARM GCC toolchain

While building the emb6 stack, C library related errors might occur on some specific versions of the GNU ARM GCC toolchain:

  • 4.8 2014q3: This doesn't have "strings.h" or functions such as 'strncasecmp' and 'strcasecmp' are not provided by the default "string.h" header. Therefore we had a macro switch in root/emb6/src/apl/dns/resolv.c "#ifdef __SDCC" which includes the functions locally. A (__SDCC = 1) def was added in the SConscript of target/arch/arm/cm3/toolchain/GCC/SConscript. This was done as I was using the efm32 at that moment.
  • 4.9 2015q3: In this version of the GNU ARM tools the above mentioned functions are already provided in "string.h". Therefore there was an error as the functions were overridden with a different signature.
  • 5.2 2015q4: The initial problem was solved but another error happened. There is an error in the generated from the libraries of the corex m0 architecture, as shown below:
In file included from target\arch\arm\cm0plus\atmel\device\common\inc/cycle_counter.h:46:0,
                 from target\arch\arm\cm0plus\atmel\device\common\inc/delay.h:64,
                 from target\arch\arm\cm0plus\atmel\device\common\src\cycle_counter.c:44:
target\arch\arm\cm0plus\atmel\device\utils\inc/compiler.h:953:50: error: 's' undeclared here (not in a function)
 #   define OPTIMIZE_HIGH __attribute__((optimize(s)))
                                                  ^
target\arch\arm\cm0plus\atmel\device\common\src\cycle_counter.c:55:1: note: in expansion of macro 'OPTIMIZE_HIGH'
 OPTIMIZE_HIGH

Therefore it is recommended to use version 4.9.2015q3 with a small workaround in root/emb6/src/apl/dns/resolv.c. Following lines of code

#ifdef __SDCC
static int
strncasecmp(const char *s1, const char *s2, size_t n)
{
  /* TODO: Add case support! */
  return strncmp(s1, s2, n);
}
static int
strcasecmp(const char *s1, const char *s2)
{
  /* TODO: Add case support! */
  return strcmp(s1, s2);
}
#else
#ifdef IAR_COMPILER
#include <string.h>
#else
#include <strings.h>    // not found in IAR
#endif
#endif /* __SDCC */

shall be replaced by

#include <string.h>