When you build a standard ChorusOS sytem image on your target hardware system, a build directory is created in your work directory for each source component included in the system image. Each build directory contains the binary code for its associated component.
No directories are created for binary components.
Create a src subdirectory on your host.
To create the basic "hello" application,
Create the following files in the src directory:
hello.c, this source file will say "hello" and is written as follows:
#include <stdio.h> int main() { /* Print the message */ printf("Hello World\n"); return 0; }
Imakefile. This file provides the rules to build the application and contains the following:
UserActorTarget(hello_u,hello.o,) SupActorTarget(hello_s, hello.o,)
The Imakefile declares:
The source files to be compiled (implicitly).
The libraries to be used (only standard libraries are used).
That you want to build both a user and a supervisor application called hello.
Use the ChorusOSMkMf command to create a make file that will build your application:
% ChorusOSMkMf build_dir
The ChorusOSMkMf command should be located in your PATH. See "Setting Environment Variables" in the ChorusOS 5.0 Installation Guide for information on how to modify your PATH.
Build your application:
% make
Use the C_INIT loading facility to run the application dynamically, as follows:
Copy the executable application files into the root_dir/bin directory:
% cp hello_s root_dir/bin
This step is important because the applications must be in a directory on the host that is exported to the target system.
Start the hello supervisor actor:
% rsh target_name /bin/hello_s
This command returns the PID of the new application.