wiki:Hardware/jCM/cCM2/bDev

Version 7 (modified by Joseph F. Miklojcik III, 16 years ago) ( diff )

updated to reflect improvements in dev tools

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

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

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 daemon is started automatically and should be up and running at all times.

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 gw.orbit-lab.org with a command like the following.

  $ ssh gw.orbit-lab.org -L 3333:sb3.orbit-lab.org:3333

Cross-compiler

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

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

Debugger

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().

Attachments (2)

  • SB3.jpg (92.6 KB ) - added by seskar 16 years ago. Sanbox 3 node with CM2 board
  • JTAG.jpg (108.3 KB ) - added by seskar 16 years ago. JTAG programnmer attached to CM2 board

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.