Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Created: Shantha Condamoor

Date: 15-Oct-2014
----------------------------------------------------------------------

While linuxRT is a relatively established RTOS at ICD, it has mostly been used only in conjunction with the uTCA platform.

Recently linuxRT has been 'ported' and running successfully on a few COTS linux servers such as the Dell PowerEdge servers and SuperMicro Industrial PCs.

Till Straumann built a newer version of linuxRT to support the new hardware.

These servers are all Intel-based targets that now run linuxRT (embedded linux) with uClibc and PREMPT_RT patch.

The important change to the linuxRT RTOS was the addition of support for the Broadcom NIC chipsets which are ethernet network controllers found in these servers.

The other important change was the setup of these servers to boot linuxRT targets as diskless clients.

The BIOS boot order was modified to over-ride the'boot out of hard-disk' or 'CD-ROM' which are the default in most cases, and to perform network booting as the first choice.

Finally, the redirection of the console output to the 'screen' process  instead of the monitor, via  via the  'iocConsole' script.

This re-direction of screen output to the first serial port, instead of the monitor, was also done in BIOS to enable us to  observe the PC boot process remotely like all our IOCs,

As we continue to test this new system and learn more, this document will also evolve.

Here's something to get started with linuxRT using the latest EPICS base.

We will use 'MyTest'  as an example EPICS application and 'vioc-b34-bd32' as an example IOC.

1. What is 'new' EPICS?

The 'new' version of EPICS is R3-14-12-3_1-0

2. How do I setup my bash shell to use the new EPICS?

...

2. If only one EVR (either PMC EVR230 or PCI EVR300) is installed in your system, then the above restriction does not apply and soft links are not needed.

Take a look at the following script:
/afs/slac/g/lcls/package/linuxKernel_Modules/pci_mrfev300_linuxRT/buildroot-2014.08/module_load

Notice how kernel modules are loaded as device drivers under the /dev/ in linuxRT much like linux.

3. The Broadcom Ethernet NIC driver used to be a separate kernel module and its dirver was loaded dynamically via ;modprobe tg3' in this script.
With the latest linuxRT version 3.14.12-rt9, this step has become unnecessary as the driver has become part of this linuxRT boot image.

4. The SIS digitizers for uTCA, loads their device drivers in 'kernel-modules.cmd':
SIS8300_DRIVER=$KERNEL_DRIVER_HOME/sis8300drv/MAIN_TRUNK

modprobe uio
insmod $SIS8300_DRIVER/sis8300drv.ko

Please note that as of date, SIS8300 has NOT been rebuilt for the latest linuxRT 3.14.12-rt9.
It is currently unsupported on COTS Linux servers.

For convinience, you can setup a soft link to your ioc's home directory in kernel-modules.cmd as below:

ln -s /afs/slac/g/lcls/epics/iocCommon/ioc-b34-pm32              /home/laci/ioc-b34-pm32

11. How do I create a startup script for my ioc?

...

ulimit -l unlimited

The following line is also needed to run the ioc with real-time priorities:

ulimit -r unlimited

Finally, you will be running your ioc as a specific user called as 'laci' who has permissions to run this ioc:
Setup the permissions for this user 'laci':

umask 002

Now you are ready to start your IOC and have it run as a foreground process.

Create a directory called as 'vioc-b34-bd32' for your 'virtual' ioc process under the following directory:

$IOC/ioc-b34-bd32
 
cd $IOC/ioc-b34-bd32/vioc-b34-bd32
 
Set up a soft link to the 'bin' directory of your IOC app that you created in step (6):

ln -s  /afs/slac/g/lcls/epics/R3-14-12-3_1-0/iocTop/Test/Development/bin/linuxRT-x86 bin

Create an ASCII text file called 'screenrc' with the following lines in it:

deflog on

logtstamp on

defscrollback 10000

'screenrc' is passed as an argument to the 'screen' process and allows us to customize a few parameters such as number of lines stored in history buffer that we can scroll back for viewing.

In the same directory $IOC/ioc-b34-my01/vioc-b34-my01, add a startup script 'iocStartup.cmd' for vioc-b34-my01:

It setups some shell environment variables used by all iocs, then changes to the ioc boot directory and starts the st.cmd file.

...

Work is still in progress regarding standardizing App-specific st.cmd.

 The IOC engineer has freedom to be as creative with this script during development;.

but But the following are expected as a minimum when the ioc is installed in production.

That is the reason they are included in the default template provided by the icdTemplates module, as a guideline:

13. How do I start my ioc and monitor it?

  1.  Making available several key paths and variables to your ioc by setting the environment variables.
    These were auto-generated during the application 'make' process and stored the 'envPaths' file under your ioc's boot directory.
    st.cmd should set all these variables using 'envPaths'.
    < envPaths
  2. Set the '<TOP>' variable. You could do this via the macro ${IOC_APP} which was defined in 'iocStartup.cmd' as describe before.
    epicsEnvSet(TOP,"${IOC_APP}")
  3. Load Timing-related databases using standard templates.
  4. Load iocAdmin and iocRelease databases using standard templates
  5. Load database for autosave using standard templates and use "makeAutosaveFiles" to autogenerate the PVs to be autoasaved/restored.

While the above is common guideline for all iocs, the following is specific to linuxRT.

You can set up real-time priorities after iocInit() for your driver threads and this can be done with a script such as rtPrioritySetup.cmd.

cd ${IOC_BOOT}

system("/bin/su root -c `pwd`/rtPrioritySetup.cmd")

Look at /afs/slac/g/lcls/epics/R3-14-12-3_1-0/iocTop/Test/Development/iocBoot/vioc-b34-bd32/rtPrioritySetup.cmd as an example.

13. How do I start my ioc and monitor it?

Example, from any lcls-dev host ssh to your ioc as 'laci':

ssh Example, from any lcls-dev host ssh to your ioc as 'laci':
ssh laci@ioc-b34-bd32

$ cd /afs/slac/g/lcls/epics/iocCommon/ioc-b34-bd32

Ensure that 'startupConsole-laci-rt.cmd' is in your current directory.

Start the virtual ioc as a foreground process:

./startupConsole-laci-rt.cmd

...

In $IOC/ioc-b34-bd32, you can add another script 'startup-laci-rt.cmd' that lets you start your EPICS-based 'virtual' ioc as a background process in your host.

...

The above line will automatically start your ioc and have it running in the background, every time your server reboots

 

 

To view the console output from the running ioc, you can attach the screen process to it, as described below:

(1)   ssh into the ioc-b34-b32 as user  "laci":

ssh laci@ioc-b34-bd32

 

(2) To see the list of all EPICS iocs running on this CPU, at the console type:

screen  -ls 

(3) To attach to vioc-b34-b32 that is running MyTest application:

screen -r vioc-b34-b32 

(4) To detach screen process from vioc-b34-bd32, press:

 

While pressing <CTRL> key, press ''A" and then 'D".

 

(5) You can also connect to vioc-b34-bd32 from any linux host, not just from ioc-b34-bd32.

 

This method uses the python-based iocConsole program.

 

ssh into LCLSDEV host (example, lcls-dev2) an type:

 

iocConsole  vioc-b34-bd32

 

 

 

15. Which script calls what and what parameters are passed from one to another?

...