Commit afe3a296 authored by Julien's avatar Julien

* Add a maccro for the target to be deployed

   for example OCARINA_RUNTIME_DEOS indicates
   that we deploy the system on top of Deos
 * For a type, Type_Source_Name will override any other
   assumption from the compiler. This lets the user indicates
   its own mapping to the implementation type
 * Fix an include issue, in subprograms.c includes
   "subprograms.h" instead of <subprograms.h>, which
   creates errors for DeOS
parent a3bc642c
......@@ -440,6 +440,19 @@ package body Ocarina.Backends.C_Common.Types is
Data_Size := Get_Data_Size (E);
Actual_Data_Size := To_Bytes (Data_Size);
Type_Source_Name := Get_Type_Source_Name (E);
--
-- If the user specifies Type_Source_Name property
-- on the data type, then, the generator takes
-- it over everything else. This is a way to
-- override some assumptions from the code generator.
--
if Type_Source_Name /= No_Name then
Data_Representation := Data_None;
end if;
case Data_Representation is
when Data_Boolean =>
N :=
......@@ -743,8 +756,6 @@ package body Ocarina.Backends.C_Common.Types is
Fatal => True);
when Data_None =>
Type_Source_Name := Get_Type_Source_Name (E);
if Type_Source_Name /= No_Name then
N :=
Make_Full_Type_Declaration
......
......@@ -110,8 +110,9 @@ package body Ocarina.Backends.PO_HI_C.Runtime is
----------------
procedure Initialize is
Name : Name_Id;
N : Node_Id;
Name : Name_Id;
N : Node_Id;
Local : Boolean;
begin
-- Initialize the runtime only once
......@@ -120,6 +121,7 @@ package body Ocarina.Backends.PO_HI_C.Runtime is
end if;
Initialized := True;
Local := False;
Register_Casing_Rule ("AADL");
Register_Casing_Rule ("char_array");
......@@ -157,7 +159,13 @@ package body Ocarina.Backends.PO_HI_C.Runtime is
N := New_Node (K_Defining_Identifier);
Set_Name (N, Name);
RHD (E) := Make_Include_Clause (N, False);
if E = RH_Subprograms then
Local := True;
else
Local := False;
end if;
RHD (E) := Make_Include_Clause (N, Local);
end loop;
for E in RC_Id loop
......
......@@ -1154,6 +1154,42 @@ package body Ocarina.Backends.POK_C.Deployment is
Bound_Processor := Get_Bound_Processor (Associated_Component);
end if;
--
-- Add a maccro to specify on which platform we are deploying
-- the code. This can be used to make some adjustment in the
-- user code.
--
case POK_Flavor is
when DEOS =>
N :=
CTU.Make_Define_Statement
(Defining_Identifier => RE (RE_Ocarina_Runtime_Deos),
Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10)));
CTU.Append_Node_To_List
(N, CTN.Declarations (CTU.Current_File));
when Vxworks =>
N :=
CTU.Make_Define_Statement
(Defining_Identifier =>
RE (RE_Ocarina_Runtime_Vxworks653),
Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10)));
CTU.Append_Node_To_List
(N, CTN.Declarations (CTU.Current_File));
when POK | Arinc653 =>
N :=
CTU.Make_Define_Statement
(Defining_Identifier =>
RE (RE_Ocarina_Runtime_Pok),
Value => CTU.Make_Literal (CV.New_Int_Value (1, 1, 10)));
CTU.Append_Node_To_List
(N, CTN.Declarations (CTU.Current_File));
end case;
N :=
CTU.Make_Define_Statement
(Defining_Identifier => RE (RE_Pok_Generated_Code),
......
......@@ -190,6 +190,9 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Assert_Ret_With_Exception, -- ASSERT_RET_WITH_EXCEPTION
RE_Pok_Generated_Code, -- POK_GENERATED_CODE
RE_Pok_Needs_Time, -- POK_NEEDS_TIME
RE_Ocarina_Runtime_Deos, -- OCARINA_RUNTIME_DEOS
RE_Ocarina_Runtime_Pok, -- OCARINA_RUNTIME_DEOS
RE_Ocarina_Runtime_Vxworks653, -- OCARINA_RUNTIME_DEOS
RE_Pok_Needs_Events, -- POK_NEEDS_EVENTS
RE_Pok_Needs_Threads, -- POK_NEEDS_THREADS
RE_Pok_Needs_Debug, -- POK_NEEDS_DEBUG
......@@ -732,6 +735,9 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Pok_Needs_Time => RH_Deployment,
RE_Pok_Generated_Code => RH_Deployment,
RE_Pok_Needs_Events => RH_Deployment,
RE_Ocarina_Runtime_Deos => RH_Deployment,
RE_Ocarina_Runtime_Pok => RH_Deployment,
RE_Ocarina_Runtime_Vxworks653 => RH_Deployment,
RE_Pok_Needs_Ports_Sampling => RH_Deployment,
RE_Pok_Needs_Ports_Virtual => RH_Deployment,
RE_Pok_Needs_Gettick => RH_Null,
......
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