From dfb800f58afb43f8c863eee730aca6df9968867a Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Fri, 19 Aug 2022 14:31:48 +0200 Subject: [PATCH] more dirty hacks to check amd64 build. To be cleaned up --- CMakeLists.txt | 5 ++ bsp_q7s/core/InitMission.cpp | 141 +++++++++++++++++++++++++++++++++++ fsfw | 2 +- 3 files changed, 147 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a33c6e82..d76b6a73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0) # set(CMAKE_VERBOSE TRUE) +# TODO WIP: add_compile_definitions(FSFW_INTROSPECTION) include_directories("bsp_mib/include") @@ -360,6 +361,10 @@ if(EIVE_ADD_LINUX_FILES) add_subdirectory(${LINUX_PATH}) endif() add_subdirectory(${BSP_PATH}) + +#TODO WIP: +add_subdirectory("bsp_mib") + if(ADD_CSP_LIB) add_subdirectory(${LIB_CSP_PATH}) endif() diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 80f5fc9e..29b9ec4e 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -34,6 +34,114 @@ ServiceInterfaceStream sif::error("ERROR", true, false, true); ObjectManagerIF* objectManager = nullptr; + + + + + +#ifdef FSFW_INTROSPECTION +void printEnum(ParameterIF* param) { + size_t i = 0; + for (auto iter : param->getEnumValues()) { + printf("---enum value %li: \"%s\"\n", iter, param->getEnumDescriptions()[i++]); + } +} +/*void printEnum(HousekeepingEntryIF* param) { + size_t i = 0; + for (auto iter : param->getEnumValues()) { + printf("---enum value %li: \"%s\"\n", iter, param->getEnumDescriptions()[i++]); + } +} + +void printModes(HasModesIF* object) { + ModeHelperIF* modeHelper = object->getModeHelper(); + + auto modes = modeHelper->getModes(); + + for (auto mode : modes) { + auto submodes = modeHelper->getSubmodes(mode.first); + if (submodes.size() == 0) { + continue; + } + printf("-mode \"%s\" (%i) with \n", mode.second, mode.first); + for (auto submode : submodes) { + printf("--submode \"%s\" (%i)\n", submode.second, submode.first); + } + } +}*/ + +void printAction(HasActionsIF* actionIf) { + auto actionMap = actionIf->getActionHelper()->getActionMap(); + + for (auto iter = actionMap->begin(); iter != actionMap->end(); iter++) { + printf("-action \"%s\" (%i) with \n", iter->second->getName(), iter->second->getId()); + auto parameterList = iter->second->getParameters(); + for (ParameterIF* param : *parameterList) { + printf("--parameter \"%s\" %.3E, %.3E\n", param->getName(), param->getMinFloating(), + param->getMaxFloating()); + if (param->getType() == Types::ENUM) { + printEnum(param); + } + } + } +} + +/* +void printHousekeeping(HousekeepingIF* housekeepingIF) { + auto dataSets = housekeepingIF->getHousekeepingHelper()->getDataSets(); + + for (auto iter : *dataSets) { + printf("-SID \"%s\" (%i) with:\n", iter.second->getDescription(), iter.first); + for (HousekeepingEntryIF* param : *(iter.second->getVariables())) { + printf("--parameter \"%s\"\n", param->getName()); + if (param->getType() == Types::ENUM) { + printEnum(param); + } + } + } +} + +const char* getClassName(uint8_t classId) { + CLASS_ID::FwClassIds fwClassId(classId); + const char* description = fwClassId.getDescription(); + if (description != nullptr) { + return description; + } + + return "UNKNOWN"; +} + +void printReturnCodes() { + puts("\nReturnvalues"); + for (auto iter : ReturnValueItems::returnValues) { + uint8_t classId = iter.first >> 8; + printf("-\"%s:%s\" (%04x)\n", getClassName(classId), iter.second, iter.first); + } +} + +void printEvents() { + puts("\nEvents"); + for (auto iter : EventItems::events) { + uint8_t classId = iter.first >> 8; + printf("-\"%s:%s\" (%06x)\n", getClassName(classId), iter.second, iter.first); + } +}*/ + + +#endif + + + + + + + + + + + + + void initmission::initMission() { sif::info << "Building global objects.." << std::endl; try { @@ -46,6 +154,39 @@ void initmission::initMission() { std::exit(1); } + #ifdef FSFW_INTROSPECTION + sif::info << "Introspecting.." << std::endl; + ObjectManager::instance()->produce(); + auto objectList = ObjectManager::instance()->getObjectList(); + + sif::info << "Looping.." << std::endl; + for (auto iter : *objectList) { + //SystemObjects objectId(iter.first); + printf("Object \"%s\" (0x%08x)\n", "TODO", iter.first); + + HasActionsIF* actionIf = dynamic_cast(iter.second); + if (actionIf != nullptr) { + printAction(actionIf); + } + + /*HasModesIF* hasmodesIF = dynamic_cast(iter.second); + if (hasmodesIF != nullptr) { + printModes(hasmodesIF); + } + + HousekeepingIF* hasHousekeeping = dynamic_cast(iter.second); + if (hasHousekeeping != nullptr) { + printHousekeeping(hasHousekeeping); + }*/ + } + + // printReturnCodes(); + + // printEvents(); + + exit(0); + #endif + sif::info << "Initializing all objects.." << std::endl; ObjectManager::instance()->initialize(); diff --git a/fsfw b/fsfw index 31f59f91..3782d8eb 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 31f59f915cd368ef4f49a3ed071420123e07eb72 +Subproject commit 3782d8eb74171343dce845606f91885e87dc54f4