next up previous contents
Next: Script to get and Up: EPICS Applications Previous: EPICS Applications   Contents

Subsections

The EPICS example application

Build the example application

  1. Create a new directory to hold the application source and then `cd' to that directory.

  2. Run the makeBaseApp.pl program to create the example application:
    makeBaseApp.pl -t example test
    makeBaseApp.pl -i -t example -a RTEMS-mvme2100 test
    
    If you get complaints about not being able to run these commands you've probably forgotten to put the `bin' directory created in the previous section on your shell executable search path.

    The `test' in the two makeBaseApp.pl commands can be replaced with whatever name you want to give your example application. The `RTEMS-mvme2100' can be replaced with whatever target architecture you plan to use to run the example application.

  3. Build the example application by running
    make
    

Install the EPICS IOC files on the TFTP/NFS server

The application build process creates db and dbd directories in the top-level application directory and produces a set of IOC shell commands in the st.cmd file in the iocBoot/ioctest directory. If you chose an application name different than test in the previous step, the directory name will change accordingly. These directories and their contents must be copied to your TFTP/NFS server. The actual location depends upon the remote file access technique being used as described in the following section.


Run the example application on an RTEMS IOC

Everything's now ready to go. The only item left is arranging some way of loading the RTEMS/EPICS application executable image into the IOC. There are many ways of doing this (floppy disks, PROM images, etc.), but I find using a BOOTP/DHCP/TFTP server to be the most convenient. The remainder of this section describes how I load executables into my RTEMS-mvme2100 and RTEMS-pc386 IOCs. If you're running a different type of IOC you'll have to figure out the required steps on your own. The RTEMS documentation may provide the required information since an EPICS IOC application is an RTEMS application like any other.

Some RTEMS board-support packages require an NTP server on the network. If such an IOC doesn't receive a time-synchronization packet from an NTP server the IOC time will be set to 00:00:00, January 1, 2001.

Location of EPICS startup script

If you're using BOOTP/DHCP to provide network configuration information to your IOC you should use DHCP site-specific option 129 to specify the path to the IOC startup script. If you're using PPCBUG you should set the NIOT `Argument File Name' parameter to the IOC startup script path.

If you're using NFS for remote file access the EPICS initialization uses the startup script pathname to determine the parameters for the initial NFS mount. If the startup script pathname begins with a `/' the first component of the pathname is used as both the server path and the local mount point. If the startup script pathname does not begin with a `/' the first component of the pathname is used as the local mount point and the server path is ``/tftpboot/'' followed by the first component of the pathname. This allows the NFS and TFTP clients to have a similar view of the remote filesystem.

If you're using TFTP for remote file access the RTEMS startup code first changes directories to /epics/hostname/ within the TFTP server, where hostname is the Internet host name of the IOC. The startup code then reads IOC shell commands from the st.cmd script in that directory. The name (st.cmd) and location of the startup script are fixed from the IOCs point of view so it must be installed in the corresponding location on the TFTP server. Many sites run the TFTP server with an option which changes its root directory. On this type of system you'll have to copy the startup script to the /epics/hostname/ directory within the TFTP server's root directory. On a system whose TFTP server runs with its root directory set to /tftpboot the startup script for the IOC whose name is norumx1 would be placed in

/tftpboot/epics/norumx1/st.cmd
The application build process creates db and dbd directories in the top-level application directory. These directories and their contents must be copied to the IOC's directory on the TFTP server. For the example described above the command to install the files for the norumx1 IOC is
cp -r db dbd /tftpboot/epics/norumx1

MVME2100 Using PPCBUG

  1. Use the PPCBUG ENV command to set the `Network PReP-Boot Mode Enable' parameter to `Y'.
  2. Use the PPCBUG NIOT command to set the network parameters. Here are the parameters for a test IOC I use:
    Controller LUN =00
    Device LUN     =00
    Node Control Memory Address =FFE10000
    Client IP Address      =www.xxx.yyy.8
    Server IP Address      =www.xxx.yyy.131
    Subnet IP Address Mask =255.255.252.0
    Broadcast IP Address   =192.168.11.255
    Gateway IP Address     =0.0.0.0
    Boot File Name ("NULL" for None)     =/epics/test/bin/RTEMS-mvme2100/example.boot
    Argument File Name ("NULL" for None) =www.xxx.yyy.98:/home/epics:test/iocBoot/iocexample/st.cmd
    Boot File Load Address         =001F0000
    Boot File Execution Address    =001F0000
    Boot File Execution Delay      =00000000
    Boot File Length               =00000000
    Boot File Byte Offset          =00000000
    BOOTP/RARP Request Retry       =00
    TFTP/ARP Request Retry         =00
    Trace Character Buffer Address =00000000
    BOOTP/RARP Request Control: Always/When-Needed (A/W)=W
    BOOTP/RARP Reply Update Control: Yes/No (Y/N)       =Y
    

  3. Set up your TFTP/NFS servers. PPCBUG uses TFTP to load the executable image then the EPICS initialization uses NFS to read the EPICS startup script (the `Argument File Name' in the NIOT parameters). I set the TFTP server root to /tftpboot and arrange for the NFS server to export /tftpboot/epics to the IOCs. This arrangement lets me simply copy the application tree, beginning at the <top> directory to the TFTP/NFS server area.


Motorola Processors Using MOTLOAD

The following `Global Environment Variables' are used. These are set using the MOTLOAD gevEdit command.
mot-script-boot
These commands are run by MOTLOAD when the board is booted. A typical example is shown below:
tftpGet -cww.ww.ww.ww -sxx.xx.xx.xxx -myy.yy.yy.yy -d/dev/enet0 -fpath
netShut
go
where ww.ww.ww.ww is the IP number of the client (VME card), xx.xx.xx.xx is the IP number of the TFTP server, yy.yy.yy.yy is the IP subnet mask, and path is the path to the executable image file on the TFTP server.

The standard MOTLOAD download buffer may be too small to hold your application. If this is the case you can call malloc to allocate a larger buffer and then use the -a option to pass the address of this buffer to the tftpGet and go commands:

dla=malloc 0x280000
tftpGet -cww.ww.ww.ww -sxx.xx.xx.xxx -myy.yy.yy.yy -d/dev/enet0 -fpath -adla
netShut
go -adla

mot-/dev/enet0-cipa
The client (VME card) IP address. If this variable is not set the client address is set to the value of the `-c' argument in the mot-script-boot variable.

mot-/dev/enet0-sipa
The server IP address. If this variable is not set the server address is set to the value of the `-s' argument in the mot-script-boot variable.

mot-/dev/enet0-gipa
The gateway IP address. If this variable is not set the gateway IP address is set to the value of the `-g' argument in the mot-script-boot variable.

mot-/dev/enet0-snma
The subnet mask. If this variable is not set the subnet mask is set to the value of the `-m' argument in the mot-script-boot variable.

mot-/dev/enet0-file
The name of the executable image. If this variable is not set the name is set to the value of the `-f' argument in the mot-script-boot variable. The name is passed as the `argv[0]' to the main() function.

rtems-dns-server
The domain name server IP address. If this variable is not set the server address as described above is used.

rtems-dns-domainname
The domain name. If this variable is not set the value compiled into the executable image is used.

rtems-client-name
The client host name. If this variable is not set the client address as described above is used.

epics-script
The path to the IOC startup script on the TFTP or NFS server. The value can be a simple path or be of the form nfsServer:nfsExport:nfsPath. The nfsExport component is the directory exported from the NFS server and is also used as the local mount point and as a prefix to nfsPath.

epics-nfsmount
If set, this variable should be of the form nfsServer:nfsExport:nfsMount. The nfsExport component is the directory exported from the NFS server and the nfsMount is the local mount point.

epics-ntpserver
The NTP server IP address. If this variable is not set the server address as described above is used.

epics-tz
Set the value of the TZ environment variable. This is useful for handling daylight-savings-time changes. A value of CST6CDT5,M3.2.0,M11.1.0 is appropriate for Chicago in 2007 and perhaps subsequent years.

PC386

  1. Install an EtherBoot bootstrap PROM image obtained from the `ROM-o-matic' server (http://www.rom-o-matic.net/) on the IOC network interface cards.
  2. Set up your BOOTP/DHCP server to provide the network configuration parameters to the IOC.
  3. The TFTP and NFS servers can be configured as noted above.

Arcturus uCDIMM ColdFire 5282

Use the bootstrap setenv command to set the EPICS and network configuration parameters:
IPADDR0=www.xxx.yyy.27
HOSTNAME=ioccoldfire
BOOTFILE=epics/ucdimm/bin/RTEMS-uC5282/ucdimm.boot
NAMESERVER=www.xxx.yyy.167
NETMASK=255.255.252.0
CMDLINE=epics/i2c/iocBoot/ioci2c/st.cmd
SERVER=www.xxx.yyy.161
NFSMOUNT=106.74@nfssrv:/export/nfssrv:/home/nfssrv

The environment variables used by the EPICS startup code are:

IPADDR0
The client (Coldfire processor) IP address.

HOSTNAME
The client host name.

SERVER
The server IP address. If this variable is not set the specific server addressses as described below must be set.

GATEWAY
The gateway IP address. If this variable is not set the Coldfire will be able to communicate only with hosts on its local network.

NETMASK
The subnet mask.

BOOTFILE
The name of the executable image. The name is passed as the `argv[0]' to the main() function.

NTPSERVER
The NTP server IP address. If this variable is not set the server address as described above is used.

NAMESERVER
The domain name server IP address. If this variable is not set the server address as described above is used.

DOMAIN
The domain name. If this variable is not set the value compiled into the executable image is used.

CMDLINE
The path to the IOC startup script on the TFTP or NFS server. The value can be a simple path or be of the form nfsServer:nfsExport:nfsPath. The nfsExport component is the directory exported from the NFS server and is also used as the local mount point and as a prefix to nfsPath.

NFSMOUNT
If set, this variable should be of the form nfsServer:nfsExport:nfsMount. The nfsExport component is the directory exported from the NFS server and the nfsMount is the local mount point.

TZ
Set the value of the TZ environment variable. This is useful for handling daylight-savings-time changes. A value of CST6CDT5,M3.2.0,M11.1.0 is appropriate for Chicago in 2007 and perhaps subsequent years.

The uCDIMM ColdFire 5282 module is distributed with two types of bootstrap ROMs. One type provides a TFTP server and the other provides a TFTP client. The steps required to boot an EPICS application differ depending on the the bootstrap type.

Arcturus uCDIMM ColdFire 5282 with boostrap ROMs providing TFTP server

Use the bootstrap tftp command to load the IOC application image (which may include a tar image of the in-memory filesystem contents in which case the CMDLINE will likely look something like /st.cmd and the NFSMOUNT need not be present). You'll need to run a TFTP client on your host machine to transfer the file. An example using curl is:
curl -T bin/RTEMS-uC5282/example.boot tftp://192.168.1.93
where 192.168.1.93 is the IP address of the ColdFire target.

Use the bootstrap goram command to start the application or the program command to burn the image into the on-board flash memory. In the latter case you may want to also use the setenv command to set the AUTOBOOT environment variable.

Arcturus uCDIMM ColdFire 5282 with boostrap ROMs providing TFTP client

The bootstrap procedure in this case is similar to that for the Motorola VME processors in section 4.1.4.

The cexp package can be used to incrementally load your application components.


next up previous contents
Next: Script to get and Up: EPICS Applications Previous: EPICS Applications   Contents
Eric Norum
norume@aps.anl.gov
Mon Oct 19 11:30:39 CDT 2009