Building a Multi-Task Application

Top  Previous  Next

You can build the two-task upper-casing example by compiling, linking using the 3L T command, and then running the configurer as we have already discussed. This uses the full library (rtl.lib) and makes all the facilities of the Diamond library available to both tasks.

 

Our processing task has no need of this full functionality as upc does no standard C I/O; the header file stdio.h is included for the definition of EOF only. A special stand-alone version of the library (sartl.lib) is provided for cases such as these. You can link a program with the stand-alone run-time library by using the 3L TA command in place of 3L T.

 

Even though all tasks can communicate with the host, linking with the stand-alone library can be worth doing as linking with the full library has costs:


The resulting task image file contains a large amount of code to handle communicating with the server;

The task has to initialize its connection with the server and read the command-line string from the host, even if the program does not explicitly use any standard I/O functions like printf;

The configurer adds extra system tasks to any processor on which you place tasks linked against the full library.

The stand-alone library is similar to the full library except that it omits all the functions that require server support (functions for file I/O, in particular). The descriptions of the run-time library functions indicate which functions are members of the stand-alone library.

 

The complete commands to build and run the two-task upper-casing example are shown below:

 

» 3L C  driver.c

» 3L C  upc.c

» 3L T  driver

» 3L TA upc

» 3L A  upc.cfg upc.app

» 3L X  upc

 

You can stop the application by typing Ctrl-Z, which the driver task reads as an end-of-file. You can try this out for yourself, using copies of the relevant files, which are supplied in the Diamond kit. You can find them in the folder <3L>My Designs\examples\Sundance\example-3\. A variant of this code that accesses the input and output channels by name rather than by port indexes may be found in bin<3L>My Designs\examples\Sundance\example-3b\. There is also a makefile and a batch file, upc.bat, for building the application.