Commit 97e1393d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Sync with subversion

parent 82de8cbd
Pipeline #350 skipped
...@@ -42,6 +42,7 @@ endif ...@@ -42,6 +42,7 @@ endif
# strip $(exec) # strip $(exec)
install: install:
$(MAKE)
cp buildsupport `ocarina-config --prefix`/bin/ cp buildsupport `ocarina-config --prefix`/bin/
cp misc/driveGnuPlotsStreams.pl `ocarina-config --prefix`/bin/ cp misc/driveGnuPlotsStreams.pl `ocarina-config --prefix`/bin/
......
...@@ -580,7 +580,8 @@ procedure BuildSupport is ...@@ -580,7 +580,8 @@ procedure BuildSupport is
if Is_In (Param_I) then if Is_In (Param_I) then
Imported_Routines.C_Add_In_Param Imported_Routines.C_Add_In_Param
(Get_Name_String (Get_Name_String
(Name (Identifier (Param_I))), (Display_Name
(Identifier (Param_I))),
Len_Name, Len_Name,
Get_Name_String Get_Name_String
(Get_Type_Source_Name (Asntype)), (Get_Type_Source_Name (Asntype)),
...@@ -595,7 +596,8 @@ procedure BuildSupport is ...@@ -595,7 +596,8 @@ procedure BuildSupport is
else else
Imported_Routines.C_Add_Out_Param Imported_Routines.C_Add_Out_Param
(Get_Name_String (Get_Name_String
(Name (Identifier (Param_I))), (Display_Name
(Identifier (Param_I))),
Len_Name, Len_Name,
Get_Name_String Get_Name_String
(Get_Type_Source_Name (Asntype)), (Get_Type_Source_Name (Asntype)),
...@@ -1172,111 +1174,120 @@ procedure BuildSupport is ...@@ -1172,111 +1174,120 @@ procedure BuildSupport is
end if; end if;
if Get_Category_Of_Component (Tmp_CI) = CC_Process then if Get_Category_Of_Component (Tmp_CI) = CC_Process then
declare
Node_Coverage : Boolean := False;
begin
if Is_Defined_Property (Tmp_CI,
"taste_dv_properties::coverageenabled")
then
Node_Coverage := Get_Boolean_Property
(Tmp_CI,
Get_String_Name ("taste_dv_properties::coverageenabled"));
if Node_Coverage then
Put_Line ("Needs Coverage");
else
Put_Line ("Needs No coverage");
end if;
end if;
CPU := Get_Bound_Processor (Tmp_CI); CPU := Get_Bound_Processor (Tmp_CI);
Set_Str_To_Name_Buffer ("");
CPU_Name := Name
(Identifier
(Parent_Subcomponent (CPU)));
CPU_Platform := Get_Execution_Platform (CPU);
if ATN.Namespace
(Corresponding_Declaration
(CPU)) /= No_Node
then
Set_Str_To_Name_Buffer ("");
Get_Name_String
(ATN.Name
(ATN.Identifier
(ATN.Namespace
(Corresponding_Declaration (CPU)))));
Pkg_Name := Name_Find;
Imported_Routines.C_Add_Package
(Get_Name_String (Pkg_Name),
Get_Name_String (Pkg_Name)'Length);
Set_Str_To_Name_Buffer (""); Set_Str_To_Name_Buffer ("");
Get_Name_String (Pkg_Name); CPU_Name := Name
Add_Str_To_Name_Buffer ("::"); (Identifier
Get_Name_String_And_Append (Name (Identifier (CPU))); (Parent_Subcomponent (CPU)));
CPU_Classifier := Name_Find;
else
CPU_Classifier := Name (Identifier (CPU));
end if;
Imported_Routines.C_New_Processor CPU_Platform := Get_Execution_Platform (CPU);
(Get_Name_String (CPU_Name),
Get_Name_String (CPU_Name)'Length,
Get_Name_String (CPU_Classifier),
Get_Name_String (CPU_Classifier)'Length,
Supported_Execution_Platform'Image (CPU_Platform),
Supported_Execution_Platform'Image (CPU_Platform)'Length);
Imported_Routines.C_New_Process if ATN.Namespace
(Get_Name_String (Corresponding_Declaration
(ATN.Name (CPU)) /= No_Node
(ATN.Component_Type_Identifier then
(Corresponding_Declaration (Tmp_CI)))),
Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI))))'Length,
Get_Name_String (Name (Identifier (Processes))),
Get_Name_String (Name (Identifier (Processes)))'Length,
NodeName, NodeName'Length);
Processes2 := First_Node (Subcomponents (My_System)); Set_Str_To_Name_Buffer ("");
Get_Name_String
(ATN.Name
(ATN.Identifier
(ATN.Namespace
(Corresponding_Declaration (CPU)))));
Pkg_Name := Name_Find;
Imported_Routines.C_Add_Package
(Get_Name_String (Pkg_Name),
Get_Name_String (Pkg_Name)'Length);
Set_Str_To_Name_Buffer ("");
Get_Name_String (Pkg_Name);
Add_Str_To_Name_Buffer ("::");
Get_Name_String_And_Append (Name (Identifier (CPU)));
CPU_Classifier := Name_Find;
else
CPU_Classifier := Name (Identifier (CPU));
end if;
while Present (Processes2) loop Imported_Routines.C_New_Processor
Tmp_CI2 := Corresponding_Instance (Processes2); (Get_Name_String (CPU_Name),
Get_Name_String (CPU_Name)'Length,
Get_Name_String (CPU_Classifier),
Get_Name_String (CPU_Classifier)'Length,
Supported_Execution_Platform'Image (CPU_Platform),
Supported_Execution_Platform'Image (CPU_Platform)'Length);
Imported_Routines.C_New_Process
(Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI)))),
Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI))))'Length,
Get_Name_String (Name (Identifier (Processes))),
Get_Name_String (Name (Identifier (Processes)))'Length,
NodeName, NodeName'Length,
Boolean'Pos (Node_Coverage));
Processes2 := First_Node (Subcomponents (My_System));
while Present (Processes2) loop
Tmp_CI2 := Corresponding_Instance (Processes2);
if Get_Category_Of_Component (Tmp_CI2) = CC_System
and then
Is_Defined_Property
(Tmp_CI2, "taste::aplc_binding")
then
Ref := Get_Reference_Property
(Tmp_CI2, Get_String_Name ("taste::aplc_binding"));
if Get_Category_Of_Component (Tmp_CI2) = CC_System if Ref = Tmp_CI then
and then declare
Is_Defined_Property Bound_APLC_Name : Unbounded_String;
(Tmp_CI2, "taste::aplc_binding")
then
Ref := Get_Reference_Property
(Tmp_CI2, Get_String_Name ("taste::aplc_binding"));
if Ref = Tmp_CI then
declare
Bound_APLC_Name : Unbounded_String;
-- constant String :=
-- Get_Name_String
-- (ATN.Name
-- (ATN.Component_Type_Identifier
-- (Corresponding_Declaration (Tmp_CI2))));
-- (Name
-- (Identifier (Processes2)));
-- (Identifier (Tmp_CI2)));
begin
begin begin
Bound_APLC_Name := To_Unbounded_String begin
(Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI2)))));
exception
when System.Assertions.Assert_Failure =>
Put_Line
("Detected DV from TASTE version 1.2");
Bound_APLC_Name := To_Unbounded_String Bound_APLC_Name := To_Unbounded_String
(Get_Name_String (Get_Name_String
(Name (Identifier (Processes2)))); (ATN.Name
end; (ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI2)))));
exception
when System.Assertions.Assert_Failure =>
Put_Line
("Detected DV from TASTE version 1.2");
Bound_APLC_Name := To_Unbounded_String
(Get_Name_String
(Name (Identifier (Processes2))));
end;
Imported_Routines.C_Add_Binding Imported_Routines.C_Add_Binding
(To_String (Bound_APLC_Name), (To_String (Bound_APLC_Name),
To_String (Bound_APLC_Name)'Length); To_String (Bound_APLC_Name)'Length);
end; end;
end if;
end if; end if;
end if;
Processes2 := Next_Node (Processes2); Processes2 := Next_Node (Processes2);
end loop; end loop;
Imported_Routines.C_End_Process; Imported_Routines.C_End_Process;
end;
end if; end if;
Processes := Next_Node (Processes); Processes := Next_Node (Processes);
......
...@@ -34,7 +34,8 @@ package Imported_Routines is ...@@ -34,7 +34,8 @@ package Imported_Routines is
Id : String; Id : String;
LenId : Integer; LenId : Integer;
Node_Name : String; Node_Name : String;
Len_Node : Integer); Len_Node : Integer;
Coverage : Integer);
procedure C_New_Processor (Name : String; procedure C_New_Processor (Name : String;
Name_Len : Integer; Name_Len : Integer;
......
This diff is collapsed.
...@@ -73,6 +73,15 @@ int ada_gw_preamble(FV * fv) ...@@ -73,6 +73,15 @@ int ada_gw_preamble(FV * fv)
FOREACH(i, Interface, fv->interfaces, { FOREACH(i, Interface, fv->interfaces, {
FOREACH(p, Parameter, i->in, ADD_TO_SET(ASN1_Module, modules, p->asn1_module)); FOREACH(p, Parameter, i->in, ADD_TO_SET(ASN1_Module, modules, p->asn1_module));
FOREACH(p, Parameter, i->out, ADD_TO_SET(ASN1_Module, modules, p->asn1_module)); FOREACH(p, Parameter, i->out, ADD_TO_SET(ASN1_Module, modules, p->asn1_module));
FOREACH(cp, Context_Parameter, fv->context_parameters, {
if (strcmp (cp->type.name, "Taste-directive") &&
strcmp (cp->type.name, "Simulink-Tunable-Parameter") &&
strcmp (cp->type.name, "Timer")) {
ADD_TO_SET(ASN1_Module,
modules,
asn2underscore(cp->type.module, strlen(cp->type.module)));
}
});
}); });
FOREACH(m, ASN1_Module, modules, { FOREACH(m, ASN1_Module, modules, {
...@@ -99,7 +108,7 @@ int ada_gw_preamble(FV * fv) ...@@ -99,7 +108,7 @@ int ada_gw_preamble(FV * fv)
"\t%s : asn1Scc%s := context_%s.%s_ctxt.%s;\n" "\t%s : asn1Scc%s := context_%s.%s_ctxt.%s;\n"
"\tpragma export(C, %s, \"%s_%s\");\n", "\tpragma export(C, %s, \"%s_%s\");\n",
cp->name, cp->name,
cp->type.name, asn2underscore(cp->type.name, strlen(cp->type.name)),
fv->name, fv->name,
fv->name, fv->name,
cp->name, cp->name,
......
/* Buildsupport is (c) 2008-2015 European Space Agency /* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int * contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */ * License is LGPL, check LICENSE file */
/* build_c_skeletons.c /* build_c_skeletons.c
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
this program generates empty C functions respecting the interfaces defined this program generates empty C functions respecting the interfaces defined
in the interface view. it provides functions to invoke RI. in the interface view. it provides functions to invoke RI.
updated 10/06/2016: properly align params and use FOREACH
updated 20/04/2009 to disable in case "-onlycv" flag is set updated 20/04/2009 to disable in case "-onlycv" flag is set
updated 8/10/2009 to rename the user_code.h/c to FV_name.h/c like in the Ada backend updated 8/10/2009 to rename the user_code.h/c to FV_name.h/c like in the Ada backend
*/ */
...@@ -58,7 +59,7 @@ void c_gw_preamble(FV * fv) ...@@ -58,7 +59,7 @@ void c_gw_preamble(FV * fv)
/* b. user_code.c preamble (if applicable) */ /* b. user_code.c preamble (if applicable) */
if (NULL != user_code_c) { if (NULL != user_code_c) {
fprintf(user_code_c, fprintf(user_code_c,
"/* Functions to be filled by the user (never overwritten by buildsupport tool) */\n\n"); "/* User code: This file will not be overwritten by TASTE. */\n\n");
fprintf(user_code_c, "#include \"%s.h\"\n\n", fv->name); fprintf(user_code_c, "#include \"%s.h\"\n\n", fv->name);
...@@ -92,12 +93,14 @@ int Init_C_GW_Backend(FV * fv, bool generateC) ...@@ -92,12 +93,14 @@ int Init_C_GW_Backend(FV * fv, bool generateC)
strlen(fv->system_ast->context->output)); strlen(fv->system_ast->context->output));
} }
build_string(&path, fv->name, strlen(fv->name)); build_string(&path, fv->name, strlen(fv->name));
build_string(&filename, fv->name, strlen(fv->name)); build_string(&filename, fv->name, strlen(fv->name));
build_string(&filename, ".h", strlen(".h")); build_string(&filename, ".h", strlen(".h"));
create_file(path, filename, &user_code_h);
create_file(path, filename, &user_code_h);
filename[strlen(filename) - 1] = 'c'; /* change from .h to .c */ filename[strlen(filename) - 1] = 'c'; /* change from .h to .c */
if (cpp == fv->language) {
build_string(&filename, "c", 1); /* change from .c to .cc */
}
if (!file_exists(path, filename) && true == generateC) if (!file_exists(path, filename) && true == generateC)
create_file(path, filename, &user_code_c); create_file(path, filename, &user_code_c);
...@@ -131,79 +134,92 @@ void close_c_gw_files() ...@@ -131,79 +134,92 @@ void close_c_gw_files()
*/ */
void add_PI_to_C_gw(Interface * i) void add_PI_to_C_gw(Interface * i)
{ {
Parameter_list *tmp;
if (NULL == user_code_h) if (NULL == user_code_h)
return; return;
fprintf(user_code_h, "void %s_PI_%s(", i->parent_fv->name, i->name); char *signature = make_string("void %s_PI_%s(",
if (NULL != user_code_c) i->parent_fv->name,
fprintf(user_code_c, "void %s_PI_%s(", i->parent_fv->name, i->name);
i->name);
tmp = i->in; size_t sig_len = strlen(signature);
char *sep = make_string(",\n%*s", sig_len, "");
bool comma = false;
while (NULL != tmp) { fprintf(user_code_h, "%s", signature);
fprintf(user_code_h, "%sconst asn1Scc%s *",
(tmp != i->in) ? ", " : "", tmp->value->type);
if (NULL != user_code_c)
fprintf(user_code_c, "%sconst asn1Scc%s *IN_%s",
(tmp != i->in) ? ", " : "",
tmp->value->type, tmp->value->name);
tmp = tmp->next;
}
tmp = i->out; if (NULL != user_code_c) {
fprintf(user_code_c, "%s", signature);
while (NULL != tmp) {
fprintf(user_code_h, "%sasn1Scc%s *",
(tmp != i->out
|| (tmp == i->out
&& NULL != i->in)) ? ", " : "", tmp->value->type);
if (NULL != user_code_c)
fprintf(user_code_c, "%sasn1Scc%s *OUT_%s",
(tmp != i->out
|| (tmp == i->out
&& NULL != i->in)) ? ", " : "", tmp->value->type,
tmp->value->name);
tmp = tmp->next;
} }
FOREACH (p, Parameter, i->in, {
char *sort = make_string("%sconst asn1Scc%s *",
comma? sep: "",
p->type);
fprintf(user_code_h, "%s", sort);
if(NULL != user_code_c) {
fprintf(user_code_c, "%sIN_%s",
sort,
p->name);
}
free(sort);
comma = true;
});
FOREACH (p, Parameter, i->out, {
char *sort = make_string("%sasn1Scc%s *",
comma? sep: "",
p->type);
fprintf(user_code_h, "%s", sort);
if(NULL != user_code_c) {
fprintf(user_code_c, "%sOUT_%s",
sort,
p->name);
}
free(sort);
comma = true;
});
fprintf(user_code_h, ");\n\n"); fprintf(user_code_h, ");\n\n");
if (NULL != user_code_c) if (NULL != user_code_c)
fprintf(user_code_c, ")\n{\n /* Write your code here! */\n}\n\n"); fprintf(user_code_c, ")\n{\n /* Write your code here! */\n}\n\n");
free(signature);
free(sep);
} }
/* Declaration of the RI in user_code.h */ /* Declaration of the RI in user_code.h */
void add_RI_to_C_gw(Interface * i) void add_RI_to_C_gw(Interface * i)
{ {
Parameter_list *tmp;
if (NULL == user_code_h) if (NULL == user_code_h)
return; return;
fprintf(user_code_h, "extern void %s_RI_%s(", i->parent_fv->name, char *signature = make_string("extern void %s_RI_%s(",
i->name); i->parent_fv->name,
i->name);
tmp = i->in; size_t sig_len = strlen(signature);
char *sep = make_string(",\n%*s", sig_len, "");
bool comma = false;
while (NULL != tmp) { fprintf(user_code_h, "%s", signature);
fprintf(user_code_h, "%sconst asn1Scc%s *",
(tmp != i->in) ? ", " : "", tmp->value->type);
tmp = tmp->next;
}
tmp = i->out; FOREACH (p, Parameter, i->in, {
fprintf(user_code_h, "%sconst asn1Scc%s *",
comma? sep: "",
p->type);
comma = true;
});
while (NULL != tmp) { FOREACH (p, Parameter, i->out, {
fprintf(user_code_h, "%sasn1Scc%s *", fprintf(user_code_h,"%sconst asn1Scc%s *",
(tmp != i->out comma? sep: "",
|| (tmp == i->out p->type);
&& NULL != i->in)) ? ", " : "", tmp->value->type); comma = true;
tmp = tmp->next; });
}
fprintf(user_code_h, ");\n\n"); fprintf(user_code_h, ");\n\n");
free(signature);
free(sep);
} }
/* Add timer declarations to the C code skeletons */ /* Add timer declarations to the C code skeletons */
......
/* Buildsupport is (c) 2008-2015 European Space Agency /* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int * contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */ * License is LGPL, check LICENSE file */
/* build_script.c /* build_script.c
this backend generates parts of the build_sample.sh script that are project-specific. this backend generates the build script that generates the binary files
1st version 20 may 2009 1st version 20 may 2009
...@@ -105,20 +105,34 @@ void Create_script() ...@@ -105,20 +105,34 @@ void Create_script()
fprintf (script, "SKELS=\"%s\"\n\n", OUTPUT_PATH); fprintf (script, "SKELS=\"%s\"\n\n", OUTPUT_PATH);
fprintf (script, "# Update the data view with local paths\n"
"taste-update-data-view\n\n");
/* OpenGEODE-specific: call code generator on the fly */
FOREACH (fv, FV, get_system_ast()->functions, {
if (sdl == fv->language) {
fprintf(script,
"# Generate code for OpenGEODE function %s\n"
"cd \"$SKELS\"/%s && "
"opengeode --toAda %s.pr system_structure.pr "
"&& cd $OLDPWD\n\n",
fv->name, fv->name, fv->name);
}
});
/* Remove old zip files and create fresh new ones from user code */ /* Remove old zip files and create fresh new ones from user code */
fprintf (script, "cd \"$SKELS\"\n");
FOREACH (fv, FV, get_system_ast()->functions, { FOREACH (fv, FV, get_system_ast()->functions, {
//if (sdl != fv->language PUT BACK WHEN OPENGEODE FULLY SUPPORTED //if (sdl != fv->language PUT BACK WHEN OPENGEODE FULLY SUPPORTED
if (vhdl != fv->language if (vhdl != fv->language
&& gui != fv->language && gui != fv->language
&& rtds != fv->language && rtds != fv->language
&& NULL == fv->zipfile) { && NULL == fv->zipfile) {
fprintf (script, "rm -f %s.zip\n", fv->name); fprintf (script,
fprintf (script, "zip %s %s/*\n", fv->name, fv->name); "cd \"$SKELS\" && rm -f %s.zip && "
"zip %s %s/* && cd $OLDPWD\n\n",
fv->name, fv->name, fv->name);
} }
}) })
fprintf (script, "cd \"$OLDPWD\"\n\n");
fprintf (script, "[ ! -z \"$CLEANUP\" ] && rm -rf binary\n\n"); fprintf (script, "[ ! -z \"$CLEANUP\" ] && rm -rf binary\n\n");
...@@ -215,11 +229,21 @@ void Create_script() ...@@ -215,11 +229,21 @@ void Create_script()
} }
}) })
/* If node is configured with code coverage flag, set the option */
FOREACH (process, Process, get_system_ast()->processes, {
if (true == process->coverage) {
fprintf(script,
" \\\n\t--nodeOptions %s@gcov=on",