Commit 53a8f51e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Merge branch 'rpi' into 'master'

Rpi

See merge request !61
parents 8688fe9f a3d9a20d
......@@ -2,7 +2,7 @@ all:
mkdir -p tmp
mkdir -p new-templates
# Extract the latest template tags from any demo project and put them in the new-templates folder
cd ../test/test-cv && kazoo --doc -o ../../doc/tmp --gw -g --glue && mv ../../doc/tmp/Dump/Doc/* ../../doc/new-templates
cd ../test/Demo_Distrib && kazoo --doc -o ../../doc/tmp --gw -g --glue && mv ../../doc/tmp/Dump/Doc/* ../../doc/new-templates
mkdir -p preprocess
cp templates/templates_from_wiki preprocess # copy the previous one
mv templates/templates_from_wiki templates/templates_from_wiki.old # delete the old templates
......
......@@ -7,6 +7,7 @@ templates/skeletons/sub/function.tmplt
templates/skeletons/sub/interface.tmplt
templates/skeletons/sub/makefile.tmplt
templates/concurrency_view/sub/trigger.tmplt
templates/concurrency_view/sub/bus.tmplt
templates/concurrency_view/sub/thread.tmplt
templates/concurrency_view/sub/pi.tmplt
templates/concurrency_view/sub/ri.tmplt
......
......@@ -18,6 +18,12 @@ This template is evaluated only once. The output is saved to the Makefile within
|Has_Context_Param
|↳ and flag to indicate if function has context parameters
|-
|Instance_Of
|↳ and the instance name or empty string
|-
|Is_Shared_Type
|↳ true if component is an instance of a function stored in the shared types folder
|-
|CP_Files
|List of all context parameters ASN.1 files
|-
......@@ -80,6 +86,12 @@ This template is evaluated only once. The output is saved to the Makefile within
|-
|Glue
|DOCUMENTATION MISSING
|-
|CPU_Platform
|DOCUMENTATION MISSING
|-
|Is_FPGA
|DOCUMENTATION MISSING
|}
=== templates/skeletons/context-parameters.tmplt ===
This template is evaluated for every function which has context parameters. The output is saved to the file Context-<function name>.asn
......@@ -112,7 +124,7 @@ This template is evaluated for every function which has context parameters. The
|DOCUMENTATION MISSING
|-
|Instance_Of
|DOCUMENTATION MISSING
|Name of instance or empty string
|}
=== templates/skeletons/sub/trigger.tmplt ===
This template is evaluated to trigger processing of other files from given directory.
......@@ -148,7 +160,7 @@ This template is identical for Skeleton and Glue subfolders.
|Value of command line flag --polyorb-hi-c (or -p)
|-
|List_Of_PIs
|DOCUMENTATION MISSING
|List of all provided interfaces (names only)
|-
|ASync_RI_Param_Type
|DOCUMENTATION MISSING
......@@ -607,6 +619,9 @@ The output of this template is saved to the file with name returned by processin
|-
|Shared_Lib_Dir
|Path to the shared component type folder
|-
|List_Of_PIs
|List of all provided interfaces (names only)
|}
=== templates/concurrency_view/sub/trigger.tmplt ===
This file is processed for every node. The result of this file indicates if the rest of templates for given node will be processed.
......@@ -680,6 +695,28 @@ This file is processed for every node. The result of this file indicates if the
|Is_Distributed
|True if the system contains at least one bus
|}
=== templates/concurrency_view/sub/bus.tmplt ===
This template is parsed for all busses referenced in system.tmplt
{| class="wikitable"
!Parameter name
!Description
|-
|Bus_Name
|Name of the bus
|-
|Classifier
|AADL Classifier for the bus
|-
|Property_Names
|AADL property names (vector tag)
|-
|Property_Values
|AADL property values
|-
|AADL_Package
|AADL package name containing the bus
|}
=== templates/concurrency_view/sub/thread.tmplt ===
This file is processed for every thread in every partition in every node.
{| class="wikitable"
......@@ -1007,7 +1044,7 @@ This template is evaluated for every block.
|Required interfaces (from ri.tmplt)
|-
|List_Of_PIs
|Complete list of provided interfaces
|List of all provided interfaces (names only)
|-
|List_Of_ASync_RIs
|Vector tag: name of asynchronous RIs
......@@ -1139,7 +1176,7 @@ This template is evaluated for every block.
|True if function is a function type
|-
|Instance_Of
|DOCUMENTATION MISSING
|Name of instance or empty string
|-
|Debug_Flag
|if -g is set in the command line
......@@ -1462,6 +1499,15 @@ This file is evaluated for every node. The result of this file is saved to the f
|-
|Glue
|DOCUMENTATION MISSING
|-
|Block_Instance_Of
|DOCUMENTATION MISSING
|-
|Block_Languages
|DOCUMENTATION MISSING
|-
|Block_Names
|DOCUMENTATION MISSING
|}
=== templates/concurrency_view/sub/system.tmplt ===
This file is evaluated for every node. The result of this file is save to the file with name returned by
......@@ -1477,7 +1523,10 @@ filesys.tmplt.
|Vector Tag of node names
|-
|Node_CPU
| -> Corresponding CPU name (eg x86_linux)
| &#8627; Corresponding CPU name (e.g. x86_linux)
|-
|Node_Platform
| &#8627; Corresponding platform (e.g. PLATFORM_AIR)
|-
|Node_CPU_Classifier
| &#8627; Corresponding CPU Classifier (ocarina...::x86_linux)
......@@ -1530,6 +1579,9 @@ filesys.tmplt.
|Bus_Classifier
| &#8627; Corresponding AADL classifier
|-
|Bus_Properties
| &#8627; Corresponding AADL properties (from bus.tmplt)
|-
|Device_Node_Name
|
|-
......@@ -1645,4 +1697,7 @@ filesys.tmplt.
|-
|Used_Shared_Types
|List of actually used shared component types
|-
|Block_Languages
|DOCUMENTATION MISSING
|}
\ No newline at end of file
......@@ -21,8 +21,8 @@ This template is evaluated for every block.
| Required | Required interfaces (from |
| | ri.tmplt) |
+-----------------------------------+-----------------------------------+
| List_Of_PIs | Complete list of provided |
| | interfaces |
| List_Of_PIs | List of all provided interfaces |
| | (names only) |
+-----------------------------------+-----------------------------------+
| List_Of_ASync_RIs | Vector tag: name of asynchronous |
| | RIs |
......@@ -126,7 +126,7 @@ This template is evaluated for every block.
| Is_Type | True if function is a function |
| | type |
+-----------------------------------+-----------------------------------+
| Instance_Of | DOCUMENTATION MISSING |
| Instance_Of | Name of instance or empty string |
+-----------------------------------+-----------------------------------+
| Debug_Flag | if -g is set in the command line |
+-----------------------------------+-----------------------------------+
......
templates/concurrency_view/sub/bus.tmplt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This template is parsed for all busses referenced in system.tmplt
+-----------------+--------------------------------------+
| Parameter name | Description |
+=================+======================================+
| Bus_Name | Name of the bus |
+-----------------+--------------------------------------+
| Classifier | AADL Classifier for the bus |
+-----------------+--------------------------------------+
| Property_Names | AADL property names (vector tag) |
+-----------------+--------------------------------------+
| Property_Values | AADL property values |
+-----------------+--------------------------------------+
| AADL_Package | AADL package name containing the bus |
+-----------------+--------------------------------------+
......@@ -101,3 +101,9 @@ used as a parameter for system.tmplt.
+-----------------------------------+-----------------------------------+
| Glue | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
| Block_Instance_Of | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
| Block_Languages | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
| Block_Names | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
......@@ -11,9 +11,12 @@ to the file with name returned by filesys.tmplt.
+-----------------------------------+-----------------------------------+
| Node_Names | Vector Tag of node names |
+-----------------------------------+-----------------------------------+
| Node_CPU | -> Corresponding CPU name (eg |
| Node_CPU | Corresponding CPU name (e.g. |
| | x86_linux) |
+-----------------------------------+-----------------------------------+
| Node_Platform | ↳ Corresponding platform (e.g. |
| | PLATFORM_AIR) |
+-----------------------------------+-----------------------------------+
| Node_CPU_Classifier | ↳ Corresponding CPU Classifier |
| | (ocarina...::x86_linux) |
+-----------------------------------+-----------------------------------+
......@@ -61,6 +64,9 @@ to the file with name returned by filesys.tmplt.
+-----------------------------------+-----------------------------------+
| Bus_Classifier | ↳ Corresponding AADL classifier |
+-----------------------------------+-----------------------------------+
| Bus_Properties | ↳ Corresponding AADL properties |
| | (from bus.tmplt) |
+-----------------------------------+-----------------------------------+
| Device_Node_Name | |
+-----------------------------------+-----------------------------------+
| Device_Partition | |
......
......@@ -18,6 +18,12 @@ This template is evaluated only once. The output is saved to the Makefile within
|Has_Context_Param
|&#8627; and flag to indicate if function has context parameters
|-
|Instance_Of
|&#8627; and the instance name or empty string
|-
|Is_Shared_Type
|&#8627; true if component is an instance of a function stored in the shared types folder
|-
|CP_Files
|List of all context parameters ASN.1 files
|-
......@@ -80,6 +86,12 @@ This template is evaluated only once. The output is saved to the Makefile within
|-
|Glue
|DOCUMENTATION MISSING
|-
|CPU_Platform
|DOCUMENTATION MISSING
|-
|Is_FPGA
|DOCUMENTATION MISSING
|}
=== templates/skeletons/context-parameters.tmplt ===
This template is evaluated for every function which has context parameters. The output is saved to the file Context-<function name>.asn
......@@ -112,7 +124,7 @@ This template is evaluated for every function which has context parameters. The
|DOCUMENTATION MISSING
|-
|Instance_Of
|DOCUMENTATION MISSING
|Name of instance or empty string
|}
=== templates/skeletons/sub/trigger.tmplt ===
This template is evaluated to trigger processing of other files from given directory.
......@@ -148,7 +160,7 @@ This template is identical for Skeleton and Glue subfolders.
|Value of command line flag --polyorb-hi-c (or -p)
|-
|List_Of_PIs
|DOCUMENTATION MISSING
|List of all provided interfaces (names only)
|-
|ASync_RI_Param_Type
|DOCUMENTATION MISSING
......@@ -607,6 +619,9 @@ The output of this template is saved to the file with name returned by processin
|-
|Shared_Lib_Dir
|Path to the shared component type folder
|-
|List_Of_PIs
|List of all provided interfaces (names only)
|}
=== templates/concurrency_view/sub/trigger.tmplt ===
This file is processed for every node. The result of this file indicates if the rest of templates for given node will be processed.
......@@ -680,6 +695,28 @@ This file is processed for every node. The result of this file indicates if the
|Is_Distributed
|True if the system contains at least one bus
|}
=== templates/concurrency_view/sub/bus.tmplt ===
This template is parsed for all busses referenced in system.tmplt
{| class="wikitable"
!Parameter name
!Description
|-
|Bus_Name
|Name of the bus
|-
|Classifier
|AADL Classifier for the bus
|-
|Property_Names
|AADL property names (vector tag)
|-
|Property_Values
|AADL property values
|-
|AADL_Package
|AADL package name containing the bus
|}
=== templates/concurrency_view/sub/thread.tmplt ===
This file is processed for every thread in every partition in every node.
{| class="wikitable"
......@@ -1007,7 +1044,7 @@ This template is evaluated for every block.
|Required interfaces (from ri.tmplt)
|-
|List_Of_PIs
|Complete list of provided interfaces
|List of all provided interfaces (names only)
|-
|List_Of_ASync_RIs
|Vector tag: name of asynchronous RIs
......@@ -1139,7 +1176,7 @@ This template is evaluated for every block.
|True if function is a function type
|-
|Instance_Of
|DOCUMENTATION MISSING
|Name of instance or empty string
|-
|Debug_Flag
|if -g is set in the command line
......@@ -1462,6 +1499,15 @@ This file is evaluated for every node. The result of this file is saved to the f
|-
|Glue
|DOCUMENTATION MISSING
|-
|Block_Instance_Of
|DOCUMENTATION MISSING
|-
|Block_Languages
|DOCUMENTATION MISSING
|-
|Block_Names
|DOCUMENTATION MISSING
|}
=== templates/concurrency_view/sub/system.tmplt ===
This file is evaluated for every node. The result of this file is save to the file with name returned by
......@@ -1477,7 +1523,10 @@ filesys.tmplt.
|Vector Tag of node names
|-
|Node_CPU
| -> Corresponding CPU name (eg x86_linux)
| &#8627; Corresponding CPU name (e.g. x86_linux)
|-
|Node_Platform
| &#8627; Corresponding platform (e.g. PLATFORM_AIR)
|-
|Node_CPU_Classifier
| &#8627; Corresponding CPU Classifier (ocarina...::x86_linux)
......@@ -1530,6 +1579,9 @@ filesys.tmplt.
|Bus_Classifier
| &#8627; Corresponding AADL classifier
|-
|Bus_Properties
| &#8627; Corresponding AADL properties (from bus.tmplt)
|-
|Device_Node_Name
|
|-
......
......@@ -23,5 +23,5 @@ parameters. The output is saved to the file Context-.asn
+----------------+-----------------------------------------------------+
| Is_Type | DOCUMENTATION MISSING |
+----------------+-----------------------------------------------------+
| Instance_Of | DOCUMENTATION MISSING |
| Instance_Of | Name of instance or empty string |
+----------------+-----------------------------------------------------+
......@@ -19,6 +19,13 @@ Makefile within output directory.
| Has_Context_Param | ↳ and flag to indicate if |
| | function has context parameters |
+-----------------------------------+-----------------------------------+
| Instance_Of | ↳ and the instance name or empty |
| | string |
+-----------------------------------+-----------------------------------+
| Is_Shared_Type | ↳ true if component is an |
| | instance of a function stored in |
| | the shared types folder |
+-----------------------------------+-----------------------------------+
| CP_Files | List of all context parameters |
| | ASN.1 files |
+-----------------------------------+-----------------------------------+
......@@ -64,3 +71,7 @@ Makefile within output directory.
+-----------------------------------+-----------------------------------+
| Glue | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
| CPU_Platform | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
| Is_FPGA | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
......@@ -41,3 +41,6 @@ languagename]
| Shared_Lib_Dir | Path to the shared component type |
| | folder |
+-----------------------------------+-----------------------------------+
| List_Of_PIs | List of all provided interfaces |
| | (names only) |
+-----------------------------------+-----------------------------------+
......@@ -25,7 +25,7 @@ and Glue subfolders.
+-----------------------+---------------------------------------------------+
| Use_POHIC | Value of command line flag --polyorb-hi-c (or -p) |
+-----------------------+---------------------------------------------------+
| List_Of_PIs | DOCUMENTATION MISSING |
| List_Of_PIs | List of all provided interfaces (names only) |
+-----------------------+---------------------------------------------------+
| ASync_RI_Param_Type | DOCUMENTATION MISSING |
+-----------------------+---------------------------------------------------+
......
......@@ -24,7 +24,6 @@ begin
Model.Concurrency_View.Generate_CV;
end if;
Model.Generate_Build_Script;
Model.Generate_Code;
if Model.Configuration.Generate_Doc then
......
-- ************************ TASTE AADL Parser ************************** --
-- Based on Ocarina **************************************************** --
-- (c) 2019 Maxime Perrotin / European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- (c) 2019-2021 Maxime Perrotin / ESA - maxime.perrotin@esa.int
-- ********************************************************************* --
--
with System.Assertions,
Ada.Exceptions,
Ada.IO_Exceptions,
......@@ -20,10 +20,8 @@ with System.Assertions,
Ocarina.Configuration,
Ocarina.Files,
Ocarina.Parser,
-- Ocarina.FE_AADL.Parser,
Ocarina.Options,
TASTE.Backend,
TASTE.Backend.Build_Script,
TASTE.Backend.Code_Generators,
TASTE.Semantic_Check;
......@@ -37,7 +35,6 @@ use Ada.Text_IO,
Ocarina;
-- for the parsing of ConcurrencyView_Properties.aadl:
-- with ocarina.BE_AADL; use ocarina.BE_AADL;
with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Tree.Nutils;
use Ocarina.ME_AADL.AADL_Tree.Nodes;
......@@ -86,8 +83,6 @@ package body TASTE.AADL_Parser is
exception
when Ada.IO_Exceptions.Name_Error =>
Put_Error ("Shared library folder not found: " & Shared_Types);
-- raise AADL_Parser_Error
-- with "Shared library folder not found: " & Shared_Types;
end Find_Shared_Libraries;
procedure Parse_Set_Of_AADL_Files (Dest : in out Node_Id) is
......@@ -263,6 +258,7 @@ package body TASTE.AADL_Parser is
exception
when Error : System.Assertions.Assert_Failure =>
Put_Error ("Parsing error: " & Exception_Message (Error));
Errors.Display_Bug_Box (Error);
raise Quit_Taste;
when Error : AADL_Parser_Error
| Interface_Error
......@@ -352,9 +348,9 @@ package body TASTE.AADL_Parser is
Result : Ports.Map;
Visited_Functions : String_Sets.Set;
procedure Rec_Find_Thread (Ports_Map : in out Ports.Map;
Visited : in out String_Sets.Set;
Func : Taste_Terminal_Function) is
procedure Rec_Find_Thread (Ports_Map : in out Ports.Map;
Visited : in out String_Sets.Set;
Func : Taste_Terminal_Function) is
use String_Sets;
Current_Function : constant String_Sets.Set :=
String_Sets.To_Set (To_String (Func.Name));
......@@ -394,7 +390,13 @@ package body TASTE.AADL_Parser is
Remote_Thread_Name : constant Unbounded_String :=
To_Lower (To_String (Dist.Function_Name))
& "_" & Dist.Interface_Name;
Port_Name : constant Unbounded_String := RI.Name;
-- The port name cannot be RI.Name because that could
-- cause multiple ports with the same name if more than
-- one function connected through a chain of sync calls
-- have a RI of that name.
-- Port_Name : constant Unbounded_String := RI.Name;
Port_Name : constant Unbounded_String :=
Dist.Function_Name & "_" & RI.Name;
New_P : constant Thread_Port :=
(Name => Port_Name,
Remote_Thread => Remote_Thread_Name,
......@@ -641,7 +643,8 @@ package body TASTE.AADL_Parser is
Partition.Out_Ports.Insert
(Key => To_String (Out_Port.RI.Name),
New_Item => (Port_Name =>
Out_Port.RI.Name,
-- Out_Port.RI.Name,
Out_Port.Name,
Connected_Threads =>
String_Vectors.Empty_Vector
& To_String (T.Name),
......@@ -732,11 +735,6 @@ package body TASTE.AADL_Parser is
raise Quit_Taste;
end Dump;
procedure Generate_Build_Script (Model : TASTE_Model) is
begin
TASTE.Backend.Build_Script.Generate (Model);
end Generate_Build_Script;
procedure Generate_Code (Model : TASTE_Model) is
begin
TASTE.Backend.Code_Generators.Generate (Model);
......
......@@ -64,7 +64,6 @@ package TASTE.AADL_Parser is
return Option_Partition.Option;
procedure Dump (Model : TASTE_Model);
procedure Generate_Build_Script (Model : TASTE_Model);
procedure Generate_Code (Model : TASTE_Model);
private
......
with Text_IO,
Ada.Exceptions,
Ada.Directories,
Templates_Parser,
TASTE.Parser_Utils;
use Text_IO,
Ada.Exceptions,
Ada.Directories,
Templates_Parser,
TASTE.Parser_Utils;
package body TASTE.Backend.Build_Script is
procedure Generate (Model : TASTE_Model) is
Prefix : constant String :=
Model.Configuration.Binary_Path.Element & "templates/";
begin
Put_Info ("Generating legacy build-script.sh");
declare
Template_Data : constant Translate_Set :=
+Assoc ("Interface_View_Path",
Model.Configuration.Interface_View.Element)
& Assoc ("Output_Path", Model.Configuration.Output_Dir.Element);
Result : constant String := Parse (Prefix & "build-script.tmplt",
Template_Data);
Output_Path : constant String :=
Model.Configuration.Output_Dir.Element;
Filename : constant String := Output_Path & "/build-script.sh";
Output : File_Type;
begin
Create_Path (Output_Path);
Create (File => Output, Mode => Out_File, Name => Filename);
Put_Line (Output, Result);
Close (Output);
exception
when E : others =>
if Is_Open (Output) then
Close (Output);
end if;
raise Backend_Error with "Generation of build script failed: "
& Exception_Message (E);
end;
end Generate;
end TASTE.Backend.Build_Script;
with TASTE.AADL_Parser;
use TASTE.AADL_Parser;
package TASTE.Backend.Build_Script is
-- The generation of the build script is there for legacy purpose only
-- It is deprecated and only ensures backward compatibility with
-- Buildsupport/Orchestrator build habits.
-- Kazoo generates a Makefile in place of this build script.
procedure Generate (Model : TASTE_Model);
end TASTE.Backend.Build_Script;
......@@ -68,6 +68,7 @@ package body TASTE.Backend.Code_Generators is
end Get_ACN_File_List;
-- Generate a global Makefile (processing all functions)
-- and a global project file (.pro) for Space Creator
procedure Generate_Global_Makefile is
package Languages_Set is new Ordered_Sets (Unbounded_String);
use Languages_Set;
......@@ -78,22 +79,33 @@ package body TASTE.Backend.Code_Generators is
Language_Tag,
Has_Context_Param_Tag,
Is_Type_Tag,
Is_Shared_Type_Tag,
Instance_Of_Tag,
Is_FPGA_Tag,
CPU_Platform_Tag : Vector_Tag;
Content_Set : Translate_Set;
Tmplt : constant String := Prefix_Skeletons
Tmplt1 : constant String := Prefix_Skeletons
& "makefile.tmplt";
Tmplt2 : constant String := Prefix_Skeletons
& "project_file.tmplt";
begin
if not Exists (Tmplt) then
raise ACG_Error with "Missing makefile.tmplt";
if not Exists (Tmplt1) or not Exists (Tmplt2) then
raise ACG_Error with "Missing " & Tmplt1 & " or " & Tmplt2;
end if;
for Each of Model.Interface_View.Flat_Functions loop
Languages := Languages or To_Set (US (Language_Spelling (Each)));
Functions_Tag := Functions_Tag & Each.Name;
Language_Tag := Language_Tag & Language_Spelling (Each);
Is_Type_Tag := Is_Type_Tag & Each.Is_Type;
Functions_Tag := Functions_Tag & Each.Name;
Language_Tag := Language_Tag & Language_Spelling (Each);
Is_Type_Tag := Is_Type_Tag & Each.Is_Type;
Instance_Of_Tag :=
Instance_Of_Tag & Each.Instance_Of.Value_Or (US (""));
Has_Context_Param_Tag := Has_Context_Param_Tag
& (not Each.Context_Params.Is_Empty);
-- Determine if the function type is in the shared folder
Is_Shared_Type_Tag := Is_Shared_Type_Tag
& (Each.Instance_Of.Has_Value and then not
Model.Interface_View.Flat_Functions.Contains
(To_String (Each.Instance_Of.Unsafe_Just)));