Commit 916b0c4b authored by jdelange's avatar jdelange

* ocarina/resources/deployment.aadl

   - Add bench and compcert execution platform
 
 * ocarina/src/backends/ocarina-backends-properties.adb
   ocarina/src/backends/ocarina-backends-properties.ads
   - Supports the handling of new platform values

 * ocarina/src/backends/ocarina-backends-po_hi_c.adb
   ocarina/src/backends/ocarina-backends-po_hi_c-activity.adb
   ocarina/src/backends/ocarina-backends-c_tree-nutils.adb
   ocarina/src/backends/ocarina-backends-c_tree-nutils.ads
   ocarina/src/backends/ocarina-backends-po_hi_c-runtime.ads
   ocarina/src/backends/ocarina-backends-c_common-mapping.adb
   ocarina/src/backends/ocarina-backends-c_common-mapping.ads
   ocarina/src/backends/ocarina-backends-po_hi_c-main.adb
   - Generate code compliant with compcert





git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2671 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent faf7e861
......@@ -27,6 +27,7 @@ property set Deployment is
Allowed_Execution_Platform : type enumeration
(Native, -- Native platforms (GNU/Linux, Solaris, Windows...)
Native_Compcert, -- Native platforms using the Compcert compiler
bench, -- Benchmark platform (native with instrumentation).
LEON_RTEMS, -- LEON2 board or tsim-leon (RTEMS)
LEON3_XTRATUM, -- LEON3 with Xtratum
LEON3_XM3, -- RTEMS for XTRATUM/LEON3
......
......@@ -3066,9 +3066,12 @@ package body Ocarina.Backends.C_Common.Mapping is
-- Map_Time --
--------------
function Map_Time (T : Time_Type) return Node_Id is
function Map_Time (T : Time_Type;
Variable : Name_Id := No_Name) return Node_Id is
Time : Unsigned_Long_Long;
S : Node_Id;
Parameters : constant List_Id
:= New_List (CTN.K_Parameter_List);
begin
case T.U is
when Picosecond =>
......@@ -3152,8 +3155,18 @@ package body Ocarina.Backends.C_Common.Mapping is
end if;
end case;
if Variable /= No_Name then
Append_Node_To_List
(Make_Variable_Address
(Make_Defining_Identifier (Variable)),
Parameters);
end if;
Append_Node_To_List
(Make_Literal (New_Int_Value (Time, 1, 10)), Parameters);
return Make_Call_Profile
(S, Make_List_Id (Make_Literal (New_Int_Value (Time, 1, 10))));
(S, Parameters);
end Map_Time;
-----------------------------
......
......@@ -65,7 +65,8 @@ package Ocarina.Backends.C_Common.Mapping is
procedure Bind_AADL_To_Servers (G : Node_Id; A : Node_Id);
procedure Bind_AADL_To_Entities (G : Node_Id; A : Node_Id);
function Map_Task_Job_Identifier (E : Node_Id) return Node_Id;
function Map_Time (T : Time_Type) return Node_Id;
function Map_Time (T : Time_Type;
Variable : Name_Id := No_Name) return Node_Id;
function Map_C_Enum_Name (E : Node_Id; Enumerator : Name_Id) return Name_Id;
function Map_C_Enumerator_Name (E : Node_Id;
Custom_Parent : Node_Id := No_Node;
......
......@@ -2183,6 +2183,7 @@ package body Ocarina.Backends.C_Tree.Nutils is
procedure Simulate_WCET
(Caller : Node_Id;
Declarations : List_Id;
Statements : List_Id) is
N : Node_Id;
Parameters : List_Id;
......@@ -2191,13 +2192,40 @@ package body Ocarina.Backends.C_Tree.Nutils is
begin
if Get_Current_Backend_Kind = PolyORB_HI_C then
N := Make_Variable_Declaration
(Make_Defining_Identifier
(Get_String_Name ("wcet_low")),
PHCR.RE (PHCR.RE_Time_T));
Append_Node_To_List (N, Declarations);
N := Make_Variable_Declaration
(Make_Defining_Identifier
(Get_String_Name ("wcet_high")),
PHCR.RE (PHCR.RE_Time_T));
Append_Node_To_List (N, Declarations);
if Execution_Times'Length > 0 then
Parameters := New_List (CTN.K_Parameter_List);
for J in Execution_Times'Range loop
N := Map_Time (Execution_Times (J));
Append_Node_To_List (N, Parameters);
end loop;
N := Map_Time (Execution_Times (0),
Get_String_Name ("wcet_low"));
Append_Node_To_List (N, Declarations);
N := Map_Time (Execution_Times (1),
Get_String_Name ("wcet_high"));
Append_Node_To_List (N, Declarations);
Append_Node_To_List
(Make_Variable_Address
(Make_Defining_Identifier
(Get_String_Name ("wcet_low"))),
Parameters);
Append_Node_To_List
(Make_Variable_Address
(Make_Defining_Identifier
(Get_String_Name ("wcet_high"))),
Parameters);
N := Make_Call_Profile
(PHCR.RE (PHCR.RE_Simulate_WCET), Parameters);
......
......@@ -586,6 +586,7 @@ package Ocarina.Backends.C_Tree.Nutils is
procedure Simulate_WCET
(Caller : Node_Id;
Declarations : List_Id;
Statements : List_Id);
function Make_Array_Value (Array_Name : Node_Id; Array_Item : Node_Id)
......
......@@ -967,7 +967,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
CTU.Handle_Call_Sequence
(S, Call_Seq, Declarations, WStatements);
CTU.Simulate_WCET (E, WStatements);
CTU.Simulate_WCET (E, Declarations, WStatements);
else
N := Message_Comment ("not implemented yet");
Append_Node_To_List (N, WStatements);
......
......@@ -71,8 +71,9 @@ package body Ocarina.Backends.PO_HI_C.Main is
package body Source_File is
Main_Function : Node_Id;
Current_Device : Node_Id := No_Node;
Main_Function : Node_Id;
Current_Device : Node_Id := No_Node;
Period_Variable_Declared : Boolean := False;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
......@@ -114,15 +115,32 @@ package body Ocarina.Backends.PO_HI_C.Main is
-- Add the period of the task to the parameters list. We use
-- the fact that an aperiodic thread is sporadic, with
-- period of 0.
if Period_Variable_Declared = False then
N := Make_Variable_Declaration
(Make_Defining_Identifier
(Get_String_Name ("period")),
RE (RE_Time_T));
Append_Node_To_List (N, CTN.Declarations (Main_Function));
Period_Variable_Declared := True;
end if;
if Get_Thread_Dispatch_Protocol (E) /= Thread_Aperiodic
and then Get_Thread_Dispatch_Protocol (E) /= Thread_Background
then
N := Map_Time (Get_Thread_Period (E));
N := Map_Time (Get_Thread_Period (E), Get_String_Name ("period"));
else
N := Make_Literal (New_Int_Value (0, 1, 10));
N := Map_Time ((0, Second), Get_String_Name ("period"));
end if;
Append_Node_To_List (N, Parameters);
Append_Node_To_List
(Make_Variable_Address
(Make_Defining_Identifier
(Get_String_Name ("period"))),
Parameters);
Append_Node_To_List (N, CTN.Statements (Main_Function));
-- Add the priority of the task in the parameters list. If
-- the task does not have any priority, we use the macro
......@@ -257,6 +275,8 @@ package body Ocarina.Backends.PO_HI_C.Main is
Set_Main_Source;
Ada_Initialized := False;
Period_Variable_Declared := False;
Add_Include (E => RH (RH_Activity));
-- Make the main function specification and add it in the current
......
......@@ -199,6 +199,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Bool_T, -- __po_hi_bool_t
RE_Asn1_Pkt_T, -- __po_hi_asn1_pkt_t
RE_Asn1_Buffer_T, -- __po_hi_asn1_buffer_t
RE_Time_T, -- __po_hi_time_t
RE_Byte_T, -- __po_hi_byte_t
RE_Uint64_T, -- __po_hi_uint64_t
RE_Uint32_T, -- __po_hi_uint32_t
......@@ -337,6 +338,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Protected_T => RH_PO_HI_Protected,
RE_Inetport_T => RH_PO_HI_Transport,
RE_Inetaddr_T => RH_PO_HI_Transport,
RE_Time_T => RH_PO_HI_Time,
RE_Byte_T => RH_PO_HI_Types,
RE_Asn1_Pkt_T => RH_PO_HI_Marshallers,
RE_Asn1_Buffer_T => RH_PO_HI_Marshallers,
......
......@@ -160,6 +160,9 @@ package body Ocarina.Backends.PO_HI_C is
when Platform_Native_Compcert =>
Write_Str ("compcert");
when Platform_Bench =>
Write_Str ("bench");
when Platform_LEON_RTEMS =>
Write_Str ("leon.rtems");
......
......@@ -302,6 +302,7 @@ package body Ocarina.Backends.Properties is
Size_Tera_Byte_Name : Name_Id;
Platform_Native_Name : Name_Id;
Platform_Bench_Name : Name_Id;
Platform_Native_Compcert_Name : Name_Id;
Platform_LINUX32_Name : Name_Id;
Platform_LINUX32_Xenomai_Native_Name : Name_Id;
......@@ -2610,6 +2611,8 @@ package body Ocarina.Backends.Properties is
if P_Name = Platform_Native_Name then
return Platform_Native;
elsif P_Name = Platform_Bench_Name then
return Platform_Bench;
elsif P_Name = Platform_Native_Compcert_Name then
return Platform_Native_Compcert;
elsif P_Name = Platform_LEON_RTEMS_Name then
......@@ -3156,6 +3159,7 @@ package body Ocarina.Backends.Properties is
Time_Hr_Name := Get_String_Name ("hr");
Platform_Native_Name := Get_String_Name ("native");
Platform_Bench_Name := Get_String_Name ("bench");
Platform_Native_Compcert_Name
:= Get_String_Name ("native_compcert");
Platform_X86_RTEMS_Name := Get_String_Name ("x86_rtems");
......
......@@ -571,6 +571,7 @@ package Ocarina.Backends.Properties is
type Supported_Execution_Platform is
(Platform_Native,
Platform_Native_Compcert,
Platform_Bench,
Platform_LEON_RTEMS,
Platform_X86_RTEMS,
Platform_X86_LINUXTASTE,
......
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