EPICS Home

Experimental Physics and Industrial Control System


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

Subject: Re: how to prevent ioc app from being built for both target and host?
From: Till Straumann <[email protected]>
To: "M.C.Shao" <[email protected]>
Cc: Tech-talk <[email protected]>
Date: Mon, 14 Apr 2003 11:42:40 -0700
M.C.Shao wrote:
> hi, all,
> I am building a rtems application with some hardware device/driver support. And the host arch is linux-x86,while the target is rtems-pc386.
> I must invoke rtems APIs in my device support,

Please consider avoiding any OS specific APIs if possible but use
epicsThread, epicsEvent, epicsMutex etc.

For VME access, you can use devLib (I have a devLib implementation
for powerpc-rtems [any board using the Tundra Universe VME-PCI
bridge - porting to x86 should be easy]).

> so I have to include header files of rtems in my device support source,

Some more tips to write portable code (sorry for the "lecture")

 - If you really _must_ use RTEMS specific code, try to use 'wrapper'
   inlines or macros and concentrate their definition in one file.

 - Dont do device I/O using simple memory access, i.e. DONT access
   a device register like an ordinary variable but do every access
   using an inline or macro to ease porting your device support to
   a different CPU/endianness.

   RTEMS has suitable macros in libcpu/io.h. I can provide a portable
   header for other architectures.

 - Dont use 'fancy' API features - think twice if you could implement
   the required functionality using and EPICS OSI API.

> such as "#include <rtems.h>". Then some codes in the device support are target arch related. But the Makefile created by "makeBaseApp.pl" are still trying to build the application for both host(linux-x86) and target(rtems-pc386). 
> How to turn off this feature of the building system?
> thanks.
>  
> 

If you want to build an IOC application (e.g. 'zzz') just for RTEMS
use

PROD_IOC_RTEMS = zzz

instead of

PROD_IOC = zzz

which would build for all target architectures.

Also, if you have a source file that is relevant only on
a specific target, use e.g.

zzz_SRCS += some_code_for_all_targets.c

zzz_SRCS_RTEMS += foo_rtems_implementation.c
zzz_SRCS_vxWorks += foo_vxWorks_implementation.c

Architecture dependent code can be conditionally
compiled with

#ifdef __rtems__

although it's much better to use an EPICS OSI API.

HTH
-- Till




References:
how to prevent ioc app from being built for both target and host? M.C.Shao

Navigate by Date:
Prev: RE: epicsMutexLockWithTimeout not supported in 3.14.1 Jeff Hill
Next: Channel Access disconnect/reconnect Nick Rees
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: how to prevent ioc app from being built for both target and host? Marty Kraimer
Next: ways to add driver support layer for rtems ioc M.C.Shao
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024