Commit 9473e85d authored by yoogx's avatar yoogx

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

parents 1427953c 3a46bcf5
......@@ -440,6 +440,19 @@ package body Ocarina.Backends.C_Common.Types is
Data_Size := Get_Data_Size (E);
Actual_Data_Size := To_Bytes (Data_Size);
Type_Source_Name := Get_Type_Source_Name (E);
--
-- If the user specifies Type_Source_Name property
-- on the data type, then, the generator takes
-- it over everything else. This is a way to
-- override some assumptions from the code generator.
--
if Type_Source_Name /= No_Name then
Data_Representation := Data_None;
end if;
case Data_Representation is
when Data_Boolean =>
N :=
......@@ -743,8 +756,6 @@ package body Ocarina.Backends.C_Common.Types is
Fatal => True);
when Data_None =>
Type_Source_Name := Get_Type_Source_Name (E);
if Type_Source_Name /= No_Name then
N :=
Make_Full_Type_Declaration
......
......@@ -110,8 +110,9 @@ package body Ocarina.Backends.PO_HI_C.Runtime is
----------------
procedure Initialize is
Name : Name_Id;
N : Node_Id;
Name : Name_Id;
N : Node_Id;
Local : Boolean;
begin
-- Initialize the runtime only once
......@@ -120,6 +121,7 @@ package body Ocarina.Backends.PO_HI_C.Runtime is
end if;
Initialized := True;
Local := False;
Register_Casing_Rule ("AADL");
Register_Casing_Rule ("char_array");
......@@ -157,7 +159,13 @@ package body Ocarina.Backends.PO_HI_C.Runtime is
N := New_Node (K_Defining_Identifier);
Set_Name (N, Name);
RHD (E) := Make_Include_Clause (N, False);
if E = RH_Subprograms then
Local := True;
else
Local := False;
end if;
RHD (E) := Make_Include_Clause (N, Local);
end loop;
for E in RC_Id loop
......
......@@ -1154,6 +1154,42 @@ package body Ocarina.Backends.POK_C.Deployment is
Bound_Processor := Get_Bound_Processor (Associated_Component);
end if;
--
-- Add a maccro to specify on which platform we are deploying
-- the code. This can be used to make some adjustment in the
-- user code.
--
case POK_Flavor is
when DEOS =>
N :=
CTU.Make_Define_Statement
(Defining_Identifier => RE (RE_Ocarina_Runtime_Deos),
Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10)));
CTU.Append_Node_To_List
(N, CTN.Declarations (CTU.Current_File));
when Vxworks =>
N :=
CTU.Make_Define_Statement
(Defining_Identifier =>
RE (RE_Ocarina_Runtime_Vxworks653),
Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10)));
CTU.Append_Node_To_List
(N, CTN.Declarations (CTU.Current_File));
when POK | Arinc653 =>
N :=
CTU.Make_Define_Statement
(Defining_Identifier =>
RE (RE_Ocarina_Runtime_Pok),
Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10)));
CTU.Append_Node_To_List
(N, CTN.Declarations (CTU.Current_File));
end case;
N :=
CTU.Make_Define_Statement
(Defining_Identifier => RE (RE_Pok_Generated_Code),
......
......@@ -190,6 +190,9 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Assert_Ret_With_Exception, -- ASSERT_RET_WITH_EXCEPTION
RE_Pok_Generated_Code, -- POK_GENERATED_CODE
RE_Pok_Needs_Time, -- POK_NEEDS_TIME
RE_Ocarina_Runtime_Deos, -- OCARINA_RUNTIME_DEOS
RE_Ocarina_Runtime_Pok, -- OCARINA_RUNTIME_DEOS
RE_Ocarina_Runtime_Vxworks653, -- OCARINA_RUNTIME_DEOS
RE_Pok_Needs_Events, -- POK_NEEDS_EVENTS
RE_Pok_Needs_Threads, -- POK_NEEDS_THREADS
RE_Pok_Needs_Debug, -- POK_NEEDS_DEBUG
......@@ -732,6 +735,9 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Pok_Needs_Time => RH_Deployment,
RE_Pok_Generated_Code => RH_Deployment,
RE_Pok_Needs_Events => RH_Deployment,
RE_Ocarina_Runtime_Deos => RH_Deployment,
RE_Ocarina_Runtime_Pok => RH_Deployment,
RE_Ocarina_Runtime_Vxworks653 => RH_Deployment,
RE_Pok_Needs_Ports_Sampling => RH_Deployment,
RE_Pok_Needs_Ports_Virtual => RH_Deployment,
RE_Pok_Needs_Gettick => RH_Null,
......
......@@ -9,7 +9,7 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.C_Common.Mapping;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
-- with Ocarina.Backends.Vxworks653_Conf.Mapping;
with Ocarina.Backends.Vxworks653_Conf.Mapping;
package body Ocarina.Backends.Vxworks653_Conf.Connections is
......@@ -21,9 +21,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils;
-- use Ocarina.Backends.Vxworks653_Conf.Mapping;
use Ocarina.Backends.Vxworks653_Conf.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
......@@ -186,11 +185,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
Connection_Node := Make_XML_Node ("Connection");
Source_Node := Make_XML_Node ("Source");
Add_Attribute ("PartitionNameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(E)))),
Get_Name_String
(Map_Partition_Name (E)),
Source_Node);
Add_Attribute ("PortNameRef",
......@@ -211,11 +207,9 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
Add_Attribute ("PartitionNameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(Get_Partition_Runtime
(Partition_Destination))))),
(Map_Partition_Name
(Get_Partition_Runtime
(Partition_Destination))),
Destination_Node);
Append_Node_To_List (Destination_Node,
......
......@@ -10,7 +10,7 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
-- with Ocarina.Backends.Properties;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
-- with Ocarina.Backends.Vxworks653_Conf.Mapping;
with Ocarina.Backends.Vxworks653_Conf.Mapping;
package body Ocarina.Backends.Vxworks653_Conf.Hm is
......@@ -20,9 +20,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Hm is
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils;
-- use Ocarina.Backends.Properties;
-- use Ocarina.Backends.Vxworks653_Conf.Mapping;
use Ocarina.Backends.Vxworks653_Conf.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
......@@ -384,10 +383,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Hm is
Partition_HM_Table_Node := Make_XML_Node ("PartitionHMTable");
XTU.Add_Attribute ("Name",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Virtual_Processor)))),
(Map_Partition_Name (Virtual_Processor))
& "_hm",
Partition_HM_Table_Node);
Settings_Node := Make_XML_Node ("Settings");
......@@ -408,11 +405,9 @@ package body Ocarina.Backends.Vxworks653_Conf.Hm is
Trusted_Partition_Node := Make_XML_Node ("TrustedPartition");
XTU.Add_Attribute ("NameRef",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Virtual_Processor)))),
Settings_Node);
(Map_Partition_Name
(Virtual_Processor)),
Trusted_Partition_Node);
Append_Node_To_List (Trusted_Partition_Node,
XTN.Subitems (Settings_Node));
......
......@@ -1106,10 +1106,7 @@ package body Ocarina.Backends.Vxworks653_Conf.Mapping is
XTU.Add_Attribute ("Name",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Runtime)))),
(Map_Partition_Name (Runtime)),
Partition_Node);
--
-- Integer'Image adds a space in the beginning. To avoid that,
......@@ -1124,7 +1121,9 @@ package body Ocarina.Backends.Vxworks653_Conf.Mapping is
Append_Node_To_List (Settings_Node,
XTN.Subitems (Partition_Description_Node));
XTU.Add_Attribute ("RequiredMemorySize", "0x300000", Settings_Node);
XTU.Add_Attribute ("PartitionHMTable", "part1Hm", Settings_Node);
XTU.Add_Attribute ("PartitionHMTable",
Get_Name_String (Map_Partition_Name (Runtime)) & "_hm",
Settings_Node);
XTU.Add_Attribute ("watchDogDuration", "0", Settings_Node);
XTU.Add_Attribute ("allocDisable", "0", Settings_Node);
XTU.Add_Attribute ("numWorkerTasks", "0", Settings_Node);
......@@ -1141,22 +1140,35 @@ package body Ocarina.Backends.Vxworks653_Conf.Mapping is
Settings_Node);
Shared_Library_Region_Node := Make_XML_Node ("SharedLibraryRegion");
XTU.Add_Attribute ("NamedRef", "vxSysLib", Shared_Library_Region_Node);
XTU.Add_Attribute ("NameRef", "vxSysLib", Shared_Library_Region_Node);
Append_Node_To_List (Shared_Library_Region_Node,
XTN.Subitems (Partition_Description_Node));
Application_Node := Make_XML_Node ("Application");
Append_Node_To_List (Application_Node,
XTN.Subitems (Partition_Description_Node));
XTU.Add_Attribute ("NameRef",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Runtime)))),
Partition_Node);
(Map_Partition_Name (Runtime, True)),
Application_Node);
Append_Node_To_List (Application_Node,
XTN.Subitems (Partition_Description_Node));
return Partition_Node;
end Map_Partition;
function Map_Partition_Name (Runtime : Node_Id;
Use_Source_Name : Boolean := False)
return Name_Id is
Result : Name_Id;
begin
Result := Get_Source_Name (Runtime);
if Result /= No_Name and then Use_Source_Name then
return Result;
end if;
Result := AIN.Name
(Identifier
(Parent_Subcomponent
(Runtime)));
return Result;
end Map_Partition_Name;
end Ocarina.Backends.Vxworks653_Conf.Mapping;
......@@ -47,4 +47,8 @@ package Ocarina.Backends.Vxworks653_Conf.Mapping is
function Map_Queuing_Port (Port : Node_Id) return Node_Id;
function Map_Partition_Name (Runtime : Node_Id;
Use_Source_Name : Boolean := False)
return Name_Id;
end Ocarina.Backends.Vxworks653_Conf.Mapping;
......@@ -237,10 +237,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Naming is
Application_Node := Make_XML_Node ("Application");
XTU.Add_Attribute ("Name",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(AADL_Virtual_Processor)))),
(Map_Partition_Name
(AADL_Virtual_Processor, True)),
Application_Node);
Append_Node_To_List (Application_Node,
XTN.Subitems (XML_Node));
......@@ -334,7 +332,11 @@ package body Ocarina.Backends.Vxworks653_Conf.Naming is
Trim (Unsigned_Long_Long'Image
(Size), Left),
Port_Node);
XTU.Add_Attribute ("Name", "1", Port_Node);
XTU.Add_Attribute ("Name",
Get_Name_String
(C_Common.Mapping.Map_Port_Name (Feature)),
Port_Node);
if Is_In (Feature) and then
not Is_Out (Feature)
......
......@@ -8,7 +8,7 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
-- with Ocarina.Backends.Vxworks653_Conf.Mapping;
with Ocarina.Backends.Vxworks653_Conf.Mapping;
package body Ocarina.Backends.Vxworks653_Conf.Payloads is
......@@ -20,9 +20,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Payloads is
use Ocarina.Backends.XML_Tree.Nutils;
-- use Ocarina.Backends.Properties;
-- use Ocarina.Backends.Vxworks653_Conf.Mapping;
use Ocarina.Backends.Vxworks653_Conf.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
......@@ -200,10 +199,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Payloads is
:= Make_XML_Node ("PartitionPayload");
Add_Attribute ("NameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(Corresponding_Instance (S))))),
(Map_Partition_Name
(Corresponding_Instance (S))),
Partition_Payload_Node);
Append_Node_To_List (Partition_Payload_Node,
XTN.Subitems (Payloads_Node));
......
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