IBM
Contents Index Previous Next



Using the Targeting Expert


What You Will Learn

Starting the Targeting Expert

The deployment diagram should be used as input to the Targeting Expert.

Right-click the network_depl diagram symbol in the Organizer and select Targeting Expert from the pop-up menu.

The deployment diagram will be analyzed. If any errors are found, the Organizer Log pops up and shows an error message. You can locate the error in the deployment diagram by clicking on the "Show error" button in the Organizer Log toolbar.

The Targeting Expert is launched.

Selecting Target Platform

The initial appearance of the Targeting Expert window is shown in Figure 210.

Figure 210 : The Targeting Expert When First Opened

The left part of the window, called Partitioning Diagram Model, shows a filtered view of the deployment diagram. The nodes and components are represented.

For each component, do the following:

  1. Select the component in the Partitioning Diagram Model window.
  2. Click the drop-down list containing "SELECT INTEGRATION". A menu with available integrations is opened. As the component has "Threaded" as integration (selected in the Deployment diagram), "Threaded Integrations" is the only available selection to select.
  3. Select the platform in the sub-menu.
    • Windows: Select Win32 Threaded (CAdvanced)
    • Solaris: Select Solaris Threaded (CAdvanced)
    • Linux: Select Linux Threaded (CAdvanced)
  4. A dialog-box will pop up, asking if the SDL system should be automatically generated. Click Yes.

The Targeting Expert window now looks as in Figure 211.

Figure 211 : Components with Selected Integration Models

Configuring C Code Generation

The Targeting Expert GUI for C code generation has four tabs. These are SDL to C Compiler, Communication, Environment Header File and Execution. All these tabs contain widgets for configuring the code generation for an executable.

Each of the executable files that will be built have communication through external code. All executables use the TCP/IP communication module and the mobile phone executables (John, Marie, ParisPizza and LyonPizza) use a GUI. The external code is connected to the SDL system through environment functions. The generation of environment functions must be configured manually.

The Targeting Expert features a wizard for easy configuration of the TCP/IP module. When activating the wizard, all the necessary environment functions will be generated by default.

The TCP/IP wizard dialog box is shown in Figure 212.

Figure 212 : The TCP/IP Wizard

The TCP/IP module needs routing information to send signals to the correct recipient. A C header file with the routing function declaration must be included. The routing function definition must be given in a C source file. The TCP port number for incoming signals must also be given. This number is used by routing functions in remote executables sending signals to this executable.

For each of the components, do the following:

  1. Click the name of the integration in the left sub-window.
    • Windows: Click Win32 Threaded
    • Solaris: Click Solaris Threaded
    • Linux: Click Linux Threaded
  2. Select the Communication tab.
  3. Click in the TCP/IP check box in the Signal Sending group. The TCP/IP Wizard is opened.
  4. Click in the check box Include routing header file.
  5. Click the file button to the right of the header file text box. A file selection dialog box is opened.
  6. Select the routing header file in your working directory.
    • If you build the John, Marie, ParisPizza or LyonPizza executable, select router.h.
    • If you build the Switch executable, select switchrouter.h.
  7. Click Open.
  8. Click the file button to the right of the source file text box. A file selection dialog box is opened.
  9. Select the routing source file in your working directory.
    • If you build the John, Marie, ParisPizza or LyonPizza executable, select router.c.
    • If you build the Switch executable, select switchrouter.c.
  10. Click Open.
  11. Enter the server port number of the executable you are building. Enter a port number according to Table 2.
Table 2 TCP Server Port Numbers for the Executables
Executable TCP Port Number

Marie

4949

John

5959

ParisPizza

7979

LyonPizza

8989

Switch

6969

  1. Click OK in the TCP/IP wizard dialog box.

The code generation configuration is now finished.

Compiling and Linking

The Targeting Expert Compiler/Linker/Make section contains six tabs: Compiler, Source Files, Additional Compiler, Linker, Library Manager and Make. The section is shown in Figure 213.

Figure 213 : The Targeting Expert Compiler/Linker/Make Section

Compiling and Linking the Switch Executable

To configure the compilation and linking of the Switch executable, do the following:

  1. Click Compiler/Linker/Make for Switch in the Partitioning diagram Model window.
  2. In the Include text box, add -I../../../../../ After the addition, the text box will look as shown in Figure 214.

    Figure 214 : The Include Text Box with an Additional -I flag

  3. Click the Save button.
  4. Click Target Library for Switch in the Partitioning diagram Model window.
  5. In the Kernel tab, click in the following check boxes:
    • Show errors on stdout. Setting this option renders log messages if errors are encountered during execution.
    • Text trace. Setting this option renders textual traces on stdout during execution.
  6. Click the Save button.
  7. Click the Full Make button. The SDL system is analyzed, code is generated and a makefile is generated and executed.

You will now have an executable file named switch. The file extension will be .exe on Windows and .sct on Unix.

Compiling and Linking the MobileStations

To configure the compilation and linking of the MobileStation executables, do the following:

  1. Click Compiler/Linker/Make for MobileStation in the Partitioning Diagram Model window.
  2. In the Include text box, add -I<your working directory>, e.g. -I/home/mobile . After the addition, the text box will look as shown in Figure 214.
  3. Add the following flags in the Library Flag text box:
    • -DXMAIN_NAME=SDL_Main
    • -DXEXTENV_INC="<gui.h>"
    • -DMARIE, -DJOHN, -DPARISPIZZA or -DLYONPIZZA, depending on which executable you are configuring

The XMAIN_NAME flag is used to rename the main function in the generated SDL system. A main function is provided in the GUI source code. The SDL main function, renamed SDL_Main, will be started in a thread from the new main function.

XEXTENV_INC is a flag for using environment code together with the TCP/IP module. The gui.h file contains definitions of some macros in the generated environment file.

  1. Click the Source Files tab. A list of the external files to compile is shown.
  2. Click the Add button. A dialog box is shown.
  3. Select gui.c in the working directory. Click Open. The file is added to the file list.
  4. Windows only: The GUI must be compiled using a resource compiler.
    • Click the Additional Compiler tab.
    • Enter rc in the Compiler Name text box.
    • Enter -l 0x41d %I -fo %o %s in the Options text box.
    • Add the file gui.rc to the list of files to compile by clicking the Add button and select gui.rc from your working directory.
    • Enter .res in the Object Extension text box.
    • Click on the Make tab.
    • Change from Microsoft nmake (using temporary response file) to Microsoft nmake in the Make tool drop down list.
  5. Click the Linker tab.
  6. Enter the following in the Options text box:
    • Windows: Change -subsystem:console to -subsystem:windows
    • Unix: Add library and library paths -lXm -lXt -lX11 and -L/usr/X11R6/lib.
  7. Click the Save button.
  8. Click the Full Make button. The SDL system is analyzed, code is generated and a makefile is generated and executed.

You will now have an executable file. The file extension will be .exe on Windows and .sct on Unix.

The Target System

The generated executable files are located in a directory structure created by the Targeting Expert. The Targeting Expert uses the target directory given in the Organizer as root.

In the mobile system, target is given as target directory. The generated target directory structure is shown in Figure 215.

Figure 215 : The Generated Target Directory Structure

The executable files are located in the platform-specific directories (Win32_threaded and Solaris/Linux

_threaded, respectively). The object files are located in subdirectories of the platform directories.


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