IBM
Contents Index Previous Next



Annex 6: Building a Threaded Integration


Introduction

This Tutorial, on how to create a Threaded integration, is developed on a Windows machine and is intended to be run under a Windows OS.
If you want to use this example on another machine and for another OS, please remember to choose the appropriate integration and compiler for your OS in the Targeting Expert.

Note:

The source file and examples for RTOS Integrations are not included in the standard delivery. They are available as free downloads from the IBM Rational Support web site.

Preparations

The same SDL source files for the example Simple, that is used in the Light integration example will be used in this tutorial.

Copy the Source files for the Example: Simple

  1. Create your own test directory and enter it.
  2. Copy the SDL source files for the example Simple:
    cp .../RTOS/TightIntegrations/Example/Simple/*.s*
  3. Copy the environment file from the Win32/ThreadedIntegration directory:
    cp .../RTOS/TightIntegrations/Examples/Simple/Win32/ThreadedIntegration/MyExtTask.c
  4. Start the SDL Suite and open the system file for the Simple example.

Partition the system using the Deployment Editor

  1. Create a new deployment diagram and call it Simple.
  2. Edit the deployment diagram according to the figure below, see : Signalling in Threaded Integration.

Figure 581 Deployment Diagram for the example Simple

  1. Make sure that you got the multiplicity right on the aggregation line from the component to thread.
    To check this you can double click on the line. The right value should be:
    • 1 - On aggregation line from component to thread Pr1.
    • * - On aggregation line from component to thread DynPr1.
      The multiplicity on the aggregation lines specifies how the component should be mapped to threads.
    • A `*' means that each instance of the component should be mapped to an individual thread.
    • A name means that the entire component should be mapped to a thread.
      In our example this means that there should be one thread for all instances of Pr1 and one thread for each instance of DynPr1.
  2. Double-click the component symbol. In the Symbol Details window specify that the integration model should be Threaded, see : Signalling in Threaded Integration.

Figure 582 Symbol Details for the Component Simple

  1. Double-click the thread symbol for Pr1. Specify the following Thread Parameters for the Thread P1:
    Thread Stack Size = 2048
    Thread Priority = 8
    Queue Size = 128
    Max Signal Size = 1024
  2. Double-click the object symbol and specify that the stereotype should be Process and that the qualifier (for Pr1) should be:
    • Simple/Bl1/Pr1.
      Make the appropriate specifications for the object Symbol for DynPr1(Qualifier = Simple/Bl1/DynPr1).
  3. Save the deployment diagram.
  4. Select the deployment diagram in the Organizer and open the Targeting Expert from the Generate menu.
  5. Choose the integration: Threaded Integrations->Win32 threaded.
  6. You will be prompted if you want to generate the sdl_cfg.h file. Select No!
  7. Disable the Generation of Environment Function by deselecting Environment Functions in the Environment section of the window.
  8. Click on the Compiler/Linker/Make line in the Partitioning Diagram Model. You should now see the following in the Targeting Expert window, see:: The Compile/Linker/Make Window in Targeting Expert.

Figure 583 : The Compile/Linker/Make Window in Targeting Expert.

  1. Define the following flag: THREADED_SIMPLE_EXAMPLE in the Compiler description/Options window. This flag will start the External threads in the simple example.
  2. Define the following Compilation flags:
    • THREADED_XTRACE,
    • THREADED_MSCTRACE
      by selecting the flags: SDL trace and MSC trace in the Target library/Kernel window
  3. Add the MyExtTask.c file as a new source file.
    Click on the Source Files entry in the window and add the MyExtTask.c file in the source file list.
    Save the settings. You are now prompted again to generate configuration file, this time select Yes.
  4. You should now be back in the Analyze/Generate code window and be ready to generate the application.
    Do a full Make and if you have followed the instructions the Targeting Expert will now analyze, generate code, generate makefile, compile and link the application.
  5. Run the application simple.sct. Please note that you have to traverse down in the generated directory structure to find the application.
    You will find the application in a subdirectory similar to this path:
    • <your test directory>/Simple._DPE981536368/Simple._DPE1/Simple._DPE2/Win32_threaded/....

The output you should see when you run the application should be as follows:

Figure 584 Textual SDL trace for Simple example.

Figure 585 MSC trace for Simple Example


http://www.ibm.com/rational
Contents Index Previous Next