/
GNU ARM

GNU ARM

ARM maintains a complete toolchain for building and debugging firmware for ARM-based micro-controllers. This is the primary toolchain used by the OpenWSN team to program the following motes:

This page details the installation steps:

Installing ARM toolchain

You can find the ARM toolchain at https://launchpad.net/gcc-arm-embedded. Version 4.7 is the latest currently used: https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update

The installation consists in the following steps:

  1. Download the toolchain
  2. Inflate (unzip) the toolchain
  3. Modify the PATH environment variable so Eclipse can invoke the compiler.

 

 Installing on Linux...

In Ubuntu, Add the repository for gcc-arm-embedded:

$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
$ sudo apt-get update
$ sudo apt-get install gcc-arm-none-eabi

Then check your version:

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 If that does not work you can try the previous instructions:
  • Extract gcc-arm-none-eabi-4_7.tar.bz2 to a desired folder e.g., ~/openwsn/gcc-arm-none-eabi-4_7.
  • Modify the PATH environment variable:
    exportline="export PATH=$HOME/openwsn/gcc-arm-none-eabi-4_7/bin:\$PATH"
    if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
    . ~/.profile
  • Add your username to the dialout group to make serial port access easier:
    sudo usermod -a -G dialout $USER
  • Verify that you can invoke the compiler:
    ~$ arm-none-eabi-gcc --version
    arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.3 20130312 (release) [ARM/embedded-4_7-branch revision 196615]
    Copyright (C) 2012 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 Installing on Windows...
  • Download the Windows installer.
  • Double-click on the installer and follow the default installation procedure.
  • Modified the PATH environment to contain the bin/ directory of the toolchain installation directory. For example:
    C:\Program Files\GNU Tools ARM Embedded\4.8 2013q4\bin
  • Verify that you can invoke the compiler:

    C:\Users\Thomas>arm-none-eabi-gcc --version
    arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20131129 (release) [ARM/embedded-4_8-branch revision 205641]
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Installing Eclipse

  • Download Eclipse CDT for C/C++ developers from http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr1
    • Note: Do not install Eclipse using apt.  It is outdated and the plugins require a more recent version of Eclipse
  • unzip eclipse in your favorite folder e.g., /opt/eclipse
  • Execute eclipse and go to Help->Install New Software.
  • Add gnu-arm eclipse plug-in url and install the plug-in. Use the following url.

    http://gnuarmeclipse.sourceforge.net/updates
  • Restart eclipse when installation finishes

Testing

  • Once the gnu-arm plug-in is installed you can test that everything works by creating a test project.
  • To do so, click File > New > C Project and select ARM Cross Target Application

  • Make sure to select the right cross compiler. In my case I choose ARM Linux GCC (GNUARM). If you are using Code Sourcery or Yagarto or another tool chains, select the appropriate.
  • Name your project (e.g. "test") and click Finish.
  • Right click on the project and select properties:

  • Select the micro-controller architecture, for example Cortex M4
  • Move to the "assembler" option and set up the path to your gcc-arm-none/ directory. Select arm-none-eabi-gcc

    If you have update your computer PATH environment variable, you can just enter arm-none-eabi-gcc, without the full path.

  • Repeat the same steps for the compiler, which in our case is also arm-none-eabi-gcc.

  • Repeat the same steps for the linker, which in our case is also arm-none-eabi-gcc.

  • Configure the "Flash image creator" as follows:

  • Configure the "Create Listing" as follows:

  • Configure the "Print Size" as follows:

  • At this point, configure any extra options you might want, such as optimizations and debug levels.
  • Click OK to apply all changes.
  • Create a file to test the compiler. You can toggle an LED according to your hardware specification or simply code a while loop and test the compiler.

    int main(void){
        int i = 0;
        while (i < 10) {
           i++;
        }
        return i;
    }
  • Right-click on the project and select Build Project. Based on your configuration, Eclipse invokes the ARM GCC compiler, linker, flash image creator, and size printer tools. 

    15:49:03 **** Incremental Build of configuration Debug for project openwsn ****
    make all
    Building file: ../src/main.c
    Invoking: ARM Linux GCC C Compiler
    arm-none-eabi-gcc -O0 -Wall -Wa,-adhlns="src/main.o.lst" -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -mcpu=cortex-m4 -mthumb -g3 -gdwarf-2 -o "src/main.o" "../src/main.c"
    Finished building: ../src/main.c
    
    Building target: openwsn.elf
    Invoking: ARM Linux GCC C Linker
    arm-none-eabi-gcc -nostartfiles -Wl,-Map,openwsn.map -mcpu=cortex-m4 -mthumb -g3 -gdwarf-2 -o "openwsn.elf"  ./src/main.o   
    /home/xvilajosana/Development/tools/gcc-arm-none-eabi-4_7/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 00008000
    Finished building target: openwsn.elf
    
    Invoking: ARM Linux GNU Create Flash Image
    arm-none-eabi-objcopy -O ihex openwsn.elf  "openwsn.hex"
    Finished building: openwsn.hex
    
    Invoking: ARM Linux GNU Create Listing
    arm-none-eabi-objdump -h -S openwsn.elf > "openwsn.lst"
    Finished building: openwsn.lst
    
    Invoking: ARM Linux GNU Print Size
    arm-none-eabi-size  --format=berkeley openwsn.elf
       text       data        bss        dec        hex    filename
         44          0          0         44         2c    openwsn.elf
    Finished building: openwsn.siz
    
    15:49:03 Build Finished (took 114ms)

Related content

release 1.8.0
release 1.8.0
Read with this
Toolchains
Toolchains
Read with this
Firmware
Firmware
Read with this
OpenMoteSTM
OpenMoteSTM
Read with this
Stack
Stack
Read with this