Commit 28f44caa authored by Maxime Perrotin's avatar Maxime Perrotin

Merge branch 'master' of https://gitrepos.estec.esa.int/taste/buildsupport into ZeroCopy

parents 0127919e 336c16b0
......@@ -309,6 +309,7 @@ private
pragma Linker_Options ("system_config.o");
pragma Linker_Options ("build_scade_skeletons.o");
pragma Linker_Options ("build_vdm_skeletons.o");
pragma Linker_Options ("build_vhdl_skeletons.o");
pragma Linker_Options ("build_rtds_skeletons.o");
pragma Linker_Options ("build_driver_skeletons.o");
pragma Linker_Options ("asn2datamodel.o");
......
......@@ -239,8 +239,7 @@ void create_switch_structure(char **pgenerated_switch_structure,
build_string(pgenerated_switch_structure,
"_data_receptacle, message_data_received, sizeof(T_",
strlen
("_data_receptacle, message_data_received, sizeof(T_"));
strlen("_data_receptacle, message_data_received, sizeof(T_"));
build_string(pgenerated_switch_structure,
PI_name, strlen(PI_name));
......@@ -364,29 +363,48 @@ void create_single_queue_initialization_function(char *NODE_NAME,
//
//CCY 28/08/08 : (DOCUMENTATION) Document this function
//
void create_queues_initialization_function(char *NODE_NAME)
void create_queues_initialization_function(FV *fv)
{
//
//Create the initialisation functions to be called at startup
//
fprintf(code_id, "void %s_startup()\n", NODE_NAME);
fprintf(code_id, "{\n");
fprintf(code_id, " int res_RI = 0;\n");
fprintf(code_id, " int res_PI = 0;\n\n");
fprintf(code_id, "void %s_startup(void)\n"
"{\n"
" int res_RI = 0;\n"
" int res_PI = 0;\n"
" int msgsize_max = 8192;\n"
" FILE *f = fopen(\"/proc/sys/fs/mqueue/msgsize_max\", \"r\");\n"
" fscanf(f, \"%%d\", &msgsize_max);\n\n",
fv->name);
FOREACH (i, Interface, fv->interfaces, {
if (strcmp(i->name, cyclic_name)) {
fprintf(code_id,
" if (sizeof(T_%s_message) > msgsize_max) {\n"
" printf(\"[ERROR] The GUI is passing a message "
"(%s) which parameter size (%%d) exceeds your system limit"
" (%%d).\\nYou can extend this limit by running: \\n "
" echo NUMBER | sudo tee /proc/sys/fs/mqueue/msgsize_max"
" # ...with NUMBER > %%d\\n"
"You can also make it permanent (check TASTE wiki)\\n\\n\","
" sizeof(T_%s_message), msgsize_max, sizeof(T_%s_message));\n"
" exit(1);\n"
" }\n\n",
i->name, i->name, i->name, i->name);
}
});
//Create the RI queue initialization function, if there are some RI to be stored
if (RI_LIST != NULL) {
create_single_queue_initialization_function(NODE_NAME, RI,
create_single_queue_initialization_function(fv->name, RI,
RI_CURRENT_MAX_NUMBER_OF_PARAMS_IN_MESSAGE);
}
//create the PI queue initialization function, if there are some PI to be stored
if (PI_LIST != NULL) {
create_single_queue_initialization_function(NODE_NAME, PI,
PI_CURRENT_MAX_NUMBER_OF_PARAMS_IN_MESSAGE);
create_single_queue_initialization_function(fv->name, PI,
PI_CURRENT_MAX_NUMBER_OF_PARAMS_IN_MESSAGE);
}
//End procedure
fprintf(code_id, " return;\n");
fprintf(code_id, "}\n\n\n");
fprintf(code_id, "}\n\n");
}
......@@ -457,14 +475,14 @@ int create_max_element_queues_size_compute_function(char *NODE_NAME)
//
//CCY 28/08/08 : (DOCUMENTATION) Document this function
//
void create_gui_fv_queues(char *NODE_NAME)
void create_gui_fv_queues(FV *fv)
{
//Create the functions allowing to determine the biggest message size for the
//two queues (PI and RI)
create_max_element_queues_size_compute_function(NODE_NAME);
create_max_element_queues_size_compute_function(fv->name);
//Create the queues initialization, function
create_queues_initialization_function(NODE_NAME);
create_queues_initialization_function(fv);
}
......@@ -1107,7 +1125,7 @@ void End_GUI_Glue_Backend(FV * fv)
fclose(header_id);
//Create the queues management code for exchanging data with the outside
create_gui_fv_queues(fv->name);
create_gui_fv_queues(fv);
//finalize code file
fclose(code_id);
......@@ -1121,14 +1139,14 @@ void End_GUI_Glue_Backend(FV * fv)
void GLUE_GUI_Interface(Interface * i)
{
switch (i->direction) {
case PI:
add_PI_to_gui_glue(i);
break;
case RI:
add_RI_to_gui_glue(i);
break;
default:
break;
case PI:
add_PI_to_gui_glue(i);
break;
case RI:
add_RI_to_gui_glue(i);
break;
default:
break;
}
}
......
......@@ -42,22 +42,31 @@ void Create_script()
assert (NULL != script);
fprintf (script, "#!/bin/bash\n\n"
"# This script will build your TASTE system.\n\n"
"# You should check it before running it to make it fit with your context:\n"
"# 1) You may need to fix some paths and filenames (path to interface/deployment views)\n"
"# 2) You may need to specify additional paths for the compiler to find .h file\n"
"# (e.g. \"export C_INCLUDE_PATH=/usr/include/xenomai/analogy/:$C_INCLUDE_PATH\")\n"
"# 3) You may need to link with pre-built libraries, using the -l option\n"
"# (e.g. -l /usr/lib/libanalogy.a,/usr/lib/librtdm.a)\n"
"# 4) You may need to change the runtime (add -p flag to select PolyORB-HI-C)\n"
"# etc.\n\n"
"# Note: TASTE will not overwrite your changes - if you need to update some parts\n"
"# you will have to merge the changes with the newly-created file.\n\n"
"# This script will build your TASTE system (by default with the C runtime).\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"
"# 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"
"if [ -f user_init_pre.sh ]\n"
"then\n"
" echo [INFO] Executing user-defined init script\n"
" source user_init_pre.sh\n"
"fi\n\n");
"fi\n\n"
"# Use PolyORB-HI-C runtime\n"
"USE_POHIC=1\n\n"
"# Detect models from Ellidiss tools v2, and convert them to 1.3\n"
"INTERFACEVIEW=%s\n"
"grep \"version => \\\"2\" %s >/dev/null && {\n"
" echo '[INFO] Converting interface view from V2 to V1.3'\n"
" TASTE --load-interface-view %s --export-interface-view-to-1_3 __iv_1_3.aadl\n"
" INTERFACEVIEW=__iv_1_3.aadl\n"
"};\n\n",
get_context()->ifview,
get_context()->ifview,
get_context()->ifview);
/* The first step is to invoke QGen to generate code from user model */
......@@ -107,7 +116,14 @@ 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 '[INFO] Converting deployment view from V2 to V1.3'\n"
" TASTE --load-deployment-view \"$DEPLOYMENTVIEW\" --export-deployment-view-to-1_3 __dv_1_3.aadl\n"
" DEPLOYMENTVIEW=__dv_1_3.aadl\n"
"};\n\n");
fprintf (script, "SKELS=\"%s\"\n\n", OUTPUT_PATH);
......@@ -187,7 +203,7 @@ void Create_script()
if (get_context()->keep_case)
fprintf (script, "\t--keep-case \\\n");
fprintf (script, "\t--interfaceView %s \\\n", get_context()->ifview);
fprintf (script, "\t--interfaceView \"$INTERFACEVIEW\" \\\n");
/* When invoked with -gw, we do not know the exact name of the deployment view
-> we assume that it's the default spelling given by TASTE-IV */
......
/* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
/* build_vhdl_skeletons.c
*
* VHDL Code skeletons - generate mini-cv.addl and call aadl2glueC
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <assert.h>
#include "my_types.h"
#include "practical_functions.h"
#include "backends.h"
void vhdl_skeletons(FV *fv)
{
char *cmd = NULL;
cmd = make_string("cp %s/dataview-uniq.asn %s/dataview-uniq-v1.aadl %s/%s",
OUTPUT_PATH,
OUTPUT_PATH,
OUTPUT_PATH,
fv->name);
if (system(cmd)) {
ERROR ("[ERROR] Missing dataview-uniq.asn or dataview-uniq-v1.aadl\n");
exit(-1);
}
free(cmd);
printf("[INFO] Generating VHDL skeleton code for function %s\n", fv->name);
cmd = make_string("cd %s/%s && aadl2glueC dataview-uniq-v1.aadl mini_cv.aadl",
OUTPUT_PATH,
fv->name);
if (system(cmd)) {
ERROR ("[ERROR] Failed generating VHDL code!\n");
free(cmd);
}
else {
free(cmd);
cmd = make_string("cd %s/%s && rm -f mini_cv.aadl dataview-uniq.asn "
"dataview-uniq-v1.aadl C_ASN1_Types.? ESA_FPGA.h "
"*_VHDL.VHDL.[ch] *_vhdl.ad?",
OUTPUT_PATH,
fv->name,
fv->name,
fv->name);
system(cmd);
free(cmd);
}
}
/* External interface (the one and unique) */
void GW_VHDL_Backend(FV * fv)
{
if (get_context()->onlycv)
return;
if (vhdl == fv->language) {
GLUE_MiniCV_Backend(fv);
if (!get_context()->glue) {
vhdl_skeletons(fv);
}
}
}
......@@ -37,7 +37,7 @@ void add_error()
error_count++;
}
/*
/*:
* Main function called after the Ada AADL parser has completed.
*/
void C_End()
......@@ -127,6 +127,7 @@ void C_End()
GW_Simulink_Backend(fv);
GW_C_Backend(fv);
GW_VDM_Backend(fv);
GW_VHDL_Backend(fv);
GW_Ada_Backend(fv);
GW_SCADE_Backend(fv);
GW_RTDS_Backend(fv);
......
......@@ -15,6 +15,7 @@ extern void GW_SDL_Backend(FV *);
extern void GW_Simulink_Backend(FV *);
extern void GW_C_Backend(FV *);
extern void GW_VDM_Backend(FV *);
extern void GW_VHDL_Backend(FV *);
extern void GW_Ada_Backend(FV *);
extern void GW_SCADE_Backend(FV *);
extern void GW_RTDS_Backend(FV *);
......
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