Project

General

Profile

Code Development for the GESBC-9G20 single board computer

Hardware Documentation

Glomation GESBC-9G20: http://www.glomationinc.com/GESBC-9G20-user-manual.pdf

Atmel AT91SAM9G20 manual: http://www.atmel.com/devices/sam9g20.aspx?tab=documents

Various recipes for software tool preparation

GCC

New (2013.10.04) instructions (by example) for arm cross compiling from SLF6 (ie uboonedaq-evb)
The example is xcompiling the linux kernel.
Basically "setup gcc v4_3_2 -qarm" and then use, for example, arm-unknown-linux-gnueabi-gcc.
(please pardon the 3 line prompt (date,dir,host) used in the following example)
Start with:

--10/04_14:32:26--
/home/ron/src/linux
uboonedaq-evb :^) ls
total 76500
-rw-rw-rw- 1 ron    47526 Aug 29 16:08 config-3.2.43-2013.08.29.16.57
-rw-rw-rw- 1 ron 78202792 Aug 29 14:40 linux-3.2.43.tar.bz2
--10/04_14:32:31--
/home/ron/src/linux
uboonedaq-evb :^) 

Then init the environment with the following commands (which should have no output):
. /uboone/setup
setup gcc v4_3_2 -qarm
tar xjf linux-3.2.43.tar.bz2
cd linux-3.2.43
target=arm-unknown-linux-gnueabi
mkdir $PWD-$target
cp ../config-3.2.43-2013.08.29.16.57 $PWD-$target/.config
xmake()
{ test -z "${target-}" && echo set target variable && return
  make ARCH=`expr "$target" : '\([^-]*\)'` CROSS_COMPILE=$target- O=$PWD-$target "$@" 
}

The xcompiler should be... and the kernel build should be...:

--10/04_14:33:31--
/home/ron/src/linux
uboonedaq-evb :^) type arm-unknown-linux-gnueabi-gcc
arm-unknown-linux-gnueabi-gcc is /uboone/gcc/4.8.1/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc
/uboone/gcc/4.8.1/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc
--10/04_14:33:46--
/home/ron/src/linux
uboonedaq-evb :^) # the xcompiler tools have the "target" architecture (arm-unknown-linux-gnueabi) prepended
--10/04_14:37:18--
/home/ron/src/linux/linux-3.2.43
uboonedaq-evb :^) xmake -j30 uImage
  GEN     /home/ron/src/linux/linux-3.2.43-arm-unknown-linux-gnueabi/Makefile
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
[snip many lines of kernel compile output]
  AS      arch/arm/boot/compressed/piggy.gzip.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-3.2.43
Created:      Fri Oct  4 14:37:52 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    1930184 Bytes = 1884.95 kB = 1.84 MB
Load Address: 20008000
Entry Point:  20008000
  Image arch/arm/boot/uImage is ready
--10/04_14:37:53--
/home/ron/src/linux/linux-3.2.43
uboonedaq-evb :^) 

NOTE: Instructions below are obsolete. (The recommended cross-compiler is targeted to the older kernel that used to come on Glomation 9G20s, and won't work with either the new one that ships nor the one we are now going to install on all of them.)

For compiling code to run on the 9G20, use the ARM cross development tool chain recommended on the Glomation support page. More specifically, download Generic-arm_gcc-4.2.3-glibc-2.3.3.tar.bz2 and unpack. Add the path to the "bin" directory of the unpacked archive to your path. The C compiler is arm-unknown-linux-gnu-gcc.

GDB

NOTE: In principle the following would work if adjusted to use an up-to-date cross-compiler, but this has not been tried yet.

To make a cross-debugger for the board, the best thing to do is to make gdbserver for the 9G20 (Arm architecture) and gdb for another "host" computer with "ARM" as the target architecture. Of course the "host" gdb still has to be compiled for the host architecture on which it runs. Here's a recipe that worked for me on an x86_64-based Scientific Linux 5.3 system:

 wget http://ftp.gnu.org/gnu/gdb/gdb-7.5.tar.bz2
 tar xjf gdb-7.5.tar.bz2
 cd gdb-7.5
 ./configure --target=arm-unknown-linux-gnu
 make
 cd gdb/gdbserver
 rm config.cache
 CC=arm-unknown-linux-gnu-gcc ./configure --host=arm-unknown-linux-gnu

In my case I also had to add a definition for PTRACE_GETSIGINFO to gdbserver/linux-arm-low.c and had to compile gdbserver/remote-utils.c without the "-Wall" option due to a picky compiler warning.

Once you have successfully compiled as above, copy the gdbserver program (which you just made in the gdb-7.5/gdb/gdbserver directory) over to the SBC, and use it along with the gdb program (which you just made in gdb-7.5/gdb) as described in the gdbserver documentation.

This really helps debugging.

Compiling an EPICS IOC for the 9G20

Use the instructions at http://nuclear.unh.edu/wiki/index.php?title=Cross-compiling_EPICS, except change the path names and version numbers accordingly.

  • Use EPICS base 3.14.12 (not 3.14.10).
  • Instead of /opt/EPICS/base-3.14.10, use (where ever EPICS is installed)/base-3.14.12.
  • Instead of /usr/local/arm-linux-gnu, use wherever you installed your GCC cross-compiler.

Additionally, you should add the following to ${EPICS_BASE}/configure/os/CONFIG_SITE.Common.linux-arm:

CROSS_OPT=NO

Adding the line above to the CONFIG_SITE.Common.linux-arm file will do two things: (1) add debugging symbols to the Arm executable, allowing the use of GDB, and (2) specifies a lower level of optimization. The second point may be important: I find softIoc crashes at init unless I do this.

Here for reference is a script I source to set up my environment before building EPICS IOCs for the 9G20 at K-State. This would need to be modified for the correct installation locations for EPICS and the GCC cross-compiler on a different computer. Note simply using the script below is not sufficient: you have to also modify the three EPICS config files as described on the page referenced above.

echo This is the configure for EPICS for the Arm-based 9G20
# see http://nuclear.unh.edu/wiki/index.php?title=Cross-compiling_EPICS

EPICS=/user/gahs/MicroBooNE/EPICS/
EPICS_BASE=${EPICS}/base-3.14.12

# EPICS_HOST_ARCH is where the compile is happening (not where EPICS will run)
EPICS_HOST_ARCH=linux-x86_64

PATH=/user/gahs/Generic-arm_gcc-4.2.3-glibc-2.3.3/usr/local/arm/gcc-4.2.3-glibc-2.3.3/arm-unknown-linux-gnu/bin/:$PATH
PATH=${PATH}:${EPICS_BASE}/bin/${EPICS_HOST_ARCH}

export EPICS
export EPICS_BASE
export EPICS_HOST_ARCH
export PATH