
    The examples here are of code loaders.  By loader we mean a program
which loads code onto a processor and then starts that code running.
They exploit the dynamic code loading facility of the INMOS ANSI C
toolset.  They also do some quite low level manipulation, as would be
expected of a loader.

    There are notes at the start of each loader's .c file giving details
of what situations the loader can be used for.

    .cfs, .lnk and .mak files are provided for both TA and T2 classes of
transputer.  The makefiles were generated by imakef on a Sun, with one
edit then made to the file.  This process is documented in a comment
in the makefiles, and so the process can be repeated for imakef on a
different host.


Example use:
------------

    Say we have a .rsc file, called appl.rsc, containing code compiled
for TA and with a main entry point of MAIN.ENTRY of the C runtime
library.  We can use the C loader with this as follows (under UNIX):

% cp loaderta.cfs cloader.cfs
% cp loaderta.lnk cloader.lnk
% cp loaderta.mak cloader.mak
% make -f cloader.mak
% cat appl.rsc >> cloader.btl
% mv cloader.btl appl.btl

The file appl.btl can now be run on any TA transputer just like any
single processor bootable, e.g. "iserver -se -sb appl.btl".  Note
that IBOARDSIZE should be set up in the environment before booting, as
the loader reads it to find out how much memory (in bytes) is attached
to the processor.

As a simple example of an appl.c that could be used, try

#include <stdio.h>

int main( void )
{
  printf( "Hello world\n" );

  return 0;
}


and the following commands:

% icc appl.c -ta
% ilink appl.tco -f clibs.lnk -me MAIN.ENTRY -ta
% icollect appl.lku -t -k

This should generate an appl.rsc file that can be used with the C loader.





The system is similar for the occam loader.  As an example appl.occ, try

#INCLUDE "hostio.inc"
#USE "hostio.lib"

PROC prog( CHAN OF SP fs, ts, []INT free.mem )

  SEQ
    so.write.string.nl( fs, ts, "hello world" )
    so.exit( fs, ts, sps.success )
:


and the following commands:

% oc appl.occ -ta
% ilink appl.tco -f occama.lnk hostio.lib -ta
% icollect appl.lku -t -k

This should generate an appl.rsc file that can be used with the occam loader
for TA.
