Merge pull request 'Generators & CMake & FSFW Update' (#42) from mueller/generators-cmake-fsfw-update into develop

Reviewed-on: #42
This commit is contained in:
Jakob Meier 2021-06-11 13:22:45 +02:00
commit d42a273336
56 changed files with 330 additions and 117 deletions

8
.gitmodules vendored
View File

@ -15,7 +15,7 @@
url = https://github.com/rmspacefish/lwgps.git
[submodule "fsfw_hal"]
path = fsfw_hal
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw_hal.git
[submodule "generators/modgen"]
path = generators/modgen
url = https://git.ksat-stuttgart.de/source/modgen.git
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-hal.git
[submodule "generators/fsfwgen"]
path = generators/fsfwgen
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-generators.git

View File

@ -54,6 +54,7 @@ set(MISSION_PATH mission)
set(TEST_PATH test/testtasks)
set(LINUX_PATH linux)
set(COMMON_PATH common)
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
set(FSFW_HAL_LIB_PATH fsfw_hal)
set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp)
@ -95,8 +96,21 @@ else()
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
endif()
# Configuration files
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
if(${TGT_BSP} MATCHES "arm/q7s")
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
elseif(${TGT_BSP} MATCHES "arm/raspberrypi")
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
endif()
# Set common config path for FSFW
set(FSFW_ADDITIONAL_INC_PATH "${COMMON_PATH}/config")
set(FSFW_ADDITIONAL_INC_PATHS
"${COMMON_PATH}/config"
${CMAKE_CURRENT_BINARY_DIR}
)
# Set for lwgps library
set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
@ -157,6 +171,7 @@ endif()
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -1,6 +1,9 @@
FROM ubuntu:latest
# FROM alpine:latest
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y cmake g++
# RUN apk add cmake make g++

View File

@ -32,9 +32,9 @@ ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
objectManager = new ObjectManager(ObjectFactory::produce);
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();

View File

@ -36,7 +36,7 @@ void Factory::setStaticFrameworkObjectIds(){
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();

View File

@ -1,17 +1,10 @@
/*
* ObjectFactory.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
void produce(void* args);
};
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -26,9 +26,9 @@ ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
objectManager = new ObjectManager(ObjectFactory::produce);
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
@ -117,6 +117,10 @@ void initmission::initTasks() {
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
@ -124,6 +128,11 @@ void initmission::initTasks() {
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("INT_ERR_RPRT",
objects::INTERNAL_ERROR_REPORTER);
}
#if OBSW_ADD_TEST_PST == 1
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(

View File

@ -45,15 +45,13 @@ void Factory::setStaticFrameworkObjectIds() {
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();

View File

@ -1,17 +1,10 @@
/*
* ObjectFactory.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
void produce(void* args);
};
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -5,6 +5,3 @@ target_sources(${TARGET_NAME} PRIVATE
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -8,6 +8,4 @@ add_subdirectory(boardconfig)
add_subdirectory(comIF)
add_subdirectory(boardtest)
add_subdirectory(gpio)
add_subdirectory(core)

View File

@ -1,15 +1,18 @@
FROM ubuntu:latest
# FROM alpine:latest
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y curl cmake g++
# Q7S root filesystem, required for cross-compilation
RUN mkdir -p /usr/rootfs; \
curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
curl --tlsv1 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/dnfMy9kGpgynN6J/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
| tar xvz -C /usr/rootfs
# Q7S C++ cross-compiler
RUN mkdir -p /usr/tools; \
curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/2Fp2ag6NGnbtAsK/download/gcc-arm-linux-gnueabi.tar.gz \
curl --tlsv1 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/RMsbHydJc6PSqcz/download/gcc-arm-linux-gnueabi.tar.gz \
| tar xvz -C /usr/tools
# RUN apk add cmake make g++

View File

@ -33,9 +33,9 @@ ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
objectManager = new ObjectManager(ObjectFactory::produce);
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();

View File

@ -7,11 +7,15 @@
#include "devices/powerSwitcherList.h"
#include "spiConf.h"
#include <bsp_q7s/gpio/gpioCallbacks.h>
#include "bsp_q7s/gpio/gpioCallbacks.h"
#include "bsp_q7s/core/CoreController.h"
#include <linux/devices/HeaterHandler.h>
#include <linux/devices/SolarArrayDeploymentHandler.h>
#include <linux/devices/devicedefinitions/SusDefinitions.h>
#include <linux/devices/SusHandler.h>
#include <linux/csp/CspCookie.h>
#include <linux/csp/CspComIF.h>
#include <mission/core/GenericFactory.h>
#include <mission/devices/PDU1Handler.h>
@ -28,8 +32,6 @@
#include <mission/devices/GyroL3GD20Handler.h>
#include <mission/devices/PlocHandler.h>
#include <mission/devices/RadiationSensorHandler.h>
#include <linux/devices/devicedefinitions/SusDefinitions.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
#include <mission/devices/devicedefinitions/PlocDefinitions.h>
@ -37,13 +39,8 @@
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/utility/TmFunnel.h>
#include <linux/csp/CspCookie.h>
#include <linux/csp/CspComIF.h>
#include <linux/uart/UartComIF.h>
#include <linux/uart/UartCookie.h>
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
#include <fsfw_hal/linux/i2c/I2cCookie.h>
#include <fsfw_hal/linux/i2c/I2cComIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
@ -84,9 +81,20 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::produce(){
void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
/* Communication interfaces */
new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF);
new UartComIF(objects::UART_COM_IF);
#if Q7S_ADD_SPI_TEST == 0
new SpiComIF(objects::SPI_COM_IF, gpioComIF);
#endif /* Q7S_ADD_SPI_TEST == 0 */
new CoreController(objects::CORE_CONTROLLER);
#if TE0720 == 1
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
@ -99,15 +107,6 @@ void ObjectFactory::produce(){
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
#endif
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
/* Communication interfaces */
new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF);
new UartComIF(objects::UART_COM_IF);
#if Q7S_ADD_SPI_TEST == 0
new SpiComIF(objects::SPI_COM_IF, gpioComIF);
#endif /* Q7S_ADD_SPI_TEST == 0 */
/* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(

View File

@ -3,7 +3,7 @@
namespace ObjectFactory {
void setStatics();
void produce();
void produce(void* args);
};
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */

View File

@ -5,6 +5,3 @@ target_sources(${TARGET_NAME} PRIVATE
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -0,0 +1,3 @@
target_sources(${TARGET_NAME} PRIVATE
CoreController.cpp
)

View File

@ -0,0 +1,26 @@
#include "CoreController.h"
CoreController::CoreController(object_id_t objectId):
ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) {
}
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
return HasReturnvaluesIF::RETURN_OK;
}
void CoreController::performControlOperation() {
}
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return HasReturnvaluesIF::RETURN_OK;
}
LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) {
return nullptr;
}
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,22 @@
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
#define BSP_Q7S_CORE_CORECONTROLLER_H_
#include "fsfw/controller/ExtendedControllerBase.h"
class CoreController: public ExtendedControllerBase {
public:
CoreController(object_id_t objectId);
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
void performControlOperation() override;
private:
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode);
};
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */

View File

@ -0,0 +1,4 @@
target_sources(${TARGET_NAME} PRIVATE
FileSystemManager.cpp
SdCardAccess.cpp
)

View File

@ -0,0 +1,7 @@
#include "FileSystemManager.h"
class FileSystemManager {
public:
private:
};

View File

@ -0,0 +1,8 @@
#ifndef BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_
#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */

View File

@ -0,0 +1,4 @@
#include "SdCardAccess.h"
SdCardAccess::SdCardAccess() {
}

View File

@ -0,0 +1,11 @@
#ifndef BSP_Q7S_MEMORY_SDCARDACCESS_H_
#define BSP_Q7S_MEMORY_SDCARDACCESS_H_
class SdCardAccess {
public:
SdCardAccess();
private:
};
#endif /* BSP_Q7S_MEMORY_SDCARDACCESS_H_ */

View File

@ -6,7 +6,7 @@ if(NOT DEFINED ENV{Q7S_SYSROOT})
# "point to the raspbian rootfs."
# )
else()
set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE FILEPATH "Q7S root filesystem path")
set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE PATH "Q7S root filesystem path")
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})

View File

@ -6,7 +6,7 @@
namespace CLASS_ID {
enum commonClassIds: uint8_t {
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
COMMON_CLASS_ID_START = FW_CLASS_ID_COUNT,
MGM_LIS3MDL, //MGMLIS3
MGM_RM3100, //MGMRM3100
PCDU_HANDLER, //PCDU

View File

@ -11,6 +11,12 @@ enum commonObjects: uint32_t {
UDP_BRIDGE = 0x50000300,
UDP_POLLING_TASK = 0x50000400,
/* 0x43 ('C') for Controllers */
THERMAL_CONTROLLER = 0x43001000,
ATTITUDE_CONTROLLER = 0x43002000,
ACS_CONTROLLER = 0x43003000,
CORE_CONTROLLER = 0x43004000,
/* 0x44 ('D') for device handlers */
P60DOCK_HANDLER = 0x44000001,
PDU1_HANDLER = 0x44000002,

View File

@ -1,4 +1,4 @@
version: "3.8"
version: "3.3"
services:
build-host:

2
fsfw

@ -1 +1 @@
Subproject commit e9adaf672f7bfac9aaa03c284410b318142431ff
Subproject commit 4b095eea8991d3e9a48fa8945c86339cfdad26d5

View File

@ -11,10 +11,10 @@ On Windows, Build Tools installation might be necessary
"""
import datetime
from modgen.events.event_parser import handle_csv_export, handle_cpp_export, SubsystemDefinitionParser, EventParser
from modgen.parserbase.file_list_parser import FileListParser
from modgen.utility.printer import PrettyPrinter
from modgen.utility.file_management import copy_file, move_file
from fsfwgen.events.event_parser import handle_csv_export, handle_cpp_export, SubsystemDefinitionParser, EventParser
from fsfwgen.parserbase.file_list_parser import FileListParser
from fsfwgen.utility.printer import PrettyPrinter
from fsfwgen.utility.file_management import copy_file, move_file
from definitions import BspType

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 83 translations.
* @details
* Generated on: 2021-05-18 16:15:50
* Generated on: 2021-06-08 17:09:32
*/
#include "translateEvents.h"

1
generators/fsfwgen Submodule

@ -0,0 +1 @@
Subproject commit 78e890f947f55a9417d390fea8d9bd5684d11730

@ -1 +0,0 @@
Subproject commit d9beb68bd9d1a1e6015e4979d547a762d199bff7

View File

@ -10,10 +10,10 @@ On Windows, Build Tools installation might be necessary
"""
import datetime
from modgen.objects.objects import sql_object_exporter, ObjectDefinitionParser, write_translation_file, \
from fsfwgen.objects.objects import sql_object_exporter, ObjectDefinitionParser, write_translation_file, \
export_object_file, write_translation_header_file
from modgen.utility.printer import PrettyPrinter
from modgen.utility.file_management import copy_file, move_file
from fsfwgen.utility.printer import PrettyPrinter
from fsfwgen.utility.file_management import copy_file, move_file
from definitions import BspType, DATABASE_NAME

View File

@ -9,10 +9,10 @@ Returnvalue exporter.
To use MySQLdb, run pip install mysqlclient or install in IDE. On Windows, Build Tools installation might be necessary.
:data: 21.11.2019
"""
from modgen.parserbase.file_list_parser import FileListParser
from modgen.returnvalues.returnvalues_parser import InterfaceParser, ReturnValueParser
from modgen.utility.sql_writer import SqlWriter
from modgen.utility.file_management import move_file
from fsfwgen.parserbase.file_list_parser import FileListParser
from fsfwgen.returnvalues.returnvalues_parser import InterfaceParser, ReturnValueParser
from fsfwgen.utility.sql_writer import SqlWriter
from fsfwgen.utility.file_management import move_file
from definitions import BspType, DATABASE_NAME

View File

@ -3,14 +3,14 @@
#include "devices/gpioIds.h"
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tasks/TaskFactory.h>
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
GpioCookie* gpioCookie):
TestTask(objectId) {
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioIfobjectId);
if (gpioInterface == nullptr) {
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
}

View File

@ -2,6 +2,7 @@
#include "devices/gpioIds.h"
#include "devices/powerSwitcherList.h"
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
@ -38,7 +39,7 @@ ReturnValue_t HeaterHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
gpioInterface = objectManager->get<GpioIF>(gpioDriverId);
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioDriverId);
if (gpioInterface == nullptr) {
sif::error << "HeaterHandler::initialize: Invalid Gpio interface." << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
@ -50,14 +51,14 @@ ReturnValue_t HeaterHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
if (IPCStore == nullptr) {
sif::error << "HeaterHandler::initialize: IPC store not set up in factory." << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
if(mainLineSwitcherObjectId != objects::NO_OBJECT) {
mainLineSwitcher = objectManager->get<PowerSwitchIF>(mainLineSwitcherObjectId);
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
if (mainLineSwitcher == nullptr) {
sif::error
<< "HeaterHandler::initialize: Failed to get main line switcher. Make sure "

View File

@ -5,6 +5,7 @@
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/ObjectManager.h>
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_,
@ -35,7 +36,7 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
gpioInterface = objectManager->get<GpioIF>(gpioDriverId);
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioDriverId);
if (gpioInterface == nullptr) {
sif::error << "SolarArrayDeploymentHandler::initialize: Invalid Gpio interface."
<< std::endl;
@ -50,7 +51,7 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() {
}
if (mainLineSwitcherObjectId != objects::NO_OBJECT) {
mainLineSwitcher = objectManager->get<PowerSwitchIF>(mainLineSwitcherObjectId);
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
if (mainLineSwitcher == nullptr) {
sif::error
<< "SolarArrayDeploymentHandler::initialize: Main line switcher failed to fetch object"

View File

@ -7,9 +7,9 @@
#define FSFWCONFIG_OBSWCONFIG_H_
#ifdef RASPBERRY_PI
#include <rpi_config.h>
#include "rpiConfig.h"
#elif defined(XIPHOS_Q7S)
#include <q7s_config.h>
#include "q7sConfig.h"
#endif
#include "commonConfig.h"
#include "OBSWVersion.h"

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 83 translations.
* @details
* Generated on: 2021-05-18 16:15:50
* Generated on: 2021-06-08 17:09:32
*/
#include "translateEvents.h"

View File

@ -1,9 +1,9 @@
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#include <cstdint>
#include "commonObjects.h"
#include <fsfw/objectmanager/frameworkObjects.h>
#include <commonObjects.h>
#include <cstdint>
// The objects will be instantiated in the ID order
namespace objects {
@ -12,12 +12,7 @@ namespace objects {
FW_ADDRESS_START = PUS_SERVICE_1_VERIFICATION,
FW_ADDRESS_END = TIME_STAMPER,
PUS_SERVICE_3 = 0x51000300,
PUS_SERVICE_5 = 0x51000400,
PUS_SERVICE_6 = 0x51000500,
PUS_SERVICE_8 = 0x51000800,
PUS_SERVICE_23 = 0x51002300,
PUS_SERVICE_201 = 0x51020100,
TM_FUNNEL = 0x52000002,

View File

@ -1,7 +1,6 @@
#include "GPIORPi.h"
#include <FSFWConfig.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <linux/fsfwconfig/FSFWConfig.h.in>
#include <linux/gpio/GpioCookie.h>
ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,

View File

@ -30,7 +30,7 @@ ReturnValue_t ThermalController::initializeAfterTaskCreation() {
sif::error << "ThermalController::initializeAfterTaskCreation: Base"
<< " class initialization failed!" << std::endl;
}
HasLocalDataPoolIF* testHkbHandler = objectManager->get<HasLocalDataPoolIF>(
HasLocalDataPoolIF* testHkbHandler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
TSensorDefinitions::ObjIds::TEST_HKB_HANDLER);
if(testHkbHandler == nullptr) {
sif::warning << "ThermalController::initializeAfterTaskCreation: Test"

View File

@ -1,3 +1,4 @@
#include <fsfw/action/HasActionsIF.h>
#include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw_hal/linux/utility.h>
@ -14,7 +15,7 @@
GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
object_id_t deviceCommunication, CookieIF * comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this),
configDataset(this) {
configDataset(this), breakCountdown() {
#if ADIS16507_DEBUG == 1
debugDivider = new PeriodicOperationDivider(5);
#endif
@ -28,18 +29,34 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
}
void GyroADIS16507Handler::doStartUp() {
// Initial 310 ms start up time after power-up
if(internalState == InternalState::STARTUP) {
if(not commandExecuted) {
breakCountdown.setTimeout(ADIS16507::START_UP_TIME);
commandExecuted = true;
}
if(breakCountdown.hasTimedOut()) {
internalState = InternalState::CONFIG;
commandExecuted = false;
}
}
// Read all configuration registers first
if(internalState == InternalState::CONFIG) {
if(commandExecuted) {
commandExecuted = false;
internalState = InternalState::IDLE;
}
}
if(internalState == InternalState::IDLE) {
setMode(MODE_NORMAL);
// setMode(MODE_ON);
}
}
void GyroADIS16507Handler::doShutDown() {
commandExecuted = false;
}
ReturnValue_t GyroADIS16507Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
@ -49,11 +66,14 @@ ReturnValue_t GyroADIS16507Handler::buildNormalDeviceCommand(DeviceCommandId_t *
ReturnValue_t GyroADIS16507Handler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
switch(internalState) {
case(InternalState::STARTUP): {
case(InternalState::CONFIG): {
*id = ADIS16507::READ_OUT_CONFIG;
buildCommandFromCommand(*id, nullptr, 0);
break;
}
case(InternalState::STARTUP): {
break;
}
default: {
/* Might be a configuration error. */
sif::debug << "GyroADIS16507Handler::buildTransitionDeviceCommand: "
@ -80,6 +100,10 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
break;
}
case(ADIS16507::READ_SENSOR_DATA): {
if(breakCountdown.isBusy()) {
// A glob command is pending and sensor data can't be read currently
return NO_REPLY_EXPECTED;
}
std::memcpy(commandBuffer.data(), ADIS16507::BURST_READ_ENABLE.data(),
ADIS16507::BURST_READ_ENABLE.size());
std::memset(commandBuffer.data() + 2, 0, 10 * 2);
@ -87,6 +111,62 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
this->rawPacket = commandBuffer.data();
break;
}
case(ADIS16507::SELF_TEST_SENSORS): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::SENSOR_SELF_TEST, 0x00);
breakCountdown.setTimeout(ADIS16507::SELF_TEST_BREAK);
break;
}
case(ADIS16507::SELF_TEST_MEMORY): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FLASH_MEMORY_TEST, 0x00);
breakCountdown.setTimeout(ADIS16507::FLASH_MEMORY_TEST_BREAK);
break;
}
case(ADIS16507::UPDATE_NV_CONFIGURATION): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FLASH_MEMORY_UPDATE, 0x00);
breakCountdown.setTimeout(ADIS16507::FLASH_MEMORY_UPDATE_BREAK);
break;
}
case(ADIS16507::RESET_SENSOR_CONFIGURATION): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FACTORY_CALIBRATION, 0x00);
breakCountdown.setTimeout(ADIS16507::FACTORY_CALIBRATION_BREAK);
break;
}
case(ADIS16507::SW_RESET): {
if(breakCountdown.isBusy()) {
// Another glob command is pending
return HasActionsIF::IS_BUSY;
}
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::SOFTWARE_RESET, 0x00);
breakCountdown.setTimeout(ADIS16507::SW_RESET_BREAK);
break;
}
case(ADIS16507::PRINT_CURRENT_CONFIGURATION): {
#if OBSW_VERBOSE_LEVEL >= 1
PoolReadGuard pg(&configDataset);
sif::info << "ADIS16507 Sensor configuration: DIAG_STAT: 0x" << std::hex << std::setw(4) <<
std::setfill('0') << "0x" << configDataset.diagStatReg.value << std::endl;
sif::info << "MSC_CTRL: " << std::hex << std::setw(4) << "0x" <<
configDataset.mscCtrlReg.value << " | FILT_CTRL: 0x" <<
configDataset.filterSetting.value << " | DEC_RATE: 0x" <<
configDataset.decRateReg.value << std::setfill(' ') << std::endl;
#endif /* OBSW_VERBOSE_LEVEL >= 1 */
}
}
return HasReturnvaluesIF::RETURN_OK;
}
@ -94,6 +174,12 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
void GyroADIS16507Handler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(ADIS16507::READ_SENSOR_DATA, 1, &primaryDataset);
insertInCommandAndReplyMap(ADIS16507::READ_OUT_CONFIG, 1, &configDataset);
insertInCommandAndReplyMap(ADIS16507::SELF_TEST_SENSORS, 1);
insertInCommandAndReplyMap(ADIS16507::SELF_TEST_MEMORY, 1);
insertInCommandAndReplyMap(ADIS16507::UPDATE_NV_CONFIGURATION, 1);
insertInCommandAndReplyMap(ADIS16507::RESET_SENSOR_CONFIGURATION, 1);
insertInCommandAndReplyMap(ADIS16507::SW_RESET, 1);
insertInCommandAndReplyMap(ADIS16507::PRINT_CURRENT_CONFIGURATION, 1);
}
ReturnValue_t GyroADIS16507Handler::scanForReply(const uint8_t *start, size_t remainingSize,
@ -123,7 +209,7 @@ ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id,
configDataset.mscCtrlReg.value = packet[6] << 8 | packet[7];
configDataset.decRateReg.value = packet[8] << 8 | packet[9];
configDataset.setValidity(true, true);
if(internalState == InternalState::STARTUP) {
if(internalState == InternalState::CONFIG) {
commandExecuted = true;
}
break;
@ -223,6 +309,19 @@ uint32_t GyroADIS16507Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t mode
return 5000;
}
void GyroADIS16507Handler::prepareWriteCommand(uint8_t startReg, uint8_t valueOne,
uint8_t valueTwo) {
uint8_t secondReg = startReg + 1;
startReg |= ADIS16507::WRITE_MASK;
secondReg |= ADIS16507::WRITE_MASK;
commandBuffer[0] = startReg;
commandBuffer[1] = valueOne;
commandBuffer[2] = secondReg;
commandBuffer[3] = valueTwo;
this->rawPacketLen = 4;
this->rawPacket = commandBuffer.data();
}
void GyroADIS16507Handler::prepareReadCommand(uint8_t *regList, size_t len) {
for(size_t idx = 0; idx < len; idx++) {
commandBuffer[idx * 2] = regList[idx];

View File

@ -40,6 +40,7 @@ private:
enum class InternalState {
STARTUP,
CONFIG,
IDLE
};
@ -65,6 +66,8 @@ private:
#if ADIS16507_DEBUG == 1
PeriodicOperationDivider* debugDivider;
#endif
Countdown breakCountdown;
void prepareWriteCommand(uint8_t startReg, uint8_t valueOne, uint8_t valueTwo);
ReturnValue_t handleSensorData(const uint8_t* packet);
};

View File

@ -33,7 +33,7 @@ ReturnValue_t PCDUHandler::initialize() {
ReturnValue_t result;
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
if (IPCStore == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
@ -44,7 +44,8 @@ ReturnValue_t PCDUHandler::initialize() {
}
/* Subscribing for housekeeping table update messages of the PDU2 */
HasLocalDataPoolIF* pdu2Handler = objectManager->get<HasLocalDataPoolIF>(objects::PDU2_HANDLER);
HasLocalDataPoolIF* pdu2Handler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
objects::PDU2_HANDLER);
if(pdu2Handler == nullptr) {
sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl;
return RETURN_FAILED;
@ -58,7 +59,8 @@ ReturnValue_t PCDUHandler::initialize() {
}
/* Subscribing for housekeeping table update messages of the PDU1 */
HasLocalDataPoolIF* pdu1Handler = objectManager->get<HasLocalDataPoolIF>(objects::PDU1_HANDLER);
HasLocalDataPoolIF* pdu1Handler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
objects::PDU1_HANDLER);
if(pdu1Handler == nullptr) {
sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl;
return RETURN_FAILED;
@ -207,11 +209,11 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const
switch (switchNr) {
case pcduSwitches::TCS_BOARD_8V_HEATER_IN:
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN;
pdu = objectManager->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break;
case pcduSwitches::DEPLOYMENT_MECHANISM:
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM;
pdu = objectManager->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
break;
default:
sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl;

View File

@ -8,6 +8,7 @@
namespace ADIS16507 {
static constexpr size_t MAXIMUM_REPLY_SIZE = 64;
static constexpr uint8_t WRITE_MASK = 0b1000'0000;
static constexpr uint32_t GYRO_RANGE = 125;
static constexpr uint32_t ACCELEROMETER_RANGE = 392;
@ -18,6 +19,13 @@ static constexpr uint16_t PROD_ID = 16507;
static constexpr std::array<uint8_t, 2> BURST_READ_ENABLE = {0x68, 0x00};
static constexpr dur_millis_t START_UP_TIME = 310;
static constexpr dur_millis_t SW_RESET_BREAK = 255;
static constexpr dur_millis_t FACTORY_CALIBRATION_BREAK = 136;
static constexpr dur_millis_t FLASH_MEMORY_UPDATE_BREAK = 70;
static constexpr dur_millis_t FLASH_MEMORY_TEST_BREAK = 30;
static constexpr dur_millis_t SELF_TEST_BREAK = 24;
static constexpr uint8_t DIAG_STAT_REG = 0x02;
static constexpr uint8_t FILTER_CTRL_REG = 0x5c;
static constexpr uint8_t MSC_CTRL_REG = 0x60;
@ -47,6 +55,14 @@ static constexpr size_t SENSOR_READOUT_SIZE = 20 + 2;
static constexpr uint32_t ADIS_DATASET_ID = READ_SENSOR_DATA;
static constexpr uint32_t ADIS_CFG_DATASET_ID = READ_OUT_CONFIG;
enum GlobCmds: uint8_t {
FACTORY_CALIBRATION = 0b0000'0010,
SENSOR_SELF_TEST = 0b0000'0100,
FLASH_MEMORY_UPDATE = 0b0000'1000,
FLASH_MEMORY_TEST = 0b0001'0000,
SOFTWARE_RESET = 0b1000'0000
};
enum PrimaryPoolIds: lp_id_t {
ANG_VELOC_X,
ANG_VELOC_Y,

View File

@ -1,5 +1,6 @@
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
#include <mission/utility/TmFunnel.h>
@ -79,7 +80,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
ReturnValue_t TmFunnel::initialize() {
tmPool = objectManager->get<StorageManagerIF>(objects::TM_STORE);
tmPool = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
if(tmPool == nullptr) {
sif::error << "TmFunnel::initialize: TM store not set."
<< std::endl;
@ -89,7 +90,7 @@ ReturnValue_t TmFunnel::initialize() {
}
AcceptsTelemetryIF* tmTarget =
objectManager->get<AcceptsTelemetryIF>(downlinkDestination);
ObjectManager::instance()->get<AcceptsTelemetryIF>(downlinkDestination);
if(tmTarget == nullptr){
sif::error << "TmFunnel::initialize: Downlink Destination not set."
<< std::endl;
@ -105,7 +106,7 @@ ReturnValue_t TmFunnel::initialize() {
}
AcceptsTelemetryIF* storageTarget =
objectManager->get<AcceptsTelemetryIF>(storageDestination);
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
if(storageTarget != nullptr) {
storageQueue->setDefaultDestination(
storageTarget->getReportReceptionQueue());

View File

@ -1,6 +1,6 @@
#include <test/testtasks/PusTcInjector.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tmtcservices/AcceptsTelecommandsIF.h>
#include <fsfw/tmtcservices/TmTcMessage.h>
#include <fsfw/tmtcpacket/pus/TcPacketBase.h>
@ -47,7 +47,7 @@ ReturnValue_t PusTcInjector::initialize() {
// Prepare message queue which is used to send telecommands.
injectionQueue = QueueFactory::instance()->
createMessageQueue(INJECTION_QUEUE_DEPTH);
AcceptsTelecommandsIF* targetQueue = objectManager->
AcceptsTelecommandsIF* targetQueue = ObjectManager::instance()->
get<AcceptsTelecommandsIF>(destination);
if(targetQueue == nullptr) {
sif::error << "PusTcInjector: CCSDS distributor not initialized yet!" << std::endl;
@ -58,7 +58,7 @@ ReturnValue_t PusTcInjector::initialize() {
}
// Prepare store used to store TC messages
tcStore = objectManager->get<StorageManagerIF>(tcStoreId);
tcStore = ObjectManager::instance()->get<StorageManagerIF>(tcStoreId);
if(tcStore == nullptr) {
sif::error << "PusTcInjector: TC Store not initialized!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;

View File

@ -1,9 +1,9 @@
#include "TestTask.h"
#include <OBSWConfig.h>
#include "OBSWConfig.h"
#include <fsfw/objectmanager/frameworkObjects.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <fsfw/globalfunctions/arrayprinter.h>
@ -13,7 +13,7 @@
TestTask::TestTask(object_id_t objectId_):
SystemObject(objectId_), testMode(testModes::A) {
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
}
TestTask::~TestTask() {