Revise top tests

This commit is contained in:
Rob Bocchino 2025-12-04 21:08:05 -08:00
parent 7b6456b879
commit 48b8afab20
27 changed files with 191 additions and 80 deletions

View File

@ -1,24 +0,0 @@
module Fw {
port Cmd
port CmdReg
port CmdResponse
port PrmGet
port PrmSet
port Time
port Tlm
}
enum Phases {
configConstants
configObjects
instances
initComponents
configComponents
regCommands
readParameters
loadParameters
startTasks
stopTasks
freeThreads
tearDownComponents
}

View File

@ -1,46 +1,7 @@
#!/bin/sh -e
fpp_to_cpp=../../../../../../bin/fpp-to-cpp
fprime_gcc=../../../../../../scripts/fprime-gcc
. `dirname $0`/../check_topology.sh
echo ' removing old files'
./clean
check_topology tlm_packets
dir=`cd ../..; echo $PWD`
tops="
<NoInstances>
<OneInstance>
<TwoInstances>
"
echo ' generating C++'
$fpp_to_cpp -p $dir -i ../../builtin.fpp ../../tlm_packets.fpp
for suffix in hpp cpp
do
top_acs=`echo $tops | sed -e "s;<;../../;g" -e "s;>;TopologyAc.ref.$suffix;g"`
for file in ../../*TlmPacketsAc.ref.$suffix $top_acs
do
base=`basename $file .ref.$suffix`
cp $file $base.$suffix
done
done
echo ' compiling C++'
top_cpps=`echo $tops | sed -e "s;<;;g" -e "s;>;TopologyAc.cpp;g"`
for file in *TlmPacketsAc.cpp $top_cpps
do
include_paths="
-I..
-I../../../fprime
-I../../../fprime/config
-I../../../fprime/Fw/Time
-I../../../fprime/Fw/Tlm
"
echo " compiling $file"
for variable_flags in '' '-DFW_DIRECT_PORT_CALLS'
do
echo " variable_flags=$variable_flags"
$fprime_gcc $variable_flags $include_paths -Wno-unused-parameter -c $file
done
done

View File

@ -2,7 +2,6 @@ check_topology()
{
src_dir=$1
top_name=$2
dir=`dirname $0`
dir=`cd $dir; pwd`
@ -20,12 +19,38 @@ check_topology()
$FPP_TO_CPP -p $PWD -i $FPRIME_DEPS,../phases.fpp -d $dir components.fpp topology.fpp
)
flags="-I$FPRIME_DIR -I$FPRIME_DIR/fprime/config -Wno-unused-parameter -c"
echo ' compiling C++'
for variable_flags in '' '-DFW_DIRECT_PORT_CALLS'
options="
-I..
-I$FPRIME_DIR
-I$FPRIME_DIR/config
-I$FPRIME_DIR/Fw/Time
-I$FPRIME_DIR/Fw/Tlm
-Wno-unused-parameter
-c
"
#flags="-I$FPRIME_DIR -I$FPRIME_DIR/config -Wno-unused-parameter -c"
top_files=`find . -maxdepth 1 -name '*TopologyAc.cpp'`
for top_file in $top_files
do
echo " variable_flags=$variable_flags"
$FPRIME_GCC $variable_flags $flags $top_name'TopologyAc.cpp'
top_name=`echo $top_file | sed -e 's;^\./;;' -e 's/TopologyAc\.cpp$//'`
echo ' compiling C++ for '$top_name
for variable_flags in '' '-DFW_DIRECT_PORT_CALLS'
do
echo " variable_flags=$variable_flags"
$FPRIME_GCC $variable_flags $options $top_name'TopologyAc.cpp'
done
done
tlm_packet_files=`find . -maxdepth 1 -name '*TlmPacketsAc.cpp'`
for tlm_packet_file in $tlm_packet_files
do
echo " compiling $tlm_packet_file"
for variable_flags in '' '-DFW_DIRECT_PORT_CALLS'
do
echo " variable_flags=$variable_flags"
$FPRIME_GCC $variable_flags $options $tlm_packet_file
done
done
}

View File

@ -4,6 +4,6 @@ export COMPILER_ROOT=`cd ../../../..; pwd`
export TOP_DIR=$PWD
export FPRIME_DIR=`cd ../fprime; pwd`
export FPRIME_DEPS="$FPRIME_DIR/config/FpConfig.fpp,$FPRIME_DIR/Platform/PlatformTypes.fpp,$FPRIME_DIR/Fw/Prm/Prm.fpp,$FPRIME_DIR/Fw/Cmd/Cmd.fpp"
export FPRIME_DEPS="$FPRIME_DIR/config/FpConfig.fpp,$FPRIME_DIR/Platform/PlatformTypes.fpp,$FPRIME_DIR/Fw/Prm/Prm.fpp,$FPRIME_DIR/Fw/Cmd/Cmd.fpp,$FPRIME_DIR/Fw/Time/Time.fpp,$FPRIME_DIR/Fw/Tlm/Tlm.fpp"
export FPRIME_GCC=$COMPILER_ROOT/scripts/fprime-gcc
export FPP_TO_CPP=$COMPILER_ROOT/bin/fpp-to-cpp

View File

@ -43,8 +43,8 @@ params()
tlm_packets()
{
cd $TOP_DIR
run_test "-i builtin.fpp -p $PWD" tlm_packets && \
cd $TOP_DIR/tlm_packets
run_test "-p $PWD -i $FPRIME_DEPS,../phases.fpp,components.fpp" topology && \
diff_cpp NoInstancesTopology && \
diff_cpp NoInstances_P1TlmPackets && \
diff_cpp NoInstances_P2TlmPackets && \

View File

@ -128,7 +128,10 @@ bool CComponentBase::isConnected_tlmOut_OutputPort(FwIndexType portNum) const {
return result;
}
void CComponentBase::timeGetOut_out(FwIndexType portNum) const {
void CComponentBase::timeGetOut_out(
FwIndexType portNum,
Fw::Time& time
) const {
FW_ASSERT(
(0 <= portNum) && (portNum < NUM_TIMEGETOUT_OUTPUT_PORTS),
static_cast<FwAssertArgType>(portNum),
@ -142,7 +145,12 @@ void CComponentBase::timeGetOut_out(FwIndexType portNum) const {
}
}
void CComponentBase::tlmOut_out(FwIndexType portNum) const {
void CComponentBase::tlmOut_out(
FwIndexType portNum,
FwChanIdType id,
Fw::Time& timeTag,
Fw::TlmBuffer& val
) const {
FW_ASSERT(
(0 <= portNum) && (portNum < NUM_TLMOUT_OUTPUT_PORTS),
static_cast<FwAssertArgType>(portNum),

View File

@ -136,7 +136,10 @@ bool CComponentBase::isConnected_tlmOut_OutputPort(FwIndexType portNum) const {
return result;
}
void CComponentBase::timeGetOut_out(FwIndexType portNum) const {
void CComponentBase::timeGetOut_out(
FwIndexType portNum,
Fw::Time& time
) const {
FW_ASSERT(
(0 <= portNum) && (portNum < NUM_TIMEGETOUT_OUTPUT_PORTS),
static_cast<FwAssertArgType>(portNum),
@ -150,7 +153,12 @@ void CComponentBase::timeGetOut_out(FwIndexType portNum) const {
}
}
void CComponentBase::tlmOut_out(FwIndexType portNum) const {
void CComponentBase::tlmOut_out(
FwIndexType portNum,
FwChanIdType id,
Fw::Time& timeTag,
Fw::TlmBuffer& val
) const {
FW_ASSERT(
(0 <= portNum) && (portNum < NUM_TLMOUT_OUTPUT_PORTS),
static_cast<FwAssertArgType>(portNum),

View File

@ -0,0 +1,21 @@
array A = [3] U32
struct S {
x: U32
y: F32
}
passive component C {
telemetry T1: string
telemetry T2: U32
telemetry T3: F32
telemetry T4: bool
telemetry T5: A
telemetry T6: S
time get port timeGetOut
telemetry port tlmOut
}

View File

@ -0,0 +1,112 @@
module M {
instance c1: C base id 0x100
instance c2: C base id 0x200
}
@ A topology with no instances
topology NoInstances {
@ Empty packet set
telemetry packets P1 {
}
@ Packet set with empty packet
telemetry packets P2 {
packet P1 group 0 {
}
}
}
module M {
@ A topology with one instance
topology OneInstance {
instance c1
@ No channels omitted
telemetry packets P1 {
packet P1 group 1 {
c1.T1
c1.T2
c1.T3
}
packet P2 group 2 {
c1.T4
c1.T5
c1.T6
}
}
@ Some channels omitted
telemetry packets P2 {
packet P1 group 3 {
c1.T1
c1.T2
c1.T3
}
} omit {
c1.T4
c1.T5
c1.T6
}
@ All channels omitted
telemetry packets P3 {
} omit {
c1.T1
c1.T2
c1.T3
c1.T4
c1.T5
c1.T6
}
}
}
module N {
@ A topology with two instances
topology TwoInstances {
instance M.c1
instance M.c2
telemetry packets P1 {
packet P1 group 4 {
M.c1.T1
M.c1.T2
M.c1.T3
M.c1.T4
M.c1.T5
M.c1.T6
}
} omit {
M.c2.T1
M.c2.T2
M.c2.T3
M.c2.T4
M.c2.T5
M.c2.T6
}
}
}

View File

@ -43,8 +43,8 @@ params()
tlm_packets()
{
cd $TOP_DIR
update "-i builtin.fpp -p $PWD" tlm_packets
cd $TOP_DIR/tlm_packets
update "-p $PWD -i $FPRIME_DEPS,../phases.fpp,components.fpp" topology
move_cpp NoInstancesTopology
move_cpp NoInstances_P1TlmPackets
move_cpp NoInstances_P2TlmPackets