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