Commit 13556151 authored by Jerome Hugues's avatar Jerome Hugues

* Add circuitry to rely on external project file to configure a

          GNAT runtime

          For ticket #93
parent 8dd81c27
......@@ -2301,6 +2301,9 @@ package body Ocarina.Backends.Build_Utils is
-- The execution platform of the processor the current node
-- is bound to.
Ada_Runtime : Name_Id;
-- Ada runtime to be used
Transport_API : Supported_Transport_APIs;
-- The transport API used by the current node to
-- communicate with other nodes.
......@@ -2580,6 +2583,7 @@ package body Ocarina.Backends.Build_Utils is
P.Execution_Platform :=
Get_Execution_Platform (Get_Bound_Processor (E));
P.Ada_Runtime := Get_Ada_Runtime (Get_Bound_Processor (E));
-- Get the transport API used by this node. It is
-- important to ensure that the Namings package visitors
-- have already been executed since they perform all
......@@ -2896,6 +2900,7 @@ package body Ocarina.Backends.Build_Utils is
P.Node_Name,
P.Is_Server,
P.Execution_Platform,
P.Ada_Runtime,
P.Transport_API,
P.Spec_Names,
P.Custom_Spec_Names,
......
......@@ -108,6 +108,7 @@ package Ocarina.Backends.Build_Utils is
Node_Name : Name_Id;
Is_Server : Boolean;
Execution_Platform : Supported_Execution_Platform;
Ada_Runtime : Name_Id;
Transport_API : Supported_Transport_APIs;
Spec_Names : Name_Tables.Instance;
Custom_Spec_Names : Name_Tables.Instance;
......
......@@ -188,6 +188,7 @@ package body Ocarina.Backends.Properties is
-- Processor component properties --
------------------------------------
Ada_Runtime : Name_Id;
Location : Name_Id;
Execution_Platform : Name_Id;
Scheduler_Quantum : Name_Id;
......@@ -330,6 +331,7 @@ package body Ocarina.Backends.Properties is
Platform_ARM_N770_Name : Name_Id;
Platform_MARTE_OS_Name : Name_Id;
Platform_Vxworks_Name : Name_Id;
Platform_GNAT_Runtime_Name : Name_Id;
Transport_BSD_Sockets_Name : Name_Id;
Transport_SpaceWire_Name : Name_Id;
......@@ -2461,6 +2463,8 @@ package body Ocarina.Backends.Properties is
return Platform_MARTE_OS;
elsif P_Name = Platform_Vxworks_Name then
return Platform_VxWorks;
elsif P_Name = Platform_GNAT_Runtime_Name then
return Platform_GNAT_Runtime;
else
return Platform_None;
end if;
......@@ -2469,6 +2473,17 @@ package body Ocarina.Backends.Properties is
end if;
end Get_Execution_Platform;
---------------------
-- Get_Ada_Runtime --
---------------------
function Get_Ada_Runtime (P : Node_Id) return Name_Id is
pragma Assert
(AINU.Is_Processor (P) or else AINU.Is_Virtual_Processor (P));
begin
return Get_String_Property (P, Ada_Runtime);
end Get_Ada_Runtime;
-----------------------
-- Get_Transport_API --
-----------------------
......@@ -2868,6 +2883,7 @@ package body Ocarina.Backends.Properties is
Byte_Count := Get_String_Name ("byte_count");
Word_Size := Get_String_Name ("word_size");
Ada_Runtime := Get_String_Name ("deployment::ada_runtime");
Location := Get_String_Name ("deployment::location");
Execution_Platform := Get_String_Name ("deployment::execution_platform");
Scheduler_Quantum := Get_String_Name ("scheduler_quantum");
......@@ -2983,6 +2999,7 @@ package body Ocarina.Backends.Properties is
Platform_ARM_N770_Name := Get_String_Name ("arm_n770");
Platform_MARTE_OS_Name := Get_String_Name ("marte_os");
Platform_Vxworks_Name := Get_String_Name ("vxworks");
Platform_GNAT_Runtime_Name := Get_String_Name ("gnat_runtime");
Transport_BSD_Sockets_Name := Get_String_Name ("bsd_sockets");
Transport_SpaceWire_Name := Get_String_Name ("spacewire");
......
......@@ -566,6 +566,7 @@ package Ocarina.Backends.Properties is
Platform_ARM_N770,
Platform_MARTE_OS,
Platform_VxWorks,
Platform_GNAT_Runtime,
Platform_None); -- Unspecified
function Get_Execution_Platform
......@@ -573,6 +574,9 @@ package Ocarina.Backends.Properties is
function Get_Execution_Platform (P : Node_Id) return Name_Id;
-- Return the execution platform of the given processor P
function Get_Ada_Runtime (P : Node_Id) return Name_Id;
-- return the name of the Ada runtime library for the processor P
function Get_Location (P : Node_Id) return Name_Id;
-- Return the location of the processor or device P. No_Name is
-- returned if the processor to which O is mapped does not have a
......
......@@ -102,6 +102,7 @@ package body Ocarina.Backends.PO_HI_Ada is
Node_Name : Name_Id;
Is_Server : Boolean;
Execution_Platform : Supported_Execution_Platform;
Ada_Runtime : Name_Id;
Transport_API : Supported_Transport_APIs;
Spec_Names : Name_Tables.Instance;
Custom_Spec_Names : Name_Tables.Instance;
......@@ -191,6 +192,10 @@ package body Ocarina.Backends.PO_HI_Ada is
Change_If_Empty (String_Ptr (Target_Prefix), "m");
Target := new String'("MARTEOS");
when Platform_GNAT_Runtime =>
Change_If_Empty (String_Ptr (Target_Prefix), "arm-eabi-");
Target := new String'("GNAT_Runtime");
when Platform_LEON_RTEMS | Platform_LEON_RTEMS_POSIX =>
-- Nothing to do: a special makefile is used for RTEMS
null;
......@@ -274,29 +279,48 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Eol;
if Execution_Platform = Platform_LEON_GNAT then
-- Determine which portion of code is unused and recompile the
-- the application with Eliminate pragmas.
-- Use gnateliim to determine which portion of code is
-- unused and recompile the application with Eliminate
-- pragmas. Note: gnatelim is available in GNAT GPL/Pro,
-- but not GCC
Write_Eol;
Write_Line ("elim:");
Write_Char (ASCII.HT);
Write_Line
("ADA_PROJECT_PATH=" &
Standard.Utils.Quoted
(Get_Runtime_Path ("polyorb-hi-ada") &
Path_Separator &
"$$ADA_PROJECT_PATH") &
" \");
Write_Char (ASCII.HT);
Write_Str (" $(GNAT) elim -P$(PROJECT_FILE) ");
Write_Name (Node_Name);
Write_Str (" > local.adc");
Write_Eol;
Write_Char (ASCII.HT);
Write_Str (" $(GNAT) elim -P$(PROJECT_FILE) ");
Write_Name (Node_Name);
Write_Str (" > local.adc");
Write_Eol;
Write_Char (ASCII.HT);
Write_Line
("ADA_PROJECT_PATH=" &
Standard.Utils.Quoted
(Get_Runtime_Path ("polyorb-hi-ada") &
Path_Separator &
"$$ADA_PROJECT_PATH") &
" \");
Write_Char (ASCII.HT);
Write_Str
(" $(GNATMAKE) -f -P$(PROJECT_FILE) -XTARGET=$(TARGET)" &
" -XBUILD=$(BUILD) -XCGCTRL=$(CGCTRL)" &
" -cargs -gnatec=local.adc");
Write_Char (ASCII.HT);
Write_Str
(" $(GNATMAKE) -f -P$(PROJECT_FILE) -XTARGET=$(TARGET)" &
" -XBUILD=$(BUILD) -XCGCTRL=$(CGCTRL)" &
" -cargs -gnatec=local.adc");
-- If there are C source or C libraries, there will be more
-- options.
-- If there are C source or C libraries, there will be more
-- options.
Write_Str
(" -largs $(EXTERNAL_OBJECTS) ${C_OBJECTS} ${USER_LDFLAGS}");
Write_Eol;
Write_Str
(" -largs $(EXTERNAL_OBJECTS) ${C_OBJECTS} ${USER_LDFLAGS}");
Write_Eol;
end if;
else
Write_Str ("PROGRAM = ");
Write_Name (Node_Name);
......@@ -330,6 +354,7 @@ package body Ocarina.Backends.PO_HI_Ada is
Node_Name : Name_Id;
Is_Server : Boolean;
Execution_Platform : Supported_Execution_Platform;
Ada_Runtime : Name_Id;
Transport_API : Supported_Transport_APIs;
Spec_Names : Name_Tables.Instance;
Custom_Spec_Names : Name_Tables.Instance;
......@@ -340,6 +365,12 @@ package body Ocarina.Backends.PO_HI_Ada is
pragma Unreferenced (Appli_Name, Is_Server);
begin
if Ada_Runtime /= No_Name then
Write_Str ("with """);
Write_Name (Ada_Runtime);
Write_Line (""";");
end if;
Write_Line
("with """ &
Get_Runtime_Path ("polyorb-hi-ada") &
......@@ -401,6 +432,14 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Name (Node_Name);
Write_Line (".adb"");");
if Ada_Runtime /= No_Name then
Write_Eol;
Write_Indentation;
Write_Str ("for Runtime (""Ada"") use ");
Write_Name (Ada_Runtime);
Write_Line ("'Runtime (""Ada"");");
end if;
-- The custom file names
Write_Eol;
......@@ -420,6 +459,12 @@ package body Ocarina.Backends.PO_HI_Ada is
("for Body (""PolyORB_HI.Output_Low_Level"")" &
" use ""polyorb_hi-output_low_level_leon.adb"";");
when Platform_GNAT_Runtime =>
Write_Indentation;
Write_Line
("for Body (""PolyORB_HI.Output_Low_Level"")" &
" use ""polyorb_hi-output_low_level_gnatruntime.adb"";");
when others =>
Write_Indentation;
Write_Line
......
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