Difference between pages "TASTE Step by step tutorial" and "TASTE Communication Device"

From TASTE
(Difference between pages)
Jump to: navigation, search
(Hello World)
 
 
Line 1: Line 1:
= Introduction =
+
== Introduction ==
 +
CommunicationDevice (CD) is a new type of TASTE project, that allows to model low level system drivers and integrate CD driver with existing or new TASTE project. It comes with two pre-defined templates: Broker and Broker + Packetizer. Depending on a selected template CD allows to model either Broker or Broker and Packetizer communication components. CommunicationDevice is a part of the SpaceCreator and Kazoo projects.
  
This tutorial explains how to quickly build a system using [https://taste.tools/ TASTE].
+
== Capabilities ==
 +
The following functionalities are supported:
 +
* creation of new CD project from QTC wizard – SpaceCreator
 +
* modeling and implementation of broker and packetizer
 +
* CD code generation done be Kazoo templates
 +
* integration with full TASTE project
  
Make sure you have either installed the TASTE Virtual machine : https://download.tuxfamily.org/taste/TASTE-VM-10-64bit.ova
+
==How to create CD project==
 +
Communication device project can be created form QT Creator wizard that can be opened with TASTE command. Then under File->New File or Project (Ctrl + N)
 +
[[File:Cd_wizard_2.png]]
  
...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
+
Non-Qt Project -> Communication Device Project
  
= Important =
+
[[File:Cd wizard 1.png]]
  
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
+
CD wizard starts with “Project Location” tab. User shall provide Name for the project and path under which project will be created.
  $ ./Update-TASTE.sh
 
  
When it is done, close the current window and open a new terminal.
+
[[File:Cd_wizard_3.png]]
  
= Hello World =
+
Next tab “Project Initialization” provides capabilities of selecting interface view template and CD board. Under IV template either “Broker” or “Broker_Packetizer” can be selected. Under Communication Device board either “x86 Linux CPP” or “SAM V71 FreeRTOS N7S” can be selected.
  
This tutorial explains how to create a basic system to get familiar with the tool.
+
[[File:Cd_wizard_4.png]]
  
== Create a new project ==
+
Next tab is standard “Kit Selection” tab.
  
Run the following command:
+
[[File:Cd_wizard_5.png]]
  
  $ taste
+
Under last tab that is “Project Management” version control can be added. Also wizard displays all files that will be added to Communication Device project.
  
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.
+
[[File:Cd_wizard_6.png]]
  
The Space Creator editor will show up:
+
===Generated CD project files details===
 +
Communication Device Project wizard adds the following files to the project:
 +
{| class="wikitable"
 +
|-
 +
| --acn-filepath-prefix <prefix>
 +
| <prefix> to add at the beginning of the ACN output filepath
 +
|-
 +
| --asn1-filepath-prefix <prefix>
 +
| <prefix> to add at the beginning of the ASN.1 output filepath
 +
|}
  
:[[File:ClipCapIt-221116-133346.PNG|1000px]]
+
{| class="wikitable"
 +
|-
 +
|--taste.pro – empty taste.pro file that will be automatically generated during build
 +
|-
 +
|-- Makefile – entry build and clean procedure that includes Kazoo and SC dependencies definitions
 +
|-
 +
|-- deploymentvew.dv.xml – predefined deploymentview.dv.xml that includes CD build partition
 +
|-
 +
|*--interfaceview.xml – interfaceview with Broker, Packetizer and interfaces. In this file user shall model Broker or Broker and Packetizer (depending on a template) along with required and provided components interfaces.
 +
|-
 +
|-- <project name>.acn – ACN project model for custom binary encoding rules.
 +
|-
 +
|-- <project name>.asn – ASN non user-editable model that contains all the basic data types.
 +
|-
 +
|-- <project name>.pro/shared – QTC project files with custom user build settings.
 +
|-
 +
|-- <project name>configuration.acn - ACN project configuration model for custom binary encoding rules.
 +
|-
 +
|-- <project name>configuration.asn - ASN user-editable model that contains definition of Driver Configuration. This file will be used by ocarina-components.aadl and Board1.xml and shall be implemented by the user.
 +
|-
 +
|--<project name>privatedata.acn - ACN project privatedata model for custom binary encoding rules.
 +
|-
 +
|-- <project name>privatedata.asn - ASN user-editable model that contains definition of Private Data structure. This type shall be used in main.c[pp] to indicate the type of the variable that is passed as a private pointer to the driver. Shall be implemented by the user.
 +
|}
  
== Build the system logical architecture ==
+
==Exemplary CD broker and packetizer modeling and implementation==
 +
Based on selected CD “Interface view template” either broker or broker and packetizer can be modeled and implemented. In this example second template will be used.
  
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:
+
===CD IV file specifics – fixed system elements===
 +
After opening IV file in the editor user can find (depending on selected template) Broker and Packetizer components. These are virtual components that are not taken for final code generation. Purpose of those elements is to provide “must have” set of interfaces. Those are required to match newly created and modeled communication components to existing in TASTE runtime calls.
  
:[[File:ClipCapIt-221116-133603.PNG]]
+
[[File:Cd_broker_pack_iv_1.png|1100px]]
  
Choose "Function", and rename the box:
+
User can’t remove those element neither the interfaces and will be informed about that while trying to do so.
  
:[[File:ClipCapIt-221116-133927.PNG]]
+
[[File:Cd_broker_pack_iv_2.png]]
  
Create a second function next to it.
+
===Modeling Packetizer component===
 +
While modeling Packetizer user shall provide a TASTE function that implements needed interfaces and connect that function to pre-defined virtual Packetizer component. Also each interface shall contain set of input and output parameters. The easiest way to do so is by dragging each interface from virtual Packetizer with left Ctrl key pressed and drop it on custom function. This way each interface will be copied along with set of parameters.
  
Then keep the Ctrl key and the left mouse button clicked to draw a line between the two functions:
+
[[File:Cd_broker_pack_iv_3.png|1100px]]
  
:[[File:ClipCapIt-221116-134009.PNG]]
 
  
When you release the mouse button, a connection will appear and a dialog will let you name this connection:
+
[[File:Cd_pack_params_1.png|t300px]]
 +
[[File:Cd_pack_params_2.png|500px]]
  
 +
To avoid build errors another function can be connected to Broker and it’s implementation is not required.
  
:[[File:ClipCapIt-221116-134200.PNG]]
+
===Implementation of Packetizer component===
 +
At this point CD project is able to generate source code for MyPacketizer function that can be extended with user implementation. Screens below presents empty mypacketizer.c/h files.
  
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:
+
[[File:Cd_mypack_code_2.png|t300px]]
 +
[[File:Cd_mypack_code_1.png|400px]]
  
:[[File:ClipCapIt-221116-134541.PNG]]
+
For this example simple implementations of “Packetize” and “Depacketize” functions will be implemented and Init function will not be used. Screens bellow presents exemplary implementation of those functions.
  
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-221116-134816.PNG]]
+
[[File:Cd_mypack_code_6.png|t300px]]
 +
[[File:Cd_mypack_code_5.png|400px]]
  
In the dialog, name it ("trigger", choose "Periodic" for the kind attribute, and leave the period to 1000 ms:
+
Communication Device project with packetizer component implementation is ready to be integrated wit full TASTE project. See another chapters to follow TASTE project integration.
 
 
:[[File: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:
 
 
 
:[[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.
 
 
 
== 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):
 
 
 
:[[File: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:
 
 
 
:[[File:ClipCapIt-221116-140250.PNG]]
 
 
 
Edit the code at will. The IDE provides auto-completion and on-the-fly syntax and semantic checks:
 
 
 
:[[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).
 
 
 
Right-click on Caller and choose "Edit Implementation". This will open the SDL editor (OpenGEODE).
 
 
 
:[[File: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.
 
 
 
:[[File: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:
 
 
 
:[[File: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:
 
 
 
:[[File:ClipCapIt-221116-142131.PNG]]
 
 
 
 
 
After a few seconds of build, you will see the system run in a console:
 
 
 
:[[File: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:
 
 
 
:[[File: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"
 
 
 
:[[File:ClipCapIt-221116-143200.PNG]]
 
 
 
In the dialog select "Deployment View file":
 
 
 
:[[File:ClipCapIt-221116-143234.PNG]]
 
 
 
 
 
Then on the next screen you may rename it, but keep the ".dv.xml" file extension:
 
 
 
:[[File:ClipCapIt-221116-143320.PNG]]
 
 
 
This will open a new editor, from which you can drag and drop deployment boards. Select for example this one:
 
 
 
:[[File: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:
 
 
 
:[[File: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.
 

Revision as of 17:47, 29 November 2022

Introduction

CommunicationDevice (CD) is a new type of TASTE project, that allows to model low level system drivers and integrate CD driver with existing or new TASTE project. It comes with two pre-defined templates: Broker and Broker + Packetizer. Depending on a selected template CD allows to model either Broker or Broker and Packetizer communication components. CommunicationDevice is a part of the SpaceCreator and Kazoo projects.

Capabilities

The following functionalities are supported:

  • creation of new CD project from QTC wizard – SpaceCreator
  • modeling and implementation of broker and packetizer
  • CD code generation done be Kazoo templates
  • integration with full TASTE project

How to create CD project

Communication device project can be created form QT Creator wizard that can be opened with TASTE command. Then under File->New File or Project (Ctrl + N) Cd wizard 2.png


Non-Qt Project -> Communication Device Project

Cd wizard 1.png


CD wizard starts with “Project Location” tab. User shall provide Name for the project and path under which project will be created.

Cd wizard 3.png

Next tab “Project Initialization” provides capabilities of selecting interface view template and CD board. Under IV template either “Broker” or “Broker_Packetizer” can be selected. Under Communication Device board either “x86 Linux CPP” or “SAM V71 FreeRTOS N7S” can be selected.

Cd wizard 4.png

Next tab is standard “Kit Selection” tab.

Cd wizard 5.png

Under last tab that is “Project Management” version control can be added. Also wizard displays all files that will be added to Communication Device project.

Cd wizard 6.png

Generated CD project files details

Communication Device Project wizard adds the following files to the project:

--acn-filepath-prefix <prefix> <prefix> to add at the beginning of the ACN output filepath
--asn1-filepath-prefix <prefix> <prefix> to add at the beginning of the ASN.1 output filepath
*--interfaceview.xml – interfaceview with Broker, Packetizer and interfaces. In this file user shall model Broker or Broker and Packetizer (depending on a template) along with required and provided components interfaces.

Exemplary CD broker and packetizer modeling and implementation

Based on selected CD “Interface view template” either broker or broker and packetizer can be modeled and implemented. In this example second template will be used.

CD IV file specifics – fixed system elements

After opening IV file in the editor user can find (depending on selected template) Broker and Packetizer components. These are virtual components that are not taken for final code generation. Purpose of those elements is to provide “must have” set of interfaces. Those are required to match newly created and modeled communication components to existing in TASTE runtime calls.

Cd broker pack iv 1.png

User can’t remove those element neither the interfaces and will be informed about that while trying to do so.

Cd broker pack iv 2.png

Modeling Packetizer component

While modeling Packetizer user shall provide a TASTE function that implements needed interfaces and connect that function to pre-defined virtual Packetizer component. Also each interface shall contain set of input and output parameters. The easiest way to do so is by dragging each interface from virtual Packetizer with left Ctrl key pressed and drop it on custom function. This way each interface will be copied along with set of parameters.

Cd broker pack iv 3.png


t300px Cd pack params 2.png

To avoid build errors another function can be connected to Broker and it’s implementation is not required.

Implementation of Packetizer component

At this point CD project is able to generate source code for MyPacketizer function that can be extended with user implementation. Screens below presents empty mypacketizer.c/h files.


t300px Cd mypack code 1.png

For this example simple implementations of “Packetize” and “Depacketize” functions will be implemented and Init function will not be used. Screens bellow presents exemplary implementation of those functions.


t300px Cd mypack code 5.png

Communication Device project with packetizer component implementation is ready to be integrated wit full TASTE project. See another chapters to follow TASTE project integration.