Compare commits

...

30 Commits

Author SHA1 Message Date
32f2cd60bb Merge remote-tracking branch 'origin/main' into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-22 15:54:14 +02:00
d6532f8181 Merge pull request 'Update for new yocto rootfs' (#217) from mueller/yocto-rootfs into develop
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Reviewed-on: #217
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2022-04-22 10:21:52 +02:00
a24464f13e Merge pull request 'v1.10.0' (#220) from develop into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #220
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2022-04-22 07:42:18 +02:00
e61fada99e Merge pull request 'MPSoC Handler Update' (#219) from meier/plocMPSoC into develop
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #219
Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
2022-04-21 16:36:02 +02:00
333155b1a0 Merge branch 'develop' into meier/plocMPSoC
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-21 14:32:22 +02:00
2c491b27c0 update CHANGELOG
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2022-04-21 14:21:02 +02:00
ae2cd52087 add changelog
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-21 14:18:41 +02:00
47b9576c24 decreased pst uart frequency again
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
2022-04-21 14:04:46 +02:00
7ae8138a43 Merge branch 'develop' into meier/plocMPSoC
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
2022-04-21 14:03:27 +02:00
438957c466 update shell script to use default SDK sysroot
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-04-21 13:52:27 +02:00
4f4a8930c8 repoint fsfw
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
2022-04-21 13:45:37 +02:00
20bb1d73f5 Merge remote-tracking branch 'origin/develop' into mueller/yocto-rootfs 2022-04-21 13:45:13 +02:00
4325eaa956 Merge pull request 'bugfix for inverse copying' (#213) from mueller/q7s-cp-bugfix into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #213
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2022-04-21 11:23:33 +02:00
daf50a83fd Merge pull request 'fix initializer list order' (#215) from mueller/imtq-order-fix into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #215
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2022-04-21 11:23:09 +02:00
34c0ac3f05 Merge pull request 'fix and improvement for include handling in OBSW watchdog' (#216) from mueller/watchdog-fixes into develop
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Reviewed-on: #216
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2022-04-21 11:22:09 +02:00
b68c58fd37 Merge pull request 'fix out-of-bounds read in PCDU Handler' (#218) from mueller/hotfix-pcdu-handler into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #218
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2022-04-21 11:21:27 +02:00
707c318ab9 repoint fsfw again
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
2022-04-21 10:41:29 +02:00
9c54696d91 fix out-of-bounds read
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-21 10:25:51 +02:00
0e9300b51c fsfw update
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-21 09:33:49 +02:00
73ba4a39b0 comments 2022-04-21 09:31:52 +02:00
77870468d9 cam commands
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-04-20 21:34:29 +02:00
38ecb9e055 cam commands
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-04-20 21:33:39 +02:00
17c440643f Merge branch 'mueller/master' into mueller/yocto-rootfs
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
2022-04-20 13:44:07 +02:00
eb0e7c39e4 update README
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-04-20 01:27:16 +02:00
f23ba7ab7b always build watchdog for arm q7s now 2022-04-20 01:25:56 +02:00
c4220b37e5 add option for external toolchain file 2022-04-20 00:57:37 +02:00
850722eae5 include improvements
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-19 17:24:04 +02:00
1fb5b48455 fix initializer list order
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-19 17:18:31 +02:00
f5d88a4b6a bugfix for inverse copying
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good
2022-04-14 18:27:11 +02:00
f9c8b544ba Merge pull request 'v1.9.1' (#178) from develop into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #178
2022-03-09 09:34:13 +01:00
15 changed files with 784 additions and 585 deletions

26
CHANGELOG.md Normal file
View File

@ -0,0 +1,26 @@
Change Log
=======
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
The [milestone](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)
list yields a list of all related PRs for each release.
# [unreleased]
# [v1.11.0]
## Changed
- Update rootfs base of Linux, all related OBSW changes
- Use gpsd version 3.17 now. Includes API changes
- Add `/usr/local/bin` to PATH. All shell scripts are there now
- Rename GPS device to `/dev/gps0`
# [v1.10.0]
For all releases equal or prior to v1.10.0,
see [milestones](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)

View File

@ -16,7 +16,10 @@ set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
option(EIVE_HARDCODED_TOOLCHAIN_FILE "\
For Linux Board Target BSPs, a default toolchain file will be set. Should be set to OFF \
if a different toolchain file is set externally" ON
)
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
@ -41,7 +44,7 @@ include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config()
# Check whether the user has already installed Catch2 first. This has to come before
# the project call. We could also exlcude doing this when the Q7S primary OBSW is built..
# the project call. We could also exclude doing this when the Q7S primary OBSW is built..
find_package(Catch2 3 CONFIG QUIET)
# Project Name
@ -247,8 +250,13 @@ else()
endif()
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
#watchdog
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
# Watchdog
if(TGT_BSP MATCHES "arm/q7s")
add_executable(${WATCHDOG_NAME})
else()
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
endif()
add_subdirectory(${WATCHDOG_PATH})
target_link_libraries(${WATCHDOG_NAME} PUBLIC
${LIB_CXX_FS}
@ -373,7 +381,7 @@ endif()
if(${CMAKE_CROSSCOMPILING})
if(CMAKE_CROSSCOMPILING)
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
post_source_hw_os_config()
endif()

View File

@ -163,23 +163,26 @@ automatically.
The EIVE OBSW is the default target if no target is specified.
**Debug**
```sh
mkdir build-Debug-Q7S && cd build-Debug-Q7S
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . -j
```
### Q7S Watchdog
To build the EIVE watchdog, the corresponding target must be specified in the build command.
The configure steps do not need to be repeated if the folder has already been configured.
**Release**
```sh
mkdir build-Debug-Watchdog && cd build-Debug-Watchdog
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . --target eive-watchdog -j
mkdir build-Release-Q7S && cd build-Release-Q7S
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j
```
### Q7S Watchdog
The watchdog will be built along side the primary OBSW binary.
### Hosted
You can also use the FSFW OSAL `host` to build on Windows or for generic OSes.

View File

@ -82,7 +82,7 @@ void initmission::initTasks() {
std::vector<PeriodicTaskIF*> pstTasks;
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstUart(pst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;

View File

@ -44,16 +44,15 @@ void ObjectFactory::produce(void* args) {
ObjectFactory::produceGenericObjects();
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie =
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
mpsocUartCookie->setNoFixedSizeReply();
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
new UartComIF(objects::UART_COM_IF);
auto dummyGpioIF = new DummyGpioIF();
PlocMPSoCHandler* plocMPSoCHandler =
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF));
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF), objects::PLOC_SUPERVISOR_HANDLER);
plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */

View File

@ -11,7 +11,7 @@ endif()
# Disable compiler checks for cross-compiling.
if(FSFW_OSAL MATCHES linux AND TGT_BSP)
if(FSFW_OSAL MATCHES linux AND TGT_BSP AND EIVE_HARDCODED_TOOLCHAIN_FILE)
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/te0720-1cfa")
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/Zynq7020CrossCompileConfig.cmake"

View File

@ -2,6 +2,6 @@
export PATH=$PATH:"$HOME/EIVE/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
export CROSS_COMPILE="arm-linux-gnueabihf"
export ZYNQ_7020_SYSROOT="$HOME/Xilinx/eive-compile-rootfs"
export ZYNQ_7020_SYSROOT="/opt/xiphos/sdk/ark/sysroots/cortexa9hf-neon-xiphos-linux-gnueabi"
export CONSOLE_PREFIX="[Q7S ENV]"
/bin/bash

2
fsfw

Submodule fsfw updated: 96babff67e...613dbe9592

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,9 @@ static const DeviceCommandId_t TC_REPLAY_WRITE_SEQUENCE = 13;
static const DeviceCommandId_t TC_DOWNLINK_PWR_ON = 14;
static const DeviceCommandId_t TC_DOWNLINK_PWR_OFF = 15;
static const DeviceCommandId_t TC_MODE_REPLAY = 16;
static const DeviceCommandId_t TC_CAM_CMD_SEND = 17;
static const DeviceCommandId_t TC_MODE_IDLE = 18;
static const DeviceCommandId_t TM_CAM_CMD_RPT = 19;
// Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
@ -33,6 +36,7 @@ static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
/**
* SpacePacket apids of PLOC telecommands and telemetry.
@ -49,18 +53,23 @@ static const uint16_t TC_FLASHFOPEN = 0x119;
static const uint16_t TC_FLASHFCLOSE = 0x11A;
static const uint16_t TC_FLASHDELETE = 0x11C;
static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_MODE_IDLE = 0x11E;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static const uint16_t TC_CAM_CMD_SEND = 0x12C;
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
static const uint16_t ACK_SUCCESS = 0x400;
static const uint16_t ACK_FAILURE = 0x401;
static const uint16_t EXE_SUCCESS = 0x402;
static const uint16_t EXE_FAILURE = 0x403;
static const uint16_t TM_CAM_CMD_RPT = 0x407;
} // namespace apid
/** Offset from first byte in space packet to first byte of data field */
static const uint8_t DATA_FIELD_OFFSET = 6;
static const size_t MEM_READ_RPT_LEN_OFFSET = 10;
static const char NULL_TERMINATOR = '\0';
static const uint8_t MIN_SPACE_PACKET_LENGTH = 7;
static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
/**
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
@ -117,11 +126,11 @@ class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = initPacket(commandData, commandDataLen);
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = addCrc();
if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) {
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
@ -615,6 +624,45 @@ class TcModeReplay : public TcBase {
}
};
/**
* @brief Class to build mode idle command
*/
class TcModeIdle : public TcBase {
public:
TcModeIdle(uint16_t sequenceCount) : TcBase(apid::TC_MODE_IDLE, sequenceCount) {}
ReturnValue_t createPacket() {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
result = addCrc();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
return HasReturnvaluesIF::RETURN_OK;
}
};
class TcCamcmdSend : public TcBase {
public:
TcCamcmdSend(uint16_t sequenceCount) : TcBase(apid::TC_CAM_CMD_SEND, sequenceCount) {}
protected:
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH;
}
std::memcpy(this->getPacketData(), commandData, commandDataLen);
*(this->getPacketData() + commandDataLen) = CARRIAGE_RETURN;
uint16_t trueLength = commandDataLen + sizeof(CARRIAGE_RETURN) + CRC_SIZE;
this->setPacketDataLength(trueLength - 1);
return HasReturnvaluesIF::RETURN_OK;
}
private:
static const uint8_t MAX_DATA_LENGTH = 10;
static const uint8_t CARRIAGE_RETURN = 0xD;
};
} // namespace mpsoc
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */

View File

@ -133,6 +133,7 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
}
void PlocMPSoCHandler::doStartUp() {
#ifdef XIPHOS_Q7S
switch (powerState) {
case PowerState::OFF:
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
@ -145,6 +146,9 @@ void PlocMPSoCHandler::doStartUp() {
default:
break;
}
#else
setMode(_MODE_TO_ON);
#endif /* XIPHOS_Q7S */
}
void PlocMPSoCHandler::doShutDown() {
@ -211,6 +215,14 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
result = prepareTcModeReplay();
break;
}
case (mpsoc::TC_MODE_IDLE): {
result = prepareTcModeIdle();
break;
}
case (mpsoc::TC_CAM_CMD_SEND): {
result = prepareTcCamCmdSend(commandData, commandDataLen);
break;
}
default:
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
<< std::endl;
@ -238,16 +250,21 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT);
this->insertInCommandMap(mpsoc::TC_MODE_IDLE);
this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND);
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT);
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, SpacePacket::PACKET_MAX_SIZE);
}
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = RETURN_OK;
uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK;
SpacePacket spacePacket;
std::memcpy(spacePacket.getWholeData(), start, remainingSize);
uint16_t apid = spacePacket.getAPID();
switch (apid) {
case (mpsoc::apid::ACK_SUCCESS):
@ -262,6 +279,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
*foundLen = tmMemReadReport.rememberRequestedSize;
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
break;
case (mpsoc::apid::TM_CAM_CMD_RPT):
*foundLen = spacePacket.getFullSize();
tmCamCmdRpt.rememberSpacePacketSize = *foundLen;
*foundId = mpsoc::TM_CAM_CMD_RPT;
break;
case (mpsoc::apid::EXE_SUCCESS):
*foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT;
@ -276,6 +298,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
return MPSoCReturnValuesIF::INVALID_APID;
}
}
sequenceCount++;
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
if (recvSeqCnt != sequenceCount) {
@ -297,6 +320,10 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
result = handleMemoryReadReport(packet);
break;
}
case (mpsoc::TM_CAM_CMD_RPT): {
result = handleCamCmdRpt(packet);
break;
}
case (mpsoc::EXE_REPORT): {
result = handleExecutionReport(packet);
break;
@ -463,6 +490,37 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcModeIdle tcModeIdle(sequenceCount);
result = tcModeIdle.createPacket();
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
memcpy(commandBuffer, tcModeIdle.getWholeData(), tcModeIdle.getFullSize());
rawPacket = commandBuffer;
rawPacketLen = tcModeIdle.getFullSize();
nextReplyId = mpsoc::ACK_REPORT;
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcCamcmdSend tcCamCmdSend(sequenceCount);
result = tcCamCmdSend.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
copyToCommandBuffer(&tcCamCmdSend);
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
return RETURN_OK;
}
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
if (tc == nullptr) {
sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl;
@ -586,6 +644,25 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
return result;
}
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
ReturnValue_t result = RETURN_OK;
SpacePacket packet;
std::memcpy(packet.getWholeData(), data, tmCamCmdRpt.rememberSpacePacketSize);
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
}
const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE;
std::string camCmdRptMsg(reinterpret_cast<const char*>(
dataFieldPtr), tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - 3);
uint8_t ackValue = *(packet.getPacketData() + packet.getPacketDataLength() - 2);
sif::info << "CamCmdRpt message: " << camCmdRptMsg << std::endl;
sif::info << "CamCmdRpt Ack value: 0x" << std::hex << static_cast<unsigned int>(ackValue)
<< std::endl;
handleDeviceTM(packet.getPacketData(), packet.getPacketDataLength() - 1, mpsoc::TM_CAM_CMD_RPT);
return result;
}
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies, bool useAlternateId,
DeviceCommandId_t alternateReplyID) {
@ -602,6 +679,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
case mpsoc::TC_DOWNLINK_PWR_OFF:
case mpsoc::TC_REPLAY_WRITE_SEQUENCE:
case mpsoc::TC_MODE_REPLAY:
case mpsoc::TC_MODE_IDLE:
enabledReplies = 2;
break;
case mpsoc::TC_MEM_READ: {
@ -611,6 +689,18 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
if (result != RETURN_OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
return result;
}
break;
}
case mpsoc::TC_CAM_CMD_SEND: {
enabledReplies = 3;
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
mpsoc::TM_CAM_CMD_RPT);
if (result != RETURN_OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl;
return result;
}
break;
}
@ -690,6 +780,11 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
replyLen = tmMemReadReport.rememberRequestedSize;
break;
}
case mpsoc::TM_CAM_CMD_RPT:
// Read acknowledgment, camera and execution report in one go because length of camera
// report is not fixed
replyLen = SpacePacket::PACKET_MAX_SIZE;
break;
default: {
replyLen = iter->second.replyLen;
break;

View File

@ -4,6 +4,7 @@
#include <string>
#include "PlocMPSoCHelper.h"
#include "fsfw/tmtcpacket/SpacePacket.h"
#include "fsfw/action/CommandActionHelper.h"
#include "fsfw/action/CommandsActionsIF.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
@ -126,14 +127,26 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
// Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false;
class TmMemReadReport {
public:
struct TmMemReadReport {
static const uint8_t FIX_SIZE = 14;
size_t rememberRequestedSize = 0;
};
TmMemReadReport tmMemReadReport;
struct TmCamCmdRpt {
size_t rememberSpacePacketSize = 0;
};
TmCamCmdRpt tmCamCmdRpt;
struct TelemetryBuffer {
uint16_t length = 0;
uint8_t buffer[SpacePacket::PACKET_MAX_SIZE];
};
TelemetryBuffer tmBuffer;
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
PowerState powerState = PowerState::OFF;
@ -151,7 +164,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcDownlinkPwrOff();
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcModeIdle();
/**
* @brief Copies space packet into command buffer
*/
@ -194,6 +208,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*/
ReturnValue_t handleMemoryReadReport(const uint8_t* data);
ReturnValue_t handleCamCmdRpt(const uint8_t* data);
/**
* @brief Depending on the current active command, this function sets the reply id of the
* next reply after a successful acknowledgment report has been received. This is

View File

@ -81,12 +81,16 @@ ReturnValue_t PCDUHandler::initialize() {
void PCDUHandler::initializeSwitchStates() {
using namespace pcdu;
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
if (idx < PDU::CHANNELS_LEN) {
switchStates[idx] = INIT_SWITCHES_PDU1[idx];
} else {
switchStates[idx] = INIT_SWITCHES_PDU2[idx];
try {
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
if (idx < PDU::CHANNELS_LEN) {
switchStates[idx] = INIT_SWITCHES_PDU1.at(idx);
} else {
switchStates[idx] = INIT_SWITCHES_PDU2.at(idx - PDU::CHANNELS_LEN);
}
}
} catch (const std::out_of_range& err) {
sif::error << "PCDUHandler::initializeSwitchStates: " << err.what() << std::endl;
}
}

View File

@ -92,7 +92,7 @@ def build_cmd(args):
else:
target = args.target
if args.invert:
cmd += f"{port_args} {address}:{args.source} {target}"
cmd += f"{port_args} {address}:{source_files} {target}"
else:
cmd += f"{port_args} {source_files} {address}:{target}"
return cmd

2
tmtc

Submodule tmtc updated: 8a30f669f0...45470f8c05