EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  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  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Generating loadable modules for Cexp
From: Till Straumann <[email protected]>
To: Ralph Lange <[email protected]>
Cc: EPICS Tech Talk <[email protected]>
Date: Wed, 04 May 2011 11:56:49 -0500
Ralph.

The modifications to build a relocatable EPICS IOC application
for loading with cexpsh are minimal. A 'diff' is attached; it
contains other local modifications (but is small anyways).

The cexp related stuff is in the following files

CONFIG_SITE.<host_arch>.RTEMS

     You'll have to make the same modifications for
     all host arches you use ;=( (IIRC, on older EPICS
     I could just tweak CONFIG_SITE.Common.RTEMS but for
     some reason I don't remember ATM under 3.14.12 that
     no longer works).

CONFIG.Common.RTEMS-pc386

     This needs a i386 specific fix (not needed for
     other BSPs.

src/libCom/osi/os/RTEMS/osdTime.cpp

     Needs a fix, the algorithm to detect whether
     the app is run-time loaded or not is broken.


HTH
-- Till

PS: If you want to break a IOC app into multiple loadable modules
    then quite a bit more thought + work is required.


On 05/04/2011 11:33 AM, Ralph Lange wrote:
Hi,

Does anyone have experiences/examples of adding support to the EPICS
build system for generating Cexp [1] loadable modules (instead of
binaries) for RTEMS and other target archs that can use Cexp?

We would like to add that option - preferably with an easy statement in
the Makefile that creates the module in addition or instead of the
completely linked binary - and would like to make new mistakes instead
of the old ones....

All hints, warnings, and rule snippets welcome!
~Ralph

[1] http://www.slac.stanford.edu/~strauman/rtems/cexp/

diff -crN base-3-14-12.orig//configure/CONFIG_SITE base-3-14-12/configure/CONFIG_SITE
*** base-3-14-12.orig//configure/CONFIG_SITE	2010-11-24 14:54:36.000000000 -0600
--- base-3-14-12/configure/CONFIG_SITE	2010-11-29 08:57:49.628308607 -0600
***************
*** 102,108 ****
  # configure/os/CONFIG_SITE.<host>.Common files will
  # override 
  #
! CROSS_COMPILER_TARGET_ARCHS=
  #CROSS_COMPILER_TARGET_ARCHS=vxWorks-68040
  
  #  If only a subset of the host architectures perform
--- 102,108 ----
  # configure/os/CONFIG_SITE.<host>.Common files will
  # override 
  #
! CROSS_COMPILER_TARGET_ARCHS=RTEMS-pc386
  #CROSS_COMPILER_TARGET_ARCHS=vxWorks-68040
  
  #  If only a subset of the host architectures perform
diff -crN base-3-14-12.orig//configure/os/CONFIG.Common.RTEMS-pc386 base-3-14-12/configure/os/CONFIG.Common.RTEMS-pc386
*** base-3-14-12.orig//configure/os/CONFIG.Common.RTEMS-pc386	2010-11-24 14:54:36.000000000 -0600
--- base-3-14-12/configure/os/CONFIG.Common.RTEMS-pc386	2010-12-01 11:53:40.362945129 -0600
***************
*** 22,25 ****
  #
  # Put text segment where it will work with etherboot
  #
! OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000
--- 22,26 ----
  #
  # Put text segment where it will work with etherboot
  #
! # Must be removed for CEXP/run-time loading:
! #OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000
diff -crN base-3-14-12.orig//configure/os/CONFIG_SITE.Common.RTEMS base-3-14-12/configure/os/CONFIG_SITE.Common.RTEMS
*** base-3-14-12.orig//configure/os/CONFIG_SITE.Common.RTEMS	2010-11-24 14:54:36.000000000 -0600
--- base-3-14-12/configure/os/CONFIG_SITE.Common.RTEMS	2010-12-01 11:41:45.034186251 -0600
***************
*** 5,16 ****
  
  # Where to find RTEMS
  #
! RTEMS_VERSION=4.9.2
! RTEMS_BASE=/usr/local/rtems/rtems-$(RTEMS_VERSION)
  
  # Cross-compile toolchain in $(RTEMS_TOOLS)/bin
  #
! RTEMS_TOOLS=$(RTEMS_BASE)
  
  
  # If you're using neither BOOTP/DHCP nor FLASH to pick up your IOC
--- 5,16 ----
  
  # Where to find RTEMS
  #
! RTEMS_VERSION=4.9
! RTEMS_BASE=/opt/rtems-$(RTEMS_VERSION)/target
  
  # Cross-compile toolchain in $(RTEMS_TOOLS)/bin
  #
! RTEMS_TOOLS=/opt/rtems-$(RTEMS_VERSION)/host/i386_linux26
  
  
  # If you're using neither BOOTP/DHCP nor FLASH to pick up your IOC
***************
*** 23,25 ****
--- 23,45 ----
  # Specify your desired command-line-input library
  #
  COMMANDLINE_LIBRARY = EPICS
+ 
+ #
+ # SSRLAPPS package. 
+ #
+ # Top location (for specific CPU and BSP):
+ SSRLAPPS= $(RTEMS_BASE)/ssrlApps/$(RTEMS_TARGET_CPU)-rtems$(RTEMS_VERSION)/$(T_A:RTEMS-%=%)
+ 
+ # If anything, apps need the headers
+ OP_SYS_INCLUDES += -I$(SSRLAPPS)/include
+ 
+ # Very unlikely that they need a library from there, too
+ # since things are usually contained in modules that are
+ # run-time loaded prior to EPICS.
+ #
+ # If any application really needs a library 'foo' then
+ # their Makefile should say:
+ #
+ # foo_DIR=$(SSRLAPPS_LIB)
+ SSRLAPPS_LIB=$(SSRLAPPS)/lib
+ 
diff -crN base-3-14-12.orig//configure/os/CONFIG_SITE.linux-x86_64.RTEMS base-3-14-12/configure/os/CONFIG_SITE.linux-x86_64.RTEMS
*** base-3-14-12.orig//configure/os/CONFIG_SITE.linux-x86_64.RTEMS	1969-12-31 18:00:00.000000000 -0600
--- base-3-14-12/configure/os/CONFIG_SITE.linux-x86_64.RTEMS	2010-11-29 09:30:52.448856929 -0600
***************
*** 0 ****
--- 1,17 ----
+ #
+ # Site-specific information for all RTEMS targets
+ #
+ #-------------------------------------------------------
+ 
+ # CEXP run-time loading
+ override EXE=.obj
+ OP_SYS_LDFLAGS = $(CPU_CFLAGS) -Wl,-r -nostdlib
+ # To strip debugging symbols add
+ #OP_SYS_LDFLAGS += -Wl,-S
+ 
+ #Don't bother to build munched binaries
+ MUNCH_CMD=
+ MUNCHNAME=
+ 
+ #
+ OP_SYS_LDLIBS=
diff -crN base-3-14-12.orig//src/libCom/osi/os/RTEMS/osdTime.cpp base-3-14-12/src/libCom/osi/os/RTEMS/osdTime.cpp
*** base-3-14-12.orig//src/libCom/osi/os/RTEMS/osdTime.cpp	2010-11-24 14:54:36.000000000 -0600
--- base-3-14-12/src/libCom/osi/os/RTEMS/osdTime.cpp	2010-11-29 10:05:35.477850025 -0600
***************
*** 18,23 ****
--- 18,24 ----
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
+ #include <rtems/rtems_bsdnet_internal.h>
  #include "epicsTime.h"
  #include "osdTime.h"
  #include "osiNTPTime.h"
***************
*** 117,133 ****
   * explicitly calls osdTimeRegister() at the appropriate time.
   * However if we are loaded dynamically we *do* register our
   * standard time providers at static constructor time; in this
!  * case the tick rate will have been set already.
   */
  static int staticTimeRegister(void)
  {
-     if (rtemsTicksPerSecond != 0)
-         osdTimeRegister();
- 
      rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &rtemsTicksPerSecond);
      rtemsTicksPerSecond_double = rtemsTicksPerSecond;
      rtemsTicksPerTwoSeconds_double = rtemsTicksPerSecond_double * 2.0;
  
      return 1;
  }
  static int done = staticTimeRegister();
--- 118,138 ----
   * explicitly calls osdTimeRegister() at the appropriate time.
   * However if we are loaded dynamically we *do* register our
   * standard time providers at static constructor time; in this
!  * case the network is available already.
   */
  static int staticTimeRegister(void)
  {
      rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &rtemsTicksPerSecond);
      rtemsTicksPerSecond_double = rtemsTicksPerSecond;
      rtemsTicksPerTwoSeconds_double = rtemsTicksPerSecond_double * 2.0;
  
+     /* If networking is already up at the time static constructors
+      * are executed then we are probably run-time loaded and it's
+      * OK to osdTimeRegister() at this point.
+      */
+     if (rtems_bsdnet_ticks_per_second != 0)
+         osdTimeRegister();
+ 
      return 1;
  }
  static int done = staticTimeRegister();

References:
Generating loadable modules for Cexp Ralph Lange

Navigate by Date:
Prev: CMLOG Execution and configuration problem Ritesh Sugandhi
Next: EPICS and Octave Andreas Balzer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Generating loadable modules for Cexp Ralph Lange
Next: Re: Generating loadable modules for Cexp Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·