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


    Cmicro Targeting Tutorial

This Cmicro tutorial takes you through the first steps of targeting using Cmicro.

Currently this tutorial is designed for using a Borland C++ 5.02 or a Microsoft Visual C++ 5.0 compiler in Windows, and any C++ compiler available on UNIX.

Table of Contents 

Prerequisites / Abbreviations Used

It is assumed that Telelogic Tau is already installed on your PC running Windows 95/NT4.0, or on your UNIX workstation running SunOS 5.5 or HP-UX 10.20. This tutorial will not work on any other systems.

Before you run this tutorial, you should be familiar with the SDT tools, especially the Organizer, the Analyzer and the Simulator. If you have not already done so, you are recommended to go through the previous tutorials in this volume.

The following notations and directories concern the rest of this tutorial:

Introduction

Parts of This Tutorial

In the first part of this tutorial you will generate an already designed system. All configurations have already been done. This part starts with Generating the Executable.

In the second part, you will design a new system, generate it with the SDT Analyzer, configure it with the Cmicro Bodybuilder (including creation of environment functions) and run the target as an application in a command shell. This part starts with Creating Your Own Target System.

The Kind of Integration Used in This Tutorial

Targeting may be implemented using the following methods:

The Cmicro Package is mainly designed to work in bare integrations but can be simply adapted to OSs and executed as light integrations.

For tight integrations the effort depends on the operating system in use.

In this tutorial you will be doing a light integration as the target executable is executed as independent OS tasks, where the SDL processes are scheduled by the Cmicro Kernel.

Prerequisites to the First Example

The AccessControl System

The SDL system that will be used for the first part of this tutorial is an AccessControl System that controls four doors. An administrator has got a master card and uses this card to register cards along with an associated PIN (Personal Identity Number).

To register a card, the administrator inserts his card via the control panel and enters the PIN 0 0 0 0. Now the user can insert his own card and enter a private PIN. The users card and PIN are then registered and it is allowed to open one of the four doors.

The SDL Overview shows the access system divided into blocks and processes.

Figure 272 : An overview of the system Access

Extracted pic [3]

Process Description
DoorMonitor

The DoorMonitor process starts the DoorController process instances when the controller wants to allocate a door.

DoorController

Any instance of the DoorController controls one door.

PanelControl

The PanelController is an interface between the access system and the user, who wants to open a door. It displays messages via a display and performs any message from the card reader and the keyboard.

Controller

The process Controller controls the doors and user interface and establishes a link to the database represented by the Central.

Central

The Central is the database of the system containing all card information. If a user inserts a card the card information will be registered by the database.

Delivered Files

The files needed for the first part of this tutorial can be found in the following directories:

The project directory door_acc is divided into directories called system and target. The directory system contains the SDL-GR files of the Access Control system. The files located in the target directory are listed below.

Filename Description
mk_stim.c

Timer implementation

mk_user.c

Errorhandler, watchdog

mk_cpu.c

Memory management, interface to an external environment

env.c

Environment functions

dl.c

Physical layer of the access.exe

mpm_con.c

Connection to the Cmicro Postmaster

sdtmt.btm

Button file for the Cmicro Tester

Special Files in Windows

To generate an executable in Windows you need following files, located in the make_bc and make_cl directory of the cmicrotutorial\wini386 directory, for the Borland C++ and the Microsoft Visual C++ compiler.

File Description
make.opt

Configuration for the project (Cmicro path, compiler flags)

comp.opt

make template for the generator

Special Files on UNIX

File Description
makeoptions

Configuration for the project (Cmicro path, compiler flags)

Generating the Executable

You will now generate an executable for the already designed Access Control system.

  1. Make a new empty directory cmicrotutorial in your home directory or on your local hard disk. This directory will be denoted by <MyTutorial> in the following.
  2. Copy the directory <TAUinstallation>/sdt/examples/
    cmicrotutorial/<platform>/door_acc
    (including all files and subdirectories) to your new <MyTutorial> directory and remove any write protections.
  3. In Windows, if you use the Borland C++ compiler, copy make.opt and comp.opt from the directory <TAUinstallation>\sdt\
    e
    xamples\cmicrotutorial\wini386\make_bc into your target directory.

  4. If you use the Microsoft C++ compiler, you have to copy these files from the <TAUinstallation>\sdt\examples\
    cmicrotutorial\wini386\make_cl
    directory into your target directory.
  5. In the Organizer, open the Access Control system found in<MyTutorial>/door_acc/system.

The following steps are necessary to ensure that the tutorial works properly.

Generating Files for the Bodybuilder

The Cmicro Bodybuilder needs the files access.sym, access.ifc and sdl_cfg.h (generated by the Cmicro Code Generator) to configure the Cmicro Library. To generate these files, do as follows:

  1. Select Make in the Generate menu of the Organizer.

  2. The Make dialog will be issued.
  3. In the dialog, make the following settings:
  4. When this is all done, click on the Full Make button.

When the make process has finished, you will have the files necessary to configure the Cmicro Library and the Cmicro Tester.

Configuring the Cmicro Library and the Cmicro Tester

  1. Start the Cmicro Bodybuilder from the Generate menu in the Organizer.
  2. In the Bodybuilder, click on the Host box and then select Gate Selection. Modify the path to the following (you cannot use the Browse button, because no gateway has been built yet):
    <MyTutorial>\door_acc\target\access.exe (in Windows), or <MyTutorial>/door_acc/target/access (on UNIX).
  3. Click on Message Coding and modify the values, which are described in Configuring the Host with the Bodybuilder. Follow the instructions in that section and then continue with the next step below.
  4. Leave the Host box and go to the Compiler box. In the Compiler box you have to select the compiler (e.g. Microsoft C++).
  5. Select Save from the File menu. You can now exit the Cmicro Bodybuilder. All other modifications are already done for this example.

Compiling and Linking the Program

Before you compile your system you have to modify the file make.opt (in Windows) or makeoptions (on UNIX).

  1. Edit the file make.opt or makeoptions if not already done.

  2. On UNIX, you have to select the sctLDFLAGS for your hosttype. Also modify the macro sctLINKKERNEL to use sctLINKTARGET_WITH_TESTER.

Note: 

Make sure that you are using a C++ compiler because you are linking C++ objects from the Cmicro Postmaster Library.

Note: 

Make sure that you can use your compiler with an external tool like the Telelogic Tau package (binaries, include path, lib path, etc. of your compiler may need to be added to your environment).

  1. Next you have to select Make again in the Organizer, and this time you will actually compile and link the program. All that you need to modify from the last time is to select the Makefile and Compile & Link toggle buttons. When this has completed, you will have created a file access.exe in Windows, or access on UNIX, respectively.

  2. Figure 273 summarizes the settings to use in this step.

Figure 273  : The Telelogic SDL Make Dialog

Extracted pic [2]

Caution! 

The executable you will get following the steps described above is a Cmicro target executable for use in combination with the SDT Cmicro Tester only.

It cannot be started directly from the command line (see the following sections).

Use of the Cmicro Tester

Differences between SDT Simulator and Cmicro Tester

The difference compared to the SDT Simulator is that the generated SDL system is running on a target hardware and is sending messages to the host system on which the SDT Cmicro Tester's host part is running.

In this Cmicro tutorial, the SDT Cmicro Tester's host part is running on the host as well as the generated SDL system (target). Therefore, from the host's point of view, the target is running as a gateway (to be able to establish a communications link to the Cmicro Tester's host part via the Cmicro Postmaster).

Figure 274 : Communication links between the processes

Extracted pic [1]

Restrictions in This Tutorial

It is possible to use all the features supported by Cmicro (e.g. signal priorities, error checks, tester) except the preemptive Cmicro Kernel. This is due to the concept behind Cmicro which is designed for small targets on a stand-alone hardware (bare integration).

Restriction in the Use of Commands

There are a few Cmicro Tester commands which make no sense for a light integration:

Note: 

The Cmicro Tester is intentionally designed for testing a hardware connected to a host machine.

Testing the Access System with the Cmicro Tester

Running the Cmicro Tester

The Cmicro Tester has a user interface similar to the SDT Simulator. You are assumed to be familiar with this user interface. For more information, see Tutorial: The SDT Simulator.

The Cmicro Tester is forking the target access or access.exe in the directory you selected in the Bodybuilder's Host box. Now you can test the access system.

  1. Start the communication with the access or access.exe by pushing the button Start-Com in the Access Control group or in the Communication group.
  2. Now the system on the target is idle. The Cmicro Tester displays the message Start with "Go Forever". The appropriate button is located in the Execute group.
  3. On UNIX, all messages from the target are displayed on the console from where your tester was started. In Windows, all messages are displayed in a DOS window. You can send the message card with the keys a, b, c, d and numbers with the keys 0 - 9.
  4. The Access Control displays the message "Insert card". After starting the access system, the control system database is empty. The system only knows the administrator, who has the permission to deliver access codes. Insert a card by entering a letter and then the administrator PIN 0 0 0 0.
  5. The access control displays the message "Register card". Now the user who wants to get the access puts his card in the card reader by typing a letter. Afterwards he can insert his own PIN and select a door. The user will then be registered in the system's database.

CmicroTester Commands

The Cmicro Tester has button groups. Each button represents a Tester command. You can use the buttons to enter a command or the command line at the bottom of the Tester. If you enter help in the command line you will see a list of Cmicro Tester commands.

In the following some Tester commands are explained briefly. For more information, see The Cmicro Tester.

Tracing the SDL System With the Cmicro Tester and MSC Editor

Similar to the SDT Simulator GUI it is possible to generate MSC traces while testing the system with the Cmicro Tester.

Tracing the SDL System With the Cmicro Tester and SDL Editor

It is possible to trace the target system with the SDL Editor.

The MSC trace and SDL trace functions are powerful tools for understanding the system.

Target Information

To get more information about target configuration, you must open the Configuration Group in the button area of the Cmicro Tester. Now you can press Target to get the current target configuration.

To get information about the kernel, you have to open the View group. If you press Queue you will get information about the current state of the internal queue of your system. You will see the peek hold and the amount of signals of your current system. By pressing the other buttons in the View group, you will get more information of the running system.

Breakpoints

To debug the system you can use the Breakpoints button group. You can set a breakpoint on a signal input or a process state. If a breakpoint was reached you can continue the system with the button Continue.

Systemcontrol

In the Systemcontrol group it is possible to test the system with single steps. To switch into single step mode use Single-Step; to exit this mode use Exit-Single-Step.

Creating Your Own Target System

In the second part of this tutorial, you will now design a new system, generate it with the SDT Analyzer, configure it with the Cmicro Bodybuilder (inclusive creation of environment functions) and run the target as an application in a command shell.

Prerequisites

When you start a new project, it is recommended to keep the SDL files and the generated files in separate directories.

Thus the following scenario shows how a typical project might be partitioned.

Figure 275 : Directory structure

Extracted pic [4]

The SDL system should be stored in <My_SDL_System>, and the generated system in the directory <My_Cmicro_Target>.

Caution! 

If you use DOS to compile your target program you should use file names which fit to the 8.3 convention, since only Windows 95/NT and UNIX are supporting long file names. Long file names can cause errors while compiling your program within a DOS environment.

Note: 

For any Cmicro project you have to create a new directory, because some tools create files (e.g. sdl_cfg.h and env.c) which have the same name for all SDL systems.

Now you can design a new SDL system or take an already created and tested system.

In the following sections the way of targeting a delivered system is described, as it is sometimes necessary to have references to some signal names in the explanation. The directories <My_SDL_System> and <My_Cmicro_Target> will be named system and target, and <My_Cmicro_Project> will be named calcul.

The calculator example may be found in the following directories:

Hint: 

When using timers in Cmicro, timers are often realized as an interrupt service routine, i.e. one timer tick can take any value which is possible. So the SDL command "set(NOW+5,TIMER)" lets the timer TIMER expire after 5 ticks. Please view the timer implementation in mk_stim.c.

In this tutorial one timer tick is one second.

Note: 

Timers are differently realized within the SDT Simulator where timers always have ticks of one second.

The SDL System Calcul

This section uses the supplied SDL Calcul system to show you how to create your own target system.

Figure 276 : System view of Calcul

Extracted pic [5]

The simple calculator given receives two integer values (0, 1, 2,...9). The user can then apply common mathematical functions such as addition, subtraction, etc. to these integer values.

  1. Copy the directory <TAUinstallation>/sdt/examples/
    cmicrotutorial/<hosttype>/calcul
    (including all files and subdirectories) to your <MyTutorial> directory.
  2. Using the Telelogic Tau Organizer, open the Calcul system found in <MyTutorial>/calcul/system, and take a little time to become familiar with it. When the design is finished the system can be simulated using the SDT Simulator to debug the system and ensure that all the logic is correct and does what it sets out to do.

When the debugging is done you can start the targeting with the Cmicro Package.

  1. Open the Make dialog in the Organizer.

Figure 277  : Make dialog to generate a Cmicro system

Extracted pic [6]

To generate the system you must:

  1. Select Analyze & generate code
  2. Select Generate makefile and Use kernel in directory.
  3. Make sure that the Target directory path and the Use kernel in directory path are set to <MyTutorial>/calcul/target.
  4. De-select the toggle buttons Makefile and Compile & link
  5. Click Full Make.

  6. The C Code Generator generates the system.

Note: 

If the message "Max number of instances must be specified" is printed in the Organizer Log, you have to look into your blocks and correct your process names with <processname>(x,y). The maximum number of instances of a process must specified in Cmicro to generate an optimized code.

Please view the section SDL Restrictions to get a feeling about the SDL restrictions concerning Cmicro.

The Cmicro Code Generator creates the files <systemname>.c, <systemname>.ifc and sdl_cfg.h for compiling the system. In this case, the <systemname> will be calcul.

Filename Description

<systemname>.c

This file describes the SDL system with C functions.

<systemname>.ifc

This file is a header file for the environment functions

<systemname>.sym

The .sym file is a file for the Cmicro Tester to locate SDL symbols for tracing the SDL system.

sdl_cfg.h

This file is the automatic configuration for the Cmicro Kernel. For example, if you use timers the file will include a define, which turns the timer implementation on.

Template Files

Filename Description
mk_cpu.c

This module is a template for functions, which are to be filled up by the user of the Cmicro Kernel in some cases.

  1. Character read / write on hardware / OS-level
  2. Functions for dynamic memory handling.
mk_stim.c

This module exports all necessary functions to represent the hardware layer of timers.

mk_user.c

This module includes

  1. Functions for central error handling
  2. Functions for the Cmicro Kernel (optional in order to optimize)
  3. Functions to trigger a hardware-Watchdog
dl.c

This module represents the data link of the communication interface (which is normally a serial interface like V.24).

Note: 

The template of the environment functions (signals from and to the SDL system) will be created by the Cmicro Bodybuilder (please see Configuring with the Bodybuilder).

If you are creating a new system running on a microcontroller you have also to copy the template file make.opt or makeoptions into your target directory. The file make.opt or makeoptions is already adapted as this tutorial is still based on a light integration.

Configuring with the Bodybuilder

After generating the C code you have to configure the Cmicro target. The best way is to use the Cmicro Bodybuilder. With the Bodybuilder you can scale your target, configure your communications link to your host and select your C-compiler.

  1. Start the Bodybuilder.

  2. (For more information, see Configuring the Cmicro Library and the Cmicro Tester.)
  3. Open the log window of the Bodybuilder. Here the Bodybuilder reports errors and operations.
  4. In the tool bar of the Bodybuilder you will see a button with a check mark. Click this button.
  5. The Bodybuilder shows you a box, informing you about the configuration of your files.
  6. Click on Target Kernel. Now you see the Kernel options and a help text.
  7. Click on Cmicro Kernel > Kernel. Now you can scale your Cmicro Kernel.
  8. In this tutorial, only the button Initialize Variables has to be selected, which leads to a

  9. #define XMK_USE_KERNEL_INIT
    
    in ml_mcf.h.
  10. Open the environment configuration by clicking Environment > Target Environment
  11. In this box you have to select Standard IO library, because all your signals are received from the stdin and sent to the stdout.
  12. Click on the OK button.
  13. The last step is to select the C Compiler. You need a C compiler to compile a program. There is no default compiler selected so you must select the compiler yourself. For this tutorial select an appropriate Windows or UNIX compiler.
  14. Now you can save the options with File > Save.
  15. You have to generate the environment file with File > Generate "env.c"
  16. Exit the Bodybuilder with File > Exit.

Generated Files

The Bodybuilder generates three files which have different meanings.

File Description

env.c

This module includes the environment functions. The environment functions must be filled up by the user.

ml_mcf.h

This header file includes the options for the Cmicro target. All option are set by #define XMK... directives.

The ml_mcf.h file is the manual configuration file and the sdl_cfg.h the automatic configuration file for the Cmicro Kernel

sdtmt.opt

This is an option file for the Cmicro Tester. This settings are made in the host section of the Cmicro Bodybuilder.

Environment Functions (env.c)

In this section you will learn how to fill in the environment functions in env.c.

In the example system calcul you send the signals

to the system.

And you receive the signals

from the system.

Caution! 

When using the file env.c it is allowed to edit only between the lines

    /* BEGIN User Code */

    /*   END User Code */

When the Bodybuilder is started for the second time, it will create a new file env.c (e.g. when creating new signals in the system or other changes), if you select Generate "env.c". Only the lines between these labels are unchanged by the Bodybuilder.

Do not remove, modify or insert any lines with the text

    /* BEGIN User Code */

    /*   END User Code */

Sending Signals into the SDL System

The function xInEnv() will be polled by the Cmicro Kernel and asks the environment for events which causes the sending of environment signals.

Caution! 

As the environment is polled with every cycle of the Cmicro Kernel it is not allowed to use blocking functions here.

Blocking and Unblocking Functions


Example 7 : Using a blocking function      

You can see that the getchar() function blocks the kernel because it waits until someone presses a key on the keyboard. The Kernel stops and cannot receive or send any other signals, and cannot process the SDL system.

The right way is to use non-blocking functions. Example 8 is fitted to UNIX and Windows compilers. _GCC_ is the switch for the UNIX compiler and BORLAND_Cor MICROSOFT_C for a Windows compiler.


Example 8  : Using non-blocking function      

Signals with Parameters

Now you have to define the receiving process and fill up the parameters of your signals.

You will find a part in your env.c listing like this:


Example 9 : Sending a signal into the SDL system      

You have to change the text in the lines 02 and 15 and you have to insert code between line 06 and 08.

In the Calcul system you have to change (line 02)

into

This is the condition when you have to send the specific signal. Here you send only a value so you have to filter only numeric characters.

After that you have to adapt the signal parameters. So you have to insert

between line 07 and 08.

For instance, if you have defined a signal in your SDL system like this:

then you can reach the parameters via var.Param1, var.Param2 and var.Param3.

Hint: 

If you want to see the structure of your signal parameters, please view the file <systemname>.ifc.

Finally you have to modify line 15:

In this line the receiver process PID must be inserted. The symbolic name of the PID can be found in the file sdl_cfg.h.


Example 10 : sdl_cfg.h for system calcul      

The PID of the process alu is now defined as XPTID_alu. So you can modify the line 15 as follows:

Now the listing env.c is ready for sending the value message with parameters.

Sending Signals without Parameters

In this unit you have to modify a signal that does not include any parameters.

In the env.c file you will find code like this:


Example 11 : Sending a signal into the SDL system      

Here you have to modify only the line 02 into

and line 14 into

The same steps must be done for the signals sub, mult and div, where sub, mul and div are represented by the symbols `-', `*' and `/', respectively.

Receiving Signals from the System

In this section you will learn how to describe the behavior of the environment when the SDL system sends a signal.

Let us look at the env.c listing again. Please locate the code looking like this:


Example 12 : Sending a signal to the environment      

Between line 03 and 08 the behavior of the environment when receiving the signal result can be described.

You can get the data from the signal's parameters by using

This information can be found in line 04. Similar to when sending signals, other signal data can be reached by using Param2, Param3, and so on.

Now you can print the calculated result by inserting the following lines between lines 03 and 08:

The next step is to implement the behavior for the signal message. Find the place where the first three lines of Example 13 below appear in the env.c file and insert the remaining code at that position.


Example 13  : Sending signal message      

In Example 13 you can see your literals defined in the SDL system (e.g. the synonym command). These literals will be defined in the file <systemname>.ifc.

Initializing and Closing the Environment

In your target there is no need to initialize or to close the environment. In other cases, e.g. microprocessor set ports, timers and so on, you will be required to do so.

In the file env.c, find the part in the function xInitEnv() of the listing looking like this:


Example 14 : Section in xInitEnv()      

You can modify this part as follows. You insert only a message and disable the assignment.


Example 15 : Possible initialization of the environment      

The same procedure must be done when modifying the function xCloseEnv().

The System Without Cmicro Tester

In this section, all the things are described which have to be done when you are not using the Cmicro Tester.

Making of <systemname>.exe

You have to build your executable using a makefile.

Files Used in Windows

The following files are used (by different tools) while making the executable. It is assumed that you have copied the files from the make_bc or make_cl directory.

File Description
comp.opt

Definition of how to generate the makefile.

make.opt

This file is for the Borland or Microsoft C++ compiler (light integration) and includes compiler options, include paths and dependencies.

These files exist only to generate an executable for Windows. In other cases you have to create your own files, i.e. for target compilers.

Note: 

You have two versions of the make.opt file. One version still exist in the template directory and one is in the calcul example.

You need the template make.opt from the calcul example when you create your target executable. This file is already fitted for your target.

If you compile your system for a microcontroller, you have to modify the make.opt from the template directory.

More information about make.opt can be found in The Cmicro Library.

The first compile of the system will be done without the Cmicro Tester. Therefore the make tool must only include the files of the kernel directory of the Cmicro library.

Files Used on UNIX

The following file is used while making the executable on UNIX.

File Description
makeoptions

This file is fitted for UNIX compilers and includes compiler options, include paths and dependencies.

You can use the default setting compile without tester in the makeoptions file. This means you must not select the sctLINKKERNEL. You have to select the sctLDFLAGS for your host.

Starting Make

  1. Open the Organizer's Make dialog.
  2. Select Analyze & generate code.
  3. Set the target directory to <My_Cmicro_Project>\target.
  4. Select Generate Makefile and Compile & link.
  5. Set the kernel directory to <My_Cmicro_Project>\target.
  6. Start making with Full Make when all settings have been done.

In the calcul example the file calcul.m will be generated. Then the maketool of your compiler with the makefile below will be started.


Example 16 : The File calcul.m for the Borland maketool generated with SDT      

The make tool starts and generates an executable program. Now you can modify the system, compile and make the system again, and test the system without modifying make files or using other tools again.

Note: 

If you are adding environment signals you have to start the Bodybuilder because you must generate a new env.c file. After that you have to modify the environment function in env.c.

Execution of the System

You should see your created program waiting for an input of a value. Now you can test your system by simply sending signals via the keyboard (type values and the desired operator).

Debugging and Testing the System with the Cmicro Tester

You have the possibility to test and trace the target system with the Cmicro Tester. But before that, some things must be performed.

Prerequisites

The Cmicro Tester provides the option for a communications link via a V.24 interface. These options are available in the Bodybuilder.

However, the target is not running on a small embedded system (like an 8051); it runs on the host machine. Therefore, you have to create a gateway from your SDL system to the Cmicro Tester. All messages needed for debugging and tracing are sent to the Cmicro Postmaster who delivers the messages to the Cmicro Tester.

Therefore you have to compile the files dl.c and mpm_con.c

The file dl.c represents the physical layer. If you use another target system, you have to modify the file dl.c to include functions that are communicating with the serial interface or doing something else. The module mpm_con.c includes functions used by the module dl.c

Note: 

The Cmicro Tester was built for testing SDL systems on small embedded systems and not for host systems.

Configure the Target with the Bodybuilder

  1. Start the Bodybuilder.
  2. Select Use the Cmicro Postmaster in the Communications Link section of the Bodybuilder.
  3. Open Target > Tester in the Bodybuilder.

  4. Here you have to configure the Tester options. First you have to configure the Initialization options. You can select all options except the option Add connection to external environment. In the section Target > Tester > Trace you can select all options.

Configuring the Host with the Bodybuilder

The next step is to configure the host which is represented by the Cmicro Tester.

  1. Open Host > Gate Selection.
  2. You have to define where your gateway is placed. In the example calcul system the gateway is represented by the file calcul.exe or calcul. Insert the path to the gate <My_Cmicro_Projekt>\target\<systemname>.exe or <My_Cmicro_Projekt>/target/<systemname>.

  3. The Cmicro Tester does not know which target hardware your SDL system is running on. So you must describe in the host section of the Bodybuilder how the Cmicro Tester deals with the messages received from the target system.
  4. Open the Host > Message Coding in the Bodybuilder menu. You have to configure three sections.
  5. In the first section you must define the number of octets of each data type. For example, the host is a PC with an 80x86 processor. That means that the integer value needs 4 octets, or pointers needs 4 octets.
  6. The second section is for to configuring the alignment. This means defining how the processor maps the data types in the memory.
  7. The last section represents the endian configuration. This means for instance that a 4 byte integer (long)is mapped in the memory as low byte first, high byte last. Therefore you have to insert the integer 41 according to Example 17 below.

Hint: 

More information about message coding can be found in the Cmicro Tester's help. See Configuration Possibilities of Sdtmt (sdtmt.opt) for more information.


Example 17  : Message Coding in Windows      

Data type Length Alignment
Microsoft (Borland)
Endian

Character

1

8 (8)

1

Short

2

16 (8)

21

Integer

4

32 (8)

41

Long

4

32 (8)

41

Pointer

4

32 (8)

41

This table above shows the complete configuration for this example for an 80x86 Intel processor. The alignment differs for the Borland and Microsoft Compiler.      


Example 18 : Message Coding on UNIX      

Data type Length Alignment Endian

Character

1

8

1

Short

2

16

12

Integer

4

32

14

Long

4

32

14

Pointer

4

32

14

The table above shows the complete configuration for this example for a SPARC processor of a Sun workstation.


Making <systemname>.exe with the Cmicro Tester Extension

After configuring with the Bodybuilder you only have to modify the file make.opt (in Windows) or makeoptions (on UNIX) as follows.

  1. You have to set the sctLINKKERNEL to sctLINKTARGET_WITH_TESTER.
  2. Finally you use the Make dialog of the Organizer again to make an executable.

Execution with the Cmicro Tester

The Cmicro Tester requires an sdtmt.btn file. This file includes the configuration of the buttons.

  1. Copy this file from the directory
  2. (depending on your used platform) into your <My_Cmicro_Project>\target directory.

Hint: 

You can modify the sdtmt.btn file with an ASCII editor or add, modify and remove buttons directly in the Cmicro Tester.

  1. Start the Cmicro Tester. The Cmicro Tester tries to fork the gateway executable (calcul).

Figure 278 : Init phase of the Cmicro Tester

Extracted pic [7]

  1. Now you can start the gateway in the Communication group with the button Start Gateway.
  2. The target is ready for configuration and waits for the start signal from the Cmicro Tester. This can be done in the Execution group of the Cmicro Tester with Go Forever.

After this point the target is running and is ready to receive environment signals from the environment or the Cmicro Tester.

You can trace the target with the MSC or the SDL Editor to see your system at work (see also CmicroTester Commands).

Summary

Now you have learned how to build an executable using the tools of Telelogic Tau, Cmicro and your compiler.

Below are all the steps to build a system running on a target summarized.

  1. The first step is to build an SDL system. There are some SDL restrictions when using Cmicro; please see SDL Restrictions.
  2. Then you have to generate the system for Cmicro.

Note: 

If your target compiler is not listed in the manual (see List of Available C Compilers in ml_typ.h), you have to make some adaptations for the Cmicro Library, e.g. timer handling, make, startup, etc.

  1. Using the Cmicro Bodybuilder, you can scale the Cmicro Kernel to switch on features or to save memory.
  2. Then you have to adapt the environment.

Note: 

If you want to test your system without using the environment, you can turn it off with the Bodybuilder.

  1. After adding the environment you can compile your system.
  2. The last step is to test the system with or without the Cmicro Tester.

This is the way to get a running SDL system with the Cmicro Package.


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