Commit 388c01b9 authored by yoogx's avatar yoogx

Merge branch 'master' of https://github.com/yoogx/ocarina

parents cf7bc935 b17ba45c
......@@ -81,7 +81,7 @@ $(GUIDE).html: $(IMAGES) $(GUIDE_TEXIFILES)
mv -f "$$TMP_FILE" "$$INDEX_FILE"
$(GUIDE).pdf: $(IMAGES) $(GUIDE_TEXIFILES)
$(TEXI2PDF) $(srcdir)/$(GUIDE).texi
-$(TEXI2PDF) $(srcdir)/$(GUIDE).texi
clean-local:
rm -f *.aux *.log *.dvi *.info *.tmp
......
......@@ -54,6 +54,8 @@ property set Memory_Properties is
Byte_Count: aadlinteger 0 .. Max_Byte_Count
applies to (memory);
Memory_Size: Size applies to (memory);
Word_Size: Size => 8 bits
applies to (memory);
......
......@@ -49,7 +49,8 @@ property set Deployment is
X86_LINUXTASTE, -- TASTE-specific linux distribution
MARTE_OS, -- MaRTE OS
WIN32, -- WIN32
VXWORKS -- VXWORKS
VXWORKS, -- VXWORKS
FREERTOS -- FREERTOS
);
-- Supported platforms
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -3245,6 +3245,10 @@ package body Ocarina.Backends.Ada_Tree.Nutils is
Fatal => True);
end if;
if To_Lower (Name_Buffer (1 .. Pos - 1)) = "standard" then
return No_Name;
end if;
Set_Str_To_Name_Buffer (Name_Buffer (1 .. Pos - 1));
return Name_Find;
end Unit_Name;
......
......@@ -948,7 +948,8 @@ package Ocarina.Backends.Ada_Tree.Nutils is
function Unit_Name (N : Name_Id) return Name_Id;
-- Given an ENTITY fully qualified name A.B.C.D, returns A.B.C
-- Raises an arror if the name does not contains any dot.
-- Raises an error if the name does not contains any dot.
-- Return No_Name is unit name is Standard
function Local_Name (N : Name_Id) return Name_Id;
-- Given an ENTITY fully qualified name A.B.C.D, returns D
......
......@@ -318,6 +318,7 @@ package body Ocarina.Backends.Build_Utils is
-- The node name (in lower case)
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id := No_Name;
-- The execution platform of the processor the current node
-- is bound to.
......@@ -962,6 +963,8 @@ package body Ocarina.Backends.Build_Utils is
M.Execution_Platform := Get_Execution_Platform
(Get_Bound_Processor (E));
M.Execution_Platform_Name := Get_Execution_Platform
(Get_Bound_Processor (E));
-- Get the transport API used by this node. It is
-- important to ensure that the Namings package visitors
......@@ -1511,8 +1514,14 @@ package body Ocarina.Backends.Build_Utils is
Write_Name (M.Node_Name);
Write_Eol;
Write_Line ("# Execution platform : "
& M.Execution_Platform'Img);
Write_Str ("# Execution platform : ");
Write_Name (M.Execution_Platform_Name);
if M.Execution_Platform = Platform_None then
Write_Eol;
Write_Str ("# Note: user defined");
end if;
Write_Eol;
Write_Line ("# Transport API : "
& M.Transport_API'Img);
......@@ -1550,6 +1559,7 @@ package body Ocarina.Backends.Build_Utils is
(M.Appli_Name,
M.Node_Name,
M.Execution_Platform,
M.Execution_Platform_Name,
M.Transport_API,
M.Ada_Sources,
M.Asn_Sources,
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -71,6 +71,7 @@ package Ocarina.Backends.Build_Utils is
(Appli_Name : Name_Id;
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......
......@@ -2207,7 +2207,7 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
-- parameter which is the port that triggered the thread.
case P is
when Thread_Periodic =>
when Thread_Periodic | Thread_Background =>
Call_Profile := Make_List_Id
(Extract_Enumerator (E));
......@@ -2609,14 +2609,14 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
Used : Boolean := False;
begin
while Present (D) loop
exit when Kind (Item (D)) = K_Port_Spec_Instance;
if not Used then
if Parent_Component (Item (D)) = Wrapper then
Used := True;
end if;
end if;
exit when Kind (Item (D)) = K_Port_Spec_Instance;
D := Next_Node (D);
end loop;
......
......@@ -316,28 +316,31 @@ package body Ocarina.Backends.PO_HI_Ada.Types is
L : constant Name_Id := Local_Name (Name);
P : Node_Id;
begin
if U = No_Name then
Display_Located_Error
(Loc (E),
"'Type_Source_Name' property value must be a fully"
& " qualified name", Fatal => True);
end if;
P := Make_Designator (U);
ADN.Set_Corresponding_Node
(ADN.Defining_Identifier (P),
New_Node (ADN.K_Package_Specification));
Add_With_Package (P);
-- Get the full name
if U /= No_Name then
-- The user provided a fully qualified name that
-- is not prefixed by Standard, add this fully
-- qualified name in the package
P := Make_Designator (U);
ADN.Set_Corresponding_Node
(ADN.Defining_Identifier (P),
New_Node (ADN.K_Package_Specification));
Add_With_Package (P);
N := Make_Designator (L);
Set_Homogeneous_Parent_Unit_Name (N, P);
else
-- Otherwise, simply refer to Standard package
N := Make_Designator (L);
Set_Homogeneous_Parent_Unit_Name (N, P);
N := Make_Designator (L);
Set_Homogeneous_Parent_Unit_Name (N, RU (RU_Standard));
end if;
N := Make_Full_Type_Declaration
(Defining_Identifier => Map_Ada_Defining_Identifier (E),
Type_Definition => Make_Derived_Type_Definition
(N));
(N, Is_Subtype => True),
Is_Subtype => True);
end;
else
-- Otherwise, we extract from the Data_Model specific
......
......@@ -90,6 +90,7 @@ package body Ocarina.Backends.PO_HI_Ada is
(Appli_Name : Name_Id;
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -137,6 +138,7 @@ package body Ocarina.Backends.PO_HI_Ada is
(Appli_Name : Name_Id;
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -152,6 +154,7 @@ package body Ocarina.Backends.PO_HI_Ada is
is
pragma Unreferenced (Appli_Name,
Transport_API,
Execution_Platform_Name,
Ada_Sources,
C_Libraries,
User_Source_Dirs,
......
......@@ -131,12 +131,12 @@ package body Ocarina.Backends.PO_HI_C.Naming is
U : Node_Id;
Root_Sys : constant Node_Id
:= Parent_Component (Parent_Subcomponent (E));
Platform : constant Supported_Execution_Platform
Platform_Name : constant Name_Id
:= Get_Execution_Platform (Get_Bound_Processor (E));
begin
pragma Assert (AAU.Is_System (Root_Sys));
if Platform = Platform_None then
if Platform_Name = No_Name then
Display_Located_Error
(Loc (Parent_Subcomponent (E)),
"This process subcomponent is bound to a processor without"
......
......@@ -107,6 +107,7 @@ package body Ocarina.Backends.PO_HI_C is
Do_Regression_Test : Boolean := False;
Do_Coverage_Test : Boolean := False;
Generated_Sources_Directory : Name_Id := No_Name;
Verbose_Mode : Boolean := False;
procedure Visit_Architecture_Instance (E : Node_Id);
-- Most top level visitor routine. E is the root of the AADL
......@@ -117,6 +118,7 @@ package body Ocarina.Backends.PO_HI_C is
(Appli_Name : Name_Id;
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -138,6 +140,7 @@ package body Ocarina.Backends.PO_HI_C is
(Appli_Name : Name_Id;
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -194,9 +197,16 @@ package body Ocarina.Backends.PO_HI_C is
Write_Str ("TARGET = ");
case Execution_Platform is
when Platform_Native | Platform_None =>
when Platform_Native =>
Write_Str ("native");
when Platform_None =>
if Execution_Platform_Name /= No_Name then
Write_Name (Execution_Platform_Name);
else
Write_Str ("native");
end if;
when Platform_Native_Compcert =>
Write_Str ("compcert");
......@@ -303,8 +313,10 @@ package body Ocarina.Backends.PO_HI_C is
for J in
Name_Tables.First .. Name_Tables.Last (User_Source_Dirs) loop
Write_Space;
Write_Name (User_Source_Dirs.Table (J));
Write_Str ("""-I");
Write_Name (Remove_Directory_Separator
(User_Source_Dirs.Table (J)));
Write_Str ("""");
exit when J = Name_Tables.Last (User_Source_Dirs);
Write_Space;
......@@ -537,6 +549,13 @@ package body Ocarina.Backends.PO_HI_C is
-- Enter the output directory
Enter_Directory (Generated_Sources_Directory);
if Verbose_Mode then
Set_Standard_Error;
Write_Str ("Generating code in directory: ");
Write_Name (Generated_Sources_Directory);
Write_Eol;
Set_Standard_Output;
end if;
if Remove_Generated_Sources then
Build_Utils.Makefiles.Clean (Instance_Root);
......@@ -631,7 +650,7 @@ package body Ocarina.Backends.PO_HI_C is
Generated_Sources_Directory := Get_String_Name (".");
Initialize_Option_Scan;
loop
case Getopt ("* b z ec er o: perf asn1") is
case Getopt ("* b z ec er o: perf asn1 v") is
when ASCII.NUL =>
exit;
......@@ -643,6 +662,9 @@ package body Ocarina.Backends.PO_HI_C is
when 'b' =>
Compile_Generated_Sources := True;
when 'v' =>
Verbose_Mode := True;
when 'z' =>
Remove_Generated_Sources := True;
......
......@@ -2688,6 +2688,18 @@ package body Ocarina.Backends.Properties is
-- Get_Execution_Platform --
----------------------------
function Get_Execution_Platform (P : Node_Id) return Name_Id is
pragma Assert (AINU.Is_Processor (P)
or else AINU.Is_Virtual_Processor (P));
begin
if Is_Defined_Enumeration_Property (P, Execution_Platform) then
return Get_Enumeration_Property (P, Execution_Platform);
else
return No_Name;
end if;
end Get_Execution_Platform;
function Get_Execution_Platform
(P : Node_Id)
return Supported_Execution_Platform
......@@ -2755,8 +2767,6 @@ package body Ocarina.Backends.Properties is
elsif P_Name = Platform_VxWorks_Name then
return Platform_VxWorks;
else
Display_Located_Error
(AIN.Loc (P), "Unknown execution platform", Fatal => True);
return Platform_None;
end if;
else
......
......@@ -609,6 +609,7 @@ package Ocarina.Backends.Properties is
function Get_Execution_Platform
(P : Node_Id)
return Supported_Execution_Platform;
function Get_Execution_Platform (P : Node_Id) return Name_Id;
-- Return the execution platform of the given processor P
function Get_Location (P : Node_Id) return Name_Id;
......
......@@ -950,10 +950,14 @@ package body Ocarina.Backends.Utils is
return Get_Container_Process (Parent_Component (E));
when others =>
if Is_Thread (E) or else Is_Subprogram (E) then
if Is_Thread (E) or else Is_Subprogram (E)
or else AAU.Is_Data (E)
then
return Get_Container_Process (Parent_Subcomponent (E));
elsif Is_Process (E) or else Is_Device (E) then
return Parent_Subcomponent (E);
else
raise Program_Error with "Wrong node kind in "
& "Get_Container_Process: " & Kind (E)'Img
......
......@@ -315,7 +315,7 @@ package body Ocarina.Instances.Components.Features is
-- Abort the instantiation of the corresponding entity if there
-- is no such corresponding entity.
Display_Instantiation_Error (Feature, Fatal => False);
Display_Type_Instantiation_Error (Feature, Fatal => False);
return No_Node;
else
C := ATE.Get_Referenced_Entity (Entity_Ref (Feature));
......
......@@ -88,4 +88,21 @@ package body Ocarina.Instances.Messages is
Exit_On_Error (Fatal, "Cannot instantiate full model, exit now");
end Display_Instantiation_Error;
procedure Display_Type_Instantiation_Error
(Node : Node_Id; Fatal : Boolean := True)
is
pragma Assert (Present (Node));
Error_Msg : constant String
:= "% (feature) cannot be properly instantiated: requires full type";
begin
Error_Loc (1) := Loc (Node);
Error_Name (1) := Get_Name_Of_Entity (Node);
if Fatal then
DE (Error_Msg);
else
DW (Error_Msg);
end if;
Exit_On_Error (Fatal, "Cannot instantiate full model, exit now");
end Display_Type_Instantiation_Error;
end Ocarina.Instances.Messages;
......@@ -34,8 +34,13 @@
package Ocarina.Instances.Messages is
procedure Display_No_Entity_Ref (Node : Node_Id);
procedure Display_Entity_Is_A_Component_Type (Node : Node_Id);
procedure Display_Instantiation_Error
(Node : Node_Id; Fatal : Boolean := True);
procedure Display_Type_Instantiation_Error
(Node : Node_Id; Fatal : Boolean := True);
end Ocarina.Instances.Messages;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -31,28 +31,39 @@
-- --
------------------------------------------------------------------------------
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Locations;
with Ocarina.AADL_Values;
with Ocarina.Instances.Queries;
with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.ME_AADL.AADL_Instances.Entities.Properties;
with Ocarina.Instances.Queries;
use Ocarina.Instances.Queries;
with Ocarina.ME_REAL.REAL_Tree.Nodes;
with Ocarina.ME_REAL.REAL_Tree.Nutils;
with Ocarina.REAL_Values;
with Ocarina.AADL_Values;
with Locations;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Processor.Properties;
with Ocarina.REAL_Values;
package body Ocarina.Instances.REAL_Finder is
use Ocarina.Instances.Queries;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_REAL.REAL_Tree.Nodes;
use Ocarina.ME_REAL.REAL_Tree.Nutils;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.REAL_Values;
use Ocarina.Processor.Properties;
package RNU renames Ocarina.ME_REAL.REAL_Tree.Nutils;
package OV renames Ocarina.AADL_Values;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AIEP renames Ocarina.ME_AADL.AADL_Instances.Entities.Properties;
package RNU renames Ocarina.ME_REAL.REAL_Tree.Nutils;
package RV renames Ocarina.REAL_Values;
------------------------
......@@ -81,10 +92,8 @@ package body Ocarina.Instances.REAL_Finder is
is
use Locations;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package OV renames Ocarina.AADL_Values;
use OV;
use type ATN.Node_Kind;
pragma Assert (AIN.Kind (Var) = AIN.K_Component_Instance or else
AIN.Kind (Var) = AIN.K_Call_Instance);
......@@ -240,9 +249,33 @@ package body Ocarina.Instances.REAL_Finder is
(ATN.Name (ATN.Identifier (N)));
when ATN.K_Reference_Term =>
Result := RV.New_Elem_Value
(Get_Reference_Property
(Resolved_Var, Property_Name));
-- In the case of reference term, we change the logic:
-- we use Get_List_Property to fetch all elements, and
-- then enqueue them in the Result.
if not Is_List then
Result := RV.New_Elem_Value
(Get_Reference_Property
(Resolved_Var, Property_Name));
else
declare
A_List : constant List_Id := Get_List_Property
(Resolved_Var, Property_Name);
A_Node : Node_Id;
begin
A_Node := ATN.First_Node (A_List);
while Present (A_Node) loop
Result := RV.New_Elem_Value
(ATN.Entity (ATN.Reference_Term (A_Node)));
Val := New_Node (K_Value_Node, No_Location);
Set_Item_Val (Val, Result);
RNU.Append_Node_To_List (Val, Result_List);
A_Node := ATN.Next_Node (A_Node);
end loop;
return RV.New_List_Value (Result_List);
end;
end if;
when ATN.K_Component_Classifier_Term =>
Result := RV.New_Elem_Value
......@@ -253,7 +286,9 @@ package body Ocarina.Instances.REAL_Finder is
return RV.No_Value;
end case;
if Is_List then
if Is_List
and then ATN.Kind (N) /= ATN.K_Reference_Term
then
Val := New_Node (K_Value_Node, No_Location);
Set_Item_Val (Val, Result);
RNU.Append_Node_To_List (Val, Result_List);
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -183,7 +183,7 @@ package body Ocarina.Instances is
else
Error_Loc (1) := No_Location;
DE ("Cannot select a root system among several ");
DE ("Please select a root system among ");
List_Node := Root_Systems.First;
while Present (List_Node) loop
Error_Loc (1) := ATN.Loc (List_Node);
......@@ -191,6 +191,7 @@ package body Ocarina.Instances is
DE ("%");
List_Node := ATN.Next_Entity (List_Node);
end loop;
Exit_On_Error (True, "Cannot instantiate AADL model");
end if;
else
......@@ -210,6 +211,7 @@ package body Ocarina.Instances is
Error_Name (2) := ATE.Get_Name_Of_Entity (List_Node);
DE ("system % is not a root system, use %");
Root_System := No_Node;
Exit_On_Error (True, "Cannot instantiate AADL model");
end if;
end if;
......@@ -219,6 +221,7 @@ package body Ocarina.Instances is
if No (Root_System) then
Instance_Root := No_Node;
Exit_On_Error (True, "Cannot instantiate full model, exit now");
else
-- The first step of the instantiation consist of propagate the
-- properties declared in the AADL packages to the AADL
......
......@@ -263,6 +263,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
or else Kind (Container) = K_Feature_Group_Type
then
Pack_Container := Namespace (Container);
elsif Kind (Container) = K_Subcomponent
or else Kind (Container) = K_Port_Spec
or else Kind (Container) = K_Parameter
......@@ -271,6 +272,7 @@ package body Ocarina.Analyzer.AADL.Semantics is
or else Kind (Container) = K_Connection
then
Pack_Container := Namespace (Container_Component (Container));
elsif Kind (Container) = K_Package_Specification then
Pack_Container := Container;
end if;
......
......@@ -68,7 +68,7 @@ package body Ocarina.Configuration is
@AADL_VERSION@;
pragma Style_Checks (Off);
SVN_Revision : constant String := "Working Copy from @SVN_REVISION@";
SCM_Revision : constant String := "Working Copy from @SCM_REVISION@";
pragma Style_Checks (On);
-- We keep the repository version as "(Working Copy) from ..." to
-- distinguish modified versions. When packaging Ocarina, we
......@@ -245,13 +245,13 @@ package body Ocarina.Configuration is
end Ocarina_Version;
--------------------------
-- Ocarina_SVN_Revision --
-- Ocarina_Revision --
--------------------------
function Ocarina_SVN_Revision return String is
function Ocarina_Revision return String is
begin
return SVN_Revision;
end Ocarina_SVN_Revision;
return SCM_Revision;
end Ocarina_Revision;
---------------------------------
-- Ocarina_Last_Configure_Date --
......
......@@ -40,7 +40,7 @@ package Ocarina.Configuration is
procedure Reset_Modules;