cd /afs/slac/package/rtems/4.6.2/examples/hello_world
cp /afs/slac/package/rtems/4.6.2/target/ssrlApps/config/Makefile.leaf Makefile
Next, you want to fill-in the template; look for 'xxx' and substitute
your values.
setenv RTEMS_MAKEFILE_PATH /afs/slac/package/rtems/4.6.2/target/ssrlApps/config
setenv RTEMS_BSP <your_bsp>
setenv RTEMS_SITE_DIR <top_of_where_you_want_to_install>
RTEMS_SITE_DIR defines where your created code will be installed. (Consult the bottom of the Makefile for details - RTEMS_SITE_INSTALLDIR maps to RTEMS_SITE_DIR/$(RTEMS_CPU)-rtems/). Your loadable module will be installed in RTEMS_SITE_DIR/<cpu>-rtems/bin or RTEMS_SITE_DIR/<cpu>-rtems/<bsp>/bin (depending on your makefile variable settings).
Cexp> nfsMount(<nfshost>,"/usr/local/rtems","/site")
Trying to mount xxx.xxx.xxx.xxx:/usr/local/rtems on /mnt
0x00000000(0)
Cexp> hwmod=cexpModuleLoad("/site/powerpc-rtems/bin/hello_world.obj")
0x00394d2c (3755308)
Cexp> hello_world("World")
HELLO World
0x0000000c (12)
Cexp> cexpModuleUnload(hwmod)
0x00000000
Cexp> unmount("/site")0x00000000
The examples were created with RTEMS_SITE_DIR set to /afs/slac/package/rtems/4.6.2/target/ssrlApps, i.e., to load and run the precompiled examples substitute '/usr/local/rtems' by '/afs/slac/package/rtems/4.6.2/target/ssrlApps' in step 5.
I forgot to mention that you should add '/afs/slac/package/rtems/4.6.2/host/i386_linux24/bin' to your shell's PATH to ensure that all tools are found. Note that you should always use the Makefiles to compile code. Never use the cross compiler directly (although on certain CPUs you might get away with it). The reason being that gcc supports various CPU variants and unless your BSP is using the default one you might generate incompatible code. The RTEMS/SSRL Makefiles take care of selecting the proper compiler options for your BSP.
The standard EPICS 'exampleApp' can be found under /afs/slac/package/rtems/4.6.2/examples/epics. Here's how this is created. It's ridiculously simple:
/afs/slac/package/rtems/4.6.2/epics-3.14.6/base/bin/linux-x86/makeBaseApp.pl -t example example
/afs/slac/package/rtems/4.6.2/epics-3.14.6/base/bin/linux-x86/makeBaseApp.pl -i -t example example
CROSS_COMPILER_TARGET_ARCHS=RTEMS-pc586
This step is necessary because not all pre-built target BSPs are distributed on the CD (RTEMS-svgm is not included by default).
You can also define an INSTALL_LOCATION in this file.
/afs/slac/package/rtems/4.6.2', you need to read this.At the top of iocBoot/iocexample/st.cmd I added
chdir("../../")
cexpModuleLoad("bin/RTEMS-<your_bsp>/example.obj")
You're now all set to run the example.
Cexp>nfsMount(<nfshost>,"/afs/slac/package/rtems/4.6.2","/opt")
Trying to mount xxx.xxx.xxx.xxx:/afs/slac/package/rtems/4.6.2 on /opt
0x00000000 (0)
Cexp> chdir("/opt/examples/epics/iocBoot/iocexample/")
0x00000000 (0)
Cexp> < st.cmd-<your-bsp>
For the demo, there are BSP specific versions of the startup script, e.g., st.cmd-mvme2307, (making sure the correct binary module is loaded). These simply define the correct path to the binary and then include st.cmd.
setenv PATH /afs/slac/package/rtems/4.6.2/epics/base/bin/linux-x86:$PATH
caget till:aiExample
(If using your own build of the exampleApp, you have to substitute your user name, of course).