Commit a6230be4 authored by Maxime Perrotin's avatar Maxime Perrotin

Initial support for C++

parent c93ff8a1
......@@ -27,6 +27,7 @@
configuration project AIR is
package Compiler is
for Driver ("C") use "sparc-rtems5-gcc";
for Driver ("C++") use "sparc-rtems5-g++";
for Driver ("Ada") use "sparc-rtems5-gcc";
for Leading_Required_Switches ("C") use ("-c");
......@@ -72,6 +73,7 @@ configuration project AIR is
for Body_Suffix ("C") use ".c";
for Spec_Suffix ("Ada") use ".ads";
for Body_Suffix ("Ada") use ".adb";
for Body_Suffix ("C++") use ".cc";
for Dot_Replacement use "-";
end Naming;
for Archive_Builder use ("ar" , "cr");
......
......@@ -45,9 +45,9 @@ project @_CAPITALIZE:Name_@_AIR is
for Exec_Dir use "../deploymentview_final/@_Name_@";
@@IF@@ @_Need_Ada_@ = TRUE
for Languages use ("Ada", "C");
for Languages use ("Ada", "C", "C++");
@@ELSE@@
for Languages use ("C");
for Languages use ("C", "C++");
@@END_IF@@
for Main use ("main.c");
......@@ -160,6 +160,9 @@ project @_CAPITALIZE:Name_@_AIR is
"spwrouter_custom_config.c",
"star_dundee_api.c",
"trace_manager.c",
"um_threads.c");
"um_threads.c",
"cheddar_schedule.cc",
"remote_configuration.cc",
"trace_manager.cc");
end @_CAPITALIZE:Name_@_AIR;
......@@ -70,13 +70,17 @@ project @_CAPITALIZE:Name_@ is
for Exec_Dir use "../../binaries";
@@IF@@ @_Need_Ada_@ = TRUE
for Languages use ("Ada", "C");
for Languages use ("Ada", "C", "C++");
@@ELSE@@
for Languages use ("C");
for Languages use ("C", "C++");
@@END_IF@@
for Main use ("main.c");
package Naming is
for Body_Suffix ("C++") use ".cc";
end Naming;
-- These files are not needed to use POHIC: don' t compile them
for Excluded_Source_Files use
("config.c",
......@@ -122,7 +126,10 @@ project @_CAPITALIZE:Name_@ is
"spwrouter_custom_config.c",
"star_dundee_api.c",
"trace_manager.c",
"um_threads.c");
"um_threads.c",
"cheddar_schedule.cc",
"remote_configuration.cc",
"trace_manager.cc");
package Compiler is
case Build is
......
......@@ -34,8 +34,10 @@ configuration project RTEMS_WITH_ADA is
package Compiler is
for Driver ("C") use "sparc-rtems5-gcc";
for Driver ("Ada") use "sparc-rtems5-gcc";
for Driver ("C++") use "sparc-rtems5-g++";
for Leading_Required_Switches ("C") use ("-c");
for Leading_Required_Switches ("C++") use ("-c");
for Required_Switches("Ada") use
("-c",
......@@ -43,7 +45,7 @@ configuration project RTEMS_WITH_ADA is
"ada",
"-gnatA");
for Required_Switches("C") use
Common_C_Switches :=
("--pipe",
"-DTARGET=leon.rtems_posix",
"-DRTEMS_POSIX",
......@@ -60,11 +62,18 @@ configuration project RTEMS_WITH_ADA is
"-DBSP_leon3",
"-DCORES=1");
for Required_Switches("C") use Common_C_Switches;
for Required_Switches("C++") use Common_C_Switches;
for Object_File_Suffix ("C") use ".o";
for Object_File_Suffix ("C++") use ".o";
for Object_File_Suffix ("Ada") use ".o";
for Dependency_Switches ("C") use ("-Wp,-MD,");
for Dependency_Switches ("C++") use ("-Wp,-MD,");
for Dependency_Switches ("Ada") use ("-MMD","-MF","");
for Include_Switches ("C") use ("-I");
for Include_Switches ("C++") use ("-I");
for Include_Switches ("Ada") use ("-I");
for Include_Path ("Ada") use "ADA_INCLUDE_PATH";
for Include_Path_File ("Ada") use "ADA_PRJ_INCLUDE_FILE";
......@@ -76,13 +85,14 @@ configuration project RTEMS_WITH_ADA is
for Body_Suffix ("C") use ".c";
for Spec_Suffix ("Ada") use ".ads";
for Body_Suffix ("Ada") use ".adb";
for Body_Suffix ("C++") use ".cc";
for Dot_Replacement use "-";
end Naming;
for Archive_Builder use ("ar" , "cr");
package Linker is
for Driver use "sparc-rtems5-gcc";
for Default_Switches ("C") use
Common_C_Linker_Switches :=
("--pipe",
"-g",
"-B/opt/rtems-5.1-2019.07.25/sparc-rtems5/leon3/lib",
......@@ -93,6 +103,9 @@ configuration project RTEMS_WITH_ADA is
"-lgnat",
"-lgnarl",
"-mcpu=cypress");
for Default_Switches ("C") use Common_C_Linker_Switches;
for Default_Switches ("C++") use Common_C_Linker_Switches;
for Default_Switches ("Ada") use
("--pipe",
"-g",
......
......@@ -45,9 +45,9 @@ project @_CAPITALIZE:Name_@_RTEMS_Ada is
for Exec_Dir use "../../binaries";
@@IF@@ @_Need_Ada_@ = TRUE
for Languages use ("Ada", "C");
for Languages use ("Ada", "C", "C++");
@@ELSE@@
for Languages use ("C");
for Languages use ("C", "C++");
@@END_IF@@
for Main use ("main.c");
......@@ -153,7 +153,10 @@ project @_CAPITALIZE:Name_@_RTEMS_Ada is
"spwrouter_custom_config.c",
"star_dundee_api.c",
"trace_manager.c",
"um_threads.c");
"um_threads.c",
"cheddar_schedule.cc",
"remote_configuration.cc",
"trace_manager.cc");
end @_CAPITALIZE:Name_@_RTEMS_Ada;
ConcurrencyView_Properties.aadl
function1.zip
function2.zip
This diff is collapsed.
TASTE-Dataview DEFINITIONS ::= BEGIN
-- In this ACN model, you can specify custom binary encoding rules for
-- your data types. For example if you require a specific memory layout
-- for a record, or need to add padding fields, define endianness, etc.
-- you can do that with ACN. Refer to the ACN user manual for details.
-- TASTE-Boolean []
END
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
TASTE-Boolean ::= BOOLEAN
-- ASN.1 Type definitions must start with an uppercase
-- Field names in records (SEQUENCE) must start with a lowercase
-- Underscores are not allowed: use dash (hyphen)
-- Simple types:
-- MyInteger ::= INTEGER (0..255)
-- MyReal ::= REAL (0.0 .. 1000.0)
-- MyBool ::= BOOLEAN
-- MyEnum ::= ENUMERATED { hello, world, how-are-you }
-- Complex types:
-- 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.1
-- TASTE type deploymentview
--
-- generated code: do not edit
---------------------------------------------------
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 interfaceview::IV::Function1;
WITH interfaceview::IV::Function2;
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_Function1 : SYSTEM interfaceview::IV::Function1::Function1.others {
Taste::FunctionName => "Function1";
};
IV_Function2 : SYSTEM interfaceview::IV::Function2::Function2.others {
Taste::FunctionName => "Function2";
};
x86_partition : PROCESS deploymentview::DV::Node1::x86_partition.others {
Taste::coordinates => "96228 74011 128176 96928";
Deployment::Port_Number => 0;
};
x86_linux : PROCESSOR ocarina_processors_x86::x86.linux {
Taste::coordinates => "92234 67463 132170 100202";
};
PROPERTIES
Taste::APLC_Binding => (reference (x86_partition)) APPLIES TO IV_Function1;
Taste::APLC_Binding => (reference (x86_partition)) APPLIES TO IV_Function2;
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 => "87242 58109 137162 104879";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.0";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
---------------------------------------------------
-- AADL2.1
-- TASTE type interfaceview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE interfaceview::IV::Function1
PUBLIC
WITH interfaceview::IV::Function2;
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_doSomethingInCPP
FEATURES
in1 : IN PARAMETER DataView::T_Int32 {
Taste::encoding => UPER;
};
out1 : OUT PARAMETER DataView::T_Int32 {
Taste::encoding => UPER;
};
END RI_doSomethingInCPP;
SUBPROGRAM IMPLEMENTATION RI_doSomethingInCPP.others
END RI_doSomethingInCPP.others;
SYSTEM Function1
FEATURES
PI_pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Function1::PI_pulse.others {
Taste::coordinates => "111341 56534";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 1000 ms;
Taste::Deadline => 1000 ms;
Taste::InterfaceName => "pulse";
};
RI_doSomethingInCPP : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::Function2::PI_doSomethingInCPP.others {
Taste::coordinates => "124879 72284";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "doSomethingInCPP";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
END Function1;
SYSTEM IMPLEMENTATION Function1.others
END Function1.others;
END interfaceview::IV::Function1;
PACKAGE interfaceview::IV::Function2
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_doSomethingInCPP
FEATURES
in1 : IN PARAMETER DataView::T_Int32 {
Taste::encoding => UPER;
};
out1 : OUT PARAMETER DataView::T_Int32 {
Taste::encoding => UPER;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_doSomethingInCPP;
SUBPROGRAM IMPLEMENTATION PI_doSomethingInCPP.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_doSomethingInCPP.others;
SYSTEM Function2
FEATURES
PI_doSomethingInCPP : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Function2::PI_doSomethingInCPP.others {
Taste::coordinates => "151807 77793";
Taste::RCMoperationKind => protected;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "doSomethingInCPP";
};
PROPERTIES
Source_Language => (CPP);
Taste::Active_Interfaces => any;
END Function2;
SYSTEM IMPLEMENTATION Function2.others
END Function2.others;
END interfaceview::IV::Function2;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::IV::Function1;
WITH interfaceview::IV::Function2;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM interfaceview
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
Function1 : SYSTEM interfaceview::IV::Function1::Function1.others {
Taste::coordinates => "88187 56534 124879 110076";
};
Function2 : SYSTEM interfaceview::IV::Function2::Function2.others {
Taste::coordinates => "151807 59211 191176 105981";
};
CONNECTIONS
Function2_PI_doSomethingInCPP_Function1_RI_doSomethingInCPP : SUBPROGRAM ACCESS Function2.PI_doSomethingInCPP -> Function1.RI_doSomethingInCPP {
Taste::coordinates => "124879 72284 138343 72284 138343 77793 151807 77793";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.0";
END interfaceview::IV;
KAZOO=../../kazoo
all: c
ada: test-parse-ada
make -C output.ada
cp function1/function1.c output.pohic/function1/C/src
cp function2/function2.cc output.pohic/function2/CPP/src
cd output.ada/build && \
ocarina -x main.aadl && \
make -f Makefile.taste
c: test-parse-c # Polyorb_HI_C output
cp function1/function1.c output.pohic/function1/C/src
cp function2/function2.cc output.pohic/function2/CPP/src
make -C output.pohic
test-parse-ada: clean-ada
$(KAZOO) --gw \
-o output.ada \
--glue \
--debug
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 \
-o output.pohic \
--glue \
--debug
clean-ada:
rm -rf output.ada
clean-c:
rm -rf output.pohic
skeletons:
$(KAZOO) -p --gw --glue -o code && make -C code dataview
clean-skeletons:
rm -rf code
clean: clean-ada clean-c clean-skeletons
.PHONY: clean clean-ada clean-c test-parse-ada gdb test-parse-c buildsupport_pohic buildsupport_pohiada c skeletons clean-skeletons
#!/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
# Set up the cache to limit the calls to ASN1SCC in DMT tools
mkdir -p .cache
export PROJECT_CACHE=$HOME/.taste_AST_cache
# Use PolyORB-HI-C runtime
USE_POHIC=1
# Set Debug mode by default
DEBUG_MODE=--debug
# 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
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j /tmp/dv.asn
cd "$SKELS" && rm -f function1.zip && zip function1 function1/* && cd $OLDPWD
cd "$SKELS" && rm -f function2.zip && zip function2 function2/* && cd $OLDPWD
[ ! -z "$CLEANUP" ] && rm -rf binary*
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
elif [ -f ConcurrencyView_Properties.aadl ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView_Properties.aadl "
fi
if [ -f user_init_post.sh ]
then
echo -e "${INFO} Executing user-defined post-init script"
source user_init_post.sh
fi
if [ -f additionalCommands.sh ]
then
source additionalCommands.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_MODE \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o "$OUTPUTDIR" \
--subC function1:"$SKELS"/function1.zip \
--subCPP function2:"$SKELS"/function2.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
/* User code: This file will not be overwritten by TASTE. */
#include <stdio.h>
#include "function1.h"
void function1_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void function1_PI_pulse()
{
static asn1SccT_Int32 i=0, o;
function1_RI_doSomethingInCPP(&i, &o);
printf("Send %lld, got %lld\n", i, o);
}
/* User code: This file will not be overwritten by TASTE. */
#include <iostream>
#include "function2.h"
void function2_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void function2_PI_doSomethingInCPP(const asn1SccT_Int32 *IN_in1,
asn1SccT_Int32 *OUT_out1)
{
/* Write your code here! */
std::cout << *IN_in1 << std::endl;
*OUT_out1 = *IN_in1 + 1;
}
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