Commit 7b27a2cc authored by Maxime Perrotin's avatar Maxime Perrotin
parents e9f477c7 3b85ace5
ignore:
- "tools/mknodes"
- "src/transfo"
- "doc"
......@@ -30,6 +30,7 @@ AC_CHECK_PROG(GNATCLEAN, gnatclean, gnatclean)
AC_CHECK_PROG(GNATLS, gnatls, gnatls)
AC_EXEEXT
AM_PATH_PYTHON
AM_GPRBUILD
dnl we need a GNU flavoured sed
AC_CHECK_PROG(HAVE_GNUSED,gnused,yes,no)
......@@ -60,11 +61,11 @@ PATH_KIND=`$GNATLS -v 2>&1 \
case ${PATH_KIND} in
"WINDOWS" | "UNIX" )
AC_MSG_RESULT($PATH_KIND)
;;
;;
* )
AC_MSG_WARN([gnatls ("$GNATLS") uses an unknown path kind: "${PATH_KIND}. Assuming UNIX path"])
PATH_KIND=UNIX
;;
AC_MSG_WARN([gnatls ("$GNATLS") uses an unknown path kind: "${PATH_KIND}. Assuming UNIX path"])
PATH_KIND=UNIX
;;
esac
AC_SUBST(PATH_KIND)
......@@ -212,26 +213,26 @@ AS_HELP_STRING([--with-ocarina-runtimes=x], [enumerate runtimes]),
do
case ${R} in
all )
for P in aadlib polyorb-hi-ada polyorb-hi-c
for P in aadlib polyorb-hi-ada polyorb-hi-c
do
if test -d ${root}/resources/runtime/${P}
then
RUNTIME_LIST="${RUNTIME_LIST}${P} "
if test -d ${root}/resources/runtime/${P}
then
RUNTIME_LIST="${RUNTIME_LIST}${P} "
else
AC_MSG_ERROR([runtime ${P} not found])
fi
fi
done
AM_CONDITIONAL(AADLIB, true)
AM_CONDITIONAL(PO_HI_ADA, true)
AM_CONDITIONAL(PO_HI_C, true)
;;
AM_CONDITIONAL(PO_HI_C, true)
;;
none )
AM_CONDITIONAL(AADLIB, false)
AM_CONDITIONAL(PO_HI_ADA, false)
AM_CONDITIONAL(PO_HI_C, false)
;;
AM_CONDITIONAL(PO_HI_ADA, false)
AM_CONDITIONAL(PO_HI_C, false)
;;
aadlib )
if test -d ${root}/resources/runtime/${R}
......@@ -240,43 +241,43 @@ AS_HELP_STRING([--with-ocarina-runtimes=x], [enumerate runtimes]),
else
AC_MSG_ERROR([runtime ${R} not found])
fi
AM_CONDITIONAL(AADLIB, true)
;;
AM_CONDITIONAL(AADLIB, true)
;;
pok )
pok )
if test -d ${root}/resources/runtime/${R}
then
RUNTIME_LIST="${RUNTIME_LIST}${R} "
else
AC_MSG_ERROR([runtime ${R} not found])
fi
AM_CONDITIONAL(POK, true)
;;
AM_CONDITIONAL(POK, true)
;;
polyorb-hi-ada )
polyorb-hi-ada )
if test -d ${root}/resources/runtime/${R}
then
RUNTIME_LIST="${RUNTIME_LIST}${R} "
else
AC_MSG_ERROR([runtime ${R} not found])
fi
AM_CONDITIONAL(PO_HI_ADA, true)
;;
AM_CONDITIONAL(PO_HI_ADA, true)
;;
polyorb-hi-c )
polyorb-hi-c )
if test -d ${root}/resources/runtime/${R}
then
RUNTIME_LIST="${RUNTIME_LIST}${R} "
else
AC_MSG_ERROR([runtime ${R} not found])
fi
AM_CONDITIONAL(PO_HI_C, true)
;;
AM_CONDITIONAL(PO_HI_C, true)
;;
* )
AC_MSG_ERROR([unknown runtime ${R}])
;;
* )
AC_MSG_ERROR([unknown runtime ${R}])
;;
esac
done
RUNTIME_LIST=`echo "$RUNTIME_LIST" | sed 's/ $//'`
......@@ -287,7 +288,7 @@ AS_HELP_STRING([--with-ocarina-runtimes=x], [enumerate runtimes]),
do
if test -d ${root}/resources/runtime/${P}
then
RUNTIME_LIST="${RUNTIME_LIST}${P} "
RUNTIME_LIST="${RUNTIME_LIST}${P} "
fi
done
......@@ -406,42 +407,42 @@ dnl may, one day, be edited automatically to remove
dnl some entries.
AC_OUTPUT([
Makefile
doc/Makefile
doc/real/Makefile
examples/Makefile
examples/real/Makefile
examples/real/lib/Makefile
examples/real/resources/Makefile
examples/real/safety/Makefile
examples/real/security/Makefile
projects/Makefile
projects-distrib/Makefile
resources/Makefile
resources/behavioural_properties/Makefile
resources/runtime/Makefile
resources/runtime/aadl_xml/Makefile
resources/runtime/alloy/Makefile
resources/runtime/cheddar/Makefile
resources/runtime/lnt/Makefile
resources/runtime/python/Makefile
projects/ocarina.gpr
projects-distrib/ocarina/ocarina_core.gpr
src/main/Makefile
src/config/ocarina-configuration.adb
src/frontends/Makefile
src/config/Makefile
src/core/Makefile
src/transfo/Makefile
src/backends/Makefile
src/python/Makefile
src/Makefile
support/Makefile
support/strip_wrapper.sh
tools/Makefile
tools/gendoc.py
tools/compare.py
ocarina-config
Makefile
doc/Makefile
doc/real/Makefile
examples/Makefile
examples/real/Makefile
examples/real/lib/Makefile
examples/real/resources/Makefile
examples/real/safety/Makefile
examples/real/security/Makefile
projects/Makefile
projects-distrib/Makefile
resources/Makefile
resources/behavioural_properties/Makefile
resources/runtime/Makefile
resources/runtime/aadl_xml/Makefile
resources/runtime/alloy/Makefile
resources/runtime/cheddar/Makefile
resources/runtime/lnt/Makefile
resources/runtime/python/Makefile
projects/ocarina.gpr
projects-distrib/ocarina/ocarina_core.gpr
src/main/Makefile
src/config/ocarina-configuration.adb
src/frontends/Makefile
src/config/Makefile
src/core/Makefile
src/transfo/Makefile
src/backends/Makefile
src/python/Makefile
src/Makefile
support/Makefile
support/strip_wrapper.sh
tools/Makefile
tools/gendoc.py
tools/compare.py
ocarina-config
])
AC_MSG_NOTICE(%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%)
......
......@@ -95,7 +95,7 @@ PARALLEL_GNATMAKE_FLAGS = -j4
all-local: $(BUILD_DIRS) maybe-generate-tree-files $(PYTHON_TARGET) $(BUILD_STAMPS)
$(BUILD_STAMPS): %-build:
$(INIT_ADA_PROJECT_PATH) $(GNATMAKE_FOR_TARGET) \
$(INIT_ADA_PROJECT_PATH) $(GPRBUILD) \
$(PARALLEL_GNATMAKE_FLAGS) -P $* $(GNATFLAGS) $(GNAT_LIB_FLAGS) \
-XABS_SRC_DIR="$(PL_DEP_ABS_SRC_DIR)" \
-XABS_BUILD_DIR="$(PL_DEP_ABS_BUILD_DIR)" \
......@@ -148,7 +148,7 @@ build-mknodes:
if [ -f $(MKNODES_SRC_DIR)/mknodes.gpr ]; then \
mkdir -p $(MKNODES_BUILD_DIR)/objects; \
$(INIT_ADA_PROJECT_PATH) \
$(GNATMAKE) -P $(MKNODES_SRC_DIR)/mknodes.gpr \
$(GPRBUILD) -P $(MKNODES_SRC_DIR)/mknodes.gpr \
-XABS_SRC_DIR="$(PL_DEP_ABS_SRC_DIR)" \
-XABS_BUILD_DIR="$(PL_DEP_ABS_BUILD_DIR)" \
$(AP_FLAGS) \
......
......@@ -31,8 +31,9 @@ property set AADL_Project is
Supported_Connection_QoS: type enumeration (GuaranteedDelivery, OrderedDelivery, SecureDelivery);
Supported_Scheduling_Protocols: type enumeration -- Updated for Cheddar
Supported_Scheduling_Protocols: type enumeration
(SporadicServer, RMS, FixedTimeline,
-- for Cheddar
PARAMETRIC_PROTOCOL,
EDF,
EARLIEST_DEADLINE_FIRST_PROTOCOL,
......@@ -50,7 +51,10 @@ property set AADL_Project is
HIERARCHICAL_CYCLIC_PROTOCOL,
HIERARCHICAL_ROUND_ROBIN_PROTOCOL,
HIERARCHICAL_FIXED_PRIORITY_PROTOCOL,
HIERARCHICAL_PARAMETRIC_PROTOCOL);
HIERARCHICAL_PARAMETRIC_PROTOCOL,
-- for AADL Inspector
RM, DM, HPF, ARINC653, static, cyclic
);
Supported_Source_Languages: type enumeration -- Updated for TASTE/Ocarina
(Ada95,
......
property set Code_Generation_Properties is
Convention: enumeration (AADL, Legacy) => Legacy applies to (subprogram);
Parameter_Usage: enumeration (By_Value, By_Reference)
applies to (data access, parameter);
Return_Parameter: aadlboolean => false applies to (parameter);
-- if true, out parameter is actually a return parameter
end Code_Generation_Properties;
......@@ -194,6 +194,11 @@ package Ocarina.Backends.C_Tree.Nutils is
M_Deadline,
M_Period,
M_Flags,
M_Nb_Dispatch_Triggers_Of_Each_Transition,
M_Nb_Transitions,
M_Dispatch_Triggers_Of_All_Transitions,
M_Nb_Of_All_Dispatch_Events,
M_States_Attributes,
M_Vars);
MN : array (Member_Id) of Name_Id;
......@@ -224,12 +229,15 @@ package Ocarina.Backends.C_Tree.Nutils is
V_Error_Status,
V_Out,
V_In,
V_Next_Complete_State,
V_Index_Transition_To_Execute,
V_Message);
VN : array (Variable_Id) of Name_Id;
type Function_Id is
(F_Process_Request, F_Register_Source, F_Init_Lane, F_Sizeof, F_Create);
(F_Process_Request, F_Register_Source, F_Init_Lane, F_Sizeof,
F_Malloc, F_Create);
FN : array (Function_Id) of Name_Id;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2019 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2020 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -69,14 +69,16 @@ package body Ocarina.Backends.Build_Utils is
(Filename : Name_Id;
Directory : Name_Id;
Basename : out Name_Id;
Dirname : out Name_Id);
-- Dirname and Basename corresponds to Dir_Name and Base_Name of
-- an intermediate filename. If Filename is an absolute path, this
-- intermediate filename is Filename. If Filename is a relative
-- path, the intermediate filename is either relative to
-- Directory, if Directory is non-null, or to the current working
-- directory if Directory is null. Directory may be relative to
-- the current directory in which case it is also normalized.
Dirname : out Name_Id;
Relative_Path : Boolean := False);
-- Split the path made of Filename and Directory into Basename and
-- Dirname (with regular shell interpretations)
--
-- * If Relative_Path is true, we disregard Directory and assume
-- the base directory to be "../.." relative to the generated code
-- directory.
-- * If Relative_Path is false, the full directory path is
-- resolved and is absolute to the user environment.
function Resolve_Language (E : Node_Id) return Supported_Source_Language;
-- Fetches the Source_Language property of E. If the property is
......@@ -153,23 +155,40 @@ package body Ocarina.Backends.Build_Utils is
(Filename : Name_Id;
Directory : Name_Id;
Basename : out Name_Id;
Dirname : out Name_Id)
Dirname : out Name_Id;
Relative_Path : Boolean := False)
is
begin
if Directory = No_Name then
if Relative_Path then
Set_Str_To_Name_Buffer ("../..");
elsif Directory = No_Name then
Set_Str_To_Name_Buffer (".");
else
Get_Name_String (Directory);
end if;
declare
Normalized_Dir : constant String :=
Normalize_Pathname (Name_Buffer (1 .. Name_Len));
(if Relative_Path then
Format_Pathname (Name_Buffer (1 .. Name_Len))
else
Normalize_Pathname (Name_Buffer (1 .. Name_Len)));
Resolved_Filename : constant String :=
Normalize_Pathname (Get_Name_String (Filename), Normalized_Dir);
(if Relative_Path then
Format_Pathname (Normalized_Dir & "/"
& Get_Name_String (Filename))
else
Normalize_Pathname (Get_Name_String (Filename),
Normalized_Dir));
begin
Dirname := Get_String_Name (Dir_Name (Resolved_Filename));
Basename := Get_String_Name (Base_Name (Resolved_Filename));
end;
end Split_Path;
------------------
......@@ -560,7 +579,8 @@ package body Ocarina.Backends.Build_Utils is
(Implem_Name,
Loc (E).Dir_Name,
Source_Basename,
Source_Dirname);
Source_Dirname,
Relative_Path => True);
if Custom_Source_Dir /= No_Name then
Source_Dirname := Custom_Source_Dir;
......@@ -596,7 +616,8 @@ package body Ocarina.Backends.Build_Utils is
(Source_Files (J),
Loc (E).Dir_Name,
Source_Basename,
Source_Dirname);
Source_Dirname,
Relative_Path => True);
-- If the directory points to the default AADL
-- property set directory (case of PolyORB-HI/C
......@@ -740,7 +761,6 @@ package body Ocarina.Backends.Build_Utils is
Set_Name_Table_Info (S_Name, 1);
Get_Name_String (Source_Files (J));
Split_Path
(Source_Files (J),
Loc (E).Dir_Name,
......@@ -1729,11 +1749,9 @@ package body Ocarina.Backends.Build_Utils is
Write_Line ("###################################################");
Write_Eol;
-- The following syntax esapces whitespace in the path
Write_Line ("RUNTIME_PATH=$(shell echo """
& Get_Runtime_Path ("polyorb-hi-c")
& """ | sed 's/ /\\ /g')");
-- The following syntax escapes whitespace in the path
Write_Line ("RUNTIME_PATH=../polyorb-hi-c");
Write_Eol;
Write_Str ("all: build-partitions resident_sw");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -47,8 +47,23 @@ package Ocarina.Backends.C_Common.BA is
function Is_To_Make_Init_Sequence (S : Node_Id) return Boolean;
function Make_Specification_Of_BA_Related_Function
(S : Node_Id;
BA_Body : Boolean := False;
BA_Initialization : Boolean := False) return Node_Id;
(S : Node_Id;
BA_Body : Boolean := False;
BA_Initialization : Boolean := False;
States_Initialization : Boolean := False;
Update_Next_Complete_State : Boolean := False) return Node_Id;
function Compute_Max_Dispatch_Transitions_Per_Complete_State
(S : Node_Id) return Unsigned_Long_Long;
function Compute_Max_Dispatch_Triggers_Per_Dispatch_Transition
(S : Node_Id) return Unsigned_Long_Long;
procedure Create_Enum_Type_Of_States_Names (S : Node_Id);
function Compute_Nb_On_Dispatch_Transitions
(S : Node_Id) return Unsigned_Long_Long;
procedure Create_State_Type (S : Node_Id);
end Ocarina.Backends.C_Common.BA;
......@@ -1032,9 +1032,12 @@ package body Ocarina.Backends.C_Common.Mapping is
-----------------------
function Map_C_Define_Name
(E : Node_Id;
Nb_Ports : Boolean := False;
Nb_States : Boolean := False) return Name_Id
(E : Node_Id;
Nb_Ports : Boolean := False;
Nb_States : Boolean := False;
Max_Dispatch_Transitions_Per_Complete_State : Boolean := False;
Max_Dispatch_Triggers_Per_Dispatch_Transition : Boolean := False)
return Name_Id
is
C_Name : Name_Id;
begin
......@@ -1051,6 +1054,12 @@ package body Ocarina.Backends.C_Common.Mapping is
Add_Str_To_Name_Buffer ("_NB_PORTS");
elsif Nb_States then
Add_Str_To_Name_Buffer ("_nb_states");
elsif Max_Dispatch_Transitions_Per_Complete_State then
Add_Str_To_Name_Buffer
("_max_dispatch_transitions_per_complete_state");
elsif Max_Dispatch_Triggers_Per_Dispatch_Transition then
Add_Str_To_Name_Buffer
("_max_dispatch_triggers_per_dispatch_transition");
end if;
else
raise Program_Error with "Wrong node kind for Map_C_Enumerator_Name";
......@@ -1067,27 +1076,27 @@ package body Ocarina.Backends.C_Common.Mapping is
-------------------------
function Map_C_Variable_Name
(E : Node_Id;
Port_Variable : Boolean := False;
Port_History : Boolean := False;
Port_Woffsets : Boolean := False;
Port_Empties : Boolean := False;
Port_First : Boolean := False;
Port_Queue : Boolean := False;
Port_Recent : Boolean := False;
Port_Fifo_Size : Boolean := False;
Port_Offsets : Boolean := False;
Port_Used_Size : Boolean := False;
Port_N_Dest : Boolean := False;
Port_Local_Dest : Boolean := False;
Port_Destinations : Boolean := False;
Port_Total_Fifo : Boolean := False;
Port_Request : Boolean := False;
Request_Variable : Boolean := False;
State_Name_T : Boolean := False;
State_T : Boolean := False;
States_Array : Boolean := False;
Current_State : Boolean := False) return Name_Id
(E : Node_Id;
Port_Variable : Boolean := False;
Port_History : Boolean := False;
Port_Woffsets : Boolean := False;
Port_Empties : Boolean := False;
Port_First : Boolean := False;
Port_Queue : Boolean := False;
Port_Recent : Boolean := False;
Port_Fifo_Size : Boolean := False;
Port_Offsets : Boolean := False;
Port_Used_Size : Boolean := False;
Port_N_Dest : Boolean := False;
Port_Local_Dest : Boolean := False;
Port_Destinations : Boolean := False;
Port_Total_Fifo : Boolean := False;
Port_Request : Boolean := False;
Request_Variable : Boolean := False;
State_Name_T : Boolean := False;
State_T : Boolean := False;
States_Array : Boolean := False;
Current_State : Boolean := False) return Name_Id
is
C_Name : Name_Id;
begin
......@@ -1161,10 +1170,11 @@ package body Ocarina.Backends.C_Common.Mapping is
------------------------------------
function Map_C_BA_Related_Function_Name
(E : Node_Id;
BA_Body : Boolean := False;
States_Initialization : Boolean := False;
BA_Initialization : Boolean := False) return Name_Id
(E : Node_Id;
BA_Body : Boolean := False;
States_Initialization : Boolean := False;
BA_Initialization : Boolean := False;
Update_Next_Complete_State : Boolean := False) return Name_Id
is
C_Name : Name_Id;
begin
......@@ -1176,9 +1186,11 @@ package body Ocarina.Backends.C_Common.Mapping is
if BA_Body then
Add_Str_To_Name_Buffer ("_ba_body");
elsif States_Initialization then
Add_Str_To_Name_Buffer ("_states_initialization");
Add_Str_To_Name_Buffer ("_states_and_current_state_initialization");
elsif BA_Initialization then
Add_Str_To_Name_Buffer ("_ba_initialization");
elsif Update_Next_Complete_State then
Add_Str_To_Name_Buffer ("_update_next_complete_state");
end if;
C_Name := Name_Find;
......
......@@ -77,9 +77,12 @@ package Ocarina.Backends.C_Common.Mapping is
Port_Type : Boolean := False;
Local_Port : Boolean := False) return Name_Id;
function Map_C_Define_Name
(E : Node_Id;
Nb_Ports : Boolean := False;
Nb_States : Boolean := False) return Name_Id;
(E : Node_Id;
Nb_Ports : Boolean := False;
Nb_States : Boolean := False;
Max_Dispatch_Transitions_Per_Complete_State : Boolean := False;
Max_Dispatch_Triggers_Per_Dispatch_Transition : Boolean := False)
return Name_Id;
function Map_C_Full_Parameter_Name
(Spg : Node_Id;
P : Node_Id;
......@@ -128,33 +131,34 @@ package Ocarina.Backends.C_Common.Mapping is
function Map_C_Operation_Name (E : Node_Id) return Name_Id;
function Map_C_Port_Data_Name (E : Node_Id; P : Node_Id) return Name_Id;
function Map_C_Variable_Name
(E : Node_Id;
Port_Variable : Boolean := False;
Port_History : Boolean := False;
Port_Woffsets : Boolean := False;
Port_Empties : Boolean := False;
Port_First : Boolean := False;
Port_Queue : Boolean := False;
Port_Recent : Boolean := False;
Port_Fifo_Size : Boolean := False;
Port_Offsets : Boolean := False;
Port_Used_Size : Boolean := False;
Port_N_Dest : Boolean := False;
Port_Local_Dest : Boolean := False;
Port_Destinations : Boolean := False;
Port_Total_Fifo : Boolean := False;
Port_Request : Boolean := False;
Request_Variable : Boolean := False;
State_Name_T : Boolean := False;
State_T : Boolean := False;
States_Array : Boolean := False;
Current_State : Boolean := False) return Name_Id;
(E : Node_Id;
Port_Variable : Boolean := False;
Port_History : Boolean := False;
Port_Woffsets : Boolean := False;
Port_Empties : Boolean := False;
Port_First : Boolean := False;
Port_Queue : Boolean := False;
Port_Recent : Boolean := False;
Port_Fifo_Size : Boolean := False;
Port_Offsets : Boolean := False;
Port_Used_Size : Boolean := False;
Port_N_Dest : Boolean := False;
Port_Local_Dest : Boolean := False;
Port_Destinations : Boolean := False;
Port_Total_Fifo : Boolean := False;
Port_Request : Boolean := False;
Request_Variable : Boolean := False;
State_Name_T : Boolean := False;
State_T : Boolean := False;
States_Array : Boolean := False;
Current_State : Boolean := False) return Name_Id;
function Map_C_BA_Related_Function_Name
(E : Node_Id;
BA_Body : Boolean := False;
States_Initialization : Boolean := False;
BA_Initialization : Boolean := False) return Name_Id;
(E : Node_Id;
BA_Body : Boolean := False;
States_Initialization : Boolean := False;
BA_Initialization : Boolean := False;
Update_Next_Complete_State : Boolean := False) return Name_Id;
function Map_Port_Data_With_Virtual_Bus
(E : Node_Id;
......
......@@ -639,16 +639,37 @@ package body Ocarina.Backends.C_Common.Subprograms is
declare
BA : Node_Id;
PL : List_Id;
P : constant Supported_Thread_Dispatch_Protocol :=
Get_Thread_Dispatch_Protocol (E);
begin
BA := Get_Behavior_Specification (E);
if BANu.Length (BATN.States (BA)) > 1 then
if P = Thread_Periodic
or else (P = Thread_Sporadic and then
Compute_Nb_On_Dispatch_Transitions (E) = 1)
then
PL := No_List;