meier/plocSupervisor #89

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

View File

@ -924,6 +924,11 @@ Reading data from CAN:
candump can0
````
## Dump content of file in hex
````
cat file.bin | hexdump
````
## Preparation of a fresh rootfs and SD card
This section summarizes important changes between a fresh rootfs and the current

View File

@ -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 TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
@ -143,7 +145,9 @@ void initmission::initTasks() {
tmTcDistributor->startTask();
tmtcBridgeTask->startTask();
tmtcPollingTask->startTask();
#if BOARD_TE0720 == 0
coreController->startTask();
#endif
plocUpdaterTask->startTask();
taskStarter(pstTasks, "PST task vector");
@ -155,7 +159,10 @@ void initmission::initTasks() {
#if TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
#if BOARD_TE0720 == 0
fsTask->startTask();
#endif
sif::info << "Tasks started.." << std::endl;
}
@ -205,7 +212,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);

View File

@ -103,11 +103,11 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::produce(void* args){
ObjectFactory::setStatics();
ObjectFactory::produceGenericObjects();
new CoreController(objects::CORE_CONTROLLER);
LinuxLibgpioIF* gpioComIF = nullptr;
createCommunicationInterfaces(&gpioComIF);
createTmpComponents();
#if BOARD_TE0720 == 0
new CoreController(objects::CORE_CONTROLLER);
createPcduComponents();
createRadSensorComponent(gpioComIF);
@ -136,26 +136,6 @@ void ObjectFactory::produce(void* args){
#endif /* ADD_PLOC_MPSOC */
createReactionWheelComponents(gpioComIF);
#endif /* TE7020 != 0 */
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
auto udpBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " <<
udpBridge->getUdpPort() << std::endl;
#else
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
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
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
createTestComponents();
#endif /* OBSW_ADD_TEST_CODE == 1 */
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
#if ADD_PLOC_MPSOC == 1
UartCookie* plocMpsocCookie = new UartCookie(objects::RW1, std::string("/dev/ttyUL3"),
@ -178,9 +158,29 @@ void ObjectFactory::produce(void* args){
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
plocSupervisor->setStartUpImmediately();
#endif
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
#endif /* TE7020 != 0 */
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
auto udpBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " <<
udpBridge->getUdpPort() << std::endl;
#else
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
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
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
createTestComponents();
#endif /* OBSW_ADD_TEST_CODE == 1 */
new PlocUpdater(objects::PLOC_UPDATER);
}
@ -222,8 +222,11 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF) {
#if Q7S_ADD_SPI_TEST == 0
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() {
@ -824,7 +827,8 @@ 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();

View File

@ -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;
}
@ -1462,7 +1464,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))) {

View File

@ -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";

View File

@ -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;
@ -148,6 +149,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 +166,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 +177,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 +206,7 @@ bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
}
return false;
}
#endif /* #if BOARD_TE0720 == 0 */
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
uint8_t step) {

View File

@ -94,8 +94,9 @@ private:
MessageQueueIF* commandQueue = nullptr;
#if BOARD_TE0720 == 0
SdCardManager* sdcMan = nullptr;
#endif
CommandActionHelper commandActionHelper;
ActionHelper actionHelper;
@ -160,10 +161,12 @@ 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();

View File

@ -41,7 +41,7 @@ debugging. */
#define ADD_PLOC_SUPERVISOR 1
#define ADD_PLOC_MPSOC 0
#define BOARD_TE0720 0
#define BOARD_TE0720 1
#define TE0720_HEATER_TEST 0
#define P60DOCK_DEBUG 0

View File

@ -710,7 +710,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();
@ -767,4 +767,4 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
}
return HasReturnvaluesIF::RETURN_OK;
}
#endif /* BOARD_TE7020 == 1 */
#endif /* BOARD_TE0720 == 1 */

View File

@ -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.
*/