meier/plocSupervisor #89

Merged
muellerr merged 6 commits from meier/plocSupervisor into develop 2021-09-02 09:13:01 +02:00
6 changed files with 81 additions and 41 deletions
Showing only changes of commit 3acb61959a - Show all commits

View File

@ -928,6 +928,10 @@ candump can0
````
cat file.bin | hexdump -C
````
All content will be printed with
````
cat file.bin | hexdump -v
````
## Preparation of a fresh rootfs and SD card

View File

@ -467,6 +467,7 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MON, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MSEC, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_IS_SET, new PoolEntry<uint32_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}
@ -557,6 +558,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case PLOC_SPV::FACTORY_RESET_CLEAR_MIRROR:
case PLOC_SPV::FACTORY_RESET_CLEAR_CIRCULAR:
case PLOC_SPV::REQUEST_LOGGING_DATA:
case PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION:
enabledReplies = 2;
break;
default:
@ -867,6 +869,9 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
latchupStatusReport.timeMsec = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3);
offset += 4;
latchupStatusReport.isSet = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3);
offset += 4;
nextReplyId = PLOC_SPV::EXE_REPORT;
@ -901,6 +906,8 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
<< latchupStatusReport.timeYear << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
<< latchupStatusReport.timeMsec << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x"
<< std::hex << latchupStatusReport.timeMsec << std::dec << std::endl;
#endif
return result;
@ -1400,7 +1407,8 @@ void PlocSupervisorHandler::increaseExpectedMramReplies() {
return;
}
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)) {
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)
&& (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
// Command expects at least one MRAM packet more and the execution report
info->expectedReplies = 2;
// Wait maximum of 2 cycles for next MRAM packet
@ -1428,7 +1436,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile() {
ReturnValue_t result = RETURN_OK;
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)) {
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
result = createMramDumpFile();
if (result != RETURN_OK) {
return result;

View File

@ -52,21 +52,37 @@ ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
}
switch (actionId) {
case UPDATE_NVM0_A:
updatePartition = Partition::A;
updateMemory = Memory::NVM0;
case UPDATE_A_UBOOT:
image = Image::A;
partition = Partition::UBOOT;
break;
case UPDATE_NVM0_B:
updatePartition = Partition::B;
updateMemory = Memory::NVM0;
case UPDATE_A_BITSTREAM:
image = Image::A;
partition = Partition::BITSTREAM;
break;
case UPDATE_NVM1_A:
updatePartition = Partition::A;
updateMemory = Memory::NVM1;
case UPDATE_A_LINUX:
image = Image::A;
partition = Partition::LINUX_OS;
break;
case UPDATE_NVM1_B:
updatePartition = Partition::B;
updateMemory = Memory::NVM1;
case UPDATE_A_APP_SW:
image = Image::A;
partition = Partition::APP_SW;
break;
case UPDATE_B_UBOOT:
image = Image::B;
partition = Partition::UBOOT;
break;
case UPDATE_B_BITSTREAM:
image = Image::B;
partition = Partition::BITSTREAM;
break;
case UPDATE_B_LINUX:
image = Image::B;
partition = Partition::LINUX_OS;
break;
case UPDATE_B_APP_SW:
image = Image::B;
partition = Partition::APP_SW;
break;
default:
return INVALID_ACTION_ID;
@ -294,8 +310,8 @@ void PlocUpdater::commandUpdateAvailable() {
calcImageCrc();
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(updateMemory),
static_cast<uint8_t>(updatePartition), imageSize, imageCrc, numOfUpdatePackets);
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(), packet.getFullSize());
@ -365,8 +381,8 @@ void PlocUpdater::commandUpdatePacket() {
void PlocUpdater::commandUpdateVerify() {
ReturnValue_t result = RETURN_OK;
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(updateMemory),
static_cast<uint8_t>(updatePartition), imageSize, imageCrc, numOfUpdatePackets);
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
PLOC_SPV::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());

View File

@ -33,10 +33,14 @@ class PlocUpdater : public SystemObject,
public CommandsActionsIF {
public:
static const ActionId_t UPDATE_NVM0_A = 0;
static const ActionId_t UPDATE_NVM0_B = 1;
static const ActionId_t UPDATE_NVM1_A = 2;
static const ActionId_t UPDATE_NVM1_B = 3;
static const ActionId_t UPDATE_A_UBOOT = 0;
static const ActionId_t UPDATE_A_BITSTREAM = 1;
static const ActionId_t UPDATE_A_LINUX = 2;
static const ActionId_t UPDATE_A_APP_SW = 3;
static const ActionId_t UPDATE_B_UBOOT = 4;
static const ActionId_t UPDATE_B_BITSTREAM = 5;
static const ActionId_t UPDATE_B_LINUX = 6;
static const ActionId_t UPDATE_B_APP_SW = 7;
PlocUpdater(object_id_t objectId);
virtual ~PlocUpdater();
@ -118,19 +122,23 @@ private:
ActionId_t pendingCommand = PLOC_SPV::NONE;
enum class Memory: uint8_t {
NVM0,
NVM1
};
Memory updateMemory = Memory::NVM0;
enum class Partition: uint8_t {
enum class Image: uint8_t {
NONE,
A,
B
};
Partition updatePartition = Partition::A;
Image image = Image::NONE;
enum class Partition: uint8_t {
NONE,
UBOOT,
BITSTREAM,
LINUX_OS,
APP_SW
};
Partition partition = Partition::NONE;
uint32_t packetsSent = 0;
uint32_t remainingPackets = 0;

View File

@ -67,7 +67,7 @@ static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_HK_REPORT = 48;
static const uint16_t SIZE_BOOT_STATUS_REPORT = 22;
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 51;
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 55;
/**
* SpacePacket apids of telemetry packets
@ -196,11 +196,12 @@ enum PoolIds
LATCHUP_RPT_TIME_YEAR,
LATCHUP_RPT_TIME_MSEC,
LATCHUP_RPT_TIME_USEC,
LATCHUP_RPT_TIME_IS_SET,
};
static const uint8_t HK_SET_ENTRIES = 13;
static const uint8_t BOOT_REPORT_SET_ENTRIES = 8;
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 15;
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
static const uint32_t HK_SET_ID = HK_REPORT;
static const uint32_t BOOT_REPORT_SET_ID = BOOT_STATUS_REPORT;
@ -1445,14 +1446,15 @@ public:
*
* @param apid Packet can be used to generate the update available and the update verify
* packet. Thus the APID must be specified here.
* @param memory The memory to apply the update (NVM0 - 0, NVM1 - 1)
* @param partition The partition to update (A - 0, B - 1)
* @param image The image to update on a NVM (A - 0, B - 1)
* @param partition The partition to update. uboot - 1, bitstream - 2, linux - 3,
* application - 4
* @param imageSize The size of the update image
* param numPackets The number of space packets required to transfer all data.
*/
UpdateInfo(uint16_t apid, uint8_t memory, uint8_t partition, uint32_t imageSize,
UpdateInfo(uint16_t apid, uint8_t image, uint8_t partition, uint32_t imageSize,
uint32_t imageCrc, uint32_t numPackets) :
SupvTcSpacePacket(PAYLOAD_LENGTH, apid), memory(memory), partition(partition), imageSize(
SupvTcSpacePacket(PAYLOAD_LENGTH, apid), image(image), partition(partition), imageSize(
imageSize), imageCrc(imageCrc), numPackets(numPackets) {
initPacket();
makeCrc();
@ -1462,7 +1464,7 @@ private:
static const uint16_t PAYLOAD_LENGTH = 14; // length without CRC field
uint8_t memory = 0;
uint8_t image = 0;
uint8_t partition = 0;
uint32_t imageSize = 0;
uint32_t imageCrc = 0;
@ -1471,8 +1473,8 @@ private:
void initPacket() {
size_t serializedSize = 0;
uint8_t* data_field_ptr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&memory, &data_field_ptr, &serializedSize,
sizeof(memory), SerializeIF::Endianness::BIG);
SerializeAdapter::serialize<uint8_t>(&image, &data_field_ptr, &serializedSize,
sizeof(image), SerializeIF::Endianness::BIG);
serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&partition, &data_field_ptr, &serializedSize,
sizeof(partition), SerializeIF::Endianness::BIG);
@ -1599,6 +1601,7 @@ public:
lp_var_t<uint32_t> timeMon = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MON, this);
lp_var_t<uint32_t> timeYear = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_YEAR, this);
lp_var_t<uint32_t> timeMsec = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MSEC, this);
lp_var_t<uint32_t> isSet = lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_IS_SET, this);
};
}

2
tmtc

@ -1 +1 @@
Subproject commit 5b2ff49555f0cfee51cd53c7772a147575a825a3
Subproject commit c125a6261201930c25ebdcdeb0ef69a53ab588b0