ChorusOS 4.0 Introduction

Basic Environment

In the basic environment, application actors are loaded at boot time as part of the system image. These actors are also known as boot actors.

When the system boots, actors included in the system image are loaded. For each actor, a thread is created and starts running at the actor's program entry point.

Building an Application Actor

This section assumes that you have built a chorus or kernonly system image in the build_dir directory. This example will create a simple Hello World actor.

  1. Create a working directory where the actor will reside.

  2. In this working directory, create a file named Imakefile containing the following lines:

    Depend(hello.c)
    EmbeddedSupActorTarget(hello_s.r,hello.o,)

  3. Create a file named hello.c containing your Hello World program, written in C. For example:

    #include <stdio.h>
    
    int main()
    {
    		printf("Hello World!\n");
    		return(0);
    }

  4. Generate a Makefile to build the actor, by typing the following command:


    % ChorusOSMkMf build_dir/Paths
    

    See ChorusOSMkMf(1CC) for more information about creating a Makefile.

  5. Build the dependencies:


    % make depend
    

  6. Build the application:


    % make
    

Your directory will now contain a supervisor actor, hello_s.r.

Embedding your Actor in the System Image

The easiest way to add the actor to the system image is to use the graphical configuration tool, ews. See "Adding an Actor to the ChorusOS System Image" for a step-by-step guide on how to do this.

Alternatively, you can modify conf/mkimage/applications.xml so that it contains the list of applications that will be included in your archive. For example, to include your supervisor actor, hello, the content should be as follows:

<folder name='Applications' visible='yes'>
  <description>Placeholder for customer applications</description>

    <definition name='hello' configurable='yes'>
      <description>simple hello actor, in supervisor mode</description>
      <type name='File' />
      <value field='path'>
        <vstring>absolute_path_to_my_actor/hello_s.r</vstring>
      </value>
      <value field='bank'><ref name='sys_bank' /></value>
      <value field='binary'><ref name='supervisor_actor_model' /></value>
    </definition>

    <definition name='application_files' configurable='yes'>
      <description>application system image files</description>
      <condition>
        <or>
          <equal><var name='SYSTEM' /><const>chorus</const></equal>
          <equal><var name='SYSTEM' /><const>kernonly</const></equal>
        </or>
      </condition>
      <type name='FileList'/>
     <value index='size'><ref name='hello' /> </value>
    </definition>

</folder>

Rebuild the system image using one of the following commands:

Running your Actor in the Basic Environment

Boot the system you have created on the target system. For detailed instructions, see the appropriate book in the ChorusOS 4.0 Target Family Documentation Collection.

After the system boots, the following message is displayed on the console:


Hello World!