2021-07-12 21:50:48 +02:00
|
|
|
#include "OBSWConfig.h"
|
2022-05-22 15:30:38 +02:00
|
|
|
#include "OBSWVersion.h"
|
|
|
|
#include "boardconfig.h"
|
|
|
|
#include "hardware_init.h"
|
2021-07-12 23:33:05 +02:00
|
|
|
|
|
|
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
2021-07-12 21:50:48 +02:00
|
|
|
#include <lwip/init.h>
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
2021-07-12 21:50:48 +02:00
|
|
|
|
|
|
|
#include "core/InitMission.h"
|
|
|
|
#include "core/ObjectFactory.h"
|
|
|
|
|
2021-10-27 17:09:41 +02:00
|
|
|
#include "example/utility/utility.h"
|
2021-07-12 21:50:48 +02:00
|
|
|
|
|
|
|
#include <fsfw/objectmanager/ObjectManager.h>
|
|
|
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
|
|
|
#include <fsfw/tasks/TaskFactory.h>
|
|
|
|
|
|
|
|
#include "FreeRTOS.h"
|
|
|
|
#include "cmsis_os.h"
|
2022-05-22 15:30:38 +02:00
|
|
|
#include "task.h"
|
2021-07-12 21:50:48 +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
|
|
|
|
|
|
|
|
void initTask(void *parameters);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Core function for the STM32 FreeRTOS BSP
|
|
|
|
* @return
|
|
|
|
* @author R. Mueller, J. Meier
|
|
|
|
*/
|
|
|
|
int main() {
|
2022-05-22 15:30:38 +02:00
|
|
|
performHardwareInit();
|
2021-07-12 21:50:48 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
xTaskCreate(initTask, "INIT_TASK", 2048, nullptr, 9, nullptr);
|
2021-07-12 21:50:48 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
/* Start scheduler */
|
|
|
|
osKernelStart();
|
2021-07-12 21:50:48 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
/* Should not be reached, scheduler should now be running. */
|
|
|
|
for (;;) {
|
|
|
|
}
|
|
|
|
return 0;
|
2021-07-12 21:50:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void initTask(void *parameters) {
|
2021-07-12 23:33:05 +02:00
|
|
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
2022-05-22 15:30:38 +02:00
|
|
|
/* Initialize the LwIP stack */
|
|
|
|
lwip_init();
|
2021-07-12 21:50:48 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
/* Configure the Network interface */
|
|
|
|
Netif_Config();
|
2021-07-12 23:33:05 +02:00
|
|
|
#endif
|
2021-07-12 21:50:48 +02:00
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
utility::commonInitPrint("FreeRTOS", BOARD_NAME);
|
2021-07-12 21:50:48 +02:00
|
|
|
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-05-22 15:30:38 +02:00
|
|
|
sif::info << "Creating objects.." << std::endl;
|
2021-07-12 21:50:48 +02:00
|
|
|
#else
|
2022-05-22 15:30:38 +02:00
|
|
|
sif::printInfo("Creating objects..\n\r");
|
2021-07-12 21:50:48 +02:00
|
|
|
#endif
|
|
|
|
|
2022-05-22 15:30:38 +02:00
|
|
|
ObjectManager *objManager = ObjectManager::instance();
|
|
|
|
objManager->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
|
|
|
objManager->initialize();
|
2021-07-12 23:33:05 +02:00
|
|
|
|
2021-07-12 21:50:48 +02:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-05-22 15:30:38 +02:00
|
|
|
sif::info << "Creating tasks.." << std::endl;
|
2021-07-12 21:50:48 +02:00
|
|
|
#else
|
2022-05-22 15:30:38 +02:00
|
|
|
sif::printInfo("Creating tasks..\n\r");
|
2021-07-12 21:50:48 +02:00
|
|
|
#endif
|
2022-05-22 15:30:38 +02:00
|
|
|
InitMission::createTasks();
|
|
|
|
TaskFactory::instance()->deleteTask(nullptr);
|
2021-07-12 21:50:48 +02:00
|
|
|
}
|