The RTEMS port of ION in this directory is just a demo template from which
real RTEMS ION-based systems can be cloned and adapted.  To develop an RTEMS
ION-based system modeled on this template you will want to modify the RTEMS
linkcmds file to reflect the actual memory resources provided, modify
ionrtems.c considerably (or develop an entirely new Init module that does
the same general things; in particular, upgrade the RTEMS configuration
definitions as needed), develop new software that uses ION for communications,
modify the Makefile accordingly (possibly adding to the list of MANAGERS), etc.

A step-by-step procedure for demo'ing ION on RTEMS follows.

First construct the RTEMS development environment:

1.	Use the Yum Instructions at

	http://www.rtems.com/wiki/index.php/APT/Yum_Repository

to download and install the pre-built RTEMS development tools.  Install the
appropriate rpm, then use yum install to install the tools.

The ION RTEMS port was done on a 32-bit Fedora 10 host system using rtems
branch 4.9.3, selecting the SPARC "sis" simulator as the target system; this
is similar to the approach taken in the Quick Start example at

	http://www.rtems.com/wiki/index.php/Quick_Start

For the balance of this README, SPARC "sis" for RTEMS 4.9.3 will be assumed;
substitute other version, system, or bsp as appropriate.

2.	Make development directories:

	$(HOME)/rtems
	$(HOME)/rtems/archive
	$(HOME)/rtems/tools
	$(HOME)/rtems/tools/build

3.	Use the links in the Getting Started manual from the appropriate online
documentation library (http://www.rtems.com/onlinedocs/releases) to download
the RTEMS source code and the examples into $(HOME)/rtems/archive.

4.	Continue following the instructions in the on-line manual for
installing the operating system.  This entails adding

	export PATH=/opt/rtems-4.9/bin:${PATH}

to ~/.bash_profile before doing anything.

Test the tools as shown in section 5.4 of the online manual.

Then, in rtems/tools/build, enter the following commands to build RTEMS:

	../rtems-4.9.3/configure --target=sparc-rtems4.9 --enable-rtemsbsp=sis --prefix=/opt/rtems-4.9/
	make all install

5.	Test the RTEMS development environment.  First add

	export RTEMS_MAKEFILE_PATH=/opt/rtems-4.9/sparc-rtems4.9/sis

to ~/.bash_profile (and be sure (!) to source ~/.bash_profile in any window in
which you plan to build any RTEMS application).

Then unpack the sample applications and build hello_world_c described in 6.3
of the online manual.  The compiled application can be run from the Linux
command line by entering

	sparc-rtems4.9-run `find . -name hello.exe`

Alternatively, to run and debug the application within gdb, enter

	sparc-rtems4.9-gdb `find . -name hello.exe`

and enter the following commands at the gdb prompt:

	tar sim
	load
	r

6.	Now build and run the ION RTEMS demo application.  First cd into
ion/arch-rtems and enter the following commands to populate the directory
with symbolic links to the ION C source files and build the ion.exe executable:

	./srclinks
	make

Then use the following command to run the demo.

	sparc-rtems4.9-run `find . -name ion.exe`

The ION daemons will start running and a test execution of bpsource will
send a loopback bundle via LTP to bpsink, which will print the text in the
bundle payload.

The ION RTEMS Makefile is configured to optimize the resulting executable.
To see the actual size of the executable (with the debugging information 
inserted by the compiler removed):

$ cd o-optimize
$ cp ion.exe stripped.ion.exe
$ sparc-rtems4.9-strip stripped.ion.exe
$ ls -l stripped.ion.exe
$ sparc-rtems4.9-size stripped.ion.exe

Optimization can make source-level debugging more difficult, because key
variables may be held in registers rather than in memory.  To disable
optimization, remove the "-O2" parameter from the CFLAGS variable in the
Makefile and rebuild.
