Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FprimeZephyrReference/Components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
36 changes: 36 additions & 0 deletions FprimeZephyrReference/Components/NullPrmDb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
# )
29 changes: 29 additions & 0 deletions FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.cpp
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.fpp
Original file line number Diff line number Diff line change
@@ -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
}
}
52 changes: 52 additions & 0 deletions FprimeZephyrReference/Components/NullPrmDb/NullPrmDb.hpp
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions FprimeZephyrReference/Components/NullPrmDb/docs/sdd.md
Original file line number Diff line number Diff line change
@@ -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 |
6 changes: 2 additions & 4 deletions FprimeZephyrReference/Components/Watchdog/Watchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 2 additions & 5 deletions FprimeZephyrReference/ReferenceDeployment/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ----------------------------------------------------------------------
Expand Down Expand Up @@ -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
}
12 changes: 9 additions & 3 deletions FprimeZephyrReference/test/bootloader_trigger.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import os
import signal
import subprocess
import time

import pytest
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
Expand All @@ -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):
Expand Down