[Previous] [Next] [Contents] [Index]


    Integration with Operating Systems

This chapter describes how to integrate code generated by the C Code Generator with operating systems or real-time executables.

The chapter is focused on how to make a hard integration (from here on referred to as Tight Integration) where SDL process instances or instance sets are mapped to an RTOS task, and signal sending in SDL is handled by the message passing mechanism in the OS. In an introduction the different integration models (Light Integration and Tight Integration) are explained.

In separate annexes, one for each supported RTOS, all the OS specific parts are documented.

Table of Contents 

Introduction

The code that is generated by the SDT Cadvanced Code Generator is designed to run on different platforms. This is done by letting all platform dependent concepts be represented by C macros that can be expanded appropriately for each environment. There are also types used in the generated code that have to be defined. Integration, as referred to in this chapter, is the process of adapting the generated code to a certain platform. This chapter describes the different models for doing an integration that are supported in Telelogic Tau.

Note: 

Throughout this chapter, annexes excluded, VxWorks terminology has been used whenever there are differences between operating systems. Particularly, this means that the word task has been used on several occasions. The corresponding word would be thread for Win32 and Solaris, process for OSE Delta, and task for pSOS.

Different Integration Models

Basically there are two different integration models in SDT. In the following they are referred to as Light Integration and Tight Integration. The Light Integration Model uses SDT's standard kernel/scheduler and the Tight Integration Model calls primitives from an external RTOS. Both models use the same generated code from the Cadvanced Code Generator.

Light Integration

The SDT standard kernel is provided with the Cadvanced Code Generator. The execution of the SDL system is based on a scheduler calling a certain function representing the scheduled process each time it shall execute a transition. The function is expected to return control to the scheduler after a transition. Signals sent between internal processes are directly put into the input queue of the receiving process instance by the SDT kernel. External signals going in and out of the SDL system are handled by special environment functions that are platform dependent. An application using this integration model can run on an naked machine with no OS support but can also run under an external RTOS. Signal sending in the case of a Light Integration running under an external OS is illustrated in Figure 519.

Figure 519  : Signal sending in the Light Integration Model.
One internal and one outgoing external signal is sent. The grey areas represent different OS tasks.

Extracted pic [23]

Properties of a Light Integration:

Tight Integration

In a Tight Integration the application is using primitives from an underlying RTOS when creating processes, sending signals, etc. Scheduling is thus handled by the RTOS, which normally means it is preemptive, time-sliced and priority based. The principles of signal sending in the Tight Integration Model are illustrated in Figure 520.

Figure 520  : Signal sending in the Tight Integration Model.
One internal and one outgoing external signal is sent. The grey areas represent different OS tasks.

Extracted pic [1]

Properties of a Tight Integration:

Common Features

This section describes the parts of the integration that are common to the different models, but also some important differences.

Note: 

Many of the data structures and macros described in this section are described in more detail in The Master Library. That chapter is, however, focused on a Light Integration. Some things, especially the listings of data structures, are not correct in every detail for Tight Integrations but should still be very useful.

The Use of Macros

A source file generated by the SDT C Code Generator is independent from the choice of integration model and operating system. Instead of system calls, it uses macros that have to be defined elsewhere when the system is built. Each SDL concept is represented by one or more C macros. These macros will have different definitions for different integration models and operating systems. Telelogic Tau provides a number of integration packages for this purpose. In a Light Integration, many macros are expanded into functions of the standard SDT kernel. A Tight Integration has lower level macros that are defined in separate files for each operating system, and finally expanded into OS primitives or certain OS dependent constructions.

Below is an example of generated code for signal sending. Code in capital letters are SDT macros. The bracketed numbers indicate corresponding lines of code. For a description of the different macros, see The Master Library.


Extracted pic [17]
SDL symbol: Output

Generated code before macro expansion:



    [1]   ALLOC_SIGNAL(sig2, ySigN_z3_sig2,
            TO_PROCESS(Env, &yEnvR_env),
            XSIGNALHEADERTYPE)
          SIGNAL_ALLOC_ERROR
    [2]   SDL_2OUTPUT_COMPUTED_TO(
            xDefaultPrioSignal,
            (xIdNode *)0, sig2,
            ySigN_z3_sig2,
            TO_PROCESS(Env, &yEnvR_env),
            0, "Sig2")
          SIGNAL_ALLOC_ERROR_END
    

Generated code after macro expansion for a Light Integration:



    [1]   yOutputSignal = xGetSignal
            ((&ySigR_z3_sig2),
            (*(&yEnvR_env)->
            ActivePrsList !=
            (xPrsNode) 0 ? 
            (*(&yEnvR_env)->
            ActivePrsList)->Self : 
            xSysD.SDL_NULL_Var),
            yVarP->Self);
    [2]   SDL_Output (yOutputSignal, 
            (xIdNode *) 0);

File Structure

The Generated Files

An integration uses one or more of four files that can be generated by the Code Generator. All integrations require the C source file <systemname>.c whereas the interface file <systemname>.ifc is optional. For a Tight Integration the signal number file <systemname>.hs may be used, and for a Light Integration the file sctenv.c, representing the environment, can be used.

The source file uses the highest level set of macros, that are expanded in the respective package files of the different integration models and also, for the Tight Integration, different operating systems.

The Integration Packages

The files containing the necessary macro expansions and support functions are organized as shown in Figure 521. For each operating system there is one package for the Light Integration, and one for the Tight Integration. Although the files in different packages may have the same name they do not necessarily contain the same code. The principles for Tight Integration packages are described more thoroughly in Tight Integration. Details about each operating system can be found in the annexes.

Figure 521  : File structure for the RTOS integrations

Extracted pic [16]

There is also an INCLUDE directory containing source files common to all supported operating systems. These files are described in File Structure. Below are some additional comments on these files:

The Examples directory contains a simple SDL system that also uses an external process (a separate OS task). For each supported operating system there is an implementation of this, demonstrating how to hook into the integration package. Further description of the example can be found in A Simple Example.

Naming Conventions

Names of variables, datatypes and support functions in generated code and package files often start with one of the letters x, y and z.

The general rules (there are some exceptions) are:

The Symbol Table

All signals, blocks, processes, channels, etc. in an SDL system have a corresponding representation in the symbol table described in The Master Library. This symbol table consists of nodes (IdNodes) each representing one entity of the system. Many IdNodes are pointers to structs. See the following example:

The N_ and the R_ just before z02_dynpr1 indicate if it is a node (N_) or a record (R_).

Memory Allocation

The xAlloc function is always used when allocating dynamic memory. The function is placed in the sctos.c file, but in the Tight Integrations the body of the function is found in the sct<RTOS>.h file.

Start-up

The yInit function is called during startup of the SDL system. It is responsible for creating all static processes and for initializing SDL synonyms.

Implementation of SDL Concepts

SDL Processes

An SDL process consists of three parts in a code representation. One part defines the dynamic behavior, one contains instance specific data and one contains data common for all instances of a process.

Process specific data

Variables and structures that are common to all instances of a process are stored in a record of the type xPrsIdStruct, defined in scttypes.h. This record, as well as the instance data, is represented by a node in the symbol table.

Instance specific data

Variables and structures of the process instance are declared via the macro PROCESS_VARS. This macro is defined in different ways in the Light and the two models of Tight Integration. It contains state information, local variables, pointers to parent and offspring, etc. One important entry is the RestartAddress, pointing out which transition to execute when the PAD function is called or scheduled.

Dynamic behavior

The dynamic behavior of an SDL process is implemented in a PAD function (Process Activity Definition). The PAD function is used somewhat differently in the different integration models:

Below is the code for ending a transition, before and after macro expansion for a Light Integration.


Extracted pic [2]
SDL symbol: Nextstate

Generated code before macro expansion:



          /*-----
          * NEXTSTATE -
          * #SDTREF(SDL,/ti/RTOS/MANUAL/SDL/simple.spr(1),
                    143(55,100),1)
          ------*/
          #ifdef XCASELABELS
    [1]     case 6:
          #endif
    [2]     XAT_LAST_SYMBOL
    [3]     SDL_DASH_NEXTSTATE
    

Generated code after macro expansion for a Light Integration:



          /*-----
          * NEXTSTATE -
          * #SDTREF(SDL,/ti/RTOS/MANUAL/SDL/simple.spr(1),
                    143(55,100),1)
          ------*/
    

    [1]     case 6:
    

    [2]       xGRSetSymbol (-1);
    [3]       SDL_NextState (VarP, yVarP->State);
              return;

Signal Queues

Basically, every process has at least one signal queue.

All signals that are sent to a process arrive in the input queue. The save queue is used to keep signals that cannot be handled in the current state but should be saved for future use. This is tightly connected to the SDL Save concept, but is also used in the implementation of timers. For a Light Integration there are no save queues. Instead, all signals that should be saved will remain in the input queue until they can be received.

Process Priorities

The use of process priorities requires some caution. Priorities can be set with the #PRIO directive in SDT, but there is no mapping of priorities for different platforms. The generated code will use exactly the values specified in the SDL system. This will not be a problem in a Light Integration, but for Tight Integrations the result may not be the expected.


Example 420 : Process priority problems      

Priorities in VxWorks can be set in the range from 0 to 255, where 0 represents the highest priority. This maps well to SDT, where 0 is also the highest priority. In pSOS, however, 255 is the highest priority and 0 is the lowest.

An SDT system with two processes, Process1 and Process2, is designed. Process1 has its priority assigned with #PRIO 100 and Process2 with #PRIO 50. C code is generated and integrated with VxWorks and pSOS. In both operating systems the priorities will then be set to 100 for Process1 and 50 for Process2, which means Process2 will have the higher priority in VxWorks, while Process1 has the highest priority in pSOS.


Process Creation

Regardless of the integration model there are a number of things that have to be done when an SDL process instance is created. The structs that represent the instance have to be created. It needs a representation in the symbol tree and a signal queue, except in the Instance Set Model of Tight Integration where the signal queue belongs to the instance set. A start-up signal is also always allocated and sent to the process.


Extracted pic [3]
SDL symbol: SDL Static Create

Generated code before macro expansion:



          /**********************************************************
                        SECTION      Initialization              
          **********************************************************/



          extern void yInit XPP((void))
          {
            int  Temp;
          ........
            INIT_PROCESS_TYPE(pr1,z01_pr1,yPrsN_z01_pr1,"z01_pr1",
                              SDL_INTEGER_LIT(2),SDL_INTEGER_LIT(2),
                              yVDef_z01_pr1, xDefaultPrioProcess,
                              yPAD_z01_pr1)
          #ifdef SDL_STATIC_CREATE
    [1]     for (Temp=1; Temp<=SDL_INTEGER_LIT(2); Temp++) {
    [2]        SDL_STATIC_CREATE(pr1,z01_pr1,yPrsN_z01_pr1,
                                 "pr1",ySigN_z01_pr1,
                                 yPDef_z01_pr1,yVDef_z01_pr1,
                                 xDefaultPrioProcess,yPAD_z01_pr1,1)
            }
          #endif
    

Generated Code after macro expansion for a Light Integration:



          /**********************************************************
                          SECTION      Initialization                
          **********************************************************/

          extern void
          yInit ()
          {
            int  Temp;
          ..........
    [1]     for (Temp = 1; Temp <= 2; Temp++) {
    

    [2]       SDL_Create (xGetSignal ((&ySigR_z01_pr1),
                          xSysD.SDL_NULL_Var, xSysD.SDL_NULL_Var),
                         (&yPrsR_z01_pr1), 1);
            }

SDL Signals

Signal Sending

In generated code a signal sending is handled by two macros: ALLOC_SIGNAL (or ALLOC_SIGNAL_PAR for a signal with parameters) and SDL_2OUTPUT_xxxx (there are different macros depending on how the SDL output was defined, e.g. with or without an explicit TO).


Extracted pic [24]
SDL symbol: Output

Generated code before macro expansion:



    [1]   ALLOC_SIGNAL(go,ySigN_z03_go,TO_PROCESS(p,yPrsN_z09_p),
                       XSIGNALHEADERTYPE)
          SIGNAL_ALLOC_ERROR
    [2]   SDL_2OUTPUT_COMPUTED_TO(xDefaultPrioSignal,(xIdNode*)0, go,
                     ySigN_z03_go,TO_PROCESS(p, yPrsN_z09_p), 0, "Go")
          SIGNAL_ALLOC_ERROR_END
          XBETWEEN_SYMBOLS(4, 579)
    

Generated code after macro expansion for a VxWorks Tight Integration:



    [1]   yOutputSignalPtr = xAlloc(sizeof(xSignalHeaderRec));
          yOutputSignalPtr->SignalCode = 2;
          yOutputSignalPtr->Sender = yVarP->Self;
    [2]   Err = msgQSend (xTo_Process ((&yPrsR_z09_p)),
                          (char*)*&yOutputSignalPtr,
                          sizeof(xSignalHeaderRec) + 0, 0, 0);
          xFree ((void **) &yOutputSignalPtr);
          if (Err == (-1)) {
            taskLock ();
            printf ("Error during %s found in VXWORKS
            function %s. Error code %s\n", "OUTPUT",
            "msgQSend", strerror ((*__errno ())));
            taskUnlock ();
          }

In this example the signal is called go and has no parameters. The SDL_2OUTPUT_COMPUTED_TO macro indicates that it was sent without an explicit TO.

SDL Procedures

An SDL procedure is represented by a function similar to a PAD function. Before a procedure is called there are two support functions that need to be called: xGetPrd and xAddPrdCall.

The xGetPrd function allocates an xPrdStruct for the called procedure and returns an xPrdNode pointing to the struct.

The xAddPrdCall function adds the new procedure call in the calling process' ActivePrd list (an element in the xPrsStruct).

The procedure is called with a pointer to the instance data of the calling SDL process. This is because the procedure must be able to use internal variables in the calling process.

Before a procedure returns to the caller it performs an xReleasePrd call. This function removes the call from the ActivePrd list.

SDL Timers

SDL timers are represented by signals. All active timer signals are kept in a sorted list, either within the single task of a Light Integration or in a certain timer task in a Tight Integration. When a timer expires, the signal representing it is sent to the SDL process that set it.


Extracted pic [4]
SDL symbol: SET Timer

Generated code before macro expansion:



          /*-----
          * SET T1
          * #SDTREF(SDL,/ti/RTOS/MANUAL/SDL/dynpr1.spr(1),
                    119(55,25),1)
          ------*/
          #ifdef XCASELABELS
    [1]     case 2:
          #endif
    [2]       SDL_SET_DUR(xPlus_SDL_Time(SDL_NOW,
    [3]        SDL_DURATION_LIT(5.0, 5, 0)),
    [4]        SDL_DURATION_LIT(5.0, 5, 0), t1, ySigN_z021_t1,
                 yTim_t1, "T1")
    

Generated code after macro expansion for a Light Integration:



          /*-----
          * SET T1
          * #SDTREF(SDL,/ti/RTOS/MANUAL/SDL/dynpr1.spr(1),
                    119(55,25),1)
          ------*/
    

    [1]     case 2:
    

    [2]       SDL_Set (xPlus_SDL_Duration (SDL_Now (),
    [3]         SDL_Duration_Lit (5, 0)), xGetSignal
    [4]         ((&ySigR_z021_t1), yVarP->Self, 
                yVarP->Self));

Light Integration

A Light Integration is a stand-alone executable which can be generated with or without a simulator. An executable that should run under UNIX can use the precompiled kernels. Only the environment functions need to be written by the user.

PAD Functions

The PAD function is called by the scheduler when its process is in turn to execute a transition. The scheduler calls the PAD function with a symbol table node of the type xPrsNode, pointing to the instance specific data of the instance that is scheduled.

Start-Up

A Light Integration starts when the generated main function is called. The start-up phase works like this (pseudocode shown in italic):

You must supply the xInitEnv() function to initialize external code and hardware, etc. (this is of course application dependent). This function is placed in the same program module (environment module) as the xInEnv() and xOutEnv() functions. The xMainLoop() function contains an eternal loop, which constitutes the scheduler itself. See below:

Connection to the Environment

Signals going in and out of the SDL system are handled in the two user written functions xInEnv and xOutEnv. There is a template file for writing these two function in the standard SDT distribution. This file can be found at <Telelogic Tau installation directory>/sdt/
sdtdir/<your platform os version>sdtdir/INCLUDE/
sctenv.c
.

Running a Light Integration under an External RTOS

Since there are some fundamental differences between different RTOS we can only give a general idea of how to generate a Light Integration under an external RTOS here. Typical things that may be different in different RTOS:

General Steps

The normal steps to create a Light Integration under an external RTOS can be summarized as follows:

  1. Copy the source and header files for an application from the SDT installation. The files are residing in the following directory:
    <Telelogic Tau installation directory>/sdt/
    sdtdir/<your host and os version>sdtdir/INCLUDE
    .
  2. Generate an <application>.c file with the SDT Code Generator.

Note: 

The code generator option Cadvanced must be used.

  1. Generate an environment header file (an option in the Organizer Make dialog).
  2. Edit the sctenv.c template file to handle your in and out environment signals. Include the generated <application>.ifc file (the environment header file).
  3. Create a makefile or edit the generated makefile. Write entries for the kernel source files, the environment file and the application file.
  4. Set the appropriate compilation switches for your RTOS and your compiler.
  5. Compile the application and the kernel file to create a relocatable object file.
  6. Download.

Tight Integration

Note: 

This presentation is focused on the general principles and models used in a Tight Integration. When specific RTOS primitives are needed in the presentation, examples from the VxWorks implementation are used. The implementation and RTOS calls used in other integrations are covered in separate annexes to this chapter, one for each supported RTOS.

There are two models of Tight Integration. In the Standard Model one SDL process instance is mapped to one OS task. In the Instance Set Model an entire instance set (all instances of a process) is mapped to one OS task. Scheduling between OS tasks is managed by the RTOS scheduler; this means that preemption is normally used, though only on an instance set level in the Instance Set Model. SDL semantics are preserved in a Tight Integration, for example setting a timer implies an automatic reset first.

The start-up of a system, i.e. creation of static processes, initialization of Synonyms and creation of an environment task and a timer task, is handled by a generated initialization function called yInit. Normally this function is called from another initialization function, where some additional initializations take place before the yInit function is called.

Timers in the system are handled by one central timer task. This task receives messages2, each containing a request to set a timer, and will send messages back as the timers expire.

Common Features

File Structure

The files related to the tight integration concept are placed in the following directory in the SDT installation: <Telelogic Tau installation directory>/sdt/sdtdir/RTOS/<operating system>/
TightIntegration/
. The same files are used for both the Standard Model and the Instance Set Model.

Each RTOS directory contains the following files:

The SDL_PId Type

The SDL_PId (SDL Process ID) type has different meanings in the Standard and the Instance Set Models. In the Standard Model it represents the message queue, while it represents the process instance in the Instance Set Model. This is because the entire instance set will have the same message queue in the last case.

Signals

The signal header consists of a struct with information needed to handle the signal inside an SDL system. The signal header struct is defined in the RTOS-specific file sct<RTOS>.h.

The signal header stores SignalCode, in this case an integer, two pointers Pre and Suc used when saving the signal in the save queue, and Sender, holding the SDL_PId of the sending SDL process. In the Instance Set Model there is an extra parameter Receiver, necessary to make a distinction between the SDL processes in an instance set task.

If the signal contains parameters they are allocated in the same function call. Example:

The second parameter to the xAlloc function is a struct representing the signal parameters of the signal. In this case, with one integer, it is defined in the following way:

The macro SIGNAL_VARS is in most RTOS empty.

Note: 

The SDL signal parameters are always named Param1, Param2, etc.

Assignment of the signal parameter is done in generated code and not in a macro. Example:

The macro OUTSIGNAL_DATA_PTR is defined in VxWorks in the following way:

In some RTOS integrations there is an extra element in the SignalHeader defined as a void pointer. This pointer is set to point to the parameter area. Example:

The OUTSIGNAL_DATA_PTR macro is then defined:

After expansion of the whole expression the code will be:

Signal reception

The support function xInputSignal is used for receiving signals in both models of Tight Integration. The implementation and the parameters are different though.

Timer Signals

A timer signal is defined similarly to an ordinary signal but will contain some additional elements representing time-out time, etc. The timer header struct looks like this:

Note: 

An ordinary signal is identical to the first part of a timer signal. This makes it possible to type-cast between the two types as long as only elements in the common part of the headers are used.

Time

When the System time is required, for example when using NOW, the macro SDL_NOW is used. The macro is in turn mapped to the function SDL_Clock() (in sctos.c). This function is implemented differently depending on the RTOS representation of time. In VxWorks it returns the result of calling the RTOS function tickGet. SDL_Time is normally implemented as int or unsigned long int.

Mapping Between SDL Time and RTOS Time

The macro SDL_DURATION_LIT specifies the mapping between the SDL time in seconds and the local RTOS representation of time. In VxWorks the system time is given in ticks and the translation is defined as follows:

R is the real type representation of the time in seconds. I and D are the integer and decimal parts of an integer type representation of the time. I is in seconds and D in nanoseconds. The code generator will generate all three numbers but either R, or I and D will be used depending on the RTOS.

Timers

All timer activity in the SDL system is handled by a dedicated timer task. The timer task accepts requests in the form of messages (in VxWorks). It then keeps the requests for setting a timer sorted in a timer queue and uses some OS mechanism to wait for the first request to time out. The mechanism used can be either an OS timer, or a timeout in the waiting for new requests. When a request times out, the timer task sends a signal back to the task that first sent the request. The function calls and OS signaling involved in setting and waiting for an SDL timer can be viewed in Figure 522.

Figure 522  : Function calls and OS signaling when setting and waiting for a timer.
UML notation is being used, thus the full arrowheads represent function calls and the half arrowheads represent messages. Parameters have been left out, except for the name of the timer in the ResetTimer request. Note that a reset is performed first, as required in the SDL specification.

Extracted pic [15]

To be able to implement the full semantics of SDL timers a number of support functions have been implemented:

Addressing SDL Processes

There are two ways to address SDL processes from an external task. Either the xFindReceiver function can be called to find an arbitrary receiver, or the file pidlist.pr can be used to provide a list of the SDL processes and then address the receiver explicitly via the input queue ID of its OS task.

The xFindReceiver Function

When sending a signal into the SDL system where the receiver is not known a support function called xFindReceiver can be used. This function takes the following parameters:

The following files are needed to get access to SDL types, signal numbers and signal parameter types: scttypes.h, <system_name>.hs and <system_name>.ifc.

Example of how to use the xFindReceiver function:

The following types, signal definitions and global variables are used in the example:

The File pidlist.pr

An alternative way to get the PId for the Receiver is to use an ADT defined in the SDT ADT library called pidlist.pr. This file defines an ADT called PidList and an operator called PId_Lit. With this ADT it is possible to directly address any static process instance in the system, both from internal SDL processes and from external OS-tasks. You can find more information about this feature in How to Obtain PId Literals.

Note: 

You must use the pidlist.pr file provided in the RTOS distribution when using this concept in an RTOS Tight Integration. You find the file in the following directory: <your SDT installation directory>/sdt/sdtdir/RTOS/INCLUDE/pidlist.pr

The Standard Model

In the Standard Model of the Tight Integration each SDL process is implemented as an OS task. Preemption and the use of process priorities is only limited to what the OS supports.

Processes

Process Creation

An SDL process is created in the following way (in the VxWorks integration):

  1. A start-up signal is allocated.
  2. A message queue is created. In some operating systems the message queue is created automatically when the task is created or even later. This is explained for each operating system in the annexes to this chapter.
  3. The task is created with the message queue ID as a start-up parameter. In the case of VxWorks, the task will have a name starting with VXWORKSPAD_, this is a function which will initialize some internal variables. The task will then call the PAD function.
  4. A function (xAllocPrs) is called to create a representation of the new instance in the global symbol tree.
  5. The start-up signal is sent. When this signal is received in the task the start transition of the process is executed.
Process Termination

The following actions are carried out when a process terminates:

  1. The save queue and the input queue are emptied.
  2. The save queue is deleted.
  3. A message is sent to the xTimerTask with a request to remove all active timers of the process.
  4. xFreePrs is called to free the PrsNode.
  5. The message queue is deleted. In some operating systems this is done automatically when the task is deleted.
  6. The task is deleted.
PAD functions

Each PAD (Process Activity Definition) function will contain an eternal loop with an OS receive statement. When a process instance is created it is the PAD function that is called in the OS Create primitive.

The start-up and execution of a PAD function works like this:

  1. The support function xInputSignal is called. This function will wait for the start-up signal, that is always received first, and then return to the PAD function.
  2. The PAD function goes to the label Label_Execute_Transition. This label is the start of a code block containing a switch statement that evaluates the process variable RestartAddress. The code under each different case then represents a transition. At the end of this block the process variable State is updated and execution continues at Label_New_Transition.
  3. In Label_New_Transition a new call is made to xInputSignal and execution then continues at Label_Execute_Transition.

The structure of a PAD function is described below (with pseudo-code shown in italic):

Scheduling

Since each SDL process is implemented as an OS task, scheduling between processes will be handled completely by the OS.

Start-up

Start-up of a Standard Model Tight Integration can be described as follows (pseudocode is shown in italic):

The semaphore is used for synchronizing start-up of static processes. No static process is allowed to execute its start transition before all static processes are created, because a start transition can have signal sending to other static instances.

The MyMain function is placed among other support functions in the file sctsdl.c.

The yInit function is generated by the code generator and placed last in the generated file for the system.

The Instance Set Model

The Instance Set Model is based on the same principles as the Standard Model with the difference that the instance set is the basic unit rather than the process instance.

Processes

Both the instances and the instance sets are represented in the symbol table. In addition to the three parts that always make up an SDL process there is also an extra struct for the instance set, defining for example the input queue which is common to all the instances. Further, there is a PAD function for each instance, but also for the instance set.

Process Representation

An SDL_PId is represented by an xEPrsNode, pointing to an xEPrsStruct. An xEPrsNode also represents a process instance in the symbol table both in the Standard Model and the Instance Set Model.

Instance Set Data

The datatype xPrsInstanceSetVars is only used in the Instance Set Model. It defines common data for all instances of the set, like the save queue and the size of the instance data.

PAD functions

In the Instance Set Model there is a PAD function for each process instance but also for each instance set. The instance set PAD functions will be called at system start-up and contain an eternal loop in the same fashion as PAD functions in the Standard Model. Instance PAD functions are only called to execute transitions.

Process Creation

All instance sets, even for dynamic processes, are created at system start-up. Since the OS task and the signal queues are created with the instance set, the creation of an instance requires less labour than in the Standard Model. For the instance set creation the macro INIT_PROCESS_TYPE is used.

Process Termination

The instance set task is never terminated. Termination of a process instance will not remove the save queue, the input queue and the task. This is done at system termination. All queues, including the active timer queue, are emptied of messages to the terminated process though.

Signal queues

The message queue id of the receiver's instance set is accessed through NameNode in the receiver's xEPrsStruct and the variable PROCID.
Example from xSDLResetInTimerProcess:

In this case the receiver is the same as the original sender.

Signal sending

A support function xHandle_Sig is used when sending signals, instead of the macro RTOSSEND as in the Standard Model. This difference is shown in bold in the code below:

Scheduling

Scheduling between instance sets is handled by the operating system. Within the instance sets, however, scheduling is based on the signal queue. When the instance set PAD function is executing, it takes the first signal in the input queue and calls the PAD function of the addressed SDL process. The instance PAD function then executes one transition and returns control to the scheduling loop of the instance set PAD function.

Limitations for Integrations

In general, the same restrictions as for the C Code generator apply, but Tight integrations have some further restrictions. The detailed limitations for Light and Tight integrations are listed in Real-Time Operating System Support.

A Simple Example

This section describes an example system named Simple. The integration of the Simple system will be explained for each operating system in the annexes to this chapter.

The Simple System

Figure 523 : System Simple

Extracted pic [6]

The SDL representation of Simple consists of a single block Bl1. Seen from the outside, the system accepts the signal Go and responds after about five seconds by sending the signal Ok. The signal Go may be sent twice to the system.

Block Bl1

Figure 524 : Block Bl1

Extracted pic [5]

Block Bl1 has two processes. The static process Pr1 and the dynamic process DynPr1. DynPr1 is created by Pr1 and can send the signal Terminating back to its parent. Pr1 handles all the interaction with the environment, through the signals Go and Ok.

Process Pr1

Figure 525 : Process Pr1

Extracted pic [21]

Process Pr1 is a static process with two instances. It has two states, Idle and Wait. In the Idle state the process waits for the signal Go with an integer parameter representing the instance number of this instance. It then prints the instance number to the standard output, creates one instance of DynPr1 and enters the Wait state. In the Wait state it waits for the signal Terminating from the created instance of DynPr1, sends Ok back to the environment and goes back into the Wait state. Since the Terminating signal will only be received once, the process is going to remain in the Wait state forever.

Process DynPr1

Figure 526 : Process DynPr1

Extracted pic [22]

The dynamic process DynPr1 has no instances at system start and a maximum of two instances. Each instance of Pr1 creates one instance of DynPr1. DynPr1 sets the timer t1 to five seconds, waits for a timeout, sends the signal Terminating to its creator and finally terminates.

Connection to the Environment

The environment is handled in different ways depending on the integration model. See below for details.

Light Integration

In the light integration the entire SDL system will be represented by one OS task. Two external procedures, xInEnv and xOutEnv, are used for connection to the environment.

The xInEnv Function

This is where the start-up signal Go is sent. In a real system xInEnv could for example be used for polling hardware devices for input. The code looks like this:

The signal Go is sent the first and the second time xInEnv is called. The parameters startinstance1 and startinstance2 are integer constants defined in the SDL system, as type SYNONYM. They are made available here in the Environment module by generating and including the file simple.ifc.

The xOutEnv Function

The code in xOutEnv for receiving the signal Ok looks like this:

The signal Ok also has an integer parameter, the value of this should be 1 if it is sent by Pr1 instance one and 2 if it is sent by instance two.

The printout when running the example should be:

Tight Integration

Standard Model

In the standard model of tight integration each instance of the Pr1 and the DynPr1 processes will be represented by an OS task. The environment is represented by a task called MyExtTask. This task is external to the SDL system.

Instance Set Model

In the instance set model of tight integration Pr1 and DynPr1 will be represented by one OS task each. The environment is represented by a task called MyExtTask, just as in the standard model. This task is external to the SDL system.

How Signals are Sent to and from the Environment

The signal Go is sent from the external task MyExtTask. This task is created just after return from the call to yInit() in the main() function in the generated code. This is

The code for this task is placed in the file MyExtTask.c.

Tight Integration Code Reference

This section explains data types, procedures and macros used in a Tight Integration (Light Integrations are explained in the Master Library).

General Macros

XPP(x)

The macro XPP is used in function declarations to specify the function parameters. It is defined like this:

if function prototypes according to ANSI C can be used, or

if Kernighan/Ritchie C should be used.

xptrint

The following type is also always defined:

where xptrint should be an int type with the same size as a pointer.

xPrsNode and xPrdNode

xPrsNode and xPrdNode are pointers to structs holding instance data for an instance of a process or a procedure. Note that some parts of the structs are OS-dependent.

xInputAction, xNotInSignalSet ...

These defines specify the different ways of handling a signal.

Macros to Exclude Unnecessary Code

The following macros are defined to exclude unnecessary code for IdNode variables etc.:

Default Priorities

One group of macros defines default priorities for processes and signals:

Macros to Implement SDL

First in this section is a macro defining the symbol table root:

XPROCESSDEF_C and XPROCESSDEF_H

These macros define the start-up function for a PAD function. It is this function that is called in the task creation. As mentioned before this function will after some variable initializations call the PAD function. The definition of the start-up function varies in different RTOS, that is why there is a second OS-specific macro here.

STARTUPSIGNAL, ALLOCPRSSIGNAL, etc.

Each signal in an application is assigned a unique integer value. The values 31992 through 32000 are reserved for internal signals like the start-up signal.

Variables in the PAD Function

PROCESS_VARS, PROCEDURE_VARS

These macros define the elements in the xPrsStruct and xPrdStruct respectively.

YPAD_YSVARP

This macro defines a variable representing a pointer to a signal's parameter area.

YPAD_YVARP

This macro defines the variable yVarP which represents the process instance data.

LOOP_LABEL, LOOP_LABEL_PRD, LOOP_LABEL_PRD_NOSTATE

These three macros define the eternal loop inside processes, procedures and procedures without a state.

START_STATE

Each state in a process and procedure is represented as an integer. The Start state will always have the value 0.

Annex 1: Integration Model for OSE Classic

Introduction

This annex briefly describes the OSE models and primitives used in the SDT OSE tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed with OSE-classic and tested under OSE Simulator R1.8.3 for OS68 on a Sun workstation with SunOS 4.1.4.

The main differences between OSE and the general model are:

Using OSE Trace Features

Note: 

Telelogic has noticed that the OSE-trace feature can make the application crash in some situations. This seems to happen when a SDL process (OSE-task) sends a signal immediately before terminating. If you come across this problem, first check if the application works correctly when generated without OSE-trace.

How the OSE-Trace Information is Generated

How To Generate an Application That Can Use the OSE Trace Features

  1. Compile the SDT preprocessor program sccd for your environment.
  2. Rename the sccd program to sccdnocomp.
  3. Copy the sccd.cfg file for your environment. Rename the config file to sccdnocomp.cfg.
  4. Edit the config file and specify sccdCOMPILE = "OFF".
  5. Remove any automatically generated <application>.hs files.
  6. Generate an <application>.c file with the Make options:

  7. Capitalization = As defined.
    Generate signal number = Off.
  8. Add an entry in your makefile for generating the preprocessed application-file.

Note: 

The preprocessed file will be placed in a subdirectory called sccdtmp/. See how this is done in the provided makefile MakefileSimple for the entry OSETRACE.

  1. Add an entry in your makefile for generating the <application>.hs and <application>.osh with the sdt2ose program. See how this is done in MakefileSimple.
  2. Add an entry in your makefile for generating the sigdesc.c file with the OSE program confsig.
  3. Compile and link the sigdesc file with your application and kernel files.

How to Generate OSE-Trace for the "Simple" Example

Note: 

Due to the OSE kernel problem described above the OSE-trace for the Simple example will not work properly.

  1. Perform Steps 1-6 in the list above.
  2. Run the make in the following way:

  3. make -f MakefileSimple OSETRACE
    
    

This will preprocess the application file, generate the .hs and .osh files and generate, compile and link the sigdesc file.

Running the Test Example: Simple

This example uses a simple SDL system. You will find a detailed description of the system in A Simple Example.

This example is developed as an OSE-classic application on a Sun workstation. The makefile and compilation switches are set up for the application to run under an OSE Simulator for OS68. If you are using another configuration of OSE you will probably need to edit the provided makefile.

Figure 527 : File structure for the Simple example

Extracted pic [7]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h
    $(sdtdir)/INCLUDE/sctpred.c
    $(sdtdir)/INCLUDE/sctsdl.c
    $(sdtdir)/INCLUDE/sctos.c
    $(sdtdir)/INCLUDE/sctpred.h
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. In the beginning of the section "Utility macros" make an include of the following files:

  2. /****+*********************************************
    00   Utility macros
    ***************************************************/
    #include <sys/time.h>
    #include "ose.h"
    
    
  3. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  4. Edit the ROOT variable to your OSE installation path in the provided makefile.
  5. Use the provided makefile to make an executable.
  6. Run the executable under an OSE Simulator.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the OSE case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Compile the sdt2ose.c file. (Open the file and follow the instructions.)
  3. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  4. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  5. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg
  6. Edit the ROOT variable to your OSE installation path in the provided makefile.
  7. Use the provided makefile makefile to generate an executable. If you are not using the SCCD program you need to remove the sccd command in front of the compiler command:

  8. sctCC          = sccd gcc
    
    
  9. Run the application under an OSE Simulator for OS68.

Compiling with the XMSC_TRACE flag set and then running should result in the following output:

How Signals are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the file MyExtTask.c, as shown below:

Annex 2: Integration Model for OSE Delta

Introduction

This annex briefly describes the OSE Delta models and primitives used in the SDT OSE tight integration. The presentation is focused on the differences from the OSE classic model described in the previous annex.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed with OSE Delta Soft Kernel DESFK P1.2.2.3 and tested on a Sun workstation with SunOS Release 5.5.

The main differences between the OSE Delta and the OSE Classic model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as an OSE Delta application on a Sun workstation. The makefile and compilation switches are set up for the application to run under an OSE Simulator for OS68. If you are using another configuration of OSE you probably need to edit the provided makefile.

Figure 528 : File structure for the Simple example

Extracted pic [11]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h
    $(sdtdir)/INCLUDE/sctpred.c
    $(sdtdir)/INCLUDE/sctsdl.c
    $(sdtdir)/INCLUDE/sctos.c
    $(sdtdir)/INCLUDE/sctpred.h
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. In the beginning of the section "Utility macros" make an include of the following files:

  2. /****+*********************************************
    00   Utility macros
    ***************************************************/
    #include <sys/time.h>
    #include "ose.h"
    
    
  3. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  4. Edit the ROOT variable to your OSE installation path in the provided makefile.
  5. Use the provided makefile makefile to make an executable.
  6. Run the executable under an OSE Simulator.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the OSE Delta case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg
  5. Edit the ROOT variable to your OSE Delta installation path in the provided makefile.
  6. Use the provided makefile makefile to generate an executable. If you are not using the SCCD program you need to remove the sccd command in front of the compiler command:

  7. sctCC          = sccd gcc
    
  8. Run simple.ose.

Compiling with the XMSC_TRACE flag set and then running should result in the following output:

How Signals are Sent to and from the Environment.

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyExtTask.c. This is the same as used for OSE Classic, see the listing in How Signals are Sent to and from the Environment.

Annex 3: Integration Model for VxWorks

Introduction

This annex describes briefly the VxWorks models and primitives used in the SDT VxWorks tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed with VxWorks Tornado 1.0 version and tested under VxSim version 5.3 on a Sun workstation with SunOS 4.1.4.

The main differences between VxWorks and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a VxWorks Tornado application on a Sun workstation. The makefile and compilation switches are set up for the application to run under an VxSim target simulator. If you are using another configuration of VxWorks you probably need to edit the provided makefile.

Figure 529 : File structure for the Simple example

Extracted pic [8]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. In the beginning of the section "Utility macros" make an include of the following files:

  2. /****+*********************************************
    00   Utility macros
    **************************************************/
    #include "vxWorks.h"
    
    
  3. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  4. Use the provided makefile makefile to make an executable.
  5. Run the executable under the VxSim Simulator.

Note: 

A VxWorks application is not allowed to contain a main function. The name of the generated main is changed to "root" with the compilation switch -DXMAIN_NAME=root.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the VxWorks case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg.
  5. Use the provided makefile makefile to generate an executable. If you are not using the SCCD program you need to remove the sccd command in front of the compiler command:

  6. sctCC          = sccd ccsparc
    
  7. Run the application under the VxSim Simulator.

Compiling with the XOS_TRACE flag set and then running should result in the following output:

How Signals are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyExtTask.c, as shown below:

Annex 4: Integration Model for Chorus

Introduction

This annex describes shortly the Chorus models and primitives used in the SDT Chorus tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed with Chorus Kernel v3 r5 and tested under Chorus Kernel v3 r5 Simulator for SunOS on a Sun workstation with SunOS 4.1.4.

The main differences between Chorus and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a Chorus application on a Sun workstation. The makefile and compilation switches are set up for the application to run under an Chorus target simulator. If you are using another configuration of Chorus you probably need to edit the provided makefile.

Figure 530 : File structure for the Simple example

Extracted pic [9]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. In the beginning of the section "Utility macros" make an include of the following files:

  2. /****+*********************************************
    00   Utility macros
    **************************************************/
    #include <include/chorus.h>
    
    
  3. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  4. Edit the CHORUS_INCLUDE variable to your Chorus installation path in the provided makefile.
  5. Use the provided makefile makefile to make an executable.
  6. Run the executable under the Chorus Simulator.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the Chorus case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg.
  5. Use the provided makefile makefile to generate an executable. If you are not using the SCCD program you need to remove the sccd command in front of the compiler command:

  6. sctCC          = sccd ccsparc
    
  7. Run the application under the Chorus Simulator.

Compiling with the XOS_TRACE flag set and then running should result in the following output:

How Signals are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyextTask.c, as shown below:

Annex 5: Integration Model for Chorus ClassiX

Introduction

This annex describes shortly the Chorus ClassiX models and primitives used in the SDT Chorus ClassiX tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed with Chorus ClassiX Kernel r3.1b and tested under Chorus ClassiX Kernel Simulator r3 for Solaris on a Sun workstation with SunOS 5.5.1.

The main differences between Chorus and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a Chorus application on a Sun workstation. The makefile and compilation switches are set up for the application to run under an Chorus ClassiX Solaris simulator. If you are using another configuration of Chorus ClassiX you probably need to edit the provided makefile.

Figure 531 : File structure for the Simple example

Extracted pic [18]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following header files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    
    
  3. Copy the following source files to the LightIntegration directory:

  4. $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. In the beginning of the section "Utility macros" make an include of the following files:

  2. /****+*********************************************
    00   Utility macros
    **************************************************/
    #include <chorus.h>
    
    
  3. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  4. Edit the variables sctuseinclude, CDSPATH and CLASSIXDIR to your Chorus installation path in the provided makefile common.mf.
  5. Run the Chorus ClassiX command mkinit to generate a makefile and create dependency files (all.dp, common.dp).
  6. Compile with make.
  7. Move to Chorus directory $MERGEDIR.
  8. Edit the syst.<your application> file. Change the entry EXAMPLE to show the path for your LightIntegration directory.
  9. Build the application with the following command:
    sh mkbuild simple
  10. Run the executable.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the Chorus ClassiX case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg.
  5. Change the variables sctuseinclude, CDSPATH and CLASSIXDIR to your Chorus Installation path in the provided makefile common.mf.
  6. If you want to use sccd put this name in front of the compiler definition $(CXX).
  7. Use the Chorus ClassiX command mkinit to generate a Makefile and dependency files (all.dp, common.dp).
  8. Compile and build the application with make.
  9. Go to Chorus directory $MERGEDIR.
  10. Edit the syst.<your application> file. Change the entry EXAMPLE to show your path to
    <your path>/TightIntegration/TightIntegration_s
  11. Build the application and run-time kernel with the following command: sh mkbuild simple
  12. Run the application.

The output when running the example should be:

How Signals are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyextTask.c, as shown below:

Annex 6: Integration Model for pSOS

Introduction

This annex briefly describes the pSOS models and primitives used in the SDT pSOS tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed with pSOSystem/68K release 2.1.3 and tested on target with the BSP MVME-147.

The main differences between pSOS and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a pSOS application on a Sun workstation. The build files and compilation switches are set up for the application to run on a MVME-147 target. If you are using another configuration of pSOS you probably need to edit the provided build files.

Figure 532 : File structure for the Simple example

Extracted pic [10]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. Make a new compiler entry called PSOS_C:

  2. /*---+---------------------------------------------
         PSOS_C
     -----------------------------------------------*/
     #ifdef PSOS_C
     
     #include <psos.h>
     #include <drv_intf.h>
     #include <prepc.h>
     #include <stdio.h>
     #include <v12.h>
     
     #define abs(j) ((j)<0?-(j):(j))
     
     #endif
    
    
  3. Edit the sctos.c file. Before the SDL_Clock function definition make the definition:

  4. #ifdef PSOS_C
    unsigned long Sys_Ticks = 0;
    #endif
    
    Inside the SDL_Clock function make the following entry:

    #if defined(PSOS_C)
      tmp.s = (xint32)Sys_Ticks;
      tmp.ns = (xint32)0;
    #endif
    
    
  5. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  6. Edit the provided default.bld file to suit your pSOS installation and your target address.
  7. Edit the provided userappl.bld file to suit your pSOS installation.
  8. Start MULTI, select ram.bld, select userappl.bld and build the executable.
  9. Download and run the executable from MULTI.

The printout when running the example should be:

Special handling in the pSOS xInitEnv Function

In addition to the functions described in The xInEnv Function, the code also initializes the pSOS devices and starts the Tick task:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the pSOS case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. Edit the provided default.bld file to suit your pSOS installation and your target address.
  4. Edit the provided userappl.bld file to suit your pSOS installation.
  5. Start MULTI, select ram.bld, select userappl.bld and build the executable.
  6. Download and run the executable from MULTI.

Compiling with the XOS_TRACE flag set and then running should result in the following output:

How Signals are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyExtTask.c, as shown below:

Annex 7: Integration Model for VRTX

Introduction

This annex describes briefly the VRTXsa model and primitives used in the SDT VRTXsa tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example for both a light and tight integration.

Principles

This integration is developed using the gcc compiler and the Spectra environment and tested under the Spectra Cross-Development Shell on a Sun workstation with SunOS 4.1.4.

The main differences between VRTXsa and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a VRTXsa application on a Sun workstation. The makefile and compilation switches are set up for the application to run under the Spectra Cross-Development Shell. If you are using another configuration of VRTXsa, you probably need to edit the provided makefile.

Figure 533 : File structure for the Simple example

Extracted pic [12]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Edit the scttypes.h file. In the beginning of the section "Utility macros" make an include of the following file:

  2. /****+********************************************
    00   Utility macros
    **************************************************/
    #include <vrtxil.h>
    
    
  3. Open the sctos.c file and make the following changes. Inside the SDL_Clock function definition make the following entry:

  4. #ifdef VRTX_C
    int Err;
    struct timespec time_s;
    unsigned long ns = 10000000;  
    /* ns per tick for VRTXsa clock */
    
    sc_gclock(&time_s,&ns,&Err);
    tmp.s = time_s.seconds;
    tmp.ns = time_s.nanoseconds;
    #endif 
    
  5. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  6. Edit the provided makefile makefile to suit your environment setup and generate an executable.
  7. Run the executable under the Spectra Cross-Development Shell.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the VRTX case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<your_compiler_type>.cfg from <your_SDT_installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler_type>.cfg to sccd.cfg
  5. Edit the provided makefile makefile to suit your environment setup and generate an executable. If you are using the SCCD program you need to add the sccd command in front of the compiler command:

  6. sctCC          = sccd gcc
    
    
  7. Run the application under the Spectra Cross-Development Shell.

Compiling with the XOS_TRACE flag set and then running should result in the following output:

How Signals Are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyExtTask.c, as shown below:

Annex 8: Integration Model for Win32 and Windows CE

This annex briefly describes integration with Win32 and Windows CE. The presentation is focused on the differences from the general model described earlier in this chapter.

Principles

This integration is developed using the Microsoft 32-bit C/C++ Compiler Version 11.00.7022 and tested on NT 4.0, NT 3.51 and Windows 95 platforms. The integration is also compiled with Borland C++ 5.2 for Win32 and tested on NT 4.0, NT 3.51 and Windows 95 platforms.

The main differences between integration with Win32 and the general model are:

Note: 

The internal timer wraps around to zero if Windows is run continuously for approximately 49.7 days.

Additional comments about Windows CE

The standard Win32 integration package is also used for integrating with Windows CE. It has been tested on Windows CE 2.0.

The main difference between the Win32 integration and the Windows CE integration is that Windows CE does not provide a printf() function.

If you want to use trace output then you must supply this functionality yourself or use one of the third party solutions that are available. You must also put a prototype for your printf() function in sctwin32.h.

Note: 

To build your system for Windows CE you must use the compilation switch -DXWINCE.

Running the Test Example: Simple

Prerequisites

This test example is developed as a Win32 console application on a PC. The makefiles and compilation switches are set up for the application to compile using either the Borland or the Microsoft compiler listed above. There is a separate makefile for each compiler.

Figure 534 : File structure for the Simple example

Extracted pic [13]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>\sdt\sdtdir\<machine dependent dir>

where <machine dependent dir> is wini386 in Windows and for example sunos5sdtdir on SunOS 5 or hppasdtdir on HP.

  1. Generate the source file and the interfacefile. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  2. Edit the provided makefile <compiler_name>makefile to suit your environment and generate an executable.
  3. Run the executable.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the Win32 case.

Compiler Flags

Preparations for the Tight Integration

  1. Change to the TightIntegration directory.
  2. Generate a source file, an interface file and a signal number file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from
    <Telelogic Tau installation directory>\sdt\
    sdtdir\util\
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler_type>.cfg to sccd.cfg
  5. Open the project file to suit your compiler or else use the provided makefile <compiler_name>makefile to generate an executable. If you are using the SCCD program, you need to add the sccd command in front of the compiler command in your makefile, e.g.:

  6. sctCC          = sccd bcc32
    

Note: 

The Borland compiler command line argument limitation can sometimes be exceeded. If this happens, you should define the DEFINE MACROS at the beginning of the sctwin32.h file.

  1. Build an executable.
  2. Run the generated executable from the Command Prompt.

Example: The Simple System

Compiling with the XOS_TRACE flag set and then running should result in the following output:

How Signals Are Sent to and from the Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyExtTask.c, as shown below:

Annex 9: Integration Model for QNX

Introduction

This annex describes briefly the QNX model and primitives used in the SDT QNX tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example in both a light and tight integration.

Principles

This integration is developed using the Watcom 10.6 compiler and tested with QNX 4.23 version, running on a PC.

The main differences between QNX and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a QNX application on a PC. The makefile and compilation switches are set up for the application to run under QNX 4.23 using the Watcom 10.6 compiler.

Figure 535 : File structure for the Simple example

Extracted pic [14]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration.

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  2. Use the provided makefile makefile to make an executable.
  3. Run the executable.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the QNX case.

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from
    <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg
  5. Use the provided makefile makefile to generate an executable. If you are using the SCCD program you need to add the sccd command in front of the compiler command:

  6. sctCC          = ./sccd cc
    
  7. Run the application.

Compiling with the XOS_TRACE flag set and then running should result in the following output:

How Signals Are Sent to and from the Environment

The signal Go is sent from an external process MyExtTask. The code for this task is placed in the program file MyExtTask.c, as shown below:

Annex 10: Integration Model for Nucleus+

Introduction

This annex describes briefly the Nucleus PLUS model and primitives used in the SDT Nucleus PLUS tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example for a tight integration.

Principles

This integration is developed using Microsoft Visual C++ Version 5.0 with Nucleus MNT running on a PC.

The main differences between Nucleus PLUS and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a Nucleus MNT application on a PC. The makefile and compilation switches are set up for the application to run under Nucleus MNT using the Microsoft Visual C++ Version 5.0 compiler.

Figure 536 : Structure for the Simple example

Extracted pic [19]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration.

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Follow the steps in the README file to modify the Master Library files you have just copied for Nucleus PLUS.
  2. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  3. Use the provided makefile makefile to make an executable.
  4. Run the executable.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the Nucleus case.

Compiler Flags

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg
  5. Use the provided makefile MicrosoftMakefile to generate an executable. If you are using the SCCD program you need to add the sccd command in front of the compiler command:

  6. sctCC          = sccd cl
    
  7. Run the application.

The output when running the example should be:

How Signals are Sent to and from Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyextTask, as shown below:

Annex 11: Integration Model for Solaris 2.6

Introduction

This annex describes briefly the Solaris 2.6 model and primitives used in the SDT Solaris 2.6 tight integration. The presentation is focused on the differences from the general model described earlier in this chapter.

One section describes how to set up and run a simple test example for a tight integration.

Note: 

The Solaris 2.6 tight integration is fully POSIX compliant. For this reason it will not work with earlier versions of Solaris.

Principles

This integration is developed using cc:WorkShop Compilers 4.2 with Solaris 2.6 running on a workstation.

The main differences between the Solaris 2.6 integration and the general model are:

Running the Test Example: Simple

Prerequisites

This test example is developed as a Solaris 2.6 application on a workstation. The makefile and compilation switches are set up for the application to run under Solaris 2.6 using the cc:WorkShop Compilers 4.2 compiler.

Figure 537 : File Structure for the Simple example.

Extracted pic [20]

Light Integration

Limitations for the Light Integration

Preparations for a Light Integration.

  1. Copy the following files to the LightIntegration/INCLUDE directory:

  2. $(sdtdir)/INCLUDE/sctlocal.h,
    $(sdtdir)/INCLUDE/sctpred.c,
    $(sdtdir)/INCLUDE/sctsdl.c,
    $(sdtdir)/INCLUDE/sctos.c,
    $(sdtdir)/INCLUDE/sctpred.h,
    $(sdtdir)/INCLUDE/scttypes.h
    

Note: 

$(sdtdir) = <Telelogic Tau installation directory>/sdt/sdtdir/<machine dependent dir>

where <machine dependent dir> is for example sunos5sdtdir on SunOS 5, hppasdtdir on HP, and wini386 in Windows.

  1. Open the system file simple.sdt in SDT and generate a simple.c and simple.ifc file. Use the Cadvanced Code Generator and the options Lower Case and Generate environment header file.
  2. Use the provided makefile makefile to make an executable.

The printout when running the example should be:

Tight Integration

Limitations for the Tight Integration

Please read the section Real-Time Operating System Support for details about limitations that apply to all systems using Tight Integration.

No other limitations apply in the Solaris case.

Compiler Flags

Preparations for a Tight Integration

  1. Change to the TightIntegration directory.
  2. Open the system file simple.sdt and generate a simple.c, simple.ifc and simple.hs file. Use the Cadvanced Code Generator and the options Lower Case, Generate environment header file and Generate signal number file.
  3. If you want to use the SDT preprocessor program SCCD, copy both sccd.c and sccd_<compiler type>.cfg from <your SDT installation>/sdt/sdtdir/util/
  4. Compile the sccd.c file (open the file and follow the instructions). Rename sccd_<compiler type>.cfg to sccd.cfg
  5. Use the provided makefile makefile to generate an executable. If you are using the SCCD program you need to add the sccd command in front of the compiler command:

  6. sctCC          = sccd cc
    
    
  7. Run the application.

The output when running the example should be:

How Signals are Sent to and from Environment

The signal Go is sent from an external task MyExtTask. The code for this task is placed in the program file MyExtTask.c, as shown below:

Task MyExtTask

1. The MSC trace will be printed on standard output. To see the trace in an MSC diagram, copy the text into a file and read it into an MSC Editor.

2. SDL signals will be implemented as messages in VxWorks.


[Previous] [Next] [Contents] [Index]