Commits (11)
......@@ -24,8 +24,9 @@ ifeq ($(UNAME), Linux)
fi ; \
fi
endif
# Extraflag: set --target=x86_64-linux on 64 bits platforms
ADA_PROJECT_PATH=`ocarina-config --prefix`/lib/gnat:$$ADA_PROJECT_PATH \
$(gnatpath)gprbuild -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug"
$(gnatpath)gprbuild -x -g $(exec) -p -P buildsupport.gpr -XBUILD="debug" ${EXTRAFLAG}
install:
$(MAKE)
......
......@@ -80,7 +80,7 @@ void Call_asn2dataModel(FV * fv)
if (!file_exists(dataview_path, dataview_uniq)) {
printf
("[Information] %s/%s not found. Checking for dataview-uniq.asn\n",
("[INFO] %s/%s not found. Checking for dataview-uniq.asn\n",
dataview_path, dataview_uniq);
free(dataview_uniq);
dataview_uniq = make_string("dataview-uniq.asn");
......
/* Buildsupport is (c) 2008-2015 European Space Agency
/* Buildsupport is (c) 2008-2017 European Space Agency
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
/* build_ada_skeletons.c
......@@ -6,23 +6,8 @@
this program generates empty Ada functions respecting the interfaces defined
in the interface view. it provides functions to invoke RI.
Note on the use of the Ada skeletons:
Generated functions for PI are called by C code with parameters passed as
pointers. In Ada, pointers are expressed using the "access" keyword instead
of "in" or "out". To access the variable values, the ".all" postfix can be
used. And to declare a variable for which an access is necessary, the type
must be "aliased". Complete example:
procedure Compute (my_input: access asn1sccT_SEQUENCE) is -- Provided interface
my_output: aliased T_INTEGER; -- Parameter of a Required Interface
begin
my_output := my_input.all.x + my_input.all.y;
required_interface (my_output'access); -- Call Required Interface
end Compute;
Copyright 2014-2015 IB Krates <info@krates.ee>
QGenc code generator integration
*/
#include <stdio.h>
......@@ -105,8 +90,8 @@ int ada_gw_preamble(FV * fv)
strcmp (cp->type.name, "Timer")) {
fprintf(ads,
"\t%s : asn1Scc%s := context_%s.%s_ctxt.%s;\n"
"\tpragma export(C, %s, \"%s_%s\");\n",
" %s : asn1Scc%s := context_%s.%s_ctxt.%s;\n"
" pragma Export(C, %s, \"%s_%s\");\n",
cp->name,
asn2underscore(cp->type.name, strlen(cp->type.name)),
fv->name,
......@@ -180,7 +165,7 @@ int Init_Ada_GW_Backend(FV * fv)
create_file(path, filename, &adb);
assert(NULL != adb);
} else
INFO ("** Information: User code not overwritten for function %s\n",
INFO ("[INFO] User code not overwritten for function %s\n",
fv->name);
free(path);
......@@ -231,10 +216,10 @@ void add_PI_to_Ada_gw(Interface * i)
return;
fprintf(ads,
"\t---------------------------------------------------------\n"
"\t-- Provided interface \"%s\"\n"
"\t---------------------------------------------------------\n"
"\tprocedure %s",
" -- ---------------------------------------------------- --\n"
" -- Provided interface \"%s\"\n"
" -- ---------------------------------------------------- --\n"
" procedure %s",
i->name,
i->name);
......@@ -255,15 +240,15 @@ void add_PI_to_Ada_gw(Interface * i)
}
fprintf(ads, ";\n");
fprintf(ads, "\tpragma export(C, %s, \"%s_PI_%s\");\n\n", i->name,
fprintf(ads, " pragma Export(C, %s, \"%s_PI_%s\");\n\n", i->name,
i->parent_fv->name, i->name);
if (NULL != adb) {
fprintf(adb,
"\t---------------------------------------------------------\n"
"\t-- Provided interface \"%s\"\n"
"\t---------------------------------------------------------\n"
"\tprocedure %s",
" -- ------------------------------------------------ --\n"
" -- Provided interface \"%s\"\n"
" -- ------------------------------------------------ --\n"
" procedure %s",
i->name,
i->name);
}
......@@ -276,12 +261,12 @@ void add_PI_to_Ada_gw(Interface * i)
if (NULL != adb) {
fprintf(adb,
" is\n\tpragma suppress (all_checks);"
"\n\tbegin\n\n");
" is\n pragma Suppress (All_Checks);"
"\n begin\n\n");
fprintf(adb,
"\t\tnull;"
" -- Replace \"null\" with your own code!\n\n\tend %s;\n\n",
" null;"
" -- Replace \"null\" with your own code!\n\n end %s;\n\n",
i->name);
}
......@@ -300,10 +285,10 @@ void add_RI_to_Ada_gw(Interface * i)
return;
fprintf(ads,
"\t---------------------------------------------------------\n"
"\t-- Required interface \"%s\"\n"
"\t---------------------------------------------------------\n"
"\tprocedure %s",
" -- --------------------------------------------------- --\n"
" -- Required interface \"%s\"\n"
" -- --------------------------------------------------- --\n"
" procedure %s",
i->name,
i->name);
......@@ -324,20 +309,17 @@ void add_RI_to_Ada_gw(Interface * i)
fprintf(ads, ";\n");
fprintf(ads, "\tpragma import(C, %s, \"%s_RI_%s\");\n", i->name,
fprintf(ads, " pragma Import(C, %s, \"%s_RI_%s\");\n", i->name,
i->parent_fv->name, i->name);
fprintf(ads, "\tprocedure RI%s", i->name);
fprintf(ads, " procedure RI%s", i->name);
if (NULL != ada_params) {
fprintf(ads, "(%s)", ada_params);
}
fprintf(ads, " renames %s;\n\n", i->name);
free(ada_params);
ada_params = NULL;
}
/* Add timer declarations to the Ada code skeletons */
......@@ -345,23 +327,23 @@ void Ada_Add_timers (FV *fv)
{
if (NULL != fv->timer_list) {
fprintf (ads,
"\t---------------------------------------------------------\n"
"\t-- Timers management --\n"
"\t---------------------------------------------------------\n"
" -- ------------------------------------------------ --\n"
" -- Timers management --\n"
" -- ------------------------------------------------ --\n"
"\n\n");
}
FOREACH(timer, String, fv->timer_list, {
fprintf(ads,
"\t-- This function is called when the timer \"%s\" expires\n"
"\tprocedure %s;\n"
"\tpragma export(C, %s, \"%s_PI_%s\");\n\n"
"\t-- Call this function to set (enable) the timer\n"
"\t-- Value is in milliseconds, and must be a multiple of 100\n"
"\tprocedure SET_%s(val: access asn1sccT_UInt32);\n\n"
"\tpragma import(C, SET_%s, \"%s_RI_SET_%s\");\n\n"
"\t-- Call this function to reset (disable) the timer\n"
"\tprocedure RESET_%s;\n\n"
"\tpragma import(C, RESET_%s, \"%s_RI_RESET_%s\");\n\n",
" -- This function is called when the timer \"%s\" expires\n"
" procedure %s;\n"
" pragma Export(C, %s, \"%s_PI_%s\");\n\n"
" -- Call this function to set (enable) the timer\n"
" -- Value is in milliseconds, and must be a multiple of 100\n"
" procedure Set_%s(val: access asn1sccT_UInt32);\n\n"
" pragma Import(C, Set_%s, \"%s_RI_SET_%s\");\n\n"
" -- Call this function to reset (disable) the timer\n"
" procedure Reset_%s;\n\n"
" pragma Import(C, Reset_%s, \"%s_RI_RESET_%s\");\n\n",
timer,
timer,
timer,
......@@ -377,11 +359,11 @@ void Ada_Add_timers (FV *fv)
timer);
if (NULL != adb) {
fprintf(adb,
"\t-- This function is called when the timer \"%s\" expires \n"
"\tprocedure %s is\n"
"\tbegin\n"
"\t null; -- Replace \"null\" with your own code!\n"
"\tend;\n\n",
" -- This function is called when the timer \"%s\" expires \n"
" procedure %s is\n"
" begin\n"
" null; -- Replace \"null\" with your own code!\n"
" end;\n\n",
timer,
timer);
}
......@@ -412,9 +394,9 @@ void GW_Ada_Backend(FV * fv)
* input queue of the process before executing continuous signals */
if(get_context()->polyorb_hi_c) {
fprintf(ads,
"\t-- TASTE API to check if the input queue is empty\n"
"\tprocedure check_queue(res: access asn1SccT_Boolean);\n"
"\tpragma import(C, check_queue, \"%s_RI_check_queue\");\n",
" -- TASTE API to check if the input queue is empty\n"
" procedure Check_Queue(res: access asn1SccT_Boolean);\n"
" pragma Import(C, Check_Queue, \"%s_RI_check_queue\");\n",
fv->name);
}
......
......@@ -91,7 +91,7 @@ int Init_Driver_GW_Backend(FV * fv)
if (!file_exists(path, filename))
create_file(path, filename, &driver_c);
else {
ERROR ("** Information: driver code not overwritten\n");
ERROR ("[INFO] driver code not overwritten\n");
driver_c = NULL;
}
......@@ -111,7 +111,7 @@ void close_driver_gw_files()
{
fprintf(driver_h, "\n#endif\n");
close_file(&driver_h);
close_file(&driver_c);
}
......
/* Buildsupport is (c) 2008-2015 European Space Agency
/* Buildsupport is (c) 2008-2017 European Space Agency
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
/* build_gui_glue.c
this program generates the code to interface a GUI with the assert virtual machine
author: cyril colombo/Vega for ESA (this guy is a genuine mercenaire...)(but the best one)
this program generates the code to interface a GUI with a TASTE binary
author: Cyril Colombo/ESA (this guy is a genuine mercenaire...)(but the best one)
updated 20/04/2009 to disable in case "-onlycv" flag is set
*/
#define ID "$Id: build_gui_glue.c 437 2010-01-06 09:19:17Z maxime1008 $"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -28,14 +25,13 @@
*/
#define C_MAX_NUMBER_MESSAGES 5
/* Constant defining the maximen number of character in a line of a source file */
/* Constant defining the maximum number of characters in a line of a source file */
#define C_MAX_LINE_SIZE 256
/*Constant defining the maximum number of characters of a file name */
/* Constant defining the maximum number of characters of a file name */
#define C_MAX_FILE_NAME_SIZE 80
/*
* Internal variable definition
*/
......@@ -58,7 +54,7 @@ static FILE *code_id = NULL;
/*
* Name of the cyclic function that polls the shared memory
* that will be build by this backend
* that will be build by this backend
*/
static char *cyclic_name = NULL;
......@@ -291,8 +287,9 @@ void gui_preamble(FV * fv)
"/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n");
fprintf(header_id, "#ifndef _%s_GUI_HEADER_H\n", fv->name);
fprintf(header_id, "#define _%s_GUI_HEADER_H\n\n\n", fv->name);
fprintf(header_id, "#ifdef __unix__\n");
fprintf(header_id,
"#include <stdlib.h>\n#include <stdio.h>\n\n#include \"C_ASN1_Types.h\"\n\n");
"#include <stdlib.h>\n#include <stdio.h>\n#endif\n\n#include \"C_ASN1_Types.h\"\n\n");
fprintf(header_id, "#include \"%s_enums_def.h\"\n\n\n", fv->name);
//Create initialization function prototype
......
......@@ -41,11 +41,13 @@ void Create_script()
assert (NULL != script);
fprintf (script, "#!/bin/bash\n\n"
"# This script will build your TASTE system (by default with the C runtime).\n\n"
fprintf (script, "#!/bin/bash -e\n\n"
"# This script will build your TASTE system.\n\n"
"# You should not change this file as it was automatically generated.\n\n"
"# If you need additional preprocessing, create a file named 'user_init_pre.sh'\n"
"# and/or 'user_init_post.sh - They will never get overwritten.'\n\n"
"# If you need additional preprocessing, there are three hook files\n"
"# that you can provide and that are called dring the build:\n"
"# user_init_pre.sh, user_init_post.sh and user_init_last.sh\n"
"# These files will never get overwritten by TASTE.'\n\n"
"# Inside these files you may set some environment variables:\n"
"# C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}\n"
"# unset USE_POHIC \n\n"
......@@ -125,7 +127,7 @@ void Create_script()
fprintf (script, "if [ -z \"$DEPLOYMENTVIEW\" ]\n"
"then\n"
" DEPLOYMENTVIEW=DeploymentView.aadl\n"
"fi\n\n"
"fi\n\n"
"# Detect models from Ellidiss tools v2, and convert them to 1.3\n"
"grep \"version => \\\"2\" \"$DEPLOYMENTVIEW\" >/dev/null && {\n"
" echo -e \"${INFO} Converting deployment view from V2 to V1.3\"\n"
......@@ -136,8 +138,9 @@ void Create_script()
fprintf (script, "SKELS=\"%s\"\n\n", OUTPUT_PATH);
fprintf (script, "# Update the data view with local paths\n"
"taste-update-data-view\n\n");
fprintf (script, "# Check if Dataview references existing files \n"
"taste-extract-asn-from-design.exe -i \"$INTERFACEVIEW\" -j /tmp/dv.asn\n\n");
//"taste-update-data-view\n\n");
/* OpenGEODE-specific: call code generator on the fly */
FOREACH (fv, FV, get_system_ast()->functions, {
......@@ -250,7 +253,7 @@ void Create_script()
case qgenc: fprintf (script, "--subQGenC ");
break;
default:
ERROR ("** Error: unsupported language (function %s)\n", fv->name);
ERROR ("[ERROR] Unsupported language (function %s)\n", fv->name);
ERROR (" -> please manually check the build-script.sh file\n");
break;
}
......
......@@ -113,9 +113,9 @@ void C_End()
which possibly creates additional functions */
FOREACH(fv, FV, get_system_ast()->functions, {
if (get_context()->gw && NULL != fv->zipfile && !get_context()->glue) {
printf ("[Information] No skeleton is generated for function \"%s\"\n"
" because source code is provided in file \"%s\"\n"
" (as specified in the interface view)\n\n",
printf ("[INFO] No skeleton is generated for function \"%s\"\n"
" because source code is provided in file \"%s\"\n"
" (as specified in the interface view)\n\n",
fv->name,
fv->zipfile
);
......
......@@ -154,7 +154,7 @@ void Process_Context_Parameters(FV *fv)
dataview_path = getDataViewPath();
if (!file_exists (dataview_path, dataview_uniq)) {
ERROR ("[Information] %s/%s not found."
ERROR ("[INFO] %s/%s not found."
" Checking for dataview-uniq.asn\n",
dataview_path, dataview_uniq);
free (dataview_uniq);
......@@ -162,7 +162,7 @@ void Process_Context_Parameters(FV *fv)
}
if (!file_exists (dataview_path, dataview_uniq)) {
ERROR ("** Error: %s/%s not found\n",
ERROR ("[ERROR] %s/%s not found\n",
dataview_path, dataview_uniq);
exit (-1);
}
......@@ -190,7 +190,7 @@ void Process_Context_Parameters(FV *fv)
}
if (!will_fail && system (command)) {
ERROR ("The command failed. Try it yourself "
ERROR ("[ERROR] The command failed. Try it yourself "
"(correct paths, access to files, etc.)\n");
exit (-1);
}
......
......@@ -678,8 +678,8 @@ void Preprocess_FV (FV *fv)
interface->direction=PI;
interface->synchronism=asynch;
interface->rcm=cyclic;
/* Poll GUI queue every 40 ms */
interface->period = 40;
/* Poll GUI queue every 10 ms */
interface->period = 10;
interface->parent_fv = fv;
interface->wcet_high = 1;
interface->wcet_low = 1;
......@@ -738,8 +738,8 @@ void Preprocess_FV (FV *fv)
* define as unprotected */
else rcm = unprotected;
/* Create a new FV (thread) if there is more than
* one PI in the function */
if (count_pro+count_unpro+count_thread>1) {
* one PI in the function (unprotected don't count) */
if (count_pro+count_thread>1) {
ProcessArtificial_FV_Creation (i, rcm);
}
}
......
......@@ -34,19 +34,19 @@ void Create_New_SDL_Structure(FV * fv)
char *dataview_uniq = getASN1DataView();
char *dataview_path = getDataViewPath();
if (!file_exists (dataview_path, dataview_uniq)) {
ERROR ("[Information] %s/%s not found. Checking for dataview-uniq.asn\n", dataview_path, dataview_uniq);
ERROR ("[INFO] %s/%s not found. Checking for dataview-uniq.asn\n", dataview_path, dataview_uniq);
free (dataview_uniq);
dataview_uniq = make_string ("dataview-uniq.asn");
}
char *command = make_string("mono $(which asn1.exe) -customStg $(taste-config --prefix)/share/asn1scc/python.stg:%s/DataView.py -customStgAstVerion 4 %s/%s", path, dataview_path, dataview_uniq);
if (system(command)) {
ERROR ("** Error: Command \"%s\" failed in generation of SDL skeleton\n", command);
ERROR ("[ERROR] Command \"%s\" failed in generation of SDL skeleton\n", command);
}
free(command);
command = make_string("cp \"%s/%s\" %s/", dataview_path, dataview_uniq, path);
if (system(command)) {
ERROR ("** Error: Command \"%s\" failed in generation of SDL skeleton\n", command);
ERROR ("[ERROR] Command \"%s\" failed in generation of SDL skeleton\n", command);
}
free(command);
......