EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Embedded EPICS IOC
From: Andrew Johnson <[email protected]>
To: David DeBonis <[email protected]>
Cc: [email protected]
Date: Tue, 31 Jul 2007 14:14:48 -0500
Hi David,

David DeBonis wrote:
We are working on an embedded EPICS IOC deployment but are running into some confusion on what is necessary to build to our target architecture which is ARM running a linux kernel 2.6.x. We have our own cross-compilers that we would like to use and build with but we seem to be running into issue with some post-build executables that need to be run on the target.
Can someone clarify what EPICS binaries are necessary to be deployed to the target to run as a "Soft IOC" standalone? Also, can we cross-compile all we need on our host system yet run fully standalone on the target?

You've probably come across the issue with the CA Repeater. All IOCs contain the CA Client library, and when it starts up the client library looks for a running CA Repeater on the localhost network interface. If it doesn't find one, it will fork and attempt to exec the caRepeater binary.


In the case of a purely embedded IOC you have two choices about how to solve this issue and prevent the warning message that appears if the exec is unsuccessful. The simplest solution is to include the caRepeater on your target disk partition and arrange for it to be run before the IOC starts. It should never exit even if the IOC does, so it should never need restarting. With this solution you will need to include the caRepeater executable on the target as well as the ioc itself.

The alternative solution is to explicitly start the repeater as a separate thread within the IOC's main() program. This may use slightly fewer resources than when running it in a separate process (not least because you don't need the separate caRepeater executable), but it is a little more complicated to set up as it requires adding some lines to main(), and it is not guaranteed to work unchanged on different versions of EPICS Base since the caRepeaterThread() routine is not an official API. The code you would need is as follows:

    #include "epicsThread.h"
    extern "C" void caRepeaterThread (void *);

    epicsThreadCreate("CAC-repeater", epicsThreadPriorityLow,
        epicsThreadGetStackSize(epicsThreadStackMedium),
        caRepeaterThread, 0);

That epicsThreadCreate() call should appear at the top of the main() definition in your IOC's xxxApp/src/xxxMain.cpp file.

You should be able to do what you want using a linux-arm cross-compiler to generate a fully stand-alone ioc executable (and caRepeater if you chose the first option above). You might also want to experiment with statically linking against the EPICS libraries, for which there are controls in the EPICS build system to turn off building shared libraries (make sure you remove the lib*.so files from your lib/linux-arm directories if you do that). If you stick with the shared libraries, you'll need to copy them all to the target as well as the executables, and be aware of the issues of the runtime search path to find them all.

HTH,

- Andrew
--
When a distinguished but elderly scientist states that something is
possible, he is almost certainly right.  When he states that something
is impossible, he is very probably wrong.  -- Arthur C. Clarke

References:
Embedded EPICS IOC David DeBonis

Navigate by Date:
Prev: Re: PV save and restore tool sought Emmanuel Mayssat
Next: Re: PV save and restore tool sought Kay-Uwe Kasemir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Embedded EPICS IOC David DeBonis
Next: Re: Embedded EPICS IOC Mauro Giacchini
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·