Commit 261bdfc0 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Merge branch 'feature_buster' into 'master'

Extract the coordinates of functions

See merge request !64
parents 53a8f51e 159fb571
GCC RUNTIME LIBRARY EXCEPTION
Version 3.1, 31 March 2009
Copyright (C) 2009 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
This GCC Runtime Library Exception ("Exception") is an additional
permission under section 7 of the GNU General Public License, version
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
bears a notice placed by the copyright holder of the file stating that
the file is governed by GPLv3 along with this Exception.
When you use GCC to compile a program, GCC may combine portions of
certain GCC header files and runtime libraries with the compiled
program. The purpose of this Exception is to allow compilation of
non-GPL (including proprietary) programs to use, in this way, the
header files and runtime libraries covered by this Exception.
0. Definitions.
A file is an "Independent Module" if it either requires the Runtime
Library for execution after a Compilation Process, or makes use of an
interface provided by the Runtime Library, but is not otherwise based
on the Runtime Library.
"GCC" means a version of the GNU Compiler Collection, with or without
modifications, governed by version 3 (or a specified later version) of
the GNU General Public License (GPL) with the option of using any
subsequent versions published by the FSF.
"GPL-compatible Software" is software whose conditions of propagation,
modification and use would permit combination with GCC in accord with
the license of GCC.
"Target Code" refers to output from any compiler for a real or virtual
target processor architecture, in executable form or suitable for
input to an assembler, loader, linker and/or execution
phase. Notwithstanding that, Target Code does not include data in any
format that is used as a compiler intermediate representation, or used
for producing a compiler intermediate representation.
The "Compilation Process" transforms code entirely represented in
non-intermediate languages designed for human-written code, and/or in
Java Virtual Machine byte code, into Target Code. Thus, for example,
use of source code generators and preprocessors need not be considered
part of the Compilation Process, since the Compilation Process can be
understood as starting with the output of the generators or
preprocessors.
A Compilation Process is "Eligible" if it is done using GCC, alone or
with other GPL-compatible software, or if it is done without using any
work based on GCC. For example, using non-GPL-compatible Software to
optimize any GCC intermediate representations would not qualify as an
Eligible Compilation Process.
1. Grant of Additional Permission.
You have permission to propagate a work of Target Code formed by
combining the Runtime Library with Independent Modules, even if such
propagation would otherwise violate the terms of GPLv3, provided that
all Target Code was generated by Eligible Compilation Processes. You
may then convey such a combination under terms of your choice,
consistent with the licensing of the Independent Modules.
2. No Weakening of GCC Copyleft.
The availability of this Exception does not imply any general
presumption that third-party software is unaffected by the copyleft
requirements of the license of GCC.
This diff is collapsed.
......@@ -2,7 +2,7 @@
Kazoo is the TASTE tool in charge of generating code skeletons, glue code and build scripts
License: LGPL (see LICENSE file)
License: GPL with runtime exception (see LICENSE file)
Copyright (c) 2019-2020 Maxime Perrotin / European Space Agency
......
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Ada.Exceptions,
GNAT.OS_Lib,
TASTE,
......
-- ************************ taste aadl parser **************************** --
-- (c) 2008-2019 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Define a generic Option type
generic
type T is private;
......
-- ************************ TASTE AADL Parser ************************** --
-- Based on Ocarina **************************************************** --
-- (c) 2019-2021 Maxime Perrotin / ESA - maxime.perrotin@esa.int
-- ********************************************************************* --
--
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with System.Assertions,
Ada.Exceptions,
Ada.IO_Exceptions,
......@@ -325,16 +324,26 @@ package body TASTE.AADL_Parser is
for RI of Partition.Blocks (Block_Id).Ref_Function.Required loop
if RI.RCM = Protected_Operation or RI.RCM = Unprotected_Operation
then
-- Put_Line ("RI: " & To_String (RI.Name));
for Remote of RI.Remote_Interfaces loop
Rec_Add_Calling_Thread
(Thread_Id => Thread_Id,
Block_Id => To_String (Remote.Function_Name));
if Remote.Function_Name /=
Partition.Deployment_Partition.Name & "_Timer_Manager"
then
-- Put_Line (To_String (Remote.Function_Name)
-- & " :: " & To_String (Remote.Language));
-- Timer manager calling thread is only the Tick function
Rec_Add_Calling_Thread
(Thread_Id => Thread_Id,
Block_Id => To_String (Remote.Function_Name));
end if;
end loop;
end if;
end loop;
end Rec_Add_Calling_Thread;
begin
for Each of Partition.Threads loop
-- Put_Line ("Thread: " & To_String (Each.Name) & " - Block: "
-- & To_String (Each.Protected_Block_Name));
Rec_Add_Calling_Thread (Thread_Id => To_String (Each.Name),
Block_Id => To_String
(Each.Protected_Block_Name));
......@@ -342,8 +351,9 @@ package body TASTE.AADL_Parser is
end Set_Calling_Threads;
-- Find the output ports of a thread by following the connections
function Get_Output_Ports (Model : TASTE_Model;
F : Taste_Terminal_Function) return Ports.Map
function Get_Output_Ports (Model : TASTE_Model;
F : Taste_Terminal_Function;
Partition_Name : String) return Ports.Map
is
Result : Ports.Map;
Visited_Functions : String_Sets.Set;
......@@ -374,12 +384,17 @@ package body TASTE.AADL_Parser is
if RI.RCM = Unprotected_Operation or RI.RCM = Protected_Operation
then
Rec_Find_Thread (Ports_Map => Ports_Map,
Visited => Visited,
Func =>
Model.Interface_View.Flat_Functions
for Remote of RI.Remote_Interfaces loop
if Remote.Function_Name /= Partition_Name & "_Timer_Manager"
then
Rec_Find_Thread (Ports_Map => Ports_Map,
Visited => Visited,
Func =>
Model.Interface_View.Flat_Functions
(To_String
(RI.Remote_Interfaces.First_Element.Function_Name)));
end if;
end loop;
else
declare
-- Assume only one remote connection per RI
......@@ -534,7 +549,8 @@ package body TASTE.AADL_Parser is
Protected_Block_name => Block.Ref_Function.Name,
Node => Block.Node,
PI => PI,
Output_Ports => Get_Output_Ports (Model, F),
Output_Ports => Get_Output_Ports
(Model, F, Partition_Name),
Priority => US ("1"),
Dispatch_Offset_Ms => US ("0"),
Stack_Size_In_Bytes => US ("50000"));
......
-- ************************ TASTE AADL Parser ************************** --
-- (c) 2017 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Ada.Strings.Unbounded,
Ocarina.Types,
......
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Text_IO; use Text_IO;
with Ada.Characters.Handling,
Ada.Containers.Ordered_Sets,
......
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Templates_Parser,
TASTE.AADL_Parser;
......
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Ada.Strings.Unbounded,
-- Ocarina.Backends.Properties,
TASTE.Interface_View;
......
-- *************************** kazoo *********************** --
-- (c) 2020 European Space Agency - maxime.perrotin@esa.int
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Ada.Directories,
Ada.IO_Exceptions,
......
-- *************************** taste aadl parser *********************** --
-- (c) 2019 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Model of the Concurrency View
......
-- *************************** taste aadl parser *********************** --
-- (c) 2018 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Interface View parser
......
-- *************************** taste aadl parser *********************** --
-- (c) 2018 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Data View parser
......
-- *************************** taste aadl parser *********************** --
-- (c) 2018 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Deployment View parser
......
-- *************************** taste/kazoo *********************** --
-- (c) 2019-2020 Maxime Perrotin / European Space Agency
-- contact: maxime.perrotin@esa.int
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Deployment View parser
with Ada.Containers.Indefinite_Ordered_Maps,
......
-- *************************** kazoo *********************** --
-- (c) 2019 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with Ada.Directories,
Ada.Text_IO,
......
-- *************************** taste aadl parser *********************** --
-- (c) 2019 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- Model of the Concurrency View
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
with TASTE.AADL_Parser;
use TASTE.AADL_Parser;
......
-- *************************** kazoo *********************** --
-- (c) 2017-2020 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Interface View parser
......@@ -8,6 +9,7 @@ with Ada.Exceptions,
Ada.Directories,
Ada.Strings.Fixed,
Ada.Characters.Handling,
GNAT.String_Split,
Ocarina.Instances.Queries,
Ocarina.Analyzer,
Ocarina.Options,
......@@ -27,6 +29,7 @@ package body TASTE.Interface_View is
use Ada.Exceptions,
Ada.Strings.Fixed,
Ada.Characters.Handling,
GNAT,
Ocarina.Instances.Queries,
Ocarina.Namet,
Ocarina.Options,
......@@ -467,17 +470,25 @@ package body TASTE.Interface_View is
-- Keep compatibility with 1.2 models for the interface name
Result.Name := (if Name = No_Name then US (AIN_Case (If_I)) else
US (Get_Name_String (Name)));
Result.Queue_Size := (if Kind (If_I) = K_Subcomponent_Access_Instance
and then Is_Defined_Property
(CI, "taste::associated_queue_size")
then Just (Get_Integer_Property
(CI, "taste::associated_queue_size"))
else Option_ULL.Nothing);
Result.Queue_Size := -- Ellidiss property
(if Kind (If_I) = K_Subcomponent_Access_Instance
and then Is_Defined_Property (CI, "taste::associated_queue_size")
then
Just (Get_Integer_Property (CI, "taste::associated_queue_size"))
else Option_ULL.Nothing);
Result.RCM := Get_RCM_Operation_Kind (If_I);
Result.Period_Or_MIAT := Get_RCM_Period (If_I);
Result.WCET_ms := Get_Upper_WCET (If_I);
Result.User_Properties := Get_Properties_Map (If_I);
-- Get the queue size from the properties (space creator property)
for P of Result.User_Properties loop
if P.Name = "Taste::Associated_Queue_Size" then
Result.Queue_Size :=
Just (Unsigned_Long_Long'Value (To_String (P.Value)));
exit;
end if;
end loop;
-- Parameters:
if not Is_Empty (AIN.Features (Sub_I)) then
Param_I := AIN.First_Node (AIN.Features (Sub_I));
......@@ -1033,6 +1044,8 @@ package body TASTE.Interface_View is
PIs_Have_Params, -- True if at least one PI has an ASN.1 parameter
RIs_Have_Params : Boolean := False; -- Same for RI
Interface_Tmplt : Translate_Set;
-- Optional graphical coordinates of a function:
X1, X2, Y1, Y2 : Unbounded_String := US ("0");
begin
Result.Header := +Assoc ("Name", F.Name)
& Assoc ("Language", Language_Spelling (F))
......@@ -1052,9 +1065,9 @@ package body TASTE.Interface_View is
for Each of F.Provided loop
-- Note: some backends need to have access to the function
-- user defined properties, and implementation language
-- They are added here. At the moment the user-defined properties
-- of the interfaces themselves are not part of the template
-- This could be be added later if needed.
-- They are added here. The user-defined properties
-- of the interfaces themselves are also part of the template
-- with the IF_ prefix (see in Interface_To_Template)
Interface_Tmplt :=
Join_Sets (Each.Interface_To_Template,
Properties_To_Template (F.User_Properties))
......@@ -1138,6 +1151,29 @@ package body TASTE.Interface_View is
Timers := Timers & Each;
end loop;
-- If there is a Coordinate property, extract the 4 values
-- (Split the string)
for P of F.User_Properties loop
if P.Name = "Taste::coordinates" then
-- P.Value = x1 y1 x2 y2 (four numbers separated with space)
declare
Subs : String_Split.Slice_Set;
Seps : constant String := " ";
begin
String_Split.Create (S => Subs,
From => To_String (P.Value),
Separators => Seps,
Mode => String_Split.Multiple);
if Integer (String_Split.Slice_Count (Subs)) = 4 then
X1 := US (String_Split.Slice (Subs, 1));
Y1 := US (String_Split.Slice (Subs, 2));
X2 := US (String_Split.Slice (Subs, 3));
Y2 := US (String_Split.Slice (Subs, 4));
end if;
end;
end if;
end loop;
-- Setup the mapping for the template (processed by function.tmplt)
Result.Header :=
Join_Sets (Result.Header,
......@@ -1170,7 +1206,11 @@ package body TASTE.Interface_View is
& Assoc ("Instance_Of", F.Instance_Of.Value_Or (US ("")))
& Assoc ("Timers", Timers)
& Assoc ("PIs_Have_Params", PIs_Have_Params)
& Assoc ("RIs_Have_Params", RIs_Have_Params);
& Assoc ("RIs_Have_Params", RIs_Have_Params)
& Assoc ("Coord.X1", X1)
& Assoc ("Coord.Y1", Y1)
& Assoc ("Coord.X2", X2)
& Assoc ("Coord.Y2", Y2);
return Result;
end Function_To_Template;
......@@ -1308,6 +1348,7 @@ package body TASTE.Interface_View is
Remote_Function_Names,
Remote_Interface_Names,
Remote_Languages : Vector_Tag;
X, Y : Unbounded_String := US ("0"); -- interface graphical coordinates
TI_Language : constant String := Map_Language (To_String (TI.Language));
begin
for Each of TI.Params loop
......@@ -1327,6 +1368,26 @@ package body TASTE.Interface_View is
Remote_Languages := Remote_Languages & Each.Language;
end loop;
-- Get the graphical coordinates of the interface
for P of TI.User_Properties loop
if P.Name = "Taste::coordinates" then
-- P.Value = x y
declare
Subs : String_Split.Slice_Set;
Seps : constant String := " ";
begin
String_Split.Create (S => Subs,
From => To_String (P.Value),
Separators => Seps,
Mode => String_Split.Multiple);
if Integer (String_Split.Slice_Count (Subs)) = 2 then
X := US (String_Split.Slice (Subs, 1));
Y := US (String_Split.Slice (Subs, 2));
end if;
end;
end if;
end loop;
return
Properties_To_Template (TI.User_Properties, Prefix => "IF_")
& Assoc ("Name", TI.Name)
......@@ -1345,6 +1406,8 @@ package body TASTE.Interface_View is
& Assoc ("Remote_Function_Names", Remote_Function_Names)
& Assoc ("Remote_Interface_Names", Remote_Interface_Names)
& Assoc ("Remote_Languages", Remote_Languages)
& Assoc ("Coord.X", X)
& Assoc ("Coord.Y", Y)
& Assoc ("Is_Timer", TI.Is_Timer);
end Interface_To_Template;
......
-- *************************** taste aadl parser *********************** --
-- (c) 2017-2019 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- ******************************* KAZOO ******************************* --
-- (c) 2017-2021 European Space Agency - maxime.perrotin@esa.int
-- See LICENSE file
-- *********************************************************************** --
-- Interface View parser
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment