diff --git a/FprimeZephyrReference/Components/CMakeLists.txt b/FprimeZephyrReference/Components/CMakeLists.txt index fcd50b7c..6a0b32d5 100644 --- a/FprimeZephyrReference/Components/CMakeLists.txt +++ b/FprimeZephyrReference/Components/CMakeLists.txt @@ -3,6 +3,7 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Drv/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FatalHandler") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ImuManager/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/NullPrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Watchdog") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Burnwire/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BootloaderTrigger/") diff --git a/FprimeZephyrReference/Components/NullPrmDb/CMakeLists.txt b/FprimeZephyrReference/Components/NullPrmDb/CMakeLists.txt new file mode 100644 index 00000000..b779a42b --- /dev/null +++ b/FprimeZephyrReference/Components/NullPrmDb/CMakeLists.txt @@ -0,0 +1,36 @@ +#### +# F Prime CMakeLists.txt: +# +# SOURCES: list of source files (to be compiled) +# AUTOCODER_INPUTS: list of files to be passed to the autocoders +# DEPENDS: list of libraries that this module depends on +# +# More information in the F´ CMake API documentation: +# https://fprime.jpl.nasa.gov/latest/docs/reference/api/cmake/API/ +# +#### + +# Module names are derived from the path from the nearest project/library/framework +# root when not specifically overridden by the developer. i.e. The module defined by +# `Ref/SignalGen/CMakeLists.txt` will be named `Ref_SignalGen`. + +register_fprime_library( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/NullPrmDb.fpp" + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/NullPrmDb.cpp" +# DEPENDS +# MyPackage_MyOtherModule +) + +### Unit Tests ### +# register_fprime_ut( +# AUTOCODER_INPUTS +# "${CMAKE_CURRENT_LIST_DIR}/NullPrmDb.fpp" +# SOURCES +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/NullPrmDbTestMain.cpp" +# "${CMAKE_CURRENT_LIST_DIR}/test/ut/NullPrmDbTester.cpp" +# DEPENDS +# STest # For rules-based testing +# UT_AUTO_HELPERS +# ) diff --git a/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.cpp b/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.cpp new file mode 100644 index 00000000..f4aa07f3 --- /dev/null +++ b/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.cpp @@ -0,0 +1,29 @@ +// ====================================================================== +// \title NullPrmDb.cpp +// \author starchmd +// \brief cpp file for NullPrmDb component implementation class +// ====================================================================== + +#include "FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.hpp" + +namespace Components { + +// ---------------------------------------------------------------------- +// Component construction and destruction +// ---------------------------------------------------------------------- + +NullPrmDb ::NullPrmDb(const char* const compName) : NullPrmDbComponentBase(compName) {} + +NullPrmDb ::~NullPrmDb() {} + +// ---------------------------------------------------------------------- +// Handler implementations for typed input ports +// ---------------------------------------------------------------------- + +Fw::ParamValid NullPrmDb ::getPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer& val) { + return Fw::ParamValid::INVALID; +} + +void NullPrmDb ::setPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer& val) {} + +} // namespace Components diff --git a/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.fpp b/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.fpp new file mode 100644 index 00000000..87265a5d --- /dev/null +++ b/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.fpp @@ -0,0 +1,10 @@ +module Components { + @ Null parameter database + passive component NullPrmDb { + @ Port to get parameter values + sync input port getPrm: Fw.PrmGet + + @ Port to update parameters + sync input port setPrm: Fw.PrmSet + } +} diff --git a/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.hpp b/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.hpp new file mode 100644 index 00000000..534c7299 --- /dev/null +++ b/FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.hpp @@ -0,0 +1,52 @@ +// ====================================================================== +// \title NullPrmDb.hpp +// \author starchmd +// \brief hpp file for NullPrmDb component implementation class +// ====================================================================== + +#ifndef Components_NullPrmDb_HPP +#define Components_NullPrmDb_HPP + +#include "FprimeZephyrReference/Components/NullPrmDb/NullPrmDbComponentAc.hpp" + +namespace Components { + +class NullPrmDb final : public NullPrmDbComponentBase { + public: + // ---------------------------------------------------------------------- + // Component construction and destruction + // ---------------------------------------------------------------------- + + //! Construct NullPrmDb object + NullPrmDb(const char* const compName //!< The component name + ); + + //! Destroy NullPrmDb object + ~NullPrmDb(); + + private: + // ---------------------------------------------------------------------- + // Handler implementations for typed input ports + // ---------------------------------------------------------------------- + + //! Handler implementation for getPrm + //! + //! Port to get parameter values + Fw::ParamValid getPrm_handler(FwIndexType portNum, //!< The port number + FwPrmIdType id, //!< Parameter ID + Fw::ParamBuffer& val //!< Buffer containing serialized parameter value. + //!< Unmodified if param not found. + ) override; + + //! Handler implementation for setPrm + //! + //! Port to update parameters + void setPrm_handler(FwIndexType portNum, //!< The port number + FwPrmIdType id, //!< Parameter ID + Fw::ParamBuffer& val //!< Buffer containing serialized parameter value + ) override; +}; + +} // namespace Components + +#endif diff --git a/FprimeZephyrReference/Components/NullPrmDb/docs/sdd.md b/FprimeZephyrReference/Components/NullPrmDb/docs/sdd.md new file mode 100644 index 00000000..512c9071 --- /dev/null +++ b/FprimeZephyrReference/Components/NullPrmDb/docs/sdd.md @@ -0,0 +1,24 @@ +# Components::NullPrmDb + +Null parameter database. Returns error status on any call. + +## Requirements + +| Name | Description | Validation | +|---|---|---| +|NULL-PRM-DB-001| Return error on any port call | Inspection| + +## Usage Examples + +Add the instance to a topology: + +``` +param connections instance nullPrmDb +``` + + +## Port Descriptions +| Name | Description | +|---|---| +| getPrm | Get parameter, returns `Fw::ParamValid::INVALID` | +| setPrm | No-op | diff --git a/FprimeZephyrReference/Components/Watchdog/Watchdog.cpp b/FprimeZephyrReference/Components/Watchdog/Watchdog.cpp index da205821..91c8e102 100644 --- a/FprimeZephyrReference/Components/Watchdog/Watchdog.cpp +++ b/FprimeZephyrReference/Components/Watchdog/Watchdog.cpp @@ -54,21 +54,19 @@ void Watchdog ::stop_handler(FwIndexType portNum) { // ---------------------------------------------------------------------- void Watchdog ::START_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); - // call start handler this->start_handler(0); // Provide command response + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } void Watchdog ::STOP_WATCHDOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) { - this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); - // call stop handler this->stop_handler(0); // Provide command response + this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK); } } // namespace Components diff --git a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp index 7bda4baf..3a20cd6e 100644 --- a/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp +++ b/FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp @@ -36,11 +36,6 @@ module ReferenceDeployment { stack size Default.STACK_SIZE \ priority 4 - instance prmDb: Svc.PrmDb base id 0x10003000 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 6 - # ---------------------------------------------------------------------- # Queued component instances # ---------------------------------------------------------------------- @@ -76,4 +71,6 @@ module ReferenceDeployment { instance gpioBurnwire0: Zephyr.ZephyrGpioDriver base id 0x10022000 instance gpioBurnwire1: Zephyr.ZephyrGpioDriver base id 0x10023000 + + instance prmDb: Components.NullPrmDb base id 0x10024000 } diff --git a/FprimeZephyrReference/test/bootloader_trigger.py b/FprimeZephyrReference/test/bootloader_trigger.py index c1e9c200..85d7a66e 100644 --- a/FprimeZephyrReference/test/bootloader_trigger.py +++ b/FprimeZephyrReference/test/bootloader_trigger.py @@ -1,4 +1,5 @@ import os +import signal import subprocess import time @@ -6,9 +7,14 @@ from fprime_gds.common.testing_fw.api import IntegrationTestAPI -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(scope="session") def start_gds(fprime_test_api_session: IntegrationTestAPI): - process = subprocess.Popen(["make", "gds-integration"], cwd=os.getcwd()) + pro = subprocess.Popen( + ["make", "gds-integration"], + cwd=os.getcwd(), + stdout=subprocess.PIPE, + preexec_fn=os.setsid, + ) gds_working = False timeout_time = time.time() + 30 @@ -24,7 +30,7 @@ def start_gds(fprime_test_api_session: IntegrationTestAPI): assert gds_working yield - process.kill() + os.killpg(os.getpgid(pro.pid), signal.SIGTERM) def test_bootloader(fprime_test_api: IntegrationTestAPI):