This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
fsfw_example_public/bsp_stm32_rtems/main.cpp
2021-04-27 17:22:34 +02:00

54 lines
1.5 KiB
C++

#include "core/ObjectFactory.h"
#include "core/InitMission.h"
#include <stm32h7xx_nucleo.h>
#include <hardware_init.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/timemanager/Clock.h>
#include <rtems.h>
#include <rtems/console.h>
#include <rtems/rtems/clock.h>
#include <mission/utility/compile_time.h>
#define BOARD_NAME "stm32h743zi-nucleo"
ObjectManagerIF *objectManager = nullptr;
#if FSFW_CPP_OSTREAM_ENABLED == 1
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true);
#endif
/**
* @brief Core function for the RTEMS BSP, called in Init function.
* @return
* @author R. Mueller
*/
int main() {
hardware_init();
printf("\n\r%s-- FSFW Example (RTEMS) --\n", sif::ANSI_COLOR_RESET);
printf("-- Compiled for %s --\n", BOARD_NAME);
printf("-- Compiled on %s %s --\n\r",__DATE__, __TIME__);
timeval timeToSet;
timeToSet.tv_sec = UNIX_TIMESTAMP;
timeToSet.tv_usec = 0;
ReturnValue_t clockStatus = Clock::setClock(&timeToSet);
if(clockStatus != HasReturnvaluesIF::RETURN_OK) {
sif::printError("Clock configuration failed!\n");
}
else {
sif::printInfo("Clock configured successfully.\n");
}
objectManager = new ObjectManager(ObjectFactory::produce);
objectManager->initialize();
InitMission::createTasks();
}