From e2c081037d56a2e85e651a8ceeca2f1bde7ca7e5 Mon Sep 17 00:00:00 2001 From: Maxime Perrotin Date: Wed, 28 Aug 2019 14:11:29 +0200 Subject: [PATCH] Start support for simulink --- .../language_wrappers/mini-cv/interface.tmplt | 2 ++ .../simulink/function-filename.tmplt | 4 ++++ templates/skeletons/simulink/function.tmplt | 22 +++++++++++++++++++ templates/skeletons/simulink/interface.tmplt | 12 ++++++++++ .../simulink/makefile-filename.tmplt | 4 ++++ templates/skeletons/simulink/makefile.tmplt | 15 +++++++++++++ templates/skeletons/simulink/trigger.tmplt | 20 +++++++++++++++++ 7 files changed, 79 insertions(+) create mode 100644 templates/skeletons/simulink/function-filename.tmplt create mode 100644 templates/skeletons/simulink/function.tmplt create mode 100644 templates/skeletons/simulink/interface.tmplt create mode 100644 templates/skeletons/simulink/makefile-filename.tmplt create mode 100644 templates/skeletons/simulink/makefile.tmplt create mode 100644 templates/skeletons/simulink/trigger.tmplt diff --git a/templates/glue/language_wrappers/mini-cv/interface.tmplt b/templates/glue/language_wrappers/mini-cv/interface.tmplt index eb04906..d6eddbe 100644 --- a/templates/glue/language_wrappers/mini-cv/interface.tmplt +++ b/templates/glue/language_wrappers/mini-cv/interface.tmplt @@ -47,6 +47,8 @@ PROPERTIES Source_Language => VHDL; @@ELSIF@@ @_Language_@ = "Blackbox_C" or @_Language_@ = CPP Source_Language => C; +@@ELSIF@@ @_Language_@ = SIMULINK + Source_Language => Simulink; @@-- aadl2glueC is case sensitive here @@ELSE@@ Source_Language => @_Language_@; @@END_IF@@ diff --git a/templates/skeletons/simulink/function-filename.tmplt b/templates/skeletons/simulink/function-filename.tmplt new file mode 100644 index 0000000..e698efc --- /dev/null +++ b/templates/skeletons/simulink/function-filename.tmplt @@ -0,0 +1,4 @@ +@@-- The following tags are available in this template: +@@-- +@@-- @_Name_@ : The name of the function +@_LOWER:Name_@.m diff --git a/templates/skeletons/simulink/function.tmplt b/templates/skeletons/simulink/function.tmplt new file mode 100644 index 0000000..a8e825a --- /dev/null +++ b/templates/skeletons/simulink/function.tmplt @@ -0,0 +1,22 @@ +@@-- The following tags are available in this template: +@@-- +@@-- @_Name_@ : The name of the function +@@-- @_Language_@ : The implementation language +@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names) +@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names) +@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces +@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces +@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces +@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces +@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names +@@-- @_ASN1_Files_@ : List of ASN.1 Files with path +@@-- @_Timers_@ : List of timers (just names) +@@-- @_Has_Context_@ : Flag, True if there are context parameters +@@-- @_CP_Names_@ : List of Context Parameter names +@@-- @_CP_Types_@ : List of Context Parameter types +@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params +@@-- @_Required_Interfaces_@ : From template: Required interfaces with params +@@-- @_Property_Names_@ : List of User-defined properties (names) +@@-- @_Property_Values_@ : List of User-defined properties (values) +@@-- @_Is_Type_@ : Flag, True if function is a component type +@@-- @_Instance_Of_@ : Optional name of component type diff --git a/templates/skeletons/simulink/interface.tmplt b/templates/skeletons/simulink/interface.tmplt new file mode 100644 index 0000000..5fa2ed0 --- /dev/null +++ b/templates/skeletons/simulink/interface.tmplt @@ -0,0 +1,12 @@ +@@-- The following tags are available in this template: +@@-- +@@-- @_Name_@ : The name of the interface +@@-- @_Direction_@ : "PI" or "RI" +@@-- @_Kind_@ : The RCM Kind +@@-- @_Parent_Function_@ : The name of the function +@@-- @_Param_Names_@ : List of parameter names +@@-- @_Param_Types_@ : |_ Corresponding parameter types +@@-- @_Param_Directions_@ : |_ Corresponding direction +@@-- @_Param_Encodings_@ : |_ Corresponding ASN.1 encoding +@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : Properties of the interface +@@-- @_IF_Property_Names_@, _Values_@ : User-defined properties (vector tag) diff --git a/templates/skeletons/simulink/makefile-filename.tmplt b/templates/skeletons/simulink/makefile-filename.tmplt new file mode 100644 index 0000000..147898a --- /dev/null +++ b/templates/skeletons/simulink/makefile-filename.tmplt @@ -0,0 +1,4 @@ +@@-- The following tags are available in this template: +@@-- +@@-- @_Name_@ : The name of the function +Makefile diff --git a/templates/skeletons/simulink/makefile.tmplt b/templates/skeletons/simulink/makefile.tmplt new file mode 100644 index 0000000..96f93a4 --- /dev/null +++ b/templates/skeletons/simulink/makefile.tmplt @@ -0,0 +1,15 @@ +@@-- The following tags are available in this template: +@@-- +@@-- @_Name_@ : The function name +@@-- @_ASN1_Files_@ : List of all ASN.1 files +@@-- @_ASN1_Modules_@ : List of all ASN.1 modules +@@-- @_Is_Type_@ : Flag set to True for function type +@@-- @_Instance_Of_@ : Name of function type if instance + +all: compile-linux + +clean: + rm -rf obj + +compile-linux: + mkdir -p obj && cd obj && gcc -c ../src/*.c diff --git a/templates/skeletons/simulink/trigger.tmplt b/templates/skeletons/simulink/trigger.tmplt new file mode 100644 index 0000000..7456bbb --- /dev/null +++ b/templates/skeletons/simulink/trigger.tmplt @@ -0,0 +1,20 @@ +@@-- This template must return either TRUE or something else (meaning FALSE) +@@-- It is used to determine if the other templates in this folder will be +@@-- processed or ignored. +@@-- One folder can contain two templates: one for a function, and one for +@@-- a corresponding makefile (or build script) +@@-- The name of the function is read from template "function-filename.tmplt" +@@-- The name of the makefile is read from template "makefile-filename.tmplt" +@@-- These files are optional, if absent no error is raised +@@-- The following tags are available in this template: +@@-- +@@-- @_Name_@ : The name of the function +@@-- @_Is_Type_@ : True if function type +@@-- @_Instance_Of_@ : Name of instance or empty string +@@-- @_Language_@ : Implementation language for the function +@@-- @_Filename_Is_Present_@ : True if target function output already exists +@@-- @_Makefile_Is_Present_@ : True if target build script already exists +@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C) +@@IF@@ @_Language_@ = "SIMULINK" +TRUE +@@END_IF@@ -- GitLab