Generation working and Compilation of MARTe components

This commit is contained in:
ferrog
2025-05-13 16:03:11 +00:00
parent 3a5e378d99
commit 4faee3802a
1571 changed files with 611466 additions and 0 deletions

View File

@@ -0,0 +1,396 @@
+StateMachine = {
Class = StateMachine
+INITIAL = {
Class = ReferenceContainer
+Start = {
Class = StateMachineEvent
NextState = "WAITSTANDBY"
NextStateError = "WAITSTANDBY"
+PrepareNextStateMsg = {
Class = Message
Destination = JAGyrotronRTApp
Mode = ExpectsReply
Function = PrepareNextState
+Parameters = {
Class = ConfigurationDatabase
param1 = WaitStandby
}
}
+StartNextStateExecutionMsg = {
Class = Message
Destination = JAGyrotronRTApp
Function = StartNextStateExecution
Mode = ExpectsReply
}
}
}
+WAITSTANDBY = {
Class = ReferenceContainer
+Stay = {
Class = StateMachineEvent
NextState = "WAITSTANDBY"
NextStateError = "WAITSTANDBY"
+StopCurrentStateExecutionMsg = {
Class = Message
Destination = JAGyrotronRTApp
Function = StopCurrentStateExecution
Mode = ExpectsReply
}
+PrepareNextStateMsg = {
Class = Message
Destination = JAGyrotronRTApp
Mode = ExpectsReply
Function = PrepareNextState
+Parameters = {
Class = ConfigurationDatabase
param1 = WaitStandby
}
}
+StartNextStateExecutionMsg = {
Class = Message
Destination = JAGyrotronRTApp
Function = StartNextStateExecution
Mode = ExpectsReply
}
}
}
}
+JAGyrotronRTApp = {
Class = RealTimeApplication
+Functions = {
Class = ReferenceContainer
+GAMSDNSubCommand = {
Class = IOGAM
InputSignals = {
Command = {
DataSource = SDNSubCommands
Type = uint16
NumberOfDimensions = 1
NumberOfElements = 64
Ranges = {{0 0}}
Frequency = 1
}
ESDNTime = {
DataSource = SDNSubCommands
Type = uint32
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNTimeDisplay = {
Alias = ESDNTime
DataSource = SDNSubCommands
Type = uint32
NumberOfDimensions = 1
NumberOfElements = 1
}
}
OutputSignals = {
Command = {
DataSource = Display
Type = uint16
}
ESDNTime = {
DataSource = DDB1
Type = uint32
}
ESDNTimeDisplay = {
DataSource = Display
Type = uint32
}
}
}
+GAMSDNSubWaveform = {
Class = IOGAM
InputSignals = {
GYA_FHPS_SP = {
DataSource = SDNSubWaveform
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_MCPS_SP = {
DataSource = SDNSubWaveform
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_CCPS_SP = {
DataSource = SDNSubWaveform
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
MHVPS_SP = {
DataSource = SDNSubWaveform
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_BPS_SP = {
DataSource = SDNSubWaveform
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_APS_SP = {
DataSource = SDNSubWaveform
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
WaveformPacketIDFor1kHz = {
DataSource = SDNSubWaveform
Alias = WaveformPacketID
Type = uint16
}
}
OutputSignals = {
GYA_FHPS_SP = {
DataSource = DDB1
Type = float32
}
GYA_MCPS_SP = {
DataSource = DDB1
Type = float32
}
GYA_CCPS_SP = {
DataSource = DDB1
Type = float32
}
MHVPS_SP = {
DataSource = DDB1
Type = float32
}
GYA_BPS_SP = {
DataSource = DDB1
Type = float32
}
GYA_APS_SP = {
DataSource = DDB1
Type = float32
}
WaveformPacketIDFor1kHz = {
DataSource = DDB1
Alias = WaveformPacketID
Type = uint16
}
}
}
+GAMReply = {
Class = IOGAM
InputSignals = {
ESDNTime = {
DataSource = DDB1
Type = uint32
}
WaveformPacketID = {
DataSource = DDB1
Type = uint16
}
}
OutputSignals = {
ESDNTime = {
DataSource = SDNReply
Type = uint32
Trigger = 1
}
ReplyWaveformAck = {
DataSource = SDNReply
Type = uint16
}
}
}
}
+Data = {
Class = ReferenceContainer
DefaultDataSource = DDB1
+DDB1 = {
Class = GAMDataSource
}
+Timings = {
Class = TimingDataSource
}
+Display = {
Class = LoggerDataSource
}
+SDNSubCommands = {
Class = SDN::SDNSubscriber
Topic = ECPC2SCUJA
Interface = lo
CPUs = 0x2
Locked = 1
Timeout = 1000 // TODO: change to 1 ms
Signals = {
Header = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 48
}
ESDNHeaderVersionId = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNHeaderSize = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNStatus = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNDoNotUse = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNTime = {
Type = uint32
NumberOfDimensions = 1
NumberOfElements = 1
}
Command = {
Type = uint16
NumberOfDimensions = 1
NumberOfElements = 64
}
}
}
+SDNReply = {
Class = SDN::SDNPublisher
Topic = SCUJA2ECPC
Interface = lo
CPUs = 0x8
Locked = 1
Signals = {
Header = {
Type = uint8
NumberOfElements = 48
}
ESDNHeaderVersionId = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNHeaderSize = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNStatus = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNDoNotUse = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNTime = {
Type = uint32
NumberOfDimensions = 1
NumberOfElements = 1
}
ReplyStatus = {
Type = uint16
NumberOfDimensions = 1
NumberOfElements = 1
}
ReplyWaveformAck = {
Type = uint16
NumberOfDimensions = 1
NumberOfElements = 1
}
}
}
+SDNSubWaveform = {
Class = SDN::SDNSubscriber
Topic = ECPC2SCUJAWF
Interface = lo
Locked = 1
Timeout = 1000 // TODO: change to 1 ms
Signals = {
Header = {
Type = uint8
NumberOfElements = 48
}
ESDNHeaderVersionId = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNHeaderSize = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNStatus = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNDoNotUse = {
Type = uint8
NumberOfDimensions = 1
NumberOfElements = 1
}
ESDNTime = {
Type = uint32
NumberOfDimensions = 1
NumberOfElements = 1
}
WaveformPacketID = {
Type = uint16
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_MCPS_SP = {
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_CCPS_SP = {
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
MHVPS_SP = {
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_BPS_SP = {
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
GYA_APS_SP = {
Type = float32
NumberOfDimensions = 1
NumberOfElements = 1
}
}
}
}
+States = {
Class = ReferenceContainer
+WaitStandby = {
Class = RealTimeState
+Threads = {
Class = ReferenceContainer
+Thread1 = {
Class = RealTimeThread
Functions = {GAMSDNSubCommand GAMSDNSubWaveform GAMReply}
CPUs = 0x1
}
}
}
}
+Scheduler = {
Class = GAMScheduler
TimingDataSource = Timings
}
}

View File

@@ -0,0 +1,68 @@
//+======================================================================
// $HeadURL: https://svnpub.iter.org/codac/iter/codac/dev/units/m-sdd-translator-parts/tags/CODAC-CORE-6.0.0/org.iter.codac.sdd.translators/src/main/resources/templates/sdn/configure_sdn.cpp.vm $
// $Id: configure_sdn.cpp.vm 83098 2018-01-08 13:23:38Z cesnikt $
//
// Project : CODAC Core System
//
// Description : SDN Program - Gyrotron01DAN
//
// Author : Kirti Mahajan, Lana Abadie and TCS (link with velocity and SDD model)
//
// Copyright (c) : 2010-2018 ITER Organization,
// CS 90 046
// 13067 St. Paul-lez-Durance Cedex
// France
//
// This file is part of ITER CODAC software.
// For the terms and conditions of redistribution or use of this software
// refer to the file ITER-LICENSE.TXT located in the top level directory
// of the distribution package.
//
//-======================================================================
#include <string.h>
#include <sdn.h>
#include "includetopics.h"
using namespace std;
/* Create variables for the topics on which application is publishing */
//+P=====================================================================
//-P=====================================================================
/* Create variables for topics on which application is subscribing */
//+S=====================================================================
//-S=====================================================================
int configureSDN()
{
SR_RET sr_ret = SR_OK;
//+P=====================================================================
//-P=====================================================================
//+S=====================================================================
//-S=====================================================================
return sr_ret;
}
int cleanupSDN()
{
SR_RET sr_ret = SR_OK;
/* Unregister publisher */
//+P=====================================================================
//-P=====================================================================
/* Unregister subscriber */
//+S=====================================================================
//-S=====================================================================
return sr_ret;
}

View File

@@ -0,0 +1,195 @@
#!/bin/bash
#Arguments -f FILENAME -m MESSAGE [-d cgdb|strace] -x DAN_CONFIG_LOCATION -r root
#-f FILENAME=MARTe configuration file
#-m MESSAGE=Start message
#-d cgdb=Run with cgdb
#-d strace=Run with strace
#-x DAN_CONFIG_LOCATION=Location of the DANConfig.xml (e.g. ~/Projects/ECJASDN/Configurations/DANTestConfig.xml)
#-r run as root
#Run with cgdb or strace?
DEBUG=""
#Consume input arguments
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-f|--file)
FILE="$2"
shift # past argument
;;
-m|--message)
MESSAGE="$2"
shift # past argument
;;
-s|--state)
STATE="$2"
shift # past argument
;;
-d|--debug)
DEBUG="$2"
shift # past argument
;;
-x|--dan_config)
DAN_CONFIG_LOCATION="$2"
shift # past argument
;;
-i|--dan_ip)
DAN_MASTER_IP="$2"
shift # past argument
;;
-r|--root)
RUN_AS_ROOT="root"
shift # past argument
;;
--default)
DEFAULT=YES
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
if [ -z ${MARTe2_DIR+x} ]; then
echo "Please set the MARTe2_DIR environment variable";
exit;
fi
if [ -z ${MARTe2_Components_DIR+x} ]; then
#Check if this is a CCS deployment
MARTe2_Components_DIR_CSS=$MARTe2_DIR/Build/x86-linux/Components/
if [ -d ${MARTe2_Components_DIR_CSS+x} ]; then
MARTe2_Components_DIR=$MARTe2_DIR
else
echo "Please set the MARTe2_Components_DIR environment variable";
exit;
fi
fi
echo $MARTe2_Components_DIR
LD_LIBRARY_PATH=.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/x86-linux/Core/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/EPICSCA/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LinuxTimer/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/LoggerDataSource/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/DAN/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/NI6259/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/NI6368/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/SDN/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/UDP/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/MDSWriter/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/RealTimeThreadAsyncBridge/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/RealTimeThreadSynchronisation/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/FileDataSource/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/IOGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/BaseLib2GAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/ConversionGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/FilterGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/StatisticsGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/WaveformGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/GAMs/ConstantGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/BaseLib2Wrapper/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/SysLogger/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/Interfaces/EPICS/
### Add own datasource lib path
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/DataSources/RandomDataSource/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/DataSources/NI6528/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/DataSources/JAEPICSCA/
### Add own GAM lib path
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/ESDNValidationGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAMessageGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAPreProgrammedGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JACountdownGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAWaitStandbyGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAConditionalSignalUpdateGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JATimerGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAESDNProcessCommandGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAModeControlGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JATimedSignalUpdateGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAHVArmedSyncGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JARFONSyncGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAWFRecordGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JATriangleWaveGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JARampupGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JACounterGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JARTStateMachineGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JASDNRTStateMachineGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JATerminalInterfaceGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JABitSumGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JASourceChoiseGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JABitReverseGAM/
### Add EPICS lib path
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EPICS_BASE/lib/$EPICS_HOST_ARCH
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/FilterDownsamplingGAM/
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mdsplus/lib64/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SDN_CORE_LIBRARY_DIR
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/codac/lib/
echo $LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
#Starts the DAN services only if required
if [ ! -z "$DAN_CONFIG_LOCATION" ]; then
export DAN_ARCHIVE_MASTER=$DAN_MASTER_IP
echo $DAN_MASTER_IP
/opt/codac/bin/danApiTool api close
/opt/codac/bin/danApiTool api init $DAN_CONFIG_LOCATION
fi
NR_CPUS=16
#Setup performance
#Disable CPU speed changing
#service cpuspeed stop
#memo:Redirecting to /bin/systemctl stop cpuspeed.service
#memo:Failed to stop cpuspeed.service: Unit cpuspeed.service not loaded.
#
# Migrate irq to CPU0
#for D in $(ls /proc/irq)
#do
#if [ -x "/proc/irq/$D" ] && [ $D != "0" ]
#then
# echo $D
# echo 1 > /proc/irq/$D/smp_affinity
#fi
#done
#Location of the MARTe2 application loader
MARTe2APP=$MARTe2_DIR/Build/x86-linux/App/MARTeApp.ex
#Start with cgdb or with strace
if [ "$DEBUG" = "cgdb" ]; then
cgdb --args $MARTe2APP -l RealTimeLoader -f $FILE -m $MESSAGE
elif [ "$DEBUG" = "strace" ]; then
strace -o/tmp/strace.err $MARTe2APP -l RealTimeLoader -f $FILE -m $MESSAGE
else
if [ -z ${RUN_AS_ROOT+x} ]; then
if [ -z ${STATE+x} ]; then
echo "taskset was not used."
sleep 1
$MARTe2APP -l RealTimeLoader -f $FILE -m $MESSAGE
else
$MARTe2APP -l RealTimeLoader -f $FILE -s $STATE
fi
else
if [ -z ${STATE+x} ]; then
echo "taskset was used."
sleep 1
taskset 1 $MARTe2APP -l RealTimeLoader -f $FILE -m $MESSAGE
else
taskset 1 $MARTe2APP -l RealTimeLoader -f $FILE -s $STATE
fi
fi
fi
if [ ! -z "$DAN_CONFIG_LOCATION" ]; then
/opt/codac/bin/danApiTool api close
fi