Cross-compiling EPICS

From Nuclear Physics Group Documentation Pages
Revision as of 15:55, 30 July 2009 by Minuti (talk | contribs)
Jump to navigationJump to search

Linux-x86 host, linux-arm target

Once you have a proper cross-compiling setup, download EPICS and extract the tarball:
curl -O http://www.aps.anl.gov/epics/download/base/baseR3.14.10.tar.gz
tar -zxvf baseR3.14.10.tar.gz
cd base-3.14.10
export EPICS_BASE=`pwd`

Now you'll need to set up the configuration. EPICS spreads its config files all over the place, but unless you have special needs not covered here, this is what you need to change.

Set up configure/CONFIG_SITE

  • CROSS_COMPILER_TARGET_ARCHS=linux-arm
  • CROSS_COMPILER_HOST_ARCHS=linux-x86
  • SHARED_LIBRARIES=NO
  • STATIC_BUILD=YES

Our cross-compiling toolchain is in /usr/local/arm-linux-gnu. Set up configure/os/CONFIG_SITE.linux-x86.linux-arm

  • GNU_DIR = /usr/local/arm-linux-gnu

Our gcc and other programs are named, for example, arm-linux-gnu-gcc, instead of arm-linux-gcc. So, we have to fix how the makefiles look for programs. Fortunately, it's easy: Set up configure/os/CONFIG.Common.linux-arm

  • GNU_TARGET = arm-linux-gnu

make

Now you'll have a set of binaries for both the host and the target, found under bin/$ARCH. Confirm that cross-compilation worked as intended by running
file bin/linux-arm/softIOC
Which should return something along these lines:
bin/linux-arm/softIoc: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), for GNU/Linux 2.4.1, not stripped