Commit 27245667 authored by julien.delange's avatar julien.delange
Browse files

generate information about endianness of each node



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@574 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent d6d3136d
......@@ -580,6 +580,42 @@ package body Ocarina.Backends.C_Common.Mapping is
CTN.Set_Frontend_Node (A, G);
end Bind_AADL_To_Global_Port;
-------------------------------
-- Bind_AADL_To_Global_Names --
-------------------------------
procedure Bind_AADL_To_Global_Names (G : Node_Id; A : Node_Id) is
N : Node_Id;
begin
N := AIN.Backend_Node (G);
if No (N) then
N := New_Node (CTN.K_HI_Tree_Bindings);
AIN.Set_Backend_Node (G, N);
end if;
CTN.Set_Global_Names_Node (N, A);
CTN.Set_Frontend_Node (A, G);
end Bind_AADL_To_Global_Names;
-------------------------------------
-- Bind_AADL_To_Global_Model_Names --
-------------------------------------
procedure Bind_AADL_To_Global_Model_Names (G : Node_Id; A : Node_Id) is
N : Node_Id;
begin
N := AIN.Backend_Node (G);
if No (N) then
N := New_Node (CTN.K_HI_Tree_Bindings);
AIN.Set_Backend_Node (G, N);
end if;
CTN.Set_Global_Model_Names_Node (N, A);
CTN.Set_Frontend_Node (A, G);
end Bind_AADL_To_Global_Model_Names;
-----------------------------
-- Bind_AADL_To_Local_Port --
-----------------------------
......
......@@ -53,6 +53,8 @@ package Ocarina.Backends.C_Common.Mapping is
return Node_Id;
function Map_HI_Unit (E : Node_Id) return Node_Id;
procedure Bind_AADL_To_Activity (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Global_Names (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Global_Model_Names (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Naming (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Job (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Main (G : Node_Id; A : Node_Id);
......
......@@ -460,6 +460,8 @@ module Ocarina::Backends::C_Tree::Nodes {
Node_Id Handlers_Node;
Node_Id Global_Port_Node;
Node_Id Local_Port_Node;
Node_Id Global_Names_Node;
Node_Id Global_Model_Names_Node;
Node_Id Request_Node;
Node_Id Deployment_Node;
Node_Id Entities_Node;
......
......@@ -65,6 +65,7 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package CV renames Ocarina.Backends.C_Values;
package CTN renames Ocarina.Backends.C_Tree.Nodes;
package CTU renames Ocarina.Backends.C_Tree.Nutils;
Entity_Array : Node_Id;
......@@ -99,11 +100,13 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
-- This function is used to warrant that all entities will have
-- the same values on each node.
Node_Enumerator_List : List_Id;
Tasks_Enumerator_List : List_Id;
Entity_Enumerator_List : List_Id;
Global_Port_List : List_Id;
Local_Port_List : List_Id;
Node_Enumerator_List : List_Id;
Tasks_Enumerator_List : List_Id;
Entity_Enumerator_List : List_Id;
Global_Port_List : List_Id;
Global_Port_Names : Node_Id;
Global_Port_Model_Names : Node_Id;
Local_Port_List : List_Id;
Current_Process_Instance : Node_Id := No_Node;
......@@ -628,6 +631,15 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Bind_AADL_To_Global_Port (Identifier (S), Global_Port_To_Entity);
end if;
if not Is_Empty (CTN.Values (Global_Port_Names)) then
Bind_AADL_To_Global_Names (Identifier (S), Global_Port_Names);
end if;
if not Is_Empty (CTN.Values (Global_Port_Model_Names)) then
Bind_AADL_To_Global_Model_Names
(Identifier (S), Global_Port_Model_Names);
end if;
if not Is_Empty (Local_Port_List) then
if not Invalid_Local_Port_Added then
Set_Str_To_Name_Buffer ("invalid_local_port_t");
......@@ -668,6 +680,8 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Push_Entity (C_Root);
Global_Port_List := New_List (CTN.K_Enumeration_Literals);
Global_Port_Names := Make_Array_Values;
Global_Port_Model_Names := Make_Array_Values;
Global_Port_To_Entity := Make_Array_Values;
Global_Port_To_Local := Make_Array_Values;
Entity_Enumerator_List := New_List (CTN.K_Enumeration_Literals);
......@@ -835,6 +849,19 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Append_Node_To_List
(N, CTN.Values (Global_Port_To_Entity));
N := Make_Literal
(CV.New_Pointed_Char_Value
(Map_C_Enumerator_Name
(F)));
Append_Node_To_List
(N, CTN.Values (Global_Port_Names));
N := Make_Literal
(CV.New_Pointed_Char_Value
(Display_Name (Identifier (F))));
Append_Node_To_List
(N, CTN.Values (Global_Port_Model_Names));
N := Make_Expression
(Make_Defining_Identifier
(Map_C_Enumerator_Name (F)),
......@@ -1008,12 +1035,17 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
----------------------------
procedure Visit_Process_Instance (E : Node_Id) is
U : constant Node_Id := CTN.Distributed_Application_Unit
U : constant Node_Id := CTN.Distributed_Application_Unit
(CTN.Naming_Node (Backend_Node (Identifier (E))));
P : constant Node_Id := CTN.Entity (U);
S : constant Node_Id := Parent_Subcomponent (E);
N : Node_Id;
C : Node_Id;
P : constant Node_Id := CTN.Entity (U);
S : constant Node_Id := Parent_Subcomponent (E);
N : Node_Id;
Q : Node_Id;
C : Node_Id;
Root_Sys : constant Node_Id
:= Parent_Component (Parent_Subcomponent (E));
Endiannesses : constant Node_Id := Make_Array_Values;
Execution_Platform : Supported_Execution_Platform;
begin
Push_Entity (P);
Push_Entity (U);
......@@ -1047,6 +1079,48 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Append_Node_To_List (N, CTN.Declarations (Current_File));
end if;
if Present (Backend_Node (Identifier (S))) and then
Present (CTN.Global_Names_Node (Backend_Node (Identifier (S)))) then
N := Make_Expression
(Left_Expr =>
Make_Variable_Declaration
(Defining_Identifier =>
Make_Array_Declaration
(Defining_Identifier =>
RE (RE_Port_Global_Names),
Array_Size =>
RE (RE_Nb_Ports)),
Used_Type =>
CTU.Make_Pointer_Type
(New_Node (CTN.K_Char))),
Operator => Op_Equal,
Right_Expr =>
CTN.Global_Names_Node (Backend_Node (Identifier (S))));
Append_Node_To_List (N, CTN.Declarations (Current_File));
end if;
if Present (Backend_Node (Identifier (S))) and then
Present (CTN.Global_Model_Names_Node
(Backend_Node (Identifier (S)))) then
N := Make_Expression
(Left_Expr =>
Make_Variable_Declaration
(Defining_Identifier =>
Make_Array_Declaration
(Defining_Identifier =>
RE (RE_Port_Global_Model_Names),
Array_Size =>
RE (RE_Nb_Ports)),
Used_Type =>
CTU.Make_Pointer_Type
(New_Node (CTN.K_Char))),
Operator => Op_Equal,
Right_Expr =>
CTN.Global_Model_Names_Node
(Backend_Node (Identifier (S))));
Append_Node_To_List (N, CTN.Declarations (Current_File));
end if;
if Present (Backend_Node (Identifier (S))) and then
Present (CTN.Local_Port_Node (Backend_Node (Identifier (S)))) then
N := Make_Expression
......@@ -1086,6 +1160,56 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Append_Node_To_List (N, CTN.Declarations (Current_File));
-- end if;
Q := First_Node (Subcomponents (Root_Sys));
while Present (Q) loop
if AAU.Is_Process (Corresponding_Instance (Q)) then
Execution_Platform := Get_Execution_Platform
(Get_Bound_Processor
(Corresponding_Instance (Q)));
case Execution_Platform is
when Platform_Native | Platform_None =>
Append_Node_To_List
(RE (RE_Littleendian), CTN.Values (Endiannesses));
when Platform_LEON_RTEMS =>
Append_Node_To_List
(RE (RE_Bigendian), CTN.Values (Endiannesses));
when Platform_ARM_DSLINUX =>
Append_Node_To_List
(RE (RE_Bigendian), CTN.Values (Endiannesses));
when Platform_ARM_N770 =>
Append_Node_To_List
(RE (RE_Bigendian), CTN.Values (Endiannesses));
when others =>
Append_Node_To_List
(RE (RE_Bigendian), CTN.Values (Endiannesses));
Display_Error
("Unknown endianess of " & Execution_Platform'Img,
Fatal => False);
end case;
end if;
Q := Next_Node (Q);
end loop;
N := Make_Expression
(Left_Expr =>
Make_Variable_Declaration
(Defining_Identifier =>
Make_Array_Declaration
(Defining_Identifier =>
RE (RE_Deployment_Endiannesses),
Array_Size =>
RE (RE_Nb_Nodes)),
Used_Type =>
RE (RE_Uint8_T)),
Operator => Op_Equal,
Right_Expr => Endiannesses);
Append_Node_To_List (N, CTN.Declarations (Current_File));
Pop_Entity; -- U
Pop_Entity; -- P
end Visit_Process_Instance;
......
......@@ -119,6 +119,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Simulate_WCET, -- __po_hi_simulate_wcet
RE_Sporadic_Wait, -- __po_hi_sporadic_wait
RE_Compute_Miss, -- __po_hi_compute_miss
RE_Deployment_Endiannesses, -- __po_hi_deployment_endiannesses
RE_Sporadic_Wait_Release, -- __po_hi_sporadic_wait_release
RE_Transport_Send_Default, -- __po_hi_transport_send_default
RE_Main_Deliver, -- __po_hi_main_deliver
......@@ -141,6 +142,8 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Nb_Servers, -- __PO_HI_NB_SERVERS
RE_Nb_Ports, -- __PO_HI_NB_PORTS
RE_Noport, -- __PO_HI_NOPORT
RE_Bigendian, -- __PO_HI_BIGENDIAN
RE_Littleendian, -- __PO_HI_LITTLEENDIAN
RE_Noaddr, -- __PO_HI_NB_NOADDR
RE_Unused_Node, -- __PO_HI_UNUSED_NODE
RE_Nb_Protected, -- __PO_HI_NB_PROTECTED
......@@ -183,6 +186,8 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Operation_Names, -- __po_hi_operation_names
RE_Ports_Names, -- __po_hi_port_names
RE_Port_Global_To_Entity, -- __po_hi_port_global_to_entity
RE_Port_Global_Names, -- __po_hi_port_global_names
RE_Port_Global_Model_Names, -- __po_hi_port_global_model_names
RE_Port_Global_To_Local -- __po_hi_port_global_to_local
);
......@@ -242,6 +247,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Create_Sporadic_Task => RH_PO_HI_Task,
RE_Simulate_WCET => RH_PO_HI_Utils,
RE_Compute_Miss => RH_PO_HI_Utils,
RE_Deployment_Endiannesses => RH_PO_HI_Transport,
RE_Wait_For_Next_Period => RH_PO_HI_Task,
RE_Compute_Next_Period => RH_PO_HI_Task,
RE_Initialize => RH_PO_HI_Main,
......@@ -314,6 +320,8 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Nb_Operations => RH_Request,
RE_Noaddr => RH_PO_HI_Transport,
RE_Noport => RH_PO_HI_Transport,
RE_Bigendian => RH_PO_HI_Transport,
RE_Littleendian => RH_PO_HI_Transport,
RE_Nb_Tasks => RH_Deployment,
RE_Need_Driver_Sockets => RH_Deployment,
RE_SUCCESS => RH_PO_HI_Returns,
......@@ -323,6 +331,8 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Ports_Names => RH_PO_HI_Types,
RE_Operation_Names => RH_PO_HI_Types,
RE_Port_Global_To_Entity => RH_Deployment,
RE_Port_Global_Names => RH_Deployment,
RE_Port_Global_Model_Names => RH_Deployment,
RE_Port_Global_To_Local => RH_Deployment
);
procedure Initialize;
......
......@@ -131,6 +131,8 @@ package body Ocarina.Backends.PO_HI_C is
is
pragma Unreferenced (Appli_Name,
Transport_API,
C_Sources,
Ada_Sources,
C_Libraries);
begin
Write_Str ("BINARY = ");
......@@ -205,19 +207,6 @@ package body Ocarina.Backends.PO_HI_C is
Write_Eol;
end if;
-- The 'all' target
Write_Str ("all: ");
if Length (Ada_Sources) > 0 then
Write_Str ("compile-ada-files ");
end if;
if Length (C_Sources) > 0 then
Write_Str ("compile-c-files ");
end if;
Write_Line ("compile-node");
Write_Line ("include $(RUNTIME_PATH)/make/Makefile.common");
end PolyORB_HI_C_Makefile;
......
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