diff --git a/compiler/tools/fpp-to-cpp/test/top/builtin.fpp b/compiler/tools/fpp-to-cpp/test/top/builtin.fpp deleted file mode 100644 index a7bef6251..000000000 --- a/compiler/tools/fpp-to-cpp/test/top/builtin.fpp +++ /dev/null @@ -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 -} diff --git a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/TlmPackets/check b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/TlmPackets/check index b14dd02ba..5325dce64 100755 --- a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/TlmPackets/check +++ b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/TlmPackets/check @@ -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=" - - - -" - -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 diff --git a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/check_topology.sh b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/check_topology.sh index ae66e41a9..e44f72b9f 100644 --- a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/check_topology.sh +++ b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/check_topology.sh @@ -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 } diff --git a/compiler/tools/fpp-to-cpp/test/top/defs.sh b/compiler/tools/fpp-to-cpp/test/top/defs.sh index bd1b35fc2..a596552af 100644 --- a/compiler/tools/fpp-to-cpp/test/top/defs.sh +++ b/compiler/tools/fpp-to-cpp/test/top/defs.sh @@ -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 diff --git a/compiler/tools/fpp-to-cpp/test/top/run.sh b/compiler/tools/fpp-to-cpp/test/top/run.sh index d740077ea..f3ae55cdd 100644 --- a/compiler/tools/fpp-to-cpp/test/top/run.sh +++ b/compiler/tools/fpp-to-cpp/test/top/run.sh @@ -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 && \ diff --git a/compiler/tools/fpp-to-cpp/test/top/NoInstancesTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstancesTopologyAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/NoInstancesTopologyAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstancesTopologyAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/NoInstancesTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstancesTopologyAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/NoInstancesTopologyAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstancesTopologyAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/NoInstances_P1TlmPacketsAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P1TlmPacketsAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/NoInstances_P1TlmPacketsAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P1TlmPacketsAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/NoInstances_P1TlmPacketsAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P1TlmPacketsAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/NoInstances_P1TlmPacketsAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P1TlmPacketsAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/NoInstances_P2TlmPacketsAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P2TlmPacketsAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/NoInstances_P2TlmPacketsAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P2TlmPacketsAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/NoInstances_P2TlmPacketsAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P2TlmPacketsAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/NoInstances_P2TlmPacketsAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/NoInstances_P2TlmPacketsAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstanceTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstanceTopologyAc.ref.cpp similarity index 94% rename from compiler/tools/fpp-to-cpp/test/top/OneInstanceTopologyAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstanceTopologyAc.ref.cpp index a8adbf00f..62adf21b1 100644 --- a/compiler/tools/fpp-to-cpp/test/top/OneInstanceTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstanceTopologyAc.ref.cpp @@ -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(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(portNum), diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstanceTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstanceTopologyAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstanceTopologyAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstanceTopologyAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstance_P1TlmPacketsAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P1TlmPacketsAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstance_P1TlmPacketsAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P1TlmPacketsAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstance_P1TlmPacketsAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P1TlmPacketsAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstance_P1TlmPacketsAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P1TlmPacketsAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstance_P2TlmPacketsAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P2TlmPacketsAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstance_P2TlmPacketsAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P2TlmPacketsAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstance_P2TlmPacketsAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P2TlmPacketsAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstance_P2TlmPacketsAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P2TlmPacketsAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstance_P3TlmPacketsAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P3TlmPacketsAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstance_P3TlmPacketsAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P3TlmPacketsAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/OneInstance_P3TlmPacketsAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P3TlmPacketsAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/OneInstance_P3TlmPacketsAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/OneInstance_P3TlmPacketsAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/TwoInstancesTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstancesTopologyAc.ref.cpp similarity index 94% rename from compiler/tools/fpp-to-cpp/test/top/TwoInstancesTopologyAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstancesTopologyAc.ref.cpp index 6a464afd7..e277b9dce 100644 --- a/compiler/tools/fpp-to-cpp/test/top/TwoInstancesTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstancesTopologyAc.ref.cpp @@ -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(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(portNum), diff --git a/compiler/tools/fpp-to-cpp/test/top/TwoInstancesTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstancesTopologyAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/TwoInstancesTopologyAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstancesTopologyAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/TwoInstances_P1TlmPacketsAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstances_P1TlmPacketsAc.ref.cpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/TwoInstances_P1TlmPacketsAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstances_P1TlmPacketsAc.ref.cpp diff --git a/compiler/tools/fpp-to-cpp/test/top/TwoInstances_P1TlmPacketsAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstances_P1TlmPacketsAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/TwoInstances_P1TlmPacketsAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/TwoInstances_P1TlmPacketsAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/tlm_packets/components.fpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/components.fpp new file mode 100644 index 000000000..962af2b98 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/components.fpp @@ -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 + +} diff --git a/compiler/tools/fpp-to-cpp/test/top/tlm_packets/topology.fpp b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/topology.fpp new file mode 100644 index 000000000..b260bb04a --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/topology.fpp @@ -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 + } + + } + +} diff --git a/compiler/tools/fpp-to-cpp/test/top/tlm_packets.ref.txt b/compiler/tools/fpp-to-cpp/test/top/tlm_packets/topology.ref.txt similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/tlm_packets.ref.txt rename to compiler/tools/fpp-to-cpp/test/top/tlm_packets/topology.ref.txt diff --git a/compiler/tools/fpp-to-cpp/test/top/update-ref.sh b/compiler/tools/fpp-to-cpp/test/top/update-ref.sh index 178a94afb..0dd94b3d0 100644 --- a/compiler/tools/fpp-to-cpp/test/top/update-ref.sh +++ b/compiler/tools/fpp-to-cpp/test/top/update-ref.sh @@ -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