Difference between pages "Detailed SDL tutorial" and "TASTE Step by step tutorial"

From TASTE
(Difference between pages)
Jump to: navigation, search
(Continuous signals)
 
(Hello World)
 
Line 1: Line 1:
= OpenGEODE - SDL tutorial =
 
 
Author: Maxime Perrotin
 
 
contact: maxime (dot) perrotin (at) esa.int
 
 
 
= Introduction =
 
= Introduction =
  
SDL is a rich language and the complete specifications are available on the ITU-T website : https://www.itu.int/rec/T-REC-Z.100
+
This tutorial explains how to quickly build a system using [https://taste.tools/ TASTE].
 
 
There are several major revisions of the language:
 
 
 
* SDL88 - the first public version
 
* SDL92 - major update adding object orientation
 
* SDL96 - minor update fixing issues of SDL92
 
* SDL2000 - major update introducing new concepts (agents, exceptions, parallel and nested states)
 
* SDL2010 - the baseline of the current version (latest version is from 2019)
 
 
 
Check https://www.sdl-forum.org for more information.
 
 
 
OpenGEODE supports a subset of the last version of the standard. In this page we list the features of this subset and explain how to use them.
 
 
 
 
 
= SDL concepts overview =
 
 
 
These are the main symbols used in a SDL state machine:
 
 
 
:[[File:ClipCapIt-210118-092814.PNG]]
 
 
 
State machines in SDL look like flow diagrams and are read vertically. This is a typical SDL transition diagram:
 
 
 
:[[File:ClipCapIt-210118-094530.PNG]]
 
 
 
 
 
We will now go in the details of each symbol.
 
 
 
 
 
== Start symbol ==
 
 
 
There are three places in a SDL model where a START symbol can be used:
 
 
 
1. At the state machine root diagram: It is mandatory here. A state machine has exactly one start transition.
 
 
 
:[[File:ClipCapIt-210118-094606.PNG]]
 
 
 
 
 
The start transition is executed at process creation
 
 
 
The start transition
 
 
 
- Sets the initial state
 
- May execute initial actions
 
(initialization of variables)
 
 
 
 
 
2. Inside procedures. The start symbol has a slightly different shape, and is triggered when the procedure is called:
 
 
 
:[[File:ClipCapIt-210118-095047.PNG]]
 
 
 
 
 
3. Inside nested states
 
 
 
There can be more than one Start transition in a nested state. In that case they must be given a name.
 
 
 
:[[File:ClipCapIt-210118-095310.PNG]]
 
 
 
 
 
The selection of the nested state start transition is done one level above, when entering the nested state, using the '''via''' syntax:
 
 
 
:[[File:ClipCapIt-210118-095516.PNG]]
 
 
 
 
 
== State / Nextstate ==
 
 
 
:[[File:ClipCapIt-210118-095659.PNG]]
 
 
 
* Each state has a name
 
* In a given state, the process is expecting to receive messages
 
* A state can be composite
 
 
 
Note the following shortcut that allow to save diagram space:
 
 
 
:[[File:ClipCapIt-210118-095756.PNG]]
 
 
 
A new state is usually reached at the end of a transition:
 
 
 
:[[File:ClipCapIt-210118-100008.PNG]]
 
 
 
A shortcut is the history state, that returns to the most recent state. This is particularly useful when combined with the state shortcuts:
 
 
 
:[[File:ClipCapIt-210118-095908.PNG]]
 
 
 
If the most recent state was a nested state, re-entering the nested state means going through its startup transition and possibly executing its entry procedure.
 
 
 
It is also possible to enter a nested state via one of its internal startup transition, as seen above using the '''via''' syntax.
 
 
 
When a state is an aggregation (i.e. containing parallel states) it is possible to consume a transition at the parent level and return to the parallel states in the same state they were before the transition. This is called "history dash", and is achieved using the identifier '''-*''' in the next state symbol:
 
 
 
:[[File:ClipCapIt-210625-143721.PNG]]
 
 
 
== Input ==
 
 
 
:[[File:ClipCapIt-210118-100242.PNG]]
 
 
 
* Fires a transition : the transition is executed when the process consumes the signal
 
 
 
* In a given state, the process can expect several signals
 
 
 
* May have parameters (use variables to store their values)
 
 
 
The following shortcuts are available:
 
 
 
:[[File:ClipCapIt-210118-100336.PNG]]
 
 
 
* Inputs at level N have priority over inputs at level N-1 (composite states)
 
* As a consequence, be careful with « asterisk » inputs : if the state is composite, all inner inputs are ignored.
 
 
 
== Continuous signals ==
 
 
 
Continuous signals are spontaneous transitions that trigger when no input signal is present (standard input always have priority). They are boolean expressions:
 
 
 
:[[File:ClipCapIt-210118-110747.PNG]]
 
 
 
These can be used to perform background tasks, that will be interrupted as soon as a message is received.
 
 
 
Continuous signal should be mutually exclusive otherwise there is a case of non-determinism and the order of evaluation is not guaranteed (do not assume they are evaluated from left to right).
 
 
 
It is possible to use a priority to express the order of evaluation:
 
 
 
:[[File:ClipCapIt-220217-204043.PNG]]
 
 
 
This will be properly reflected if you generate the code:
 
 
 
:[[File:ClipCapIt-220217-204219.PNG]]
 
 
 
== Connection ==
 
 
 
A connection is a transition that is executed when leaving a nested state. It is named in the nested state itself using the exit symbol, like this:
 
 
 
:[[File:ClipCapIt-210118-100713.PNG]]
 
 
 
 
 
The connection symbol, one level above, allows to trigger a corresponding transition when leaving the state:
 
 
 
:[[File:ClipCapIt-210118-100951.PNG]]
 
 
 
 
 
''Note''
 
  Nested states also contain optional '''entry''' and '''exit''' procedures, that are executed in addition to the start transition and to the connection transitions. See below for details.
 
 
 
== Output ==
 
 
 
:[[File:ClipCapIt-210118-101539.PNG]]
 
 
 
Transmission (sending) of a message, with or without a parameter.
 
 
 
NOTE: only one parameter is supported by TASTE.
 
 
 
== TASK ==
 
 
 
Tasks are elementary actions of a process transition.
 
They can be either informal:
 
 
 
:[[File:ClipCapIt-210118-101729.PNG]]
 
 
 
 
 
(use single quotes and free text)
 
 
 
Or formal:
 
 
 
:[[File:ClipCapIt-210118-101756.PNG]]
 
 
 
 
 
Formal tasks allow to assign values to variables and to execute '''for loops''' to iterate on arrays.
 
It is also possible the manipulate data with built-in operators (ternary, math, array concatenation, etc.).
 
The details are given on this page:
 
 
 
[[Technical topic: OpenGEODE - SDL Operators: How to work with data]]
 
 
 
== Procedure calls ==
 
 
 
Procedures can:
 
 
 
* have in and in/out parameters
 
* return a variable
 
* be defined locally or externally
 
 
 
The procedure call symbol is for calling procedures that do not return variables. Parameters, if any, are separated with commas.
 
 
 
:[[File:ClipCapIt-210118-103419.PNG]]
 
 
 
 
 
There are two special built-in procedures that can be called to write strings on screen: '''write''' and '''writeln'''.
 
They can take multiple parameters separated with commas, for example to display variables of basic types. For exmaple:
 
 
 
:[[File:ClipCapIt-210118-103741.PNG]]
 
 
 
 
 
Procedures that return a value must be called within a TASK symbol using this syntax:
 
 
 
:[[File:ClipCapIt-210118-104323.PNG]]
 
 
 
 
 
There are also built-in procedures for '''setting and resetting timers''': '''set_timer(time_in_ms, timer_name)''' and '''reset_timer(timer_name)'''.
 
 
 
== Decisions ==
 
 
 
Like tasks, decisions can be formal or informal. Informal decisions are useful when building the model, and can be made formal when ready.
 
 
 
Informal decision and their answers are expressed with single quotes:
 
 
 
:[[File:ClipCapIt-210118-104654.PNG]]
 
 
 
 
 
While formal decisions contain expressions:
 
 
 
:[[File:ClipCapIt-210118-104736.PNG]]
 
 
 
A decision can have more than two answers, and in that case the answers must be mutually exclusive. The last answer can be the special kewword '''else'''.
 
Decisions can be used to build graphical loops, when used together with join/labels:
 
 
 
:[[File:ClipCapIt-210118-105024.PNG]]
 
 
 
 
 
If the expression in the decision is an ENUMERATED variable, the decision answers can be the enumerants:
 
 
 
:[[File:ClipCapIt-210118-105232.PNG]]
 
 
 
 
 
If the expression is the built-in '''present''' operator for a CHOICE type variable, the answers are the possible elements of the union:
 
 
 
 
 
:[[File:ClipCapIt-210118-105425.PNG]]
 
 
 
 
 
There is a special decision in SDL called '''decision any''' that allows to trigger a branch randomly:
 
 
 
:[[File:ClipCapIt-210118-111213.PNG]]
 
 
 
It is also possible to group answers in convenient ways to limit the number of branches:
 
 
 
:[[File:ClipCapIt-210526-110915.PNG]]
 
 
 
:[[File:ClipCapIt-210526-111230.PNG]]
 
 
 
== Labels and branches ==
 
 
 
:[[File:ClipCapIt-210118-105459.PNG]]
 
 
 
Labels and branches allow re-routing and basic loops. They can be used to go to a next state from multiple points without repeating common pre-entry actions (as an alternative to a state '''entry''' procedure).
 
 
 
== Procedures ==
 
 
 
=== Overview ===
 
 
 
:[[File:ClipCapIt-210118-105708.PNG]]
 
 
 
 
 
Procedure are sequential sub-functions. They can have in and in/out parameters and optionally return a value.
 
They have visibility on the parent variables. They can contain local variables, but no internal state (yet standard SDL allows it).
 
 
 
:[[File:ClipCapIt-210118-105905.PNG]]
 
 
 
=== Declaration ===
 
 
 
The symbol for adding a procedure to the SDL model is the following:
 
 
 
:[[File:ClipCapIt-210401-142841.PNG]]
 
  
If the procedure has parameters, they must be declared inside the procedure in a text box with the following syntax:
+
Make sure you have either installed the TASTE Virtual machine : https://download.tuxfamily.org/taste/TASTE-VM-10-64bit.ova
  
:[[File:ClipCapIt-210401-143114.PNG]]
+
...or that you made a manual installation following the instructions here: [[Manual installation on a native platform]]
  
Procedures can have special attributes, in which case the declaration of the procedures have to be done in a text box at a higher level (not in the procedure itself).
+
If you use the VM, note that the username and password to login are taste / tastevm
  
=== External procedures ===
+
= Important =
  
A procedure can be declared '''external'''. This means that the definition of the procedure is not part of the model. When generating code that implies that the user (or TASTE) provides the code of the procedure and a symbol for the linker.
+
Always make sure you are using the latest version of the TASTE tools.
 +
From within the TASTE Virtual machine or your native installation, open a terminal and run the following commands:
  
:[[File:ClipCapIt-210401-143647.PNG]]
+
  $ cd tool-src
 +
  $ ./Update-TASTE.sh
  
=== Referenced procedure ===
+
When it is done, close the current window and open a new terminal.
  
A procedure can be declared at one place of the model, and implemented (with the graphical symbol) at another place. In that case the declaration must contain the keyword '''referenced'''.
+
= Hello World =
  
:[[File:ClipCapIt-210401-143813.PNG]]
+
This tutorial explains how to create a basic system to get familiar with the tool.
  
=== Exported procedures ===
+
== Create a new project ==
  
Exported procedures allow to implement the concept of '''remote procedure calls'''.
+
Run the following command:
When a procedure is declared as exported, it means that it can be called synchronously from the environment of the process without an explicit signal. When targeting the generation of code, this is very convenient for example to implement getters or setters that can run in the context of the calling thread and that do not require a pair of signals for sending back a value.
 
  
Exported procedures in SDL are declared like this:
+
  $ taste
  
:[[File:ClipCapIt-210401-144310.PNG]]
+
You will be prompted for a project name and a new folder with this name will be created. Always use the '''taste''' command to re-open an existing project.
  
They must then be implemented graphically and the procedure content must contain a text box with the same interface declaration:
+
The Space Creator editor will show up:
  
:[[File:ClipCapIt-210401-144432.PNG]]
+
:[[File:ClipCapIt-221116-133346.PNG|1000px]]
  
As you can see in this example the procedure has visibility on the parameters, but also on the containing process context (dataHasChanged is a variable declared at process level).
+
== Build the system logical architecture ==
  
After the execution of the exported procedure, the containing process will execute an optional transition with the same name as the procedure (but with no parameters). This allows to change the state of the state machine if needed. For example:
+
In the main window, draw a rectangle while pressing the mouse '''right button'''. When you release the mouse button, a contextual menu offers to create a function or a function type:
  
:[[File:ClipCapIt-210401-144924.PNG]]
+
:[[File:ClipCapIt-221116-133603.PNG]]
  
 +
Choose "Function", and rename the box:
  
This does not require a signal declaration, as it is implicit from the procedure declaration.
+
:[[File:ClipCapIt-221116-133927.PNG]]
  
If there is no transition defined, it is also possible to trigger a transition using continuous signals. For example:
+
Create a second function next to it.
  
:[[File:ClipCapIt-210401-145044.PNG]]
+
Then keep the Ctrl key and the left mouse button clicked to draw a line between the two functions:
  
== Composite states ==
+
:[[File:ClipCapIt-221116-134009.PNG]]
  
OpenGEODE supports both nested and parallel states. Double click on a state to create a nesting structure.
+
When you release the mouse button, a connection will appear and a dialog will let you name this connection:
  
:[[File:ClipCapIt-210118-105936.PNG]]
 
  
If the neseting structure only contain states but no start transitions, they are parallel states. Each of them must then be refined and have their start transitions.
+
:[[File:ClipCapIt-221116-134200.PNG]]
  
Parallel states can't consume the same signals (signal lists are disjoint).
+
You can select the "kind" of connection this is. It can be an asynchronous message ('''sporadic''') or a simple, immediate function call (e.g. '''unprotected''').
  
A nested state can have multiple entry and exit points, as well as an entry and exit procedures which are called automatically upon entering/leaving the nested state.
+
Add a connection in the other direction by using Ctrl+Left Click from the function on the right and releasing the keys when hovering on the left function. If you name it "Hi", it will look like this:
  
=== Nested state entry points ===
+
:[[File:ClipCapIt-221116-134541.PNG]]
  
Inside a nested state you can define multiple startup transitions. In that can they must be named:
+
Last, we will add a cyclic interface to the "caller" function. To do this, right click on the Caller function and choose the "Provided Interface" option from the menu entry:
  
:[[File:ClipCapIt-210325-091559.PNG]]
+
:[[File:ClipCapIt-221116-134816.PNG]]
  
From the state above, you can choose which startup transition you want to use, using the '''via''' clause:
+
In the dialog, name it ("trigger", choose "Periodic" for the kind attribute, and leave the period to 1000 ms:
  
:[[File:ClipCapIt-210325-091648.PNG]]
+
:[[File:ClipCapIt-221116-134925.PNG]]
  
 +
== Create data types ==
  
You can add an unnamed startup symbol for the default entry without a '''via''' clause.
+
TASTE software works with data, and relies on well defined data structures. They are captured with the ASN.1 language.
  
=== Nested state exit transitions ===
+
On the Workspace area of the editor you will see a file with the ".asn" extension. The file name itself is the name of your project. Double click on this file to open the editor. The default file contains a lot of built-in documentation to help you with the syntax of the language.
  
Similar to the the startup transition you can define named exit:
+
For this example we will create a type to store a simple counter with a range of values from 0 to 3:
  
:[[File:ClipCapIt-210325-091847.PNG]]
+
:[[File:ClipCapIt-221116-135538.PNG]]
  
 +
After this is done, go back to the main diagram by selecting the file named "interfaceview.xml". Note that you may also split the window in the IDE to view both files at the same time.
  
In the level above, use the CONNECT symbol :
+
== Select the implementation language of each function ==
  
:[[File:ClipCapIt-210325-092002.PNG]]
+
To create an implementation of the system, we have to select a language for each function (caller and callee). We will use C for the callee and SDL for the caller.
 +
To do this, double click on each function, and select the tab named "Implementations". Change the language accordingly (the default being SDL, there is no need to touch the caller function):
  
and specify the exit labels you defined inside the state:
+
:[[File:ClipCapIt-221116-135952.PNG]]
  
:[[File:ClipCapIt-210325-091951.PNG]]
 
  
=== entry and exit procedures ===
+
== Implement the functions ==
  
Inside a nested state you can define a procedure with the special names '''entry''' and '''exit'''
+
We start with the "callee" function. Right click on the function and select "Edit Implementation" from the contextual menu.
 +
After being prompted to save the model (do it), wait a few seconds to enter the C editor in the IDE:
  
:[[File:ClipCapIt-210325-092203.PNG]]
+
:[[File:ClipCapIt-221116-140250.PNG]]
  
These procedures will be called automatically when the state is entered or left, from all defined paths.
+
Edit the code at will. The IDE provides auto-completion and on-the-fly syntax and semantic checks:
  
== SDL Textual grammar ==
+
:[[File:ClipCapIt-221116-140500.PNG]]
  
 +
When you are done, go back to the main diagram editor (double click on "interfaceview.xml" in the workspace on the left).
  
SDL is both a graphical '''and''' a textual language. OpenGEODE's SDL grammar is defined here:
+
Right-click on Caller and choose "Edit Implementation". This will open the SDL editor (OpenGEODE).
  
https://github.com/esa/opengeode/blob/master/sdl92.g
+
:[[File:ClipCapIt-221116-140708.PNG]]
  
= SDL in the context of TASTE =
+
If you are not familiar with SDL, a complete documentation is built-in the tool (on the right).
 +
Double click on the Caller block to enter the state machine editor.
  
One important features of SDL is the possibility to describe a system made of components that communicate through messages. This description can be nested: a block can contain other blocks that eventually contain actual state machines.
+
You can create the state machine using the set of symbols on the left of the editor. In this example, when the periodic trigger is received, the "Hello" message will be sent (to the callee function), and then the "Hi" message will be expected in return. After a few cycles, we enter a state named "Enough" and stop repeating this polite exchange.
  
This is not directly supported by OpenGEODE because it is done in TASTE (graphically and textually) using the AADL language.
+
:[[File:ClipCapIt-221116-142433.PNG]]
  
'''The semantics are nearly similar''', with the following differences:
+
You may want to visualize this simple state machine with a "statechart" representation. Click on the corresponding tab on top of the editor:
  
1. '''SDL does not allow to specify a cyclic message in this view (periodic activation has to be done using timers inside state machines)'''
+
:[[File:ClipCapIt-221116-141927.PNG]]
  
However TASTE allows it in the Interface View:
+
You may now save the model and quit OpenGEODE, to get back to the main interface view.
  
:[[File:ClipCapIt-210118-083557.PNG]]
+
== Quick build and run ==
  
 +
At this stage you can already build the system. Click on the "Play" button on the bottom left corner of the tool:
  
In this example, the interface named "monitor" is cyclic. A period has to be specified for it.
+
:[[File:ClipCapIt-221116-142131.PNG]]
  
2. '''In regular SDL all messages are asynchronous'''. Direct function calls are possible between two state machines (remote procedure calls) but this communication is hidden from the diagram.
 
  
In TASTE, synchronous calls are expressed in the Interface View to expose the remote procedure calls from SDL to an external function.
+
After a few seconds of build, you will see the system run in a console:
  
:[[File:ClipCapIt-210118-084101.PNG]]
+
:[[File:ClipCapIt-221116-142547.PNG]]
  
Synchronous calls are immediately executed (blocking calls) and can be either protected (mutual exclusion between messages) or unprotected (executed immediately no matter what).
+
When you do Ctrl-C to stop the application you can visualize a log of the execution in a file that was generated and that appeared in the workspace:
  
TASTE supports synchronous interfaces:
+
:[[File:ClipCapIt-221116-142758.PNG]]
* Synchronous provided interfaces are implemented using the declaration of '''exported procedures'''.
 
* Synchronous required interfaces are implemented using the declaration of '''external procedures'''.  
 
  
Both constructs are part of the SDL standard.
+
== Create a deployment to run on target ==
  
 +
This quick build produced a Linux binary. But you may want to build on a different platform, for example a Leon processor with the RTEMS6 Qualified RTOS.
  
3. '''In SDL all active functions are state machines'''
+
To do this you need to model the deployment of your system. On the workspace, right-click on "Other files" and choose "Add new"
  
In TASTE it is possible to implement them in different languages: SDL, but also Simulink, C, C++, Ada, and even VHDL.
+
:[[File:ClipCapIt-221116-143200.PNG]]
TASTE generates the glue code between the functions.
 
  
4. '''In SDL, communication is done via messages''' (called signals) that are defined at system level. This means that a signal name is unique across the system.
+
In the dialog select "Deployment View file":
  
When sending a message, it is possible in SDL to specify the recipient in case several can receive the same signal name. Broadcast and multicast are also supported.
+
:[[File:ClipCapIt-221116-143234.PNG]]
  
In TASTE, the interfaces are defined at function level. Two functions can therefore have the same interface name but with different semantics (different parameters). It is possible to rename the interface at the sender side to avoid ambiguities.
 
  
While SDL offers the possibility to specify the recipient when sending a message (OUTPUT message TO sender) there are two things to consider:
+
Then on the next screen you may rename it, but keep the ".dv.xml" file extension:
  
a. the state machine's code has to be aware of the system it is connected to, making reuse more difficult in some cases
+
:[[File:ClipCapIt-221116-143320.PNG]]
  
b. other languages such as C or Ada do not offer such construct
+
This will open a new editor, from which you can drag and drop deployment boards. Select for example this one:
  
This is how the problem is addressed in TASTE:
+
:[[File:ClipCapIt-221116-143650.PNG]]
  
:[[File:ClipCapIt-210118-090408.PNG]]
+
When you right click on the board, you can bind the functions (caller and callee) to it.
  
5. '''SDL allows to specify multiple parameters associated to asynchronous signals'''.  
+
Save the project, and click again on the "Run" button. This time the binary will be created using the RTEMS Cross compiler for the GR740 board that you selected, and it will execute using a SPARC/Leon built-in emulator. The output should be the same as before:
  
In TASTE however, it is possible to have only one parameter in asynchronous interfaces (one signal = one message).
+
:[[File:ClipCapIt-221116-143903.PNG]]
Synchronous interfaces support multiple in or in/out signals and are supported by TASTE and OpenGEODE.
 
  
  
6. '''The SDL standard comes with two ways to describe data types: a legacy (yet very powerful) type system, and ASN.1
+
... except for the timings, as the Leon emulator does not reproduce the waiting periods correctly (the 1 second beween each trigger isn't right). If you download this binary on a real board however it should work as expected.
'''
 
TASTE only supports a very small subset of the legacy SDL type system, and relies on ASN.1 instead. ASN.1 is an international standard (ISO and ITU-T), supported by multiple tools and used in lots of applications. It is therefore recommended to use it instead of the built-in SDL syntax for data types.
 

Revision as of 13:40, 16 November 2022

Introduction

This tutorial explains how to quickly build a system using TASTE.

Make sure you have either installed the TASTE Virtual machine : https://download.tuxfamily.org/taste/TASTE-VM-10-64bit.ova

...or that you made a manual installation following the instructions here: Manual installation on a native platform

If you use the VM, note that the username and password to login are taste / tastevm

Important

Always make sure you are using the latest version of the TASTE tools. From within the TASTE Virtual machine or your native installation, open a terminal and run the following commands:

  $ cd tool-src
  $ ./Update-TASTE.sh

When it is done, close the current window and open a new terminal.

Hello World

This tutorial explains how to create a basic system to get familiar with the tool.

Create a new project

Run the following command:

  $ taste

You will be prompted for a project name and a new folder with this name will be created. Always use the taste command to re-open an existing project.

The Space Creator editor will show up:

ClipCapIt-221116-133346.PNG

Build the system logical architecture

In the main window, draw a rectangle while pressing the mouse right button. When you release the mouse button, a contextual menu offers to create a function or a function type:

ClipCapIt-221116-133603.PNG

Choose "Function", and rename the box:

ClipCapIt-221116-133927.PNG

Create a second function next to it.

Then keep the Ctrl key and the left mouse button clicked to draw a line between the two functions:

ClipCapIt-221116-134009.PNG

When you release the mouse button, a connection will appear and a dialog will let you name this connection:


ClipCapIt-221116-134200.PNG

You can select the "kind" of connection this is. It can be an asynchronous message (sporadic) or a simple, immediate function call (e.g. unprotected).

Add a connection in the other direction by using Ctrl+Left Click from the function on the right and releasing the keys when hovering on the left function. If you name it "Hi", it will look like this:

ClipCapIt-221116-134541.PNG

Last, we will add a cyclic interface to the "caller" function. To do this, right click on the Caller function and choose the "Provided Interface" option from the menu entry:

ClipCapIt-221116-134816.PNG

In the dialog, name it ("trigger", choose "Periodic" for the kind attribute, and leave the period to 1000 ms:

ClipCapIt-221116-134925.PNG

Create data types

TASTE software works with data, and relies on well defined data structures. They are captured with the ASN.1 language.

On the Workspace area of the editor you will see a file with the ".asn" extension. The file name itself is the name of your project. Double click on this file to open the editor. The default file contains a lot of built-in documentation to help you with the syntax of the language.

For this example we will create a type to store a simple counter with a range of values from 0 to 3:

ClipCapIt-221116-135538.PNG

After this is done, go back to the main diagram by selecting the file named "interfaceview.xml". Note that you may also split the window in the IDE to view both files at the same time.

Select the implementation language of each function

To create an implementation of the system, we have to select a language for each function (caller and callee). We will use C for the callee and SDL for the caller. To do this, double click on each function, and select the tab named "Implementations". Change the language accordingly (the default being SDL, there is no need to touch the caller function):

ClipCapIt-221116-135952.PNG


Implement the functions

We start with the "callee" function. Right click on the function and select "Edit Implementation" from the contextual menu. After being prompted to save the model (do it), wait a few seconds to enter the C editor in the IDE:

ClipCapIt-221116-140250.PNG

Edit the code at will. The IDE provides auto-completion and on-the-fly syntax and semantic checks:

ClipCapIt-221116-140500.PNG

When you are done, go back to the main diagram editor (double click on "interfaceview.xml" in the workspace on the left).

Right-click on Caller and choose "Edit Implementation". This will open the SDL editor (OpenGEODE).

ClipCapIt-221116-140708.PNG

If you are not familiar with SDL, a complete documentation is built-in the tool (on the right). Double click on the Caller block to enter the state machine editor.

You can create the state machine using the set of symbols on the left of the editor. In this example, when the periodic trigger is received, the "Hello" message will be sent (to the callee function), and then the "Hi" message will be expected in return. After a few cycles, we enter a state named "Enough" and stop repeating this polite exchange.

ClipCapIt-221116-142433.PNG

You may want to visualize this simple state machine with a "statechart" representation. Click on the corresponding tab on top of the editor:

ClipCapIt-221116-141927.PNG

You may now save the model and quit OpenGEODE, to get back to the main interface view.

Quick build and run

At this stage you can already build the system. Click on the "Play" button on the bottom left corner of the tool:

ClipCapIt-221116-142131.PNG


After a few seconds of build, you will see the system run in a console:

ClipCapIt-221116-142547.PNG

When you do Ctrl-C to stop the application you can visualize a log of the execution in a file that was generated and that appeared in the workspace:

ClipCapIt-221116-142758.PNG

Create a deployment to run on target

This quick build produced a Linux binary. But you may want to build on a different platform, for example a Leon processor with the RTEMS6 Qualified RTOS.

To do this you need to model the deployment of your system. On the workspace, right-click on "Other files" and choose "Add new"

ClipCapIt-221116-143200.PNG

In the dialog select "Deployment View file":

ClipCapIt-221116-143234.PNG


Then on the next screen you may rename it, but keep the ".dv.xml" file extension:

ClipCapIt-221116-143320.PNG

This will open a new editor, from which you can drag and drop deployment boards. Select for example this one:

ClipCapIt-221116-143650.PNG

When you right click on the board, you can bind the functions (caller and callee) to it.

Save the project, and click again on the "Run" button. This time the binary will be created using the RTEMS Cross compiler for the GR740 board that you selected, and it will execute using a SPARC/Leon built-in emulator. The output should be the same as before:

ClipCapIt-221116-143903.PNG


... except for the timings, as the Leon emulator does not reproduce the waiting periods correctly (the 1 second beween each trigger isn't right). If you download this binary on a real board however it should work as expected.