C H A P T E R 3 |
Tutorial |
This chapter is a tutorial to tejacc programming. This chapter addresses the following topics:
The application used for the tutorial has two threads, tick and tock. The tick thread sends a countdown (9, 8, ..., 0) to the tock thread using a channel. Both of the threads run in a single process called ticktock.
The application code is a file called ticktock.c. The application code has a ticker function for the tick thread, and a tocker function for the tock thread. TABLE 3-1 lists the ticktock.c file and provides comment.
Unlike the application code, the configuration code is target specific. The configuration code is written to a file called config.c and contains the hardware architecture, software architecture, and the mapping to the application code. TABLE 3-2 lists the config.c file and provides comment.
|
1. Create the shared library config.so by compiling the config.c file and the Teja-supplied cmt1_board.c chip support file.
2. Compile the ticktock.c file using tejacc to generate the application code in the code directory.
The following makefile shows how this is done.
3. Run the gmake command in the code/process_name/ generated source directory to create the application binary image.
|
Copy the binary image to the tftpboot directory of the tftp server.
The CMT machine is reset, and the sytem is booted. See Building and Booting Reference Applications. When the application starts, the following countdown is printed to the console.
init tick started. tock started. 9... 8... 7... 6... 5... 4... 3... 2... 1... SHUTDOWN. Exiting tick thread ... BLAST OFF!!! SHUTDOWN. Exiting tock thread ... |
Copyright © 2007, Sun Microsystems, Inc. All Rights Reserved.