2021-05-31 16:37:06 +02:00
|
|
|
#include "hardware_init.h"
|
|
|
|
#include "lwip/init.h"
|
|
|
|
#include "boardconfig.h"
|
|
|
|
#include "OBSWVersion.h"
|
2021-04-27 17:22:34 +02:00
|
|
|
|
2021-05-31 16:37:06 +02:00
|
|
|
#include "common/utility/utility.h"
|
2021-04-27 17:22:34 +02:00
|
|
|
|
2021-05-31 16:37:06 +02:00
|
|
|
#include "fsfw/objectmanager/ObjectManager.h"
|
|
|
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
|
|
#include "fsfw/tasks/TaskFactory.h"
|
2021-04-27 17:22:34 +02:00
|
|
|
|
2021-05-31 16:37:06 +02:00
|
|
|
#include "bsp_stm32_freertos/core/InitMission.h"
|
|
|
|
#include "bsp_stm32_freertos/core/ObjectFactory.h"
|
2021-04-27 17:22:34 +02:00
|
|
|
|
2021-05-31 16:37:06 +02:00
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
|
|
|
#include "cmsis_os.h"
|
2021-04-27 17:22:34 +02:00
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
|
|
#include <iostream>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(BOARD_NAME)
|
|
|
|
#define BOARD_NAME "unknown board"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
ObjectManagerIF *objectManager = nullptr;
|
|
|
|
|
|
|
|
void initTask(void *parameters);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Core function for the STM32 FreeRTOS BSP
|
|
|
|
* @return
|
|
|
|
* @author R. Mueller, J. Meier
|
|
|
|
*/
|
|
|
|
int main() {
|
|
|
|
performHardwareInit();
|
|
|
|
|
|
|
|
xTaskCreate(initTask, "INIT_TASK", 2048, nullptr, 9, nullptr);
|
|
|
|
|
|
|
|
/* Start scheduler */
|
|
|
|
osKernelStart();
|
|
|
|
|
|
|
|
/* Should not be reached, scheduler should now be running. */
|
|
|
|
for(;;) {}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void initTask(void *parameters) {
|
|
|
|
/* Initialize the LwIP stack */
|
|
|
|
lwip_init();
|
|
|
|
|
|
|
|
/* Configure the Network interface */
|
|
|
|
Netif_Config();
|
|
|
|
|
|
|
|
utility::commonInitPrint("FreeRTOS", BOARD_NAME);
|
|
|
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
|
|
sif::info << "Creating objects.." << std::endl;
|
|
|
|
#else
|
|
|
|
sif::printInfo("Creating objects..\n\r");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
objectManager = new ObjectManager(ObjectFactory::produce);
|
|
|
|
objectManager->initialize();
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
|
|
sif::info << "Creating tasks.." << std::endl;
|
|
|
|
#else
|
|
|
|
sif::printInfo("Creating tasks..\n\r");
|
|
|
|
#endif
|
|
|
|
InitMission::createTasks();
|
|
|
|
TaskFactory::instance()->deleteTask(nullptr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|