Experimental Physics and Industrial Control System
Hi Bill.
Finally some RTEMS posting :-)
Bill Nolan wrote:
Hi all,
I've come to an interesting impass in trying to get the example IOC to start
using R3.14.beta1 and RTEMS. I hope the problem is that I'me being simple..
Drunig the boot sequence with rtems the Init() function is called from
rtems_init.c to setup the network, time , syslog etc. in Init() iocsh("st.cmd")
is called.
But Init() is called before main().
I slightly patched rtems_init.c so it calls main(). Note that the appended
patch also contains some other (small but important) fixes and workarounds
useful under RTEMS - some things have already been fixed, I had been
told, but probably are not in the distributed beta1 release yet.
What CPU/BSP are you using?
Regards
-- Till
so the app specific iocRegester calls are never made, Sould I cuntomize
rtems_init.c for each app ?
or export a replacement iocshRegisterRTEMS() ?
Thanks.
Bill N.
[email protected]
############################################################
The things you can't remember, tell the things you
can't forget.
############################################################
Index: RTEMS/base/rtems_init.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/epics/base/src/RTEMS/base/rtems_init.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 rtems_init.c
*** rtems_init.c 2002/03/09 18:09:24 1.1.1.1
--- rtems_init.c 2002/07/11 01:00:13
***************
*** 193,204 ****
--- 193,213 ----
&rtems_bsdnet_config
};
+ #define DO_NORMAL_MAIN
+
/*
* RTEMS Startup task
*/
rtems_task
Init (rtems_task_argument ignored)
{
+ #ifndef DO_NORMAL_MAIN
+ /* T. Straumann: invoke global constructors
+ * from a task context...
+ */
+ extern void __do_global_ctors(void);
+ __do_global_ctors();
+ #endif
/*
* Create a reasonable environment
*/
***************
*** 207,224 ****
putenv ("IOCSH_PS1=epics> ");
putenv ("IOCSH_HISTSIZE=20");
/*
* Start network
*/
printf ("***** Initializing network *****\n");
rtems_bsdnet_initialize_network ();
printf ("***** Initializing TFTP *****\n");
rtems_bsdnet_initialize_tftp_filesystem ();
for (;;) {
printf ("***** Initializing NTP *****\n");
if (rtems_bsdnet_synchronize_ntp (0, 0) >= 0)
break;
! epicsThreadSleep (10.0);
}
printf ("***** Initializing syslog *****\n");
openlog ("IOC", LOG_CONS, LOG_DAEMON);
--- 216,239 ----
putenv ("IOCSH_PS1=epics> ");
putenv ("IOCSH_HISTSIZE=20");
+ /* T. Straumann: epicsThreadSleep() doesnt work before clockInit() */
+ clockInit();
+
/*
* Start network
*/
+ printf ("\nWelcome to EPICS on RTEMS\n");
printf ("***** Initializing network *****\n");
rtems_bsdnet_initialize_network ();
printf ("***** Initializing TFTP *****\n");
rtems_bsdnet_initialize_tftp_filesystem ();
for (;;) {
+ double sl=10.0;
printf ("***** Initializing NTP *****\n");
if (rtems_bsdnet_synchronize_ntp (0, 0) >= 0)
break;
! printf("SLEEP %g\n",sl);
! epicsThreadSleep (sl);
}
printf ("***** Initializing syslog *****\n");
openlog ("IOC", LOG_CONS, LOG_DAEMON);
***************
*** 230,235 ****
--- 245,251 ----
printf ("***** Executing EPICS startup script *****\n");
iocshRegisterRTEMS ();
rtems_set_directory ();
+ #if 0
iocsh ("st.cmd");
/*
***************
*** 237,242 ****
--- 253,272 ----
*/
epicsThreadSleep (2.0);
iocsh (NULL);
+ #else
+ #ifdef DO_NORMAL_MAIN
+ {
+ char *args[]={"iocsh","st.cmd"};
+ main(2,args);
+ }
+ #else
+ {
+ extern int rtems_main(int, char **);
+ char *args[]={"iocsh","st.cmd"};
+ rtems_main(2,args);
+ }
+ #endif
+ #endif
LogFatal ("Console command interpreter terminated");
}
Index: RTEMS/base/rtems_netconfig.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/epics/base/src/RTEMS/base/rtems_netconfig.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** rtems_netconfig.c 2002/03/09 18:09:24 1.1.1.1
--- rtems_netconfig.c 2002/03/09 19:08:38 1.2
***************
*** 44,49 ****
--- 44,52 ----
#else /* Use NIC provided by BSP */
# define NIC_NAME RTEMS_BSP_NETWORK_DRIVER_NAME
# define NIC_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH
+ /* T. Straumann, TSILL, 12/18/2001, added declaration, just in case */
+ extern int
+ RTEMS_BSP_NETWORK_DRIVER_ATTACH();
#endif
static struct rtems_bsdnet_ifconfig netdriver_config = {
Index: libCom/cxxTemplates/tsFreeList.h
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/epics/base/src/libCom/cxxTemplates/tsFreeList.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** tsFreeList.h 2002/03/09 18:09:30 1.1.1.1
--- tsFreeList.h 2002/04/05 00:52:34 1.2
***************
*** 74,81 ****
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
! tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
tsFreeListItem < T, DEBUG_LEVEL > items [N];
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
--- 74,84 ----
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
! /* Till Straumann <[email protected]>, 2002/4/4
! * put the items first to maintain alignment.
! */
tsFreeListItem < T, DEBUG_LEVEL > items [N];
+ tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
Index: libCom/osi/os/RTEMS/osdPoolStatus.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/epics/base/src/libCom/osi/os/RTEMS/osdPoolStatus.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** osdPoolStatus.c 2002/03/09 18:09:31 1.1.1.1
--- osdPoolStatus.c 2002/03/09 18:38:31 1.2
***************
*** 8,12 ****
--- 8,17 ----
*/
epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ()
{
+ /* T. Straumann: 2/12/2002 the current RTEMS implementation
+ of this has a serious flaw (killing
+ real-time responsiveness!!!) DONT USE
return (malloc_free_space() > 100000);
+ */
+ return 1;
}
Index: libCom/osi/os/RTEMS/osdThread.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep/epics/base/src/libCom/osi/os/RTEMS/osdThread.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** osdThread.c 2002/03/09 18:09:31 1.1.1.1
--- osdThread.c 2002/03/09 18:52:38 1.2
***************
*** 118,131 ****
unsigned int
epicsThreadGetStackSize (epicsThreadStackSizeClass size)
{
switch(size) {
! case epicsThreadStackSmall: return( 4000*ARCH_STACK_FACTOR);
! case epicsThreadStackMedium: return( 6000*ARCH_STACK_FACTOR);
! case epicsThreadStackBig: return(11000*ARCH_STACK_FACTOR);
default:
errlogPrintf("epicsThreadGetStackSize illegal argument");
}
! return(11000*ARCH_STACK_FACTOR);
}
/*
--- 118,136 ----
unsigned int
epicsThreadGetStackSize (epicsThreadStackSizeClass size)
{
+ unsigned int rval=(11000*ARCH_STACK_FACTOR);
+ /* T. Straumann: make sure we allocate at least RTEMS_MINIMUM_STACK_SIZE */
switch(size) {
! case epicsThreadStackSmall: rval = ( 4000*ARCH_STACK_FACTOR); break;
! case epicsThreadStackMedium: rval = ( 6000*ARCH_STACK_FACTOR);
! case epicsThreadStackBig: break;
default:
errlogPrintf("epicsThreadGetStackSize illegal argument");
+ break;
}
! if (rval < RTEMS_MINIMUM_STACK_SIZE)
! rval = RTEMS_MINIMUM_STACK_SIZE;
! return rval;
}
/*
***************
*** 261,267 ****
if (!initialized) epicsThreadInit();
if (stackSize < RTEMS_MINIMUM_STACK_SIZE) {
errlogPrintf ("epicsThreadCreate %s illegal stackSize %d\n",name,stackSize);
! return 0;
}
strncpy (c, name, sizeof c);
sc = rtems_task_create (rtems_build_name (c[0], c[1], c[2], c[3]),
--- 266,274 ----
if (!initialized) epicsThreadInit();
if (stackSize < RTEMS_MINIMUM_STACK_SIZE) {
errlogPrintf ("epicsThreadCreate %s illegal stackSize %d\n",name,stackSize);
! /* T. Straumann: just increase the stack size */
! /* return 0; */
! stackSize=RTEMS_MINIMUM_STACK_SIZE;
}
strncpy (c, name, sizeof c);
sc = rtems_task_create (rtems_build_name (c[0], c[1], c[2], c[3]),
- References:
- iocsh under Epics r3.14 RTEMS Bill Nolan
- Navigate by Date:
- Prev:
iocsh under Epics r3.14 RTEMS Bill Nolan
- Next:
Re: iocsh under Epics r3.14 RTEMS Eric Norum
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
- Navigate by Thread:
- Prev:
iocsh under Epics r3.14 RTEMS Bill Nolan
- Next:
Re: iocsh under Epics r3.14 RTEMS Eric Norum
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025