Commit bd9826ae authored by Filip Demski's avatar Filip Demski
Browse files

Merge branch 'feature_bullseye' into feature-samv71-templates

parents 88ec014f b5fc72f4
......@@ -944,7 +944,7 @@ The result of every evaluation is joined to one string and passed as a parameter
|The name of the interface
|-
|Kind
|The RCM Kind
|The RCM Kind (PROTECTED_OPERATION or UNPROTECTED_OPERATION).
|-
|Parent_Function
|The name of the function
......@@ -958,14 +958,14 @@ The result of every evaluation is joined to one string and passed as a parameter
|Param_Directions
| ↳ Corresponding direction
|-
|Is_Timer
|DOCUMENTATION MISSING
|-
|Param_Encodings
| ↳ Corresponding Encoding specification
|-
|Is_Timer
|DOCUMENTATION MISSING
|-
|Caller_Is_Local
|DOCUMENTATION MISSING
|False only if at least one caller is on a different node
|-
|IF_Property_Values
|DOCUMENTATION MISSING
......
......@@ -197,3 +197,5 @@ This file is evaluated for every partition.
+---------------------------+-----------------------------------------+
| Out_Port_Encoding_Name | DOCUMENTATION MISSING |
+---------------------------+-----------------------------------------+
| ASN1_Modules | DOCUMENTATION MISSING |
+---------------------------+-----------------------------------------+
......@@ -4,62 +4,64 @@ The template pi.tmplt is evaluated many times for every protected and
unprotected provided interface. The result of every evaluation is joined
to one string and passed as a parameter to block.tmplt
+------------------------+-----------------------------------------+
| Parameter name | Description |
+========================+=========================================+
| Name | The name of the interface |
+------------------------+-----------------------------------------+
| Kind | The RCM Kind |
+------------------------+-----------------------------------------+
| Parent_Function | The name of the function |
+------------------------+-----------------------------------------+
| Param_Names | List of parameter names |
+------------------------+-----------------------------------------+
| Param_Types | ↳ Corresponding parameter types |
+------------------------+-----------------------------------------+
| Param_Directions | ↳ Corresponding direction |
+------------------------+-----------------------------------------+
| Is_Timer | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Param_Encodings | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Caller_Is_Local | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| IF_Property_Values | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Queue_Size | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Language | Implementation language of the function |
+------------------------+-----------------------------------------+
| Protected_Block_Name | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Remote_Languages | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Param_ASN1_Modules | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Partition_Name | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Calling_Threads | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| IF_Property_Names | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Period | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Remote_Interface_Names | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| WCET | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Remote_Function_Names | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Param_Basic_Types | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Coord.Y | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| Coord.X | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| IF_Offset | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| IF_Priority | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
| IF_Stack_Size | DOCUMENTATION MISSING |
+------------------------+-----------------------------------------+
+------------------------+--------------------------------------------+
| Parameter name | Description |
+========================+============================================+
| Name | The name of the interface |
+------------------------+--------------------------------------------+
| Kind | The RCM Kind (PROTECTED_OPERATION or |
| | UNPROTECTED_OPERATION). |
+------------------------+--------------------------------------------+
| Parent_Function | The name of the function |
+------------------------+--------------------------------------------+
| Param_Names | List of parameter names |
+------------------------+--------------------------------------------+
| Param_Types | ↳ Corresponding parameter types |
+------------------------+--------------------------------------------+
| Param_Directions | ↳ Corresponding direction |
+------------------------+--------------------------------------------+
| Param_Encodings | ↳ Corresponding Encoding specification |
+------------------------+--------------------------------------------+
| Is_Timer | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Caller_Is_Local | False only if at least one caller is on a |
| | different node |
+------------------------+--------------------------------------------+
| IF_Property_Values | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Queue_Size | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Language | Implementation language of the function |
+------------------------+--------------------------------------------+
| Protected_Block_Name | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Remote_Languages | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Param_ASN1_Modules | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Partition_Name | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Calling_Threads | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| IF_Property_Names | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Period | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Remote_Interface_Names | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| WCET | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Remote_Function_Names | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Param_Basic_Types | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Coord.Y | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| Coord.X | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| IF_Offset | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| IF_Priority | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
| IF_Stack_Size | DOCUMENTATION MISSING |
+------------------------+--------------------------------------------+
......@@ -944,7 +944,7 @@ The result of every evaluation is joined to one string and passed as a parameter
|The name of the interface
|-
|Kind
|The RCM Kind
|The RCM Kind (PROTECTED_OPERATION or UNPROTECTED_OPERATION).
|-
|Parent_Function
|The name of the function
......@@ -958,14 +958,14 @@ The result of every evaluation is joined to one string and passed as a parameter
|Param_Directions
| ↳ Corresponding direction
|-
|Is_Timer
|DOCUMENTATION MISSING
|-
|Param_Encodings
| ↳ Corresponding Encoding specification
|-
|Is_Timer
|DOCUMENTATION MISSING
|-
|Caller_Is_Local
|DOCUMENTATION MISSING
|False only if at least one caller is on a different node
|-
|IF_Property_Values
|DOCUMENTATION MISSING
......@@ -1523,6 +1523,9 @@ This file is evaluated for every partition.
|-
|Out_Port_Encoding_Name
|DOCUMENTATION MISSING
|-
|ASN1_Modules
|DOCUMENTATION MISSING
|}
=== templates/concurrency_view/sub/node.tmplt ===
This file is evaluated for every node. The result of this file is saved to the file with name returned by filenode.tmplt. The result is also used as a parameter for system.tmplt.
......
......@@ -5,6 +5,7 @@
with Ada.Exceptions,
GNAT.OS_Lib,
GNAT.Traceback.Symbolic,
TASTE,
TASTE.AADL_Parser,
TASTE.Parser_Utils,
......@@ -29,7 +30,7 @@ begin
Model.Preprocessing;
Model.Add_Concurrency_View;
Model.Add_CV_Properties;
Model.Concurrency_View.Generate_CV;
Model.Generate_Concurrency_View;
end if;
Model.Generate_Code;
......@@ -44,6 +45,10 @@ exception
when TASTE.Quit_TASTE =>
GNAT.OS_Lib.OS_Exit (1);
when Error : others =>
Put_Error ("Ending application because of the following error:");
Put_Error (Ada.Exceptions.Exception_Message (Error));
Put_Debug (Ada.Exceptions.Exception_Information (Error));
Put_Debug ("Symbolic Traceback (use gdb for better output): "
& GNAT.Traceback.Symbolic.Symbolic_Traceback (Error));
GNAT.OS_Lib.OS_Exit (1);
end Kazoo;
......@@ -440,6 +440,7 @@ package body TASTE.AADL_Parser is
(Base_Template_Path => Model.Configuration.Binary_Path,
Base_Output_Path => Model.Configuration.Output_Dir,
Deployment => Model.Deployment_View.Element,
Data_View => Model.Data_View,
Configuration => Model.Configuration,
others => <>);
use String_Vectors;
......@@ -780,6 +781,16 @@ package body TASTE.AADL_Parser is
raise Quit_Taste;
end Generate_Code;
procedure Generate_Concurrency_View (Model : TASTE_Model) is
begin
Model.Concurrency_View.Generate_Code;
exception
when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error =>
Put_Error ("Concurrency View : "
& Ada.Exceptions.Exception_Message (Error));
raise Quit_Taste;
end Generate_Concurrency_View;
function Process_Function (F : in out Taste_Terminal_Function)
return Function_Maps.Map
is
......@@ -840,6 +851,14 @@ package body TASTE.AADL_Parser is
Timer_Manager.Provided.Insert (Key => Manager_Name,
New_Item => Tick_PI);
for Function_Name : String of Partition.Bound_Functions loop
if not Model.Interface_View.Flat_Functions.Contains
(Function_Name)
then
raise AADL_Parser_Error with
"Function """ & Function_Name
& """ is bound to a partition but is not found "
& "as terminal in the interface view";
end if;
for Timer_Name : String of
Model.Interface_View.Flat_Functions (Function_Name).Timers
loop
......
......@@ -33,8 +33,8 @@ package TASTE.AADL_Parser is
type TASTE_Model is tagged
record
Interface_View : Complete_Interface_View;
Deployment_View : Deployment_View_Holder;
Data_View : Taste_Data_View;
Deployment_View : aliased Deployment_View_Holder;
Data_View : aliased Taste_Data_View;
Concurrency_View : Taste_Concurrency_View;
Configuration : Taste_Configuration;
end record;
......@@ -68,6 +68,9 @@ package TASTE.AADL_Parser is
procedure Dump (Model : TASTE_Model);
procedure Generate_Code (Model : TASTE_Model);
-- Process Templates from the templates/concurrency_view subfolder
procedure Generate_Concurrency_View (Model : TASTE_Model);
private
procedure Build_TASTE_AST (Model : out TASTE_Model);
procedure Find_Shared_Libraries (Model : out TASTE_Model);
......
......@@ -39,38 +39,6 @@ package body TASTE.Backend.Code_Generators is
Prefix_Skeletons : constant String := Prefix & "skeletons/";
Prefix_Wrappers : constant String := Prefix & "glue/language_wrappers";
-- Return a Tag list of ASN.1 Modules for the headers
function Get_Module_List return Tag is
Result : Tag;
begin
for Each of Model.Data_View.ASN1_Files loop
for Module of Each.Modules loop
Result := Result & Module.Name;
end loop;
end loop;
return Result;
end Get_Module_List;
-- Return a Tag list of ASN.1 Files
function Get_ASN1_File_List return Tag is
Result : Tag;
begin
for Each of Model.Data_View.ASN1_Files loop
Result := Result & Each.Path;
end loop;
return Result;
end Get_ASN1_File_List;
-- Return a Tag list of ACN Files
function Get_ACN_File_List return Tag is
Result : Tag;
begin
for Each of Model.Data_View.ACN_Files loop
Result := Result & Each;
end loop;
return Result;
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
......@@ -146,9 +114,9 @@ package body TASTE.Backend.Code_Generators is
& Assoc ("Is_FPGA", Is_FPGA_Tag)
& Assoc ("CPU_Platform", CPU_Platform_Tag)
& Assoc ("Unique_Languages", Unique_Languages)
& Assoc ("ASN1_Files", Get_ASN1_File_List)
& Assoc ("ACN_Files", Get_ACN_File_List)
& Assoc ("ASN1_Modules", Get_Module_List);
& Assoc ("ASN1_Files", Model.Data_View.Get_ASN1_File_List)
& Assoc ("ACN_Files", Model.Data_View.Get_ACN_File_List)
& Assoc ("ASN1_Modules", Model.Data_View.Get_Module_List);
Put_Debug ("Generating global Makefile");
Create (File => Output_File,
......@@ -282,8 +250,8 @@ package body TASTE.Backend.Code_Generators is
Function_Makefile_Template
(Model => Model,
F => F,
Modules => Get_Module_List,
Files => Get_ASN1_File_List)
Modules => Model.Data_View.Get_Module_List,
Files => Model.Data_View.Get_ASN1_File_List)
& Assoc ("List_Of_PIs", List_Of_PIs);
Make_Path : constant String := Path & "makefile.tmplt";
......@@ -303,8 +271,10 @@ package body TASTE.Backend.Code_Generators is
& Assoc ("Required_Interfaces",
Process_Interfaces
(Func_Tmpl.Required, Path))
& Assoc ("ASN1_Modules", Get_Module_List)
& Assoc ("ASN1_Files", Get_ASN1_File_List);
& Assoc ("ASN1_Modules",
Model.Data_View.Get_Module_List)
& Assoc ("ASN1_Files",
Model.Data_View.Get_ASN1_File_List);
Content : constant String :=
Parse (Path & "function.tmplt", Func_Map);
......
......@@ -4,8 +4,6 @@
-- *********************************************************************** --
with Ada.Directories,
Ada.IO_Exceptions,
Ada.Exceptions,
Ada.Characters.Latin_1,
-- Ada.Strings.Fixed,
GNAT.Directory_Operations, -- Contains Dir_Name
......@@ -560,6 +558,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Threads", Part_Threads)
& Assoc ("Thread_Names", Thread_Names)
& Assoc ("Thread_Has_Param", Thread_Has_Param)
& Assoc ("ASN1_Modules", CV.Data_View.Get_Module_List)
& Assoc ("Node_Name", Node_Name)
& Assoc ("Blocks", Blocks)
& Assoc ("Block_Names", Block_Names)
......@@ -630,6 +629,7 @@ package body TASTE.Concurrency_View is
VP_Classifiers : Vector_Tag;
Block_Names, -- All blocks of a node
Block_Languages,
Block_Is_Passive, -- If the block only has synchronous PIs
Block_Instance_Of : Vector_Tag;
begin
for Partition in CV.Nodes (Node_Name).Partitions.Iterate loop
......@@ -644,6 +644,20 @@ package body TASTE.Concurrency_View is
To_String (B.Ref_Function.Name);
Block_Languages := Block_Languages
& TASTE.Backend.Language_Spelling (B.Ref_Function);
-- Flag blocks that are purely passive (no cyclic,
-- no sporadics, no timers). Useful for some backends.
declare
Is_Passive : Boolean := True;
begin
for PI of B.Ref_Function.Provided loop
if PI.RCM = Sporadic_Operation
or PI.RCM = Cyclic_Operation
then
Is_Passive := False;
end if;
end loop;
Block_Is_Passive := Block_Is_Passive & Is_Passive;
end;
Block_Instance_Of := Block_Instance_Of
& B.Ref_Function.Instance_Of.Value_Or (US (""));
end loop;
......@@ -670,6 +684,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Node_Name", Node_Name)
& Assoc ("Block_Names", Block_Names)
& Assoc ("Block_Languages", Block_Languages)
& Assoc ("Block_Is_Passive", Block_Is_Passive)
& Assoc ("Block_Instance_Of", Block_Instance_Of)
& Assoc ("CPU_Name",
CV.Nodes (Node_Name).Deployment_Node.CPU_Name)
......@@ -901,19 +916,28 @@ package body TASTE.Concurrency_View is
All_Drivers.Append (N.Drivers);
for D : Taste_Device_Driver of N.Drivers loop
Device_Node_Name := Device_Node_Name & N.Name;
Device_Partition_Name := -- There must be only one
Device_Partition_Name & N.Partitions.First_Element.Name;
-- Update list of types and files without duplicates
if not Unique_ASN1_Sorts_Set.Contains
(Strip_String (To_String (D.ASN1_Typename)))
then
Unique_ASN1_Sorts_Set.Insert
(Strip_String (To_String (D.ASN1_Typename)));
Unique_ASN1_Sorts := Unique_ASN1_Sorts & D.ASN1_Typename;
Unique_ASN1_Modules :=
Unique_ASN1_Modules & D.ASN1_Module;
Unique_ASN1_Files := Unique_ASN1_Files & D.ASN1_Filename;
-- The vector tags of drivers miss the name of the node
-- and partition as they are not part of the Driver
-- data structure. We add them here as we are iterating
-- on nodes (and we consider only one partition)
if not D.Accessed_Bus_Name.Is_Empty then
-- Here add only if driver is bound to a bus
Device_Node_Name := Device_Node_Name & N.Name;
Device_Partition_Name := -- There must be only one
Device_Partition_Name & N.Partitions.First_Element.Name;
-- Update list of types and files without duplicates
if not Unique_ASN1_Sorts_Set.Contains
(Strip_String (To_String (D.ASN1_Typename)))
then
Unique_ASN1_Sorts_Set.Insert
(Strip_String (To_String (D.ASN1_Typename)));
Unique_ASN1_Sorts :=
Unique_ASN1_Sorts & D.ASN1_Typename;
Unique_ASN1_Modules :=
Unique_ASN1_Modules & D.ASN1_Module;
Unique_ASN1_Files :=
Unique_ASN1_Files & D.ASN1_Filename;
end if;
end if;
end loop;
end loop;
......@@ -979,14 +1003,4 @@ package body TASTE.Concurrency_View is
End_Search (ST);
end Generate_Code;
procedure Generate_CV (CV : Taste_Concurrency_View) is
begin
CV.Generate_Code;
exception
when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error =>
Put_Error ("Concurrency View : "
& Ada.Exceptions.Exception_Message (Error));
raise Quit_Taste;
end Generate_CV;
end TASTE.Concurrency_View;
......@@ -13,7 +13,8 @@ with Ada.Containers.Indefinite_Ordered_Maps,
Templates_Parser,
TASTE.Parser_Utils,
TASTE.Interface_View,
TASTE.Deployment_View;
TASTE.Deployment_View,
TASTE.Data_View;
use Ada.Containers,
Ada.Strings.Unbounded,
......@@ -21,7 +22,8 @@ use Ada.Containers,
Templates_Parser,
TASTE.Parser_Utils,
TASTE.Interface_View,
TASTE.Deployment_View;
TASTE.Deployment_View,
TASTE.Data_View;
package TASTE.Concurrency_View is
......@@ -159,6 +161,7 @@ package TASTE.Concurrency_View is
Configuration : Taste_Configuration;
Nodes : CV_Nodes.Map;
Deployment : Complete_Deployment_View;
Data_View : Taste_Data_View;
Base_Template_Path : String_Holder;
Base_Output_Path : String_Holder;
end record;
......@@ -167,6 +170,6 @@ package TASTE.Concurrency_View is
Output : File_Type);
-- Generate the concurrency view using templates
procedure Generate_CV (CV : Taste_Concurrency_View);
procedure Generate_Code (CV : Taste_Concurrency_View);
end TASTE.Concurrency_View;
......@@ -195,6 +195,35 @@ package body TASTE.Data_View is
end loop;
end Debug_Dump;
function Get_Module_List (DV : Taste_Data_View) return Tag is
Result : Tag;
begin
for Each of DV.ASN1_Files loop
for Module of Each.Modules loop
Result := Result & Module.Name;
end loop;
end loop;
return Result;
end Get_Module_List;
function Get_ASN1_File_List (DV : Taste_Data_View) return Tag is
Result : Tag;
begin
for Each of DV.ASN1_Files loop
Result := Result & Each.Path;
end loop;
return Result;
end Get_ASN1_File_List;
function Get_ACN_File_List (DV : Taste_Data_View) return Tag is
Result : Tag;
begin
for Each of DV.ACN_Files loop
Result := Result & Each;
end loop;
return Result;
end Get_ACN_File_List;
procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String) is
begin
for Idx in DV.ASN1_Files.Iterate loop
......
......@@ -8,6 +8,7 @@
with Text_IO,
Ada.Containers.Indefinite_Ordered_Maps,
Ada.Strings.Unbounded,
Templates_Parser,
Ocarina,
Ocarina.Types,
TASTE.Parser_Utils;
......@@ -15,6 +16,7 @@ with Text_IO,
use Text_IO,
Ada.Containers,
Ada.Strings.Unbounded,
Templates_Parser,
Ocarina,
Ocarina.Types,
TASTE.Parser_Utils;
......@@ -67,6 +69,11 @@ package TASTE.Data_View is
procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type);
-- Functions converting the AST into Templates Parser tags
function Get_Module_List (DV : Taste_Data_View) return Tag;
function Get_ASN1_File_List (DV : Taste_Data_View) return Tag;
function Get_ACN_File_List (DV : Taste_Data_View) return Tag;
-- Make a local copy of ASN.1 files to allow project export
procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String);
......
......@@ -91,8 +91,8 @@ package body TASTE.Deployment_View is
Device_ASN1_Modules : Vector_Tag;
begin
for Driver of Drivers loop
declare
begin
-- Only consider devices that are actually connected to a bus
if not Driver.Accessed_Bus_Name.Is_Empty then
Device_Names := Device_Names & Driver.Device_Instance_Name;
Device_Driver_Names := Device_Driver_Names
& Driver.Driver_Name;
......@@ -106,9 +106,9 @@ package body TASTE.Deployment_View is
Device_Configurations := Device_Configurations
& Driver.Device_Configuration;
Device_Accessed_Bus_Names := Device_Accessed_Bus_Names
& Driver.Accessed_Bus_Name;
& Driver.Accessed_Bus_Name.Element;
Device_Accessed_Port_Names := Device_Accessed_Port_Names
& Driver.Accessed_Port_Name;
& Driver.Accessed_Port_Name.Element;
Device_ASN1_Filenames := Device_ASN1_Filenames
& Driver.ASN1_Filename;
Device_ASN1_Typenames := Device_ASN1_Typenames
......@@ -121,7 +121,7 @@ package body TASTE.Deployment_View is
& Driver.Send_Function;
Device_Init_Languages := Device_Init_Languages
& Driver.Init_Language;
end;
end if;
end loop;
return +Assoc ("Device_Names", Device_Names)
......@@ -215,9 +215,9 @@ package body TASTE.Deployment_View is
-- case of a hierarchical structure. All bus connections
-- must be updated before processing the concurrency view, but
-- this can be done only using the interface view information.
Put_Debug ("Added bus connnection: ");
Put_Debug (" ... Channel: " & AIN_Case (Conn));
Put_Debug (" ... Bus: " & Get_Name_String (Bound_Bus_Name));
-- Put_Debug ("Added bus connnection: ");
-- Put_Debug (" ... Channel: " & AIN_Case (Conn));
-- Put_Debug (" ... Bus: " & Get_Name_String (Bound_Bus_Name));
Result := Result
& Bus_Connection'(Channel_Name => US (AIN_Case (Conn)),
......@@ -233,7 +233,7 @@ package body TASTE.Deployment_View is
while Present (Subs) loop