Commit 4ee578e8 authored by Damien George's avatar Damien George

Add Demo_uPy_TypesRI, to test all types sent thru MicroPython to a RI.

parent b84d634d
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
-- A few simple types to start with ASN.1
MyInteger ::= T-UInt8
MyReal ::= REAL (0.0 .. 1000.0)
MyBool ::= BOOLEAN
MyEnum ::= ENUMERATED { hello, world, howareyou }
MySeq ::= SEQUENCE {
input-data MyInteger,
output-data MyInteger,
validity ENUMERATED { valid, invalid }
}
MyChoice ::= CHOICE {
a BOOLEAN,
b MySeq
}
MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
MyOctStr ::= OCTET STRING (SIZE (3))
-- You can also declare constants
myVar MySeqOf ::= { hello, world }
END
---------------------------------------------------
-- AADL2.0
-- TASTE
--
--
---------------------------------------------------
PACKAGE deploymentview::DV::Node1
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS x86_partition
END x86_partition;
PROCESS IMPLEMENTATION x86_partition.others
END x86_partition.others;
END deploymentview::DV::Node1;
PACKAGE deploymentview::DV
PUBLIC
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node1;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node1
END Node1;
SYSTEM IMPLEMENTATION Node1.others
SUBCOMPONENTS
IV_GND : SYSTEM interfaceview::IV::GND.others {
Taste::coordinates => "990 990 1457 1452";
Taste::FunctionName => "GND";
};
IV_PAYLOAD : SYSTEM interfaceview::IV::PAYLOAD.others {
Taste::coordinates => "1636 980 2165 1421";
Taste::FunctionName => "PAYLOAD";
};
x86_partition : PROCESS deploymentview::DV::Node1::x86_partition.others {
Taste::coordinates => "664 752 2276 1614";
Deployment::Port_Number => 0;
};
x86_linux : PROCESSOR ocarina_processors_x86::x86.linux {
Taste::coordinates => "462 506 2477 1737";
};
PROPERTIES
Taste::APLC_Binding => (reference (x86_partition)) APPLIES TO IV_GND;
Taste::APLC_Binding => (reference (x86_partition)) APPLIES TO IV_PAYLOAD;
Actual_Processor_Binding => (reference (x86_linux)) APPLIES TO x86_partition;
END Node1.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node1 : SYSTEM Node1.others {
Taste::coordinates => "210 154 2729 1913";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 2970 2100";
Taste::version => "1.3.19";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
-- copied aadl libraries
\ No newline at end of file
This diff is collapsed.
d47e5b875dd1549969c3933d2e025a7c InterfaceView.aadl
#!/bin/bash -e
# This script will build your TASTE system.
# You should not change this file as it was automatically generated.
# If you need additional preprocessing, there are three hook files
# that you can provide and that are called dring the build:
# user_init_pre.sh, user_init_post.sh and user_init_last.sh
# These files will never get overwritten by TASTE.'
# Inside these files you may set some environment variables:
# C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
# unset USE_POHIC
CWD=$(pwd)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
COLOROFF="\e[0m"
else
COLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
if [ -f user_init_pre.sh ]
then
echo -e "${INFO} Executing user-defined init script"
source user_init_pre.sh
fi
# Use PolyORB-HI-C runtime
USE_POHIC=1
# Detect models from Ellidiss tools v2, and convert them to 1.3
INTERFACEVIEW=InterfaceView.aadl
grep "version => \"2" InterfaceView.aadl >/dev/null && {
echo -e "${INFO} Converting interface view from V2 to V1.3"
TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
INTERFACEVIEW=__iv_1_3.aadl
};
if [ -z "$DEPLOYMENTVIEW" ]
then
DEPLOYMENTVIEW=DeploymentView.aadl
fi
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$DEPLOYMENTVIEW" >/dev/null && {
echo -e "${INFO} Converting deployment view from V2 to V1.3"
TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
DEPLOYMENTVIEW=__dv_1_3.aadl
};
SKELS="./"
# Check if Dataview references existing files
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -j /tmp/dv.asn
cd "$SKELS" && rm -f gnd.zip && zip gnd gnd/* && cd $OLDPWD
cd "$SKELS" && rm -f payload.zip && zip payload payload/* && cd $OLDPWD
[ ! -z "$CLEANUP" ] && rm -rf binary*
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
fi
if [ -f user_init_post.sh ]
then
echo -e "${INFO} Executing user-defined post-init script"
source user_init_post.sh
fi
if [ ! -z "$USE_POHIC" ]
then
OUTPUTDIR=binary.c
ORCHESTRATOR_OPTIONS+=" -p "
elif [ ! -z "$USE_POHIADA" ]
then
OUTPUTDIR=binary.ada
else
OUTPUTDIR=binary
fi
cd "$CWD" && assert-builder-ocarina.py \
--fast \
--debug \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o "$OUTPUTDIR" \
--subMicroPython gnd:"$SKELS"/gnd.zip \
--subC payload:"$SKELS"/payload.zip \
$ORCHESTRATOR_OPTIONS
if [ -f user_init_last.sh ]
then
echo -e "${INFO} Executing user-defined post-build script"
source user_init_last.sh
fi
This diff is collapsed.
This diff is collapsed.
# User code: This file will not be overwritten by TASTE.
import micropython
from taste import * # import all ASN types
# gnd_RI_TC_Seq_NATIVE(IN_a: asn1SccMySeq, OUT_b: asn1SccMySeq)
from taste import gnd_RI_TC_Seq_NATIVE
# gnd_RI_TC_Seq_UPER(IN_a: asn1SccMySeq, OUT_b: asn1SccMySeq)
from taste import gnd_RI_TC_Seq_UPER
# gnd_RI_TC_Choice_NATIVE(IN_a: asn1SccMyChoice, OUT_b: asn1SccMyChoice)
from taste import gnd_RI_TC_Choice_NATIVE
# gnd_RI_TC_OctStr_NATIVE(IN_a: asn1SccMyOctStr, OUT_b: asn1SccMyOctStr)
from taste import gnd_RI_TC_OctStr_NATIVE
# gnd_RI_TC_SeqOf_NATIVE(IN_a: asn1SccMySeqOf, OUT_b: asn1SccMySeqOf)
from taste import gnd_RI_TC_SeqOf_NATIVE
def gnd_startup():
# Write your initialization code here,
# but do not make any call to a required interface.
# It's recommended to lock the heap once initialisation is done, but
# note that without the heap some Python operations are not possible.
global myOctStr1, myOctStr2, mySeq1, mySeq2, mySeqOf1, mySeqOf2
myOctStr1 = asn1SccMyOctStr()
myOctStr2 = Ref(asn1SccMyOctStr())
mySeq1 = asn1SccMySeq()
mySeq2 = Ref(asn1SccMySeq())
mySeqOf1 = asn1SccMySeqOf()
mySeqOf2 = Ref(asn1SccMySeqOf())
micropython.heap_lock()
def gnd_PI_CYCLE():
myOctStr1[0] = ord('M')
myOctStr1[1] = ord('P')
myOctStr1[2] = ord('Y')
gnd_RI_TC_OctStr_NATIVE(myOctStr1, myOctStr2)
print('got myOctStr2:', myOctStr2)
mySeq1.input_data = 10
mySeq1.output_data = 11
mySeq1.validity = 1
gnd_RI_TC_Seq_NATIVE(mySeq1, mySeq2)
print('got mySeq2:', mySeq2)
mySeq1.input_data = 20
mySeq1.output_data = 21
mySeq1.validity = 0
gnd_RI_TC_Seq_UPER(mySeq1, mySeq2)
print('got mySeq2:', mySeq2)
mySeqOf1[0] = 0
mySeqOf1[1] = 1
gnd_RI_TC_SeqOf_NATIVE(mySeqOf1, mySeqOf2)
print('got mySeqOf2:', mySeqOf2)
This diff is collapsed.
This diff is collapsed.
/* User code: This file will not be overwritten by TASTE. */
#include <stdio.h>
#include "payload.h"
void payload_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void payload_PI_TC_Seq_NATIVE(const asn1SccMySeq *IN_a,
asn1SccMySeq *OUT_b)
{
printf("payload_PI_TC_Seq_NATIVE\n");
printf(" %llu %llu %u\n", IN_a->input_data, IN_a->output_data, IN_a->validity);
OUT_b->input_data = IN_a->input_data + 10;
OUT_b->output_data = IN_a->output_data + 10;
OUT_b->validity = 1 - IN_a->validity;
}
void payload_PI_TC_Seq_UPER(const asn1SccMySeq *IN_a,
asn1SccMySeq *OUT_b)
{
printf("payload_PI_TC_Seq_UPER\n");
printf(" %llu %llu %u\n", IN_a->input_data, IN_a->output_data, IN_a->validity);
OUT_b->input_data = IN_a->input_data + 10;
OUT_b->output_data = IN_a->output_data + 10;
OUT_b->validity = 1 - IN_a->validity;
}
void payload_PI_TC_Choice_NATIVE(const asn1SccMyChoice *IN_a,
asn1SccMyChoice *OUT_b)
{
/* Write your code here! */
}
void payload_PI_TC_OctStr_NATIVE(const asn1SccMyOctStr *IN_a,
asn1SccMyOctStr *OUT_b)
{
printf("TC_OctStr_NATIVE\n");
printf(" IN_a: %c%c%c\n", IN_a->arr[0], IN_a->arr[1], IN_a->arr[2]);
for (int i = 0; i < 3; ++i) {
OUT_b->arr[i] = IN_a->arr[i] + 1;
}
}
void payload_PI_TC_SeqOf_NATIVE(const asn1SccMySeqOf *IN_a,
asn1SccMySeqOf *OUT_b)
{
printf("TC_SeqOf_NATIVE\n");
printf(" IN_a: %u %u\n", IN_a->arr[0], IN_a->arr[1]);
for (int i = 0; i < 2; ++i) {
OUT_b->arr[i] = IN_a->arr[i] + 1;
}
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_payload__
#define __USER_CODE_H_payload__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void payload_startup();
void payload_PI_TC_Seq_NATIVE(const asn1SccMySeq *,
asn1SccMySeq *);
void payload_PI_TC_Seq_UPER(const asn1SccMySeq *,
asn1SccMySeq *);
void payload_PI_TC_Choice_NATIVE(const asn1SccMyChoice *,
asn1SccMyChoice *);
void payload_PI_TC_OctStr_NATIVE(const asn1SccMyOctStr *,
asn1SccMyOctStr *);
void payload_PI_TC_SeqOf_NATIVE(const asn1SccMySeqOf *,
asn1SccMySeqOf *);
#ifdef __cplusplus
}
#endif
#endif
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