diff --git a/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh b/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh index c9bcc54a..d0a24dba 100644 --- a/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh +++ b/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh @@ -1,5 +1,9 @@ #!/bin/sh -export PATH=$PATH:"/c/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" -export CROSS_COMPILE="arm-linux-gnueabihf" +export PATH=/c/Users/integration/Documents/EIVE/gcc-arm-linux-gnueabi/bin:${PATH} +export CROSS_COMPILE=arm-linux-gnueabihf -export Q7S_SYSROOT="/c/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc" +export CMAKE_ASM_COMPILER=arm-linux-gnueabihf-as +export CMAKE_C_COMPILER=arm-linux-gnueabihf-gcc +export CMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ + +export Q7S_SYSROOT=/c/Users/integration/Documents/EIVE/cortexa9hf-neon-xiphos-linux-gnueabi diff --git a/fsfw_hal b/fsfw_hal index 7a3190e5..c47d3996 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 7a3190e5b6980ad2addc5e8a76d21994b542f0e0 +Subproject commit c47d39964fcdc08f6ab93a5e6b6e3b63d4a21abb diff --git a/mission/devices/PlocHandler.cpp b/mission/devices/PlocHandler.cpp index f1444488..427eac4c 100644 --- a/mission/devices/PlocHandler.cpp +++ b/mission/devices/PlocHandler.cpp @@ -151,7 +151,10 @@ ReturnValue_t PlocHandler::prepareTcMemWriteCommand(const uint8_t * commandData, | *(commandData + 2) << 8 | *(commandData + 3); const uint32_t memoryData = *(commandData + 4) << 24 | *(commandData + 5) << 16 | *(commandData + 6) << 8 | *(commandData + 7); - PLOC::TcMemWrite tcMemWrite(memoryAddress, memoryData); + if (subsequenceCount != 0) { + subsequenceCount++; + } + PLOC::TcMemWrite tcMemWrite(memoryAddress, memoryData, subsequenceCount); if (tcMemWrite.getFullSize() > PLOC::MAX_COMMAND_SIZE) { sif::debug << "PlocHandler::prepareTcMemWriteCommand: Command too big" << std::endl; return RETURN_FAILED; @@ -167,7 +170,10 @@ ReturnValue_t PlocHandler::prepareTcMemReadCommand(const uint8_t * commandData, size_t commandDataLen) { const uint32_t memoryAddress = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 | *(commandData + 3); - PLOC::TcMemRead tcMemRead(memoryAddress); + if (subsequenceCount != 0) { + subsequenceCount++; + } + PLOC::TcMemRead tcMemRead(memoryAddress, subsequenceCount); if (tcMemRead.getFullSize() > PLOC::MAX_COMMAND_SIZE) { sif::debug << "PlocHandler::prepareTcMemReadCommand: Command too big" << std::endl; return RETURN_FAILED; @@ -176,6 +182,7 @@ ReturnValue_t PlocHandler::prepareTcMemReadCommand(const uint8_t * commandData, rawPacket = commandBuffer; rawPacketLen = tcMemRead.getFullSize(); nextReplyId = PLOC::ACK_REPORT; + return RETURN_OK; } @@ -183,7 +190,7 @@ ReturnValue_t PlocHandler::verifyPacket(const uint8_t* start, size_t foundLen) { uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1); - uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2, 0); + uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2); if (receivedCrc != recalculatedCrc) { return CRC_FAILURE; @@ -221,10 +228,12 @@ ReturnValue_t PlocHandler::handleAckReport(const uint8_t* data) { disableAllReplies(); nextReplyId = PLOC::NONE; result = IGNORE_REPLY_DATA; + subsequenceCount = ((*(data + 2) & 0x3F) << 8) | *(data + 3); break; } case PLOC::APID_ACK_SUCCESS: { setNextReplyId(); + subsequenceCount = ((*(data + 2) & 0x3F) << 8) | *(data + 3); break; } default: { @@ -252,6 +261,7 @@ ReturnValue_t PlocHandler::handleExecutionReport(const uint8_t* data) { switch (apid) { case (PLOC::APID_EXE_SUCCESS): { + subsequenceCount = ((*(data + 2) & 0x3F) << 8) | *(data + 3); break; } case (PLOC::APID_EXE_FAILURE): { @@ -268,6 +278,7 @@ ReturnValue_t PlocHandler::handleExecutionReport(const uint8_t* data) { sendFailureReport(PLOC::EXE_REPORT, RECEIVED_EXE_FAILURE); disableExeReportReply(); result = IGNORE_REPLY_DATA; + subsequenceCount = ((*(data + 2) & 0x3F) << 8) | *(data + 3); break; } default: { @@ -298,6 +309,8 @@ ReturnValue_t PlocHandler::handleMemoryReadReport(const uint8_t* data) { nextReplyId = PLOC::EXE_REPORT; + subsequenceCount = ((*(data + 2) & 0x3F) << 8) | *(data + 3); + return result; } diff --git a/mission/devices/PlocHandler.h b/mission/devices/PlocHandler.h index b241c838..fcb423d3 100644 --- a/mission/devices/PlocHandler.h +++ b/mission/devices/PlocHandler.h @@ -65,6 +65,11 @@ private: uint8_t commandBuffer[PLOC::MAX_COMMAND_SIZE]; + /** + * This object counts takes the subsequence count of the PLOC space packets. + */ + uint16_t subsequenceCount = 0; + /** * This variable is used to store the id of the next reply to receive. This is necessary * because the PLOC sends as reply to each command at least one acknowledgment and execution diff --git a/mission/devices/devicedefinitions/PlocDefinitions.h b/mission/devices/devicedefinitions/PlocDefinitions.h index b7378a8a..f5add451 100644 --- a/mission/devices/devicedefinitions/PlocDefinitions.h +++ b/mission/devices/devicedefinitions/PlocDefinitions.h @@ -63,10 +63,10 @@ namespace PLOC { * * @param memAddr The memory address to read from. */ - TcMemRead(const uint32_t memAddr) : - SpacePacket(LENGTH_TC_MEM_READ - 1, true, APID_TC_MEM_READ) { - fillPacketDataField(&memAddr); - } + TcMemRead(const uint32_t memAddr, uint16_t sequenceCount) : + SpacePacket(LENGTH_TC_MEM_READ - 1, true, APID_TC_MEM_READ, sequenceCount) { + fillPacketDataField(&memAddr); + } private: @@ -80,22 +80,21 @@ namespace PLOC { size_t serializedSize = 0; uint8_t* memoryAddressPos = this->localData.fields.buffer; SerializeAdapter::serialize(memAddrPtr, &memoryAddressPos, &serializedSize, - sizeof(*memAddrPtr), SerializeIF::Endianness::BIG); + sizeof(*memAddrPtr), SerializeIF::Endianness::LITTLE); /* Add memLen to packet data field */ - this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 0; - this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 1; + this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 1; + this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 0; /* Calculate crc */ uint16_t crc = CRC::crc16ccitt(this->localData.byteStream, - sizeof(CCSDSPrimaryHeader) + LENGTH_TC_MEM_READ - CRC_SIZE, 0); + sizeof(CCSDSPrimaryHeader) + LENGTH_TC_MEM_READ - CRC_SIZE); /* Add crc to packet data field of space packet */ serializedSize = 0; uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET; SerializeAdapter::serialize(&crc, &crcPos, &serializedSize, sizeof(crc), SerializeIF::Endianness::BIG); - memcpy(this->localData.fields.buffer + CRC_OFFSET, &crc, sizeof(crc)); } static const uint8_t OFFSET_MEM_LEN_FIELD = 4; @@ -117,9 +116,10 @@ namespace PLOC { * * @param memAddr The PLOC memory address where to write to. * @param memoryData The data to write to the specified memory address. + * @param sequenceCount The subsequence count. Must be incremented with each new packet. */ - TcMemWrite(const uint32_t memAddr, const uint32_t memoryData) : - SpacePacket(LENGTH_TC_MEM_WRITE - 1, true, APID_TC_MEM_WRITE) { + TcMemWrite(const uint32_t memAddr, const uint32_t memoryData, uint16_t sequenceCount) : + SpacePacket(LENGTH_TC_MEM_WRITE - 1, true, APID_TC_MEM_WRITE, sequenceCount) { fillPacketDataField(&memAddr, &memoryData); } @@ -140,8 +140,8 @@ namespace PLOC { sizeof(*memAddrPtr), SerializeIF::Endianness::BIG); /* Add memLen to packet data field */ - this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 0; - this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 1; + this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD] = 1; + this->localData.fields.buffer[OFFSET_MEM_LEN_FIELD + 1] = 0; /* Add memData to packet data field */ serializedSize = 0; @@ -151,14 +151,13 @@ namespace PLOC { /* Calculate crc */ uint16_t crc = CRC::crc16ccitt(this->localData.byteStream, - sizeof(CCSDSPrimaryHeader) + LENGTH_TC_MEM_WRITE - CRC_SIZE, 0); + sizeof(CCSDSPrimaryHeader) + LENGTH_TC_MEM_WRITE - CRC_SIZE); serializedSize = 0; uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET; /* Add crc to packet data field of space packet */ SerializeAdapter::serialize(&crc, &crcPos, &serializedSize, sizeof(crc), SerializeIF::Endianness::BIG); - memcpy(this->localData.fields.buffer + CRC_OFFSET, &crc, sizeof(crc)); } /** Offsets from base address of packet data field */ diff --git a/tmtc b/tmtc index 79e897b0..b464648f 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 79e897b0353acacf0f986f22f57e9cd8cf30a0da +Subproject commit b464648f53b8b9b41f1ee00c94c095c55ee673e1