Commit 25e8ea08 authored by Maxime Perrotin's avatar Maxime Perrotin

First build with a simulink function

parent e2c08103
-- *************************** taste aadl parser *********************** --
-- (c) 2017 European Space Agency - maxime.perrotin@esa.int
-- (c) 2017-2019 European Space Agency - maxime.perrotin@esa.int
-- LGPL license, see LICENSE file
-- Interface View parser
......@@ -580,8 +580,9 @@ package body TASTE.Interface_View is
if Present (AIN.Features (Inst)) then
PI_Or_RI := AIN.First_Node (AIN.Features (Inst));
while Present (PI_Or_RI) loop
Iface := Parse_Interface (PI_Or_RI);
Iface := Parse_Interface (PI_Or_RI);
Iface.Parent_Function := Result.Name;
Iface.Language := Result.Language;
if AIN.Is_Provided (PI_Or_RI) then
Result.Provided.Insert (Key => To_String (Iface.Name),
New_Item => Iface);
......@@ -1018,6 +1019,7 @@ package body TASTE.Interface_View is
return +Assoc ("Name", TI.Name)
& Assoc ("Kind", TI.RCM'Img)
& Assoc ("Parent_Function", TI.Parent_Function)
& Assoc ("Language", TI.Language)
& Assoc ("Period", TI.Period_Or_MIAT'Img)
& Assoc ("WCET", TI.WCET_ms.Value_Or (0)'Img)
& Assoc ("Queue_Size", TI.Queue_Size.Value_Or (1)'Img)
......
......@@ -103,8 +103,9 @@ package TASTE.Interface_View is
type Taste_Interface is tagged
record
Name : Unbounded_String;
Parent_Function : Unbounded_String;
Name,
Parent_Function,
Language : Unbounded_String;
Remote_Interfaces : Remote_Entities.Vector;
Params : Parameters.Vector;
RCM : Supported_RCM_Operation_Kind;
......
......@@ -11,6 +11,8 @@
// Required interfaces of function @_Name_@
@_Required_@
@@END_IF@@
@@IF@@ @_Language_@ /= SIMULINK @@-- Simulink's glue is generated from DMT
#include "@_LOWER:Name_@_vm_if.h"
@@END_IF@@
@_Protected_PIs_@
......@@ -13,9 +13,9 @@
@@-- @_Calling_Threads_@ : Calling threads of the containing block
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
void pro_@_LOWER:Parent_Function_@_@_Name_@(void)
void pro_@_Parent_Function_@_@_Name_@(void)
@@ELSE@@ @@-- contains param(s)
void pro_@_LOWER:Parent_Function_@_@_Name_@
void pro_@_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......@@ -31,9 +31,9 @@ void pro_@_LOWER:Parent_Function_@_@_Name_@
extern process_package__taste_protected_object @_LOWER:Parent_Function_@_protected;
__po_hi_protected_lock (@_LOWER:Parent_Function_@_protected.protected_id);
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
@_LOWER:Parent_Function_@_@_LOWER:Name_@();
@_Parent_Function_@_@_Name_@();
@@ELSE@@
@_LOWER:Parent_Function_@_@_LOWER:Name_@
@_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......
......@@ -4,6 +4,7 @@
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Language_@ : The implementation language of the function
@@-- @_Partition_Name_@ : Partition name for parent function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
......@@ -15,7 +16,7 @@
@@IF@@ @_Param_Names'Length_@ = 0
@@SET@@ No_Param=True
@@END_IF@@
@@IF@@ @_Param_Names'Length_@ = 0
@@IF@@ @_No_Param_@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@(void)
@@ELSE@@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
......@@ -36,7 +37,7 @@ void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
// @_Calling_Threads_@ calling thread
if (@_LOWER:Partition_Name_@_@_LOWER:Calling_Threads_@_k == current_task) {
// puts("[TASTE] Sporadic call of @_Name_@ from thread @_LOWER:Partition_Name_@_@_LOWER:Calling_Threads_@");
@@IF@@ @_Param_Names'Length_@ > 0
@@IF@@ not @_No_Param_@
@@INLINE( )( \n )(\n)@@
__po_hi_request_t request;
__po_hi_copy_array(&(request.vars.@_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@.@_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@.buffer),
......@@ -51,8 +52,8 @@ size_IN_buf_@_LOWER:Param_Names_@;
__po_hi_gqueue_store_out(@_LOWER:Partition_Name_@_@_LOWER:Calling_Threads_@_k, @_LOWER:Calling_Threads_@_local_outport_@_LOWER:Name_@, &request);
__po_hi_send_output(@_LOWER:Partition_Name_@_@_LOWER:Calling_Threads_@_k, @_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@);
@@END_INLINE@@
@@ELSE@@ @@-- No params
__po_hi_send_output(@_LOWER:Partition_Name_@_@_LOWER:Calling_Threads_@_k, @_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@);
@@ELSE@@ @@-- No param
__po_hi_send_output(@_LOWER:Partition_Name_@_@_LOWER:Calling_Threads_@_k, @_LOWER:Calling_Threads_@_global_outport_@_LOWER:Name_@);
@@END_IF@@
return;
}
......@@ -62,9 +63,9 @@ size_IN_buf_@_LOWER:Param_Names_@;
// Unprotected call
@@TABLE@@
@@IF@@ @_No_Param_@
@_LOWER:Remote_Function_Names_@_@_LOWER:Remote_Interface_Names_@();
@_Remote_Function_Names_@_@_Remote_Interface_Names_@();
@@ELSE@@
@_LOWER:Remote_Function_Names_@_@_LOWER:Remote_Interface_Names_@
@_Remote_Function_Names_@_@_Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......@@ -80,9 +81,9 @@ size_IN_buf_@_LOWER:Param_Names_@;
// puts("[TASTE] Protected call of @_Name_@");
@@TABLE@@
@@IF@@ @_No_Param_@
pro_@_LOWER:Remote_Function_Names_@_@_Remote_Interface_Names_@();
pro_@_Remote_Function_Names_@_@_Remote_Interface_Names_@();
@@ELSE@@
pro_@_LOWER:Remote_Function_Names_@_@_Remote_Interface_Names_@
pro_@_Remote_Function_Names_@_@_Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......
......@@ -37,9 +37,9 @@
__po_hi_protected_lock (@_LOWER:Pro_Block_Name_@_protected.protected_id);
@@END_IF@@
@@IF@@ @_Param_Names'Length_@ > 0
@_LOWER:Thread_Name_@ (buf.buffer, buf.length);
@_Thread_Name_@ (buf.buffer, buf.length);
@@ELSE@@
@_LOWER:Thread_Name_@ ();
@_Thread_Name_@();
@@END_IF@@
@@IF@@ @_Need_Mutex_@
__po_hi_protected_unlock (@_LOWER:Pro_Block_Name_@_protected.protected_id);
......
......@@ -13,9 +13,9 @@
@@-- @_Calling_Threads_@ : Calling threads of the containing block
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
void pro_@_LOWER:Parent_Function_@_@_Name_@(void);
void pro_@_Parent_Function_@_@_Name_@(void);
@@ELSE@@ @@-- contains param(s)
void pro_@_LOWER:Parent_Function_@_@_Name_@
void pro_@_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\);)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......
......@@ -15,6 +15,6 @@
@@-- @_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@@ not @_Is_Type_@ and (@_Language_@ = "C" or @_Language_@ = "GUI" or @_Language_@ = "Ada" or @_Language_@ = "VDM" or @_Language_@ = "QGenAda" or @_Language_@ = "QGenC" or @_Language_@ = "RTDS" or @_Language_@ = "CPP" or @_Language_@ = "SDL" or @_Language_@ = "Blackbox_C" or @_Language_@ = "MicroPython")
@@IF@@ not @_Is_Type_@ and (@_Language_@ = "C" or @_Language_@ = "GUI" or @_Language_@ = "Ada" or @_Language_@ = "VDM" or @_Language_@ = "QGenAda" or @_Language_@ = "QGenC" or @_Language_@ = "RTDS" or @_Language_@ = "CPP" or @_Language_@ = "SDL" or @_Language_@ = "Blackbox_C" or @_Language_@ = "MicroPython" or @_Language_@ = SIMULINK)
TRUE
@@END_IF@@
......@@ -4,12 +4,12 @@
@@-- @_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
@@-- @_Sync_RIs_Parent@ : ... and corresponding Parent function name
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_Async_RIs_Parent@ : ... and corresponding Parent function name
@@-- @_List_Of_Sync_PIs_@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs_@ : List of synchronous Required Interfaces
@@-- @_Sync_RIs_Parent_@ : ... and corresponding Parent function name
@@-- @_List_Of_ASync_PIs_@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs_@ : List of asynchronous Required Interfaces
@@-- @_Async_RIs_Parent_@ : ... and corresponding Parent function name
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
......
......@@ -12,7 +12,7 @@
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_EXIST:Param_Names_@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@
void @_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......@@ -40,7 +40,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
if (0 != Decode_@_Param_Encodings_@_@_REPLACE_ALL(-/_):Param_Types_@ (&IN_@_UPPER:Param_Names_@, IN_@_LOWER:Param_Names_@, IN_@_LOWER:Param_Names_@_len)) {
#ifdef __unix__
puts("Error decoding @_Param_Types_@ in function @_LOWER:Parent_Function_@_@_LOWER:Name_@");
puts("Error decoding @_Param_Types_@ in function @_Parent_Function_@_@_Name_@");
#endif
return;
}
......@@ -78,7 +78,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@END_TABLE@@
}
@@ELSE@@ @@-- parameterless functions
void @_LOWER:Parent_Function_@_@_LOWER:Name_@()
void @_Parent_Function_@_@_Name_@()
{
// Directly call user code, no parameters to pass
// This could be done directly from the concurrency glue...
......
......@@ -13,7 +13,7 @@
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_Direction_@ = "PI"
@@IF@@ @_EXIST:Param_Names_@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@
void @_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......@@ -24,6 +24,6 @@ void *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_TABLE@@
@@END_INLINE@@
@@ELSE@@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@(void);
void @_Parent_Function_@_@_Name_@(void);
@@END_IF@@
@@END_IF@@
......@@ -9,7 +9,7 @@
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_EXIST:Param_Names_@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@
void @_Parent_Function_@_@_Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
......@@ -20,7 +20,7 @@ void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@END_TABLE@@
@@END_INLINE@@
@@ELSE@@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@(void)
void @_Parent_Function_@_@_Name_@(void)
@@END_IF@@
{
// Write your code here
......
......@@ -11,9 +11,9 @@
@@-- @_Param_Encodings_@ : |_ Corresponding encoding (Default, Native, UPER, ACN)
@@IF@@ @_Direction_@ = "PI"
@@IF@@ @_Param_Names'Length_@ = 0
void @_LOWER:Parent_Function_@_@_LOWER:Name_@(void);
void @_Parent_Function_@_@_Name_@(void);
@@ELSE@@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@
void @_Parent_Function_@_@_Name_@
@@END_IF@@
@@ELSE@@
@@IF@@ @_Param_Names'Length_@ = 0
......
This diff is collapsed.
TASTE-Dataview DEFINITIONS ::=
BEGIN
-- A few simple types to start with ASN.1
MyInteger ::= INTEGER (0..255)
MyReal ::= REAL (0.0 .. 1000.0)
MyEnum ::= ENUMERATED { hello, world, howareyou }
MySeq ::= SEQUENCE {
a MyInteger,
b ENUMERATED { taste(1), welcomes(2), you(3) }
}
MyChoice ::= CHOICE {
a BOOLEAN,
b MySeq
}
MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
MyOctStr ::= OCTET STRING (SIZE (3))
-- You can also declare variables (they will be visible in C, Ada and RTDS)
myVar MySeqOf ::= { hello, world }
myVar2 MyChoice ::= a:TRUE
END
---------------------------------------------------
-- AADL2.2
-- TASTE type deploymentview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE deploymentview::DV::Node_x86
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS demo
END demo;
PROCESS IMPLEMENTATION demo.others
END demo.others;
END deploymentview::DV::Node_x86;
PACKAGE deploymentview::DV
PUBLIC
WITH interfaceview::IV::My_C_Function;
WITH interfaceview::IV::My_Simulink_Function;
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node_x86;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node_x86
END Node_x86;
SYSTEM IMPLEMENTATION Node_x86.others
SUBCOMPONENTS
IV_My_C_Function : SYSTEM interfaceview::IV::My_C_Function::My_C_Function.others {
Taste::FunctionName => "My_C_Function";
};
IV_My_Simulink_Function : SYSTEM interfaceview::IV::My_Simulink_Function::My_Simulink_Function.others {
Taste::FunctionName => "My_Simulink_Function";
};
demo : PROCESS deploymentview::DV::Node_x86::demo.others {
Taste::coordinates => "1207 515 2270 905";
Deployment::Port_Number => 0;
};
Native_Target : PROCESSOR ocarina_processors_x86::x86.linux {
Taste::coordinates => "1049 426 2291 922";
};
PROPERTIES
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_My_C_Function;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_My_Simulink_Function;
Actual_Processor_Binding => (reference (Native_Target)) APPLIES TO demo;
END Node_x86.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node_x86 : SYSTEM Node_x86.others {
Taste::coordinates => "899 273 2708 1324";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 2970 2100";
Taste::version => "2.2";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
---------------------------------------------------
-- AADL2.2
-- TASTE type interfaceview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE interfaceview::IV::My_C_Function
PUBLIC
WITH interfaceview::IV::My_Simulink_Function;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_pulse
END PI_pulse;
SUBPROGRAM IMPLEMENTATION PI_pulse.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_pulse.others;
SUBPROGRAM RI_Add_Two_Params
FEATURES
first_param : IN PARAMETER DataView::MyInteger {
Taste::encoding => NATIVE;
};
second_param : IN PARAMETER DataView::MyInteger {
Taste::encoding => NATIVE;
};
result : OUT PARAMETER DataView::MyInteger {
Taste::encoding => NATIVE;
};
END RI_Add_Two_Params;
SUBPROGRAM IMPLEMENTATION RI_Add_Two_Params.others
END RI_Add_Two_Params.others;
SYSTEM My_C_Function
FEATURES
PI_pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::My_C_Function::PI_pulse.others {
Taste::coordinates => "538 781";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 1000 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "pulse";
};
RI_Add_Two_Params : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::My_Simulink_Function::PI_Add_Two_Params.others {
Taste::coordinates => "538 381";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "Add_Two_Params";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => enabled;
END My_C_Function;
SYSTEM IMPLEMENTATION My_C_Function.others
END My_C_Function.others;
END interfaceview::IV::My_C_Function;
PACKAGE interfaceview::IV::My_Simulink_Function
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_Add_Two_Params
FEATURES
first_param : IN PARAMETER DataView::MyInteger {
Taste::encoding => NATIVE;
};
second_param : IN PARAMETER DataView::MyInteger {
Taste::encoding => NATIVE;
};
result : OUT PARAMETER DataView::MyInteger {
Taste::encoding => NATIVE;
};
END PI_Add_Two_Params;
SUBPROGRAM IMPLEMENTATION PI_Add_Two_Params.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_Add_Two_Params.others;
SYSTEM My_Simulink_Function
FEATURES
PI_Add_Two_Params : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::My_Simulink_Function::PI_Add_Two_Params.others {
Taste::coordinates => "907 392";
Taste::RCMoperationKind => unprotected;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "Add_Two_Params";
};
PROPERTIES
Source_Language => (Simulink);
Taste::Active_Interfaces => enabled;
END My_Simulink_Function;
SYSTEM IMPLEMENTATION My_Simulink_Function.others
END My_Simulink_Function.others;
END interfaceview::IV::My_Simulink_Function;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::IV::My_C_Function;
WITH interfaceview::IV::My_Simulink_Function;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM interfaceview
PROPERTIES
Taste::dataView => ("DataView","DataView");
Taste::dataViewPath => ("DataView.aadl");
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
My_C_Function : SYSTEM interfaceview::IV::My_C_Function::My_C_Function.others {
Taste::coordinates => "67 189 538 1077";
};
My_Simulink_Function : SYSTEM interfaceview::IV::My_Simulink_Function::My_Simulink_Function.others {
Taste::coordinates => "907 203 1600 1084";
};
CONNECTIONS
My_Simulink_Function_PI_Add_Two_Params_My_C_Function_RI_Add_Two_Params : SUBPROGRAM ACCESS My_Simulink_Function.PI_Add_Two_Params -> My_C_Function.RI_Add_Two_Params {
Taste::coordinates => "538 381 720 381 720 392 907 392";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView","DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 2970 2100";
Taste::version => "2.2";
END interfaceview::IV;
KAZOO=../../kazoo
all: c
c: test-parse-c # Polyorb_HI_C output
cp my_c_function/*.c output.pohic/my_c_function/C/src
cp my_simulink_function/* output.pohic/my_simulink_function/SIMULINK/src
make -C output.pohic
test-parse-c: clean-c
$(KAZOO) -p --gw \
-o output.pohic \
--glue -g
buildsupport_pohic:
buildsupport -o output.buildsupport.pohic -p --aadlv2 --glue -i InterfaceView.aadl -c DeploymentView.aadl -d DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl
buildsupport_pohiada:
buildsupport -o output.buildsupport.ada --aadlv2 --glue -i InterfaceView.aadl -c DeploymentView.aadl -d DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl
gdb: clean
gdb --args $(KAZOO) --gw -p \
-o output.pohic \
--glue \
--debug
clean-c:
rm -rf output.pohic
skeletons:
$(KAZOO) -p --gw --glue -o code && make -C code dataview
clean-skeletons:
rm -rf code
clean: clean-c clean-skeletons
.PHONY: clean clean-c gdb test-parse-c buildsupport_pohic buildsupport_pohiada c skeletons clean-skeletons
Demo_Simulink_C_NoStopBlock
This Demo does not use any STOP block in the Simulink model.
As a consequence, RTW/EC does not generate any definition for the macro called rtmGetStopRequested.
This test verifies that our glue detects that this macro is absent and therefore does not try to "call" it.
#!/bin/bash
# This script will build your TASTE system.
# You must check it before running it: it may need to be adapted to your context:
# 1) You may need to fix some paths and filenames (path to interface/deployment views)
# 2) You may need to specify additional paths for the compiler to find .h file
# (e.g. "export C_INCLUDE_PATH=/usr/include/xenomai/analogy/:$C_INCLUDE_PATH")
# 3) You may need to link with pre-built libraries, using the -l option
# (e.g. -l /usr/lib/libanalogy.a,/usr/lib/librtdm.a)
# 4) You may need to change the runtime (add -p flag to select PolyORB-HI-C)
# etc.
# Note: TASTE will not overwrite your changes - if you need to update some parts
# you will have to merge the changes with the newly-created "build-script.new.sh" file.
mkdir -p .cache
export PROJECT_CACHE=$HOME/.taste_AST_cache
rm -f my_c_function.zip
zip my_c_function my_c_function/*
rm -f my_simulink_function.zip
zip my_simulink_function my_simulink_function/*
[ ! -z "$CLEANUP" ] && rm -rf binary
echo Building the system with the Ada runtime
assert-builder-ocarina.py \
-f -p\
--aadlv2 \
--keep-case \
--interfaceView InterfaceView.aadl \
--deploymentView DeploymentView.aadl \
-o binary \
--subC my_c_function:my_c_function.zip \
--subSIMULINK my_simulink_function:my_simulink_function.zip
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "my_c_function.h"
#include <stdio.h>
void my_c_function_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface!! */
}
void my_c_function_PI_pulse()
{
/* Write your code here! */
static asn1SccMyInteger a = 0,
b = 0;
asn1SccMyInteger res = 0;
my_c_function_RI_Add_Two_Params (&a, &b, &res);
printf ("Result: %lld + %lld = %lld\n", a, b, res);
a++;
b++;
}
/*
* File: Add_Two_Params.c
*
* Real-Time Workshop code generated for Simulink model Add_Two_Params.
*
* Model version : 1.6
* Real-Time Workshop file version : 7.4 (R2009b) 29-Jun-2009
* Real-Time Workshop file generated on : Tue Aug 30 16:58:21 2011
* TLC version : 7.4 (Jul 14 2009)
* C/C++ source code generated on : Tue Aug 30 16:58:22 2011
*
* Target selection: ert.tlc
* Embedded hardware selection: 32-bit Generic
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Add_Two_Params.h"
#include "Add_Two_Params_private.h"
/* External inputs (root inport signals with auto storage) */
ExternalInputs_Add_Two_Params Add_Two_Params_U;
/* External outputs (root outports fed by signals with auto storage) */
ExternalOutputs_Add_Two_Params Add_Two_Params_Y;
/* Real-time model */
RT_MODEL_Add_Two_Params Add_Two_Params_M_;
RT_MODEL_Add_Two_Params *Add_Two_Params_M = &Add_Two_Params_M_;
/* Model step function */
void Add_Two_Params_step(void)
{
/* local block i/o variables */
boolean_T rtb_RelationalOperator;
/* Outport: '<Root>/result' incorporates:
* Constant: '<Root>/Constant1'
*/
Add_Two_Params_Y.result = Add_Two_Params_P.Constant1_Value;
/* RelationalOperator: '<Root>/Relational Operator' incorporates:
* Constant: '<Root>/Constant'
* Inport: '<Root>/first_param'
* Inport: '<Root>/second_param'
* Sum: '<Root>/Add'
*/
rtb_RelationalOperator = ((real_T)(uint8_T)(uint32_T)
(Add_Two_Params_U.first_param + Add_Two_Params_U.second_param) ==
Add_Two_Params_P.Constant_Value);
/* Stop: '<Root>/Stop Simulation' */
if (rtb_RelationalOperator) {
rtmSetStopRequested(Add_Two_Params_M, 1);
}
}
/* Model initialize function */
void Add_Two_Params_initialize(void)
{
/* Registration code */
/* initialize real-time model */
(void) memset((void *)Add_Two_Params_M,0,
sizeof(RT_MODEL_Add_Two_Params));
/* external inputs */
(void) memset((void *)&Add_Two_Params_U, 0,
sizeof(ExternalInputs_Add_Two_Params));
/* external outputs */
Add_Two_Params_Y.result = 0;
}