lets see if this works

This commit is contained in:
Robin Müller 2023-07-03 16:55:45 +02:00
parent 697a3e8577
commit 9ece676313
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
15 changed files with 67 additions and 36 deletions

View File

@ -7,7 +7,8 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC ${LIB_FSFW_NAME})
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
add_subdirectory(simple)
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp)
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp scheduling.cpp
objectFactory.cpp)
add_subdirectory(boardtest)

View File

@ -1,4 +1 @@
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp scheduling.cpp
ObjectFactory.cpp WatchdogHandler.cpp)
target_sources(${SIMPLE_OBSW_NAME} PRIVATE scheduling.cpp)
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp)

View File

@ -188,17 +188,6 @@ ReturnValue_t CoreController::initialize() {
}
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
announceCurrentImageInfo();
// This has to come before the version announce because it might be required for retrieving
// the firmware version.
if (common::OBSW_VERSION_MAJOR >= 6 or common::OBSW_VERSION_MAJOR == 4) {
UioMapper sysRomMapper(q7s::UIO_SYS_ROM);
result = sysRomMapper.getMappedAdress(&mappedSysRomAddr, UioMapper::Permissions::READ_ONLY);
if (result != returnvalue::OK) {
// TODO: This might be a reason to switch to another image..
sif::error << "Getting mapped SYS ROM UIO address failed" << std::endl;
result = ObjectManager::CHILD_INIT_FAILED;
}
}
announceVersionInfo();
return result;
@ -2526,14 +2515,10 @@ void CoreController::announceVersionInfo() {
}
triggerEvent(VERSION_INFO, p1, p2);
if (common::OBSW_VERSION_MAJOR >= 6 or common::OBSW_VERSION_MAJOR == 4) {
if (mappedSysRomAddr != nullptr) {
uint32_t p1Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr));
uint32_t p2Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr) + 1);
triggerEvent(FIRMWARE_INFO, p1Firmware, p2Firmware);
}
}
p1 = (core::FW_VERSION_MAJOR << 24) | (core::FW_VERSION_MINOR << 16) |
(core::FW_VERSION_REVISION << 8) | (core::FW_VERSION_HAS_SHA);
std::memcpy(&p2, core::FW_VERSION_GIT_SHA, 4);
triggerEvent(FIRMWARE_INFO, p1, p2);
}
void CoreController::announceCurrentImageInfo() {

View File

@ -1,6 +1,7 @@
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
#define BSP_Q7S_CORE_CORECONTROLLER_H_
#include <bsp_q7s/core/defs.h>
#include <fsfw/container/DynamicFIFO.h>
#include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
@ -14,7 +15,6 @@
#include <atomic>
#include <cstddef>
#include "CoreDefinitions.h"
#include "OBSWConfig.h"
#include "bsp_q7s/fs/SdCardManager.h"
#include "events/subsystemIdRanges.h"

View File

@ -1,10 +1,16 @@
#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
#define BSP_Q7S_CORE_COREDEFINITIONS_H_
#ifndef BSP_Q7S_CORE_DEFS_H_
#define BSP_Q7S_CORE_DEFS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
namespace core {
extern uint8_t FW_VERSION_MAJOR;
extern uint8_t FW_VERSION_MINOR;
extern uint8_t FW_VERSION_REVISION;
extern bool FW_VERSION_HAS_SHA;
extern char FW_VERSION_GIT_SHA[4];
static const uint8_t HK_SET_ENTRIES = 3;
static const uint32_t HK_SET_ID = 5;
@ -36,4 +42,4 @@ class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
} // namespace core
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */
#endif /* BSP_Q7S_CORE_DEFS_H_ */

View File

@ -1,4 +1,5 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/objectFactory.h>
#include <dummies/ComCookieDummy.h>
#include <dummies/PcduHandlerDummy.h>
#include <fsfw/health/HealthTableIF.h>
@ -10,7 +11,6 @@
#include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h"
#include "common/config/devices/addresses.h"
#include "devConf.h"
@ -36,6 +36,7 @@ void ObjectFactory::produce(void* args) {
#endif
PersistentTmStores stores;
readFirmwareVersion();
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
enableHkSets);

View File

@ -1,4 +1,5 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/core/objectFactory.h>
#include <devices/gpioIds.h>
#include <fsfw/storagemanager/LocalPool.h>
#include <fsfw/storagemanager/PoolManager.h>
@ -7,7 +8,6 @@
#include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h"
#include "devConf.h"
#include "eive/objects.h"
@ -32,6 +32,7 @@ void ObjectFactory::produce(void* args) {
#endif
PersistentTmStores stores;
readFirmwareVersion();
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
true);

View File

@ -1,8 +1,9 @@
#include "ObjectFactory.h"
#include "objectFactory.h"
#include <fsfw/devicehandlers/HealthDevice.h>
#include <fsfw/subsystem/Subsystem.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw_hal/linux/uio/UioMapper.h>
#include <linux/acs/AcsBoardPolling.h>
#include <linux/acs/GpsHyperionLinuxController.h>
#include <linux/acs/ImtqPollingTask.h>
@ -32,6 +33,9 @@
#include <mission/system/objects/CamSwitcher.h>
#include <mission/system/tcs/TmpDevFdir.h>
#include <cstdint>
#include <cstring>
#include "OBSWConfig.h"
#include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/callbacks/gnssCallback.h"
@ -100,6 +104,7 @@
#include <sstream>
#include "bsp_q7s/core/defs.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h"
@ -130,6 +135,11 @@ ResetArgs RESET_ARGS_GNSS;
std::atomic_bool LINK_STATE = CcsdsIpCoreHandler::LINK_DOWN;
std::atomic_bool PTME_LOCKED = false;
std::atomic_uint16_t I2C_FATAL_ERRORS = 0;
uint8_t core::FW_VERSION_MAJOR = 0;
uint8_t core::FW_VERSION_MINOR = 0;
uint8_t core::FW_VERSION_REVISION = 0;
bool core::FW_VERSION_HAS_SHA = false;
char core::FW_VERSION_GIT_SHA[4] = {};
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
@ -1025,3 +1035,32 @@ void ObjectFactory::createPlI2cResetGpio(LinuxLibgpioIF* gpioIF) {
gpioIF->pullHigh(gpioIds::PL_I2C_ARESETN);
}
}
ReturnValue_t ObjectFactory::readFirmwareVersion() {
uint32_t* mappedSysRomAddr = nullptr;
// The SYS ROM FPGA block is only available in those versions.
if (not(common::OBSW_VERSION_MAJOR >= 6) or (common::OBSW_VERSION_MAJOR == 4)) {
return returnvalue::OK;
}
// This has to come before the version announce because it might be required for retrieving
// the firmware version.
UioMapper sysRomMapper(q7s::UIO_SYS_ROM);
ReturnValue_t result =
sysRomMapper.getMappedAdress(&mappedSysRomAddr, UioMapper::Permissions::READ_ONLY);
if (result != returnvalue::OK) {
sif::error << "Getting mapped SYS ROM UIO address failed" << std::endl;
return returnvalue::FAILED;
}
if (mappedSysRomAddr != nullptr) {
uint32_t firstEntry = *(reinterpret_cast<uint32_t*>(mappedSysRomAddr));
uint32_t secondEntry = *(reinterpret_cast<uint32_t*>(mappedSysRomAddr) + 1);
core::FW_VERSION_MAJOR = (firstEntry >> 24) & 0xff;
core::FW_VERSION_MINOR = (firstEntry >> 16) & 0xff;
core::FW_VERSION_REVISION = (firstEntry >> 8) & 0xff;
bool hasGitSha = (firstEntry & 0x0b1);
if (hasGitSha) {
std::memcpy(core::FW_VERSION_GIT_SHA, &secondEntry, 4);
}
}
return returnvalue::OK;
}

View File

@ -75,6 +75,7 @@ void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
ReturnValue_t createCcsdsComponents(CcsdsComponentArgs& args);
ReturnValue_t readFirmwareVersion();
void createMiscComponents();
void createTestComponents(LinuxLibgpioIF* gpioComIF);

View File

@ -11,13 +11,13 @@
#include "OBSWConfig.h"
#include "bsp_q7s/core/WatchdogHandler.h"
#include "commonConfig.h"
#include "core/scheduling.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h"
#include "mission/acs/defs.h"
#include "mission/com/defs.h"
#include "mission/system/systemTree.h"
#include "q7sConfig.h"
#include "scheduling.h"
#include "watchdog/definitions.h"
static constexpr int OBSW_ALREADY_RUNNING = -2;

View File

@ -9,7 +9,6 @@
#include <vector>
#include "OBSWConfig.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/platform.h"
@ -21,6 +20,7 @@
#include "mission/pollingSeqTables.h"
#include "mission/scheduling.h"
#include "mission/utility/InitMission.h"
#include "objectFactory.h"
#include "q7sConfig.h"
/* This is configured for linux without CR */

View File

@ -1,6 +1,6 @@
#include "CoreControllerDummy.h"
#include <bsp_q7s/core/CoreDefinitions.h>
#include <bsp_q7s/core/defs.h>
#include <objects/systemObjectList.h>
#include <cmath>

View File

@ -1,6 +1,6 @@
#include "ThermalController.h"
#include <bsp_q7s/core/CoreDefinitions.h>
#include <bsp_q7s/core/defs.h>
#include <eive/objects.h>
#include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/thermal/ThermalComponentIF.h>

View File

@ -1,7 +1,7 @@
#ifndef MISSION_CONTROLLER_THERMALCONTROLLER_H_
#define MISSION_CONTROLLER_THERMALCONTROLLER_H_
#include <bsp_q7s/core/CoreDefinitions.h>
#include <bsp_q7s/core/defs.h>
#include <fsfw/controller/ExtendedControllerBase.h>
#include <fsfw/devicehandlers/DeviceHandlerThermalSet.h>
#include <fsfw/timemanager/Countdown.h>