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: Does EPICS Base support multi-thread on vxWorks 6.3?
From: Andrew Johnson <[email protected]>
To: [email protected]
Cc: [email protected]
Date: Thu, 21 Jul 2011 11:59:13 -0500
Hi Lorna,

On 2011-07-21 you wrote:
> Finally, I'm able to build my own vxTestHarness.munch. I put it onto my
> vxWorks system, load it, and run the command epicsThreadPrivateTest, all 5
> tests passed.
> 
> Now I have no idea what has caused our problem :(

That's what I expected to happen.  The problem is that your build process is 
*not* doing the munching step, thus the binary that you're creating for 
vxWorks to load is not executing the C++ static constructors at load time.  
Your code is probably all written in C which doesn't have anything equivalent 
to static constructors, and as a result your code does not need to undergo the 
munching step.  Our code does contain C++ static constructors though, and will 
not work properly if those to not get executed.

> Actually we DO use EPICS build system, to build the static libraries (.a
> files on vxWorks). And then we link all the static libraries that we need
> into a single dynamic library (.o file on vxWorks). I'm not sure if
> there's munching stuff happening during the linking process. Could that be
> the issue?

The munching stuff has to happen *after* the linking process.  Once you have 
all of the code linked into a single object file, you have to perform the 
munch step on that file.  The munching process will look through all of the 
exported symbols in the file, extract those that are C++ static constructors, 
and create a .c file containing a couple of functions which will execute all 
those constructors as part of the vxWorks load step.  You may have to use a 
few special compiler switches when compiling that .c file, and you then link 
the output of that compilation with your orignal object file to produce a file 
that can be loaded on the vxWorks system.

These are the 4 commands that the EPICS build system uses to create a 
vxTestHarness.munch file on my system.  The object file that is the input to 
the munch step is called vxTestHarness:

/usr/local/vw/vxWorks-6.8/utilities-1.0/x86-linux2/bin/nmppc vxTestHarness  > 
vxTestHarness.nm

perl ../../../../bin/linux-x86_64/munch.pl -o vxTestHarness_ctdt.c 
vxTestHarness.nm

/usr/local/vw/vxWorks-6.8/gnu/4.1.2-vxworks-6.8/x86-linux2/bin/ccppc -c            
-DCPU=PPC32  -DvxWorks=vxWorks -include 
/usr/local/vw/vxWorks-6.8/vxworks-6.8/target/h/vxWorks.h  -O2 -Wall -mstrict-
align -mlongcall -fno-builtin -MMD -fdollars-in-identifiers -I. -I../O.Common 
-I. -I.. -I../../../../include/os/vxWorks -I../../../../include       -
I/usr/local/vw/vxWorks-6.8/vxworks-6.8/target/h -
I/usr/local/vw/vxWorks-6.8/vxworks-6.8/target/h/wrn/coreip  
vxTestHarness_ctdt.c

/usr/local/vw/vxWorks-6.8/gnu/4.1.2-vxworks-6.8/x86-linux2/bin/ldppc -r -T 
/usr/local/vw/vxWorks-6.8/vxworks-6.8/target/h/tool/gnu/ldscripts/link.OUT -o 
vxTestHarness.munch vxTestHarness_ctdt.o vxTestHarness


The munch.pl script that is the second command run above is part of EPICS 
Base.  Wind River provide an equivalent program called 'munch' which you 
should find in your $WIND_BASE/vxworks-6.3/host/<host-arch>/bin directory but 
it may need different command switches.  As I said before, the VxWorks Kernel 
Programmers Guide section 11.5 "Downloadable Kernel C++ Modules" has more 
details and will show you how to use their munch program.

Please ask your Wind River representative if you need any further help with 
this problem.  You can also look at how the vxTestHarness.munch file gets 
created on your system, it is made in the base/src/libCom/test directory.

- Andrew
-- 
Optimization is the process of taking something that works and
replacing it with something that almost works, but costs less.
-- Roger Needham

References:
Does EPICS Base support multi-thread on vxWorks 6.3? lorna . zhang
Re: Does EPICS Base support multi-thread on vxWorks 6.3? Andrew Johnson
Re: Does EPICS Base support multi-thread on vxWorks 6.3? lorna . zhang

Navigate by Date:
Prev: RE: Where is histogram? Dalesio, Leo
Next: Re: Where is histogram? Andrew Johnson
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: Re: Does EPICS Base support multi-thread on vxWorks 6.3? lorna . zhang
Next: RE: Does EPICS Base support multi-thread on vxWorks 6.3? Jeff Hill
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 ·