Development Environment

SB3 is used for CM2 firware code development. In addition to all the necessary software, SB3 console has USB based JTAG programmer attached.

Sanbox 3 node with CM2 board


Prerequisites include SUN JDK but only if you want to use Eclipse for development.

  apt-get install bzip2 gcc gnumake automake1.9 mpfr sun-java6-jdk tk-dev tcl-dev libncurses-dev
Firmware Programming

CM2 build configuration is done by overriding variables from the first few hundred lines of the Makefile on the make command line.

JTAG Programmer Hardware

We are using Olimex ARM-USB-OCD USB based JTAG debugger that is attached to the JTAG port on the CM2 board (JXX).

JTAG programnmer attached to CM2 board

JTAG Programmer Software

Software used for debugging and internal flash programming is OpenOCD (standard Debian package - apt-get isntall openocd ).

The file openocd.cfg, included in the source repository, has an appropriate configuration for programming the CM2 hardware, although you can experiment with different scripts to automate erasing the flash, verifying the image, and so forth.

The daemon is started with:

  openocd -f openocd.cfg

It is listening for gdb connections on default port 3333. Note that openocd has a startup script and should be running at all times. Often there's a native screen session with an obvious name like openocd that displays the openocd log.

You can develop on your private system and run arm-elf-gdb against openocd remotely. sb3 does not expose an ssh port, but you can tunnel through with a command like the following.

  $ ssh -L

Software development environment is based on the latest version of gcc, binutils, and newlib. There are two tricks to compiling these tools: one is to use separate build directories, the other is to bootstrap a C compiler against the newlib headers, compile newlib with that compiler, then compile another C compiler with newlib installed. Interwork and Multilib support are necessary.

  $ # unpack tarballs in $SRC_TOP
  $ mkdir $SRC_TOP/binutils-build
  $ cd $SRC_TOP/binutils-build
  $ ../binutils-$BINUTILS_VERSION/configure --target=arm-elf --enable-interwork --enable-multilib
  $ make && sudo make install
  $ mkdir $SRC_TOP/gcc-build 
  $ cd $SRC_TOP/gcc-build 
  $ ../gcc-$GCC_VERSION/configure --target=arm-elf --enable-interwork --enable-multilib --enable-languages=c --with-newlib --with-headers=../newlib-$NEWLIB_VERSION/newlib/libc/include
  $ make all-gcc && sudo make install-gcc
  $ mkdir $SRC_TOP/newlib-build
  $ cd $SRC_TOP/newlib-build
  $ ../newlib-$NEWLIB_VERSION/configure  --target=arm-elf --enable-interwork --enable-multilib
  $ make all && sudo make install
  $ cd $SRC_TOP/gcc-build
  $ make all && sudo make install
  $ mkdir $SRC_TOP/gdb-build
  $ cd $SRC_TOP/gdb-build
  $ ../gdb-$GDB_VERSION/configure --target=arm-elf
  $ make all && sudo make install

This build procedure is what makes people balk at building vanilla arm-elf debian packages. Not that it's a lot of commands, but that there's a chicken and egg problem with newlib.


Use gdb initialization file to properly interact with the JTAG debugger:

  $ arm-elf-gdb --annotate=3 -x gdbinit-rom main.elf

This will load and run the CM2 with a breakpoint set at main().

Arm Development For n-ORBIT CM

Good general instructions on setting up cross compilers and toolchain can be found in "Using Open Source Tools for STR7xx Cross Development" (Giacomo Antonino Fazio,­ Antonio Daniele Nasca, November 2007). This is more or less a subset of those instructions which worked for WINLAB ORBIT.

  1. Connect the development target CM directly to the console. These instructions assume an OLIMEX ARM-USB-OCD connects it.
  1. Install openocd from source on the console in /usr/local, using commands similar to the following.
$ apt-get install build-essential automake autoconf libusb libftdi-dev
$ cd /usr/local/src
$ svn checkout svn:// openocd
$ cd openocd
$ ./bootstrap
$ ./configure --enable-ft2232_libftdi
$ make
$ make install

You can try your luck with the Debian package of openocd, but development is still very active. If you encounter bugs you will likely be told to build from source anyway.

  1. Create a openocd configuration file.

A version that works for our OLIMEX ARM-USB-OCD is attached to this page. You may need to adjust the ft2232_vid_pid parameters by observing the output of lsusb -v. You will need a significantly different configuration file if you are using another interface.

  1. Download source for the GNUARM toolchain, compile, and install, using commands similar to the following.
$ sudo apt-get install bzip2
$ cd /usr/local/src
$ wget
$ wget
$ wget
$ wget
$ tar jxvf binutils-2.17.tar.bz2
$ cd binutils-2.17
$ ./configure --target=arm-elf --enable-network --enable-multilib
$ make all
$ make install
$ export PATH=/usr/local/bin:$PATH
$ cd ..
$ tar jxvf gcc-4.1.1.tar.bz2
$ tar zxvf newlib-1.14.0.tar.gz
$ cd gcc-4.1.1
$ ./configure ­­--target=arm­-elf ­­--prefix=/usr/local/gnuarm ­­--enable­-interwork ­­--enable-­multilib ­­--enable-­languages="c,c++" ­­--with­-newlib ­­--with-­headers=../newlib­1.14.0/newlib/libc/include
$ make all-gcc
Last modified 5 years ago Last modified on 01/11/13 12:14:12

Attachments (2)

Download all attachments as: .zip