Merge pull request 'meier/plocSupervisor' (#89) from meier/plocSupervisor into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #89 Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
commit
cc602ddada
13
README.md
13
README.md
@ -924,6 +924,19 @@ Reading data from CAN:
|
||||
candump can0
|
||||
````
|
||||
|
||||
## Dump content of file in hex
|
||||
````
|
||||
cat file.bin | hexdump -C
|
||||
````
|
||||
All content will be printed with
|
||||
````
|
||||
cat file.bin | hexdump -v
|
||||
````
|
||||
To print only the first X bytes of a file
|
||||
````
|
||||
cat file.bin | hexdump -v -n X
|
||||
````
|
||||
|
||||
## Preparation of a fresh rootfs and SD card
|
||||
|
||||
This section summarizes important changes between a fresh rootfs and the current
|
||||
|
@ -57,13 +57,14 @@ void initmission::initTasks() {
|
||||
void (*missedDeadlineFunc) (void) = nullptr;
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||
@ -102,7 +103,7 @@ void initmission::initTasks() {
|
||||
initmission::printAddObjectError("PLOC_UPDATER_TASK", objects::PLOC_UPDATER);
|
||||
}
|
||||
|
||||
|
||||
# if BOARD_TE0720 == 0
|
||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||
// because it is a non-essential background task
|
||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||
@ -111,6 +112,7 @@ void initmission::initTasks() {
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||
}
|
||||
#endif /* BOARD_TE0720 */
|
||||
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||
@ -125,8 +127,11 @@ void initmission::initTasks() {
|
||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||
std::vector<PeriodicTaskIF*> pstTasks;
|
||||
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||
|
||||
#if OBSW_ADD_TEST_TASK == 1
|
||||
std::vector<PeriodicTaskIF*> testTasks;
|
||||
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
||||
#endif
|
||||
|
||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||
for(const auto& task: taskVector) {
|
||||
@ -143,19 +148,24 @@ void initmission::initTasks() {
|
||||
tmTcDistributor->startTask();
|
||||
tmtcBridgeTask->startTask();
|
||||
tmtcPollingTask->startTask();
|
||||
#if BOARD_TE0720 == 0
|
||||
coreController->startTask();
|
||||
#endif
|
||||
plocUpdaterTask->startTask();
|
||||
|
||||
taskStarter(pstTasks, "PST task vector");
|
||||
taskStarter(pusTasks, "PUS task vector");
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
#if OBSW_ADD_TEST_TASK == 1
|
||||
taskStarter(testTasks, "Test task vector");
|
||||
#endif
|
||||
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
ptmeTestTask->startTask();
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
fsTask->startTask();
|
||||
#endif
|
||||
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
}
|
||||
@ -205,7 +215,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
||||
}
|
||||
taskVec.push_back(gomSpacePstTask);
|
||||
#else /* BOARD_TE7020 == 0 */
|
||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
|
||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
||||
missedDeadlineFunc);
|
||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||
|
@ -104,13 +104,13 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
void ObjectFactory::produce(void* args){
|
||||
ObjectFactory::setStatics();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
UartComIF* uartComIF = nullptr;
|
||||
SpiComIF* spiComIF = nullptr;
|
||||
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF);
|
||||
createTmpComponents();
|
||||
#if BOARD_TE0720 == 0
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
|
||||
createPcduComponents();
|
||||
createRadSensorComponent(gpioComIF);
|
||||
@ -132,6 +132,34 @@ void ObjectFactory::produce(void* args){
|
||||
IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
|
||||
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
||||
createReactionWheelComponents(gpioComIF);
|
||||
|
||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||
UartCookie* plocMpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER,
|
||||
q7s::UART_PLOC_MPSOC_DEV, UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD,
|
||||
PLOC_MPSOC::MAX_REPLY_SIZE);
|
||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie);
|
||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, uart::PLOC_SUPERVISOR_BAUD,
|
||||
PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||
plocSupervisorCookie->setNoFixedSizeReply();
|
||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||
|
||||
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
||||
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
UartCookie* starTrackerCookie = new UartCookie(objects::START_TRACKER,
|
||||
q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL, uart::STAR_TRACKER_BAUD,
|
||||
StarTracker::MAX_FRAME_SIZE* 2 + 2);
|
||||
starTrackerCookie->setNoFixedSizeReply();
|
||||
new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie);
|
||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||
|
||||
#endif /* TE7020 != 0 */
|
||||
|
||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||
@ -144,40 +172,13 @@ void ObjectFactory::produce(void* args){
|
||||
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||
sif::info << "Created TCP server for TMTC commanding with listener port " <<
|
||||
tcpServer->getTcpPort() << std::endl;
|
||||
#endif
|
||||
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
|
||||
|
||||
/* Test Task */
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
createTestComponents();
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
||||
|
||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||
UartCookie* plocMpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER,
|
||||
q7s::UART_PLOC_MPSOC_DEV, UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD,
|
||||
PLOC_MPSOC::MAX_REPLY_SIZE);
|
||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie);
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL, uart::PLOC_SUPERVISOR_BAUD,
|
||||
PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||
plocSupervisorCookie->setNoFixedSizeReply();
|
||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
UartCookie* starTrackerCookie = new UartCookie(objects::START_TRACKER,
|
||||
q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL, uart::STAR_TRACKER_BAUD,
|
||||
StarTracker::MAX_FRAME_SIZE* 2 + 2);
|
||||
starTrackerCookie->setNoFixedSizeReply();
|
||||
new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie);
|
||||
#endif
|
||||
|
||||
new PlocUpdater(objects::PLOC_UPDATER);
|
||||
}
|
||||
|
||||
@ -220,8 +221,11 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF,
|
||||
#if Q7S_ADD_SPI_TEST == 0
|
||||
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
|
||||
#endif /* Q7S_ADD_SPI_TEST == 0 */
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectFactory::createPcduComponents() {
|
||||
@ -756,7 +760,10 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
}
|
||||
|
||||
void ObjectFactory::createTestComponents() {
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
new Q7STestTask(objects::TEST_TASK);
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
||||
/* Configure MIO0 as input */
|
||||
@ -833,11 +840,11 @@ void ObjectFactory::createTestComponents() {
|
||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
||||
UartCookie* plocSupervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
std::string("/dev/ttyPS1"), UartModes::NON_CANONICAL, 115200,
|
||||
PLOC_SPV::MAX_REPLY_SIZE);
|
||||
PLOC_SPV::MAX_PACKET_SIZE * 20);
|
||||
plocSupervisorCookie->setNoFixedSizeReply();
|
||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
|
||||
#endif
|
||||
|
||||
#if Q7S_ADD_SPI_TEST == 1
|
||||
|
@ -34,7 +34,9 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||
return INVALID_UART_COM_IF;
|
||||
}
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
sdcMan = SdCardManager::instance();
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -465,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;
|
||||
}
|
||||
@ -555,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:
|
||||
@ -865,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;
|
||||
|
||||
@ -899,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;
|
||||
@ -1398,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
|
||||
@ -1426,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;
|
||||
@ -1462,7 +1473,12 @@ ReturnValue_t PlocSupervisorHandler::createMramDumpFile() {
|
||||
}
|
||||
|
||||
std::string filename = "mram-dump--" + timeStamp + ".bin";
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
std::string currentMountPrefix = sdcMan->getCurrentMountPrefix();
|
||||
#else
|
||||
std::string currentMountPrefix("/mnt/sd0");
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
|
||||
// Check if path to PLOC directory exists
|
||||
if (not std::filesystem::exists(std::string(currentMountPrefix + "/" + plocFilePath))) {
|
||||
|
@ -125,7 +125,9 @@ private:
|
||||
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
|
||||
/** Path to PLOC specific files on SD card */
|
||||
std::string plocFilePath = "ploc";
|
||||
|
@ -14,8 +14,9 @@ PlocUpdater::~PlocUpdater() {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::initialize() {
|
||||
#if BOARD_TE0720 == 0
|
||||
sdcMan = SdCardManager::instance();
|
||||
|
||||
#endif
|
||||
ReturnValue_t result = SystemObject::initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
@ -51,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;
|
||||
@ -148,6 +165,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
// Check if file is stored on SD card and if associated SD card is mounted
|
||||
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||
if (!isSdCardMounted(sd::SLOT_0)) {
|
||||
@ -164,6 +182,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
||||
else {
|
||||
//update image not stored on SD card
|
||||
}
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
|
||||
updateFile = std::string(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
@ -174,6 +193,7 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
|
||||
SdCardManager::SdStatePair active;
|
||||
ReturnValue_t result = sdcMan->getSdCardActiveStatus(active);
|
||||
@ -202,6 +222,7 @@ bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif /* #if BOARD_TE0720 == 0 */
|
||||
|
||||
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
|
||||
uint8_t step) {
|
||||
@ -287,10 +308,10 @@ void PlocUpdater::commandUpdateAvailable() {
|
||||
remainingPackets = numOfUpdatePackets;
|
||||
packetsSent = 0;
|
||||
|
||||
uint32_t imageCrc = makeCrc();
|
||||
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());
|
||||
@ -333,7 +354,7 @@ void PlocUpdater::commandUpdatePacket() {
|
||||
file.close();
|
||||
// sequence count of first packet is 1
|
||||
packet.setPacketSequenceCount((packetsSent + 1) & PLOC_SPV::SEQUENCE_COUNT_MASK);
|
||||
if (numOfUpdatePackets > 0) {
|
||||
if (numOfUpdatePackets > 1) {
|
||||
adjustSequenceFlags(packet);
|
||||
}
|
||||
packet.makeCrc();
|
||||
@ -360,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());
|
||||
@ -378,9 +399,27 @@ void PlocUpdater::commandUpdateVerify() {
|
||||
return;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::makeCrc() {
|
||||
//TODO: Waiting on input from TAS about the CRC to use
|
||||
return 0;
|
||||
void PlocUpdater::calcImageCrc() {
|
||||
std::ifstream file(updateFile, std::ifstream::binary);
|
||||
file.seekg(0, file.end);
|
||||
uint32_t count;
|
||||
uint32_t bit;
|
||||
uint32_t remainder = INITIAL_REMAINDER_32;
|
||||
char input;
|
||||
for (count = 0; count < imageSize; count++) {
|
||||
file.seekg(count, file.beg);
|
||||
file.read(&input, 1);
|
||||
remainder ^= (input << 16);
|
||||
for (bit = 8; bit > 0; --bit) {
|
||||
if (remainder & TOPBIT_32) {
|
||||
remainder = (remainder << 1) ^ POLYNOMIAL_32;
|
||||
} else {
|
||||
remainder = (remainder << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
||||
}
|
||||
|
||||
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
||||
|
@ -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();
|
||||
@ -92,10 +96,16 @@ private:
|
||||
// Maximum size of update payload data per space packet (max size of space packet is 1024 bytes)
|
||||
static const size_t MAX_SP_DATA = 1016;
|
||||
|
||||
static const uint32_t TOPBIT_32 = (1 << 31);
|
||||
static const uint32_t POLYNOMIAL_32 = 0x04C11DB7;
|
||||
static const uint32_t INITIAL_REMAINDER_32 = 0xFFFFFFFF;
|
||||
static const uint32_t FINAL_XOR_VALUE_32 = 0xFFFFFFFF;
|
||||
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
|
||||
#endif
|
||||
CommandActionHelper commandActionHelper;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
@ -112,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;
|
||||
@ -160,12 +174,14 @@ private:
|
||||
*/
|
||||
void commandUpdateVerify();
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
/**
|
||||
* @brief Checks whether the SD card to read from is mounted or not.
|
||||
*/
|
||||
bool isSdCardMounted(sd::SdCard sdCard);
|
||||
#endif
|
||||
|
||||
ReturnValue_t makeCrc();
|
||||
void calcImageCrc();
|
||||
|
||||
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
||||
};
|
||||
|
@ -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,15 +1446,16 @@ 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(
|
||||
imageSize), numPackets(numPackets) {
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,9 @@ debugging. */
|
||||
//! /* Can be used to switch device to NORMAL mode immediately */
|
||||
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
|
||||
#define OBSW_PRINT_MISSED_DEADLINES 1
|
||||
#define OBSW_ADD_TEST_CODE 1
|
||||
#define OBSW_ADD_TEST_CODE 0
|
||||
#define OBSW_ADD_TEST_PST 0
|
||||
#define OBSW_ADD_TEST_TASK 0
|
||||
#define OBSW_TEST_LIBGPIOD 0
|
||||
#define OBSW_TEST_RADIATION_SENSOR_HANDLER 0
|
||||
#define OBSW_TEST_SUS_HANDLER 0
|
||||
|
@ -781,7 +781,7 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#if BOARD_TE7020 == 1
|
||||
#if BOARD_TE0720 == 1
|
||||
ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
@ -838,4 +838,4 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#endif /* BOARD_TE7020 == 1 */
|
||||
#endif /* BOARD_TE0720 == 1 */
|
||||
|
@ -55,7 +55,7 @@ ReturnValue_t pstI2c(FixedTimeslotTaskIF* thisSequence);
|
||||
*/
|
||||
ReturnValue_t pstTest(FixedTimeslotTaskIF* thisSequence);
|
||||
|
||||
#if TE0720 == 1
|
||||
#if BOARD_TE0720 == 1
|
||||
/**
|
||||
* @brief This polling sequence will be created when the software is compiled for the TE0720.
|
||||
*/
|
||||
|
2
thirdparty/arcsec_star_tracker
vendored
2
thirdparty/arcsec_star_tracker
vendored
@ -1 +1 @@
|
||||
Subproject commit c468400aaf8470a31e393f53c858d2bf2c361273
|
||||
Subproject commit 657c06e4a6e4c460e897c4a5b4eaefe7c6d1085e
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit a7f1ed904c460005c6d22f17ab496694ae150046
|
||||
Subproject commit ce5596f5669b8df44df418da6adff123941a395d
|
Loading…
Reference in New Issue
Block a user