Commit 75597c42 authored by yoogx's avatar yoogx

* Add support for USER_CFLAGS and USER_LDFLAG properties

        For issue #95
parent f93ecc54
......@@ -54,6 +54,13 @@ property set Deployment is
-- Execution platform of a processor
Ada_Runtime : aadlstring applies to (processor);
-- If Execution_Platform is set to GNAT_Runtime, this property
-- points to the name of the GNAT Project file that configures the
-- Ada_Runtime, e.g. from the Ada Device Drivers project.
USER_CFLAGS : aadlstring applies to (processor);
USER_LDFLAGS : aadlstring applies to (processor);
-- User defined CFLAGS and LDFLAGS
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -320,6 +320,9 @@ package body Ocarina.Backends.Build_Utils is
-- The execution platform of the processor the current node
-- is bound to.
USER_CFLAGS : Name_Id := No_Name;
USER_LDFLAGS : Name_Id := No_Name;
Transport_API : Supported_Transport_APIs;
-- The transport API used by the current node to
-- communicate with other nodes.
......@@ -960,6 +963,11 @@ package body Ocarina.Backends.Build_Utils is
M.Execution_Platform_Name :=
Get_Execution_Platform (Get_Bound_Processor (E));
M.USER_CFLAGS :=
Get_User_CFLAGS (Get_Bound_Processor (E));
M.USER_LDFLAGS :=
Get_User_LDFLAGS (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
......@@ -1562,6 +1570,8 @@ package body Ocarina.Backends.Build_Utils is
M.Node_Name,
M.Execution_Platform,
M.Execution_Platform_Name,
M.USER_CFLAGS,
M.USER_LDFLAGS,
M.Transport_API,
M.Ada_Sources,
M.Asn_Sources,
......
......@@ -70,6 +70,8 @@ package Ocarina.Backends.Build_Utils is
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
USER_CFLAGS : Name_Id;
USER_LDFLAGS : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......
......@@ -189,6 +189,8 @@ package body Ocarina.Backends.Properties is
------------------------------------
Ada_Runtime : Name_Id;
User_CFLAGS : Name_Id;
User_LDFLAGS : Name_Id;
Location : Name_Id;
Execution_Platform : Name_Id;
Scheduler_Quantum : Name_Id;
......@@ -2484,6 +2486,28 @@ package body Ocarina.Backends.Properties is
return Get_String_Property (P, Ada_Runtime);
end Get_Ada_Runtime;
---------------------
-- Get_USER_CFLAGS --
---------------------
function Get_USER_CFLAGS (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, USER_CFLAGS);
end Get_USER_CFLAGS;
---------------------
-- Get_USER_LDFLAGS --
---------------------
function Get_USER_LDFLAGS (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, USER_LDFLAGS);
end Get_USER_LDFLAGS;
-----------------------
-- Get_Transport_API --
-----------------------
......@@ -2884,6 +2908,8 @@ package body Ocarina.Backends.Properties is
Word_Size := Get_String_Name ("word_size");
Ada_Runtime := Get_String_Name ("deployment::ada_runtime");
USER_CFLAGS := Get_String_Name ("deployment::user_cflags");
USER_LDFLAGS := Get_String_Name ("deployment::user_ldflags");
Location := Get_String_Name ("deployment::location");
Execution_Platform := Get_String_Name ("deployment::execution_platform");
Scheduler_Quantum := Get_String_Name ("scheduler_quantum");
......
......@@ -575,7 +575,11 @@ package Ocarina.Backends.Properties is
-- 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
-- Return the name of the Ada runtime library for the processor P
function Get_USER_CFLAGS (P : Node_Id) return Name_Id;
function Get_USER_LDFLAGS (P : Node_Id) return Name_Id;
-- Return USER_CFLAGS and USER_LDFLGAS property for processor P
function Get_Location (P : Node_Id) return Name_Id;
-- Return the location of the processor or device P. No_Name is
......
......@@ -81,6 +81,8 @@ package body Ocarina.Backends.PO_HI_Ada is
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
USER_CFLAGS : Name_Id;
USER_LDFLAGS : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -130,6 +132,8 @@ package body Ocarina.Backends.PO_HI_Ada is
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
USER_CFLAGS : Name_Id;
USER_LDFLAGS : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -214,10 +218,16 @@ package body Ocarina.Backends.PO_HI_Ada is
Write_Line ("TARGET = " & Target.all);
Write_Line ("BUILD = Debug");
Write_Line ("CGCTRL = No");
Free (Target_Prefix);
Free (Target);
Write_Str ("USER_CFLAGS =");
Write_Name (USER_CFLAGS);
Write_Eol;
Write_Str ("USER_LDFLAGS =");
Write_Name (USER_LDFLAGS);
Write_Eol;
-- Project file
Write_Str ("PROJECT_FILE = ");
......
......@@ -106,6 +106,8 @@ package body Ocarina.Backends.PO_HI_C is
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
USER_CFLAGS : Name_Id;
USER_LDFLAGS : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -128,6 +130,8 @@ package body Ocarina.Backends.PO_HI_C is
Node_Name : Name_Id;
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id;
USER_CFLAGS : Name_Id;
USER_LDFLAGS : Name_Id;
Transport_API : Supported_Transport_APIs;
Ada_Sources : Name_Tables.Instance;
Asn_Sources : Name_Tables.Instance;
......@@ -173,6 +177,18 @@ package body Ocarina.Backends.PO_HI_C is
Write_Eol;
end if;
if USER_CFLAGS /= No_Name then
Write_Str ("USER_CFLAGS = ");
Write_Name (USER_CFLAGS);
Write_Eol;
end if;
if USER_LDFLAGS /= No_Name then
Write_Str ("USER_LDFLAGS = ");
Write_Name (USER_LDFLAGS);
Write_Eol;
end if;
Write_Str ("BINARY = ");
Write_Name (Node_Name);
Write_Eol;
......
......@@ -86,6 +86,12 @@ property set Deployment is
Ada_Runtime : aadlstring
applies to (processor);
USER_CFLAGS : aadlstring
applies to (processor);
USER_LDFLAGS : aadlstring
applies to (processor);
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -86,6 +86,12 @@ property set Deployment is
Ada_Runtime : aadlstring
applies to (processor);
USER_CFLAGS : aadlstring
applies to (processor);
USER_LDFLAGS : aadlstring
applies to (processor);
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -86,6 +86,12 @@ property set Deployment is
Ada_Runtime : aadlstring
applies to (processor);
USER_CFLAGS : aadlstring
applies to (processor);
USER_LDFLAGS : aadlstring
applies to (processor);
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -86,6 +86,12 @@ property set Deployment is
Ada_Runtime : aadlstring
applies to (processor);
USER_CFLAGS : aadlstring
applies to (processor);
USER_LDFLAGS : aadlstring
applies to (processor);
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -86,6 +86,12 @@ property set Deployment is
Ada_Runtime : aadlstring
applies to (processor);
USER_CFLAGS : aadlstring
applies to (processor);
USER_LDFLAGS : aadlstring
applies to (processor);
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -82,6 +82,12 @@ property set Deployment is
Ada_Runtime : aadlstring
applies to (processor);
USER_CFLAGS : aadlstring
applies to (processor);
USER_LDFLAGS : aadlstring
applies to (processor);
Supported_Execution_Platform : list of Deployment::Allowed_Execution_Platform
applies to (device);
......
......@@ -57,8 +57,8 @@ ocarina: Total: 0 error and 33 warnings
package Nav_Types
public
public
data Integer
properties
Source_Data_Size => 32 bits;
......
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