Getting Started with R3.14.7 on a PC104 running Linux


This is an internal note of my lab (INFN-LNL ITALY) showing results of my first experience with running EPICS on an embedded PC104 to control a Camac Crate Controller by Serial-over-Ethernet and a Rockwell Micrologix 1500 PLC by serial line. Both Device Supports were written using Asyn in collaboration with Ralph Lange.

1 Building R3.14.7 Base on a Linux Box

  1. The following was performed on a workstation type Slackware 7.0 linux box (equipped with an old PentiumIII, 500Mhz, 512MB RAM). I ran into a sync problem on HD using the BigSlack distro, so I created the ISO image of version 7.0 and installed it using a CD-ROM.
  2. Download baseR3.14.7.tar.gz from
  3. Create a working directory: /usr/src/R3.14.7
  4. cd /usr/src/R3.14.7
  5. tar -zxvf baseR3.14.7.tar.gz
  6. cd base
  7. Edit configure/CONFIG_SITE, look for the following variables and change them to what is shown below:
  8. Edit startup/Site.cshrc or define EPICS_BASE in your shell:
    • setenv EPICS_BASE /usr/src/R3.14.7/base
  9. Source startup/Site.cshrc (or restart your shell)
  10. Type “make in /usr/src/R3.14.7/base and go brew a pot of coffee.
  11. Check for binaries in bin/linux-x86

2 Building the Example Application

  1. cd /home/giacchin/ (or wherever you want to build the example)
  2. mkdir testIOC
  3. cd testIOC
  4. $EPICS_BASE/bin/linux-x86/ -i example
  5. $EPICS_BASE/bin/linux-x86/ -i -t example example
  6. make
  7. cd ../iocBoot/iocexample
  8. Start your IOC with ../../exampleApp/src/O.linux-x86/example st.cmd
  9. List the existing records using dbl

At this point you will be in the “iocSh” (aka ioc shell). You can use the CA commandline tools from base to access your IOC through Channel Access: “caget yourHost:aiExample1” (in the same net or after you point EPICS_CA_ADDR_LIST to your linux box). The values of that example record should change between 0 and 9.

3 Migrating exampleApp Code to your PC104

Once you’ve established working binaries on your linux box, it’s time to move them to the PC104 card. I try to mimic the directory structure of the linux host on the PC104 card, so that you do not have to modify anything. The IOC boot structure should be portable without any changes, though.

  1. Log onto the pc104
  2. Create /home/giacchin (or wherever you want to put stuff) and the directory structure:
    1. mkdir /home/giacchin; cd /home/giacchin/
    2. mkdir testIOC; cd testIOC
    3. mkdir bin dbd db iocBoot iocBoot/iocexample
  3. Back on the host: cd /home/giacchin/testIOC/iocBoot/iocexample
  4. ftp from your linux box to your pc104
  5. cd /home/giacchin/testIOC/iocBoot/iocexample; lcd <same directory>
  6. put st.cmd
  7. cd /home/giacchin/testIOC/db; lcd <same directory>
  8. put dbExample1.db dbExample2.db dbsubExample.db
  9. cd /home/giacchin/testIOC/dbd ; lcd <same directory>
  10. put example.dbd
  11. cd /home/giacchin/testIOC/bin/linux-x86
  12. put caRepeater example

I used the TMZ104 (a PC104 starter kit made by TRI-M ENGINEERING). The Linux environment of the starter kit isn’t equipped with all the libs necessary to use the caRepeater, therefore I copied the libraries from my host PC (with Slackware7.0) to the PC104 into the same directory. The missing libs were:

  • libpthread
  • libstdc++-libc6.1

Now we are ready to start our application on the PC104

  1. Log onto the pc104 card
  2. cd /home/giacchin/testIOC/bin/limux-x86
  3. chmod +x caRepeater example
  4. cd /home/giacchin/testIOC/iocBoot/iocexample
  5. Start the caRepeater: ../../bin/linux-x86/caRepeater &
  6. Start the example: ../../bin/linux-x86/example st.cmd

At this point you can access your PC104 through Channel Access from your host or another unix machine with EPICS: camonitor giacchinHost:dbExample1 (Don’t forget to set EPICS_CA_ADDR_LIST to the PC104 IP address if you’re on a different subnet.) — Mauro Giacchini (INFN-LNL) 7:35, 13 Apr 2005 (CDT) Credits: This document was derived from the original version done by Arne Freyberger (JLAB), sent to me by Stephen Wood (JLAB). Thanks a lot to both of you and to Ralph Lange (BESSY) and Glen Write (CLS) for additional help.