Real Time Developer Studio
Tutorial
Tutorial
Simulation options
Byte-code generation
The SDL simulator
Verifying the behavior
GUI editor
Simulation
Code generation options
Graphical debugging
Test case
Simulation against the SDL system
Introduction - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3
A simple system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5
SDL Tutorial - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6
Organization ............................................................................................................. 6
Requirements ............................................................................................................. 7
Design .................................................................................................................... 11
Simulating the system ............................................................................................... 24
24
24
27
35
Prototyping GUI ....................................................................................................... 37
37
42
Testing .................................................................................................................... 44
45
48
Code generation ...................................................................................................... 49
49
52
Conclusion .............................................................................................................. 57
SDL-RT Tutorial - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 58
Organization ........................................................................................................... 58
Requirements ........................................................................................................... 59
Design .................................................................................................................... 63
Running the system ................................................................................................... 81
82
84
88
97
Prototyping GUI ..................................................................................................... 100
100
104
Conclusion ............................................................................................................ 105
Automatic documentation generation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 107
Publications ........................................................................................................... 108
Documentation ...................................................................................................... 113
Automatic generation ............................................................................................. 117
Generation profile
Compilation errors
The SDL-RT debugger
Verifying the behavior
GUI editor
Simulation
Page 2
Real Time Developer Studio V4.3
Tutorial
1 - Introduction
Before starting this tutorial, it is important to understand the basic concepts used in Real
Time Developer Studio.These concepts derive from the two languages supported by
RTDS, SDL and SDL-RT:
• SDL stands for Specification and Description Language. SDL is a graphi-
cal, object-oriented, formal language defined by the International Telecommuni-
cation Union - Telecommunication Standardization Sector (ITU-T) as
recommendation Z100. The language is intended for the specification of com-
plex, event-driven, real-time and interactive applications involving many con-
current activities that communicate using discrete signals.
• SDL-RT stands for Specification and Description Language - Real Time.
It is a mix of SDL with another graphical language, UML, and of a textual lan-
guage, C. It retains the graphical abstraction brought by SDL while keeping the
precision of traditional techniques in real-time and embedded software develop-
ment and making simpler the re-use of legacy code by using natively the C lan-
guage. The object-orientation is also pushed a step further by using the UML
diagrams.
The underlying concepts of both languages are the same: the overall application to
develop is called the system. Anything that is outside the system is called the environ-
ment. The system itself is described via four complementary and consistent views:
• Architecture
A system can be decomposed in functional blocks. A block can be further
decomposed in sub-blocks and so on until the functionality of the final blocks are
simple enough. A block then fulfils its functionality with one or more proc-
esses, communicating with each other via messages (also called signals). A
process is basically a task and has an implicit message queue to receive messages
from other tasks. There is no need to define it. A block has no direct implementa-
tion in the final application; it is a matter of organizing and structuring the appli-
cation. Blocks and process are called agents.
system
block
process
process
block
process
state
msg
msg
state
state
• Communication
Agents exchange messages through channels. Messages going through chan-
nels are listed to define the interface between the agents. When it comes to final
Real Time Developer Studio V4.3
Page 3
Tutorial
code on the target, channels have no direct implementation; they are only used
for structuring the software and defining the interfaces.
• Behavior
A process behavior is described graphically as a finite state machine. Internal
process states, events (messages), decisions, timer manipulations, semaphore
manipulations have specific symbols briefly summarized below necessary to
understand the following tutorial:
Start
State
Input
Output
Plain C code
Decision
Start timer
Stop timer
Take semaphore
Give semaphore
y
l
n
o
T
R
-
L
D
S
Create task
Declarations
SDL or SDL-RT procedures can be called within the process behavior descrip-
tion. In SDL-RT, C functions can be called as well; SDL also allows the call of C
function via external operators.
• Data and syntax
This is where SDL and SDL-RT differ the most:
•
In SDL, data is defined via ADT (Abstract Data Types), using specific con-
cepts and notations. The data manipulation has also a specific syntax, derived
from languages such as Pascal.
In SDL-RT, the C language is used to define and manipulate data, making
things more familiar to developers…
•
Another SDL-RT specificity is the integration of UML use case and class diagrams for
less time-critical parts of the system. Objects can be associated to processes or blocks and
used in the behavioral parts of the processes.
In both SDL and SDL-RT projects, RTDS also integrates the Message Sequence Chart
dynamic view. On such a diagram, time flows from top to bottom. Lifelines represent
agents, semaphores or objects and key SDL-RT events are represented. The diagram
emphasizes the sequence in which the events occur.
Would you need any extra information on the diagrams and their meaning, the following
references may be used:
• For SDL, the SDL Forum web-site has many tutorials and presentations:
http://www.sdl-forum.org/
• For SDL-RT, the reference manual is available in RTDS via the Help / SDL-RT ref-
erence menu. This manual is also available on the SDL-RT web-site:
http://www.sdl-rt.org
Page 4
Real Time Developer Studio V4.3
Tutorial
2 - A simple system
The system we have chosen is simple enough to be written from scratch but rich enough
to pinpoint the basics of SDL-RT and SDL. It is a very basic phone system composed of a
central and of several phones. When the phones are created, the central gives them an
automatically computed phone number. When a user takes a phone to call another one,
the phone asks the central the id of the phone to be called identified by its phone number.
The caller sends directly a call request to the distant phone. For simplicity sake the dis-
tant phone automatically answers.
This tutorial is divided into two parts, depending on the language:
• The part using SDL starts page 6
• The part using SDL-RT starts page 58
And one part for the automatic documentation generation that is based on the SDL sys-
tem but that can be applied to the SDL-RT example.
If you do not want to design the example, you can find a complete project of this system
in the examples under "SDL/tutorial" and "SDL-RT/tutorial".
Real Time Developer Studio V4.3
Page 5
3 - SDL Tutorial
3.1 - Organization
Let’s get our hands on the tool ! Start Real Time Developer Studio. The window that
appears is called the Project manager:
Tutorial
The Project manager window
The project manager gathers all the files needed in the project. First let’s create a new
project with the New SDL project button:
Page 6
Real Time Developer Studio V4.3
Tutorial
The Project manager displays an empty project:
Let’s save it straight away as "phone" and put it in a dedicated directory:
An empty new project
Phone empty project
3.2 - Requirements
Let us express the requirements of our system with a Message Sequence Chart (MSC). To
add an MSC, select the project, and click on the right mouse button. A contextual menu
will appear:
Add components to the project
Real Time Developer Studio V4.3
Page 7
Select Add component and the following window will appear:
Tutorial
The add component window
Select MSC as a node type and click on the New button. Go to the directory where your
project is and type in "normal" with no extension. Click on save and you will get the fol-
lowing window:
Completed Add component window
Click Ok and the "normal" MSC appears in the "phone" project:
"normal" MSC in "phone" project
Page 8
Real Time Developer Studio V4.3