This commit is contained in:
Ulrich Mohr 2023-01-16 12:35:14 +01:00
parent a0eae66c35
commit fe9804d922
9 changed files with 107 additions and 111 deletions

View File

@ -175,10 +175,7 @@ if(FSFW_BUILD_TESTS)
configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h) configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h)
if(FSFW_OSAL MATCHES "freertos") if(FSFW_OSAL MATCHES "freertos")
message( message(STATUS "${MSG_PREFIX} Downloading FreeRTOS with FetchContent")
STATUS
"${MSG_PREFIX} Downloading FreeRTOS with FetchContent"
)
include(FetchContent) include(FetchContent)
set(FreeRTOS_PORT posix) set(FreeRTOS_PORT posix)
@ -251,8 +248,6 @@ if(FSFW_FETCH_CONTENT_TARGETS)
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "") set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
endif() endif()
endif() endif()
set(FSFW_CORE_INC_PATH "inc") set(FSFW_CORE_INC_PATH "inc")

View File

@ -3,12 +3,12 @@
void TaskManagement::vRequestContextSwitchFromTask() { vTaskDelay(0); } void TaskManagement::vRequestContextSwitchFromTask() { vTaskDelay(0); }
void TaskManagement::requestContextSwitch(CallContext callContext = CallContext::TASK) { void TaskManagement::requestContextSwitch(CallContext callContext = CallContext::TASK) {
// if (callContext == CallContext::ISR) { // if (callContext == CallContext::ISR) {
// // This function depends on the partmacro.h definition for the specific device // // This function depends on the partmacro.h definition for the specific device
// vRequestContextSwitchFromISR(); // vRequestContextSwitchFromISR();
// } else { // } else {
vRequestContextSwitchFromTask(); vRequestContextSwitchFromTask();
// } // }
} }
TaskHandle_t TaskManagement::getCurrentTaskHandle() { return xTaskGetCurrentTaskHandle(); } TaskHandle_t TaskManagement::getCurrentTaskHandle() { return xTaskGetCurrentTaskHandle(); }

View File

@ -11,7 +11,7 @@
* Architecture dependant portmacro.h function call. * Architecture dependant portmacro.h function call.
* Should be implemented in bsp. * Should be implemented in bsp.
*/ */
//extern "C" void vRequestContextSwitchFromISR(); // extern "C" void vRequestContextSwitchFromISR();
/*! /*!
* Used by functions to tell if they are being called from * Used by functions to tell if they are being called from
@ -53,7 +53,7 @@ TaskHandle_t getCurrentTaskHandle();
* @return Smallest value of stack remaining since the task was started in * @return Smallest value of stack remaining since the task was started in
* words. * words.
*/ */
//size_t getTaskStackHighWatermark(TaskHandle_t task = nullptr); // size_t getTaskStackHighWatermark(TaskHandle_t task = nullptr);
}; // namespace TaskManagement }; // namespace TaskManagement

View File

@ -2,12 +2,12 @@
#include <cstddef> #include <cstddef>
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface.h" #include "fsfw/serviceinterface.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h" #include "fsfw/tmtcpacket/pus/tc/PusTcIF.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
static constexpr auto DEF_END = SerializeIF::Endianness::BIG; static constexpr auto DEF_END = SerializeIF::Endianness::BIG;

View File

@ -10,24 +10,27 @@
#define CATCH_CONFIG_COLOUR_WINDOWS #define CATCH_CONFIG_COLOUR_WINDOWS
#include <catch2/catch_session.hpp>
#include <fsfw/osal/osal.h> #include <fsfw/osal/osal.h>
#include <catch2/catch_session.hpp>
#ifdef FSFW_OSAL_FREERTOS #ifdef FSFW_OSAL_FREERTOS
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include "task.h"
#include "task.h"
#endif #endif
extern int customSetup(); extern int customSetup();
extern int customTeardown(); extern int customTeardown();
#ifdef FSFW_OSAL_FREERTOS #ifdef FSFW_OSAL_FREERTOS
struct Taskparameters { struct Taskparameters {
int argc; char** argv;TaskHandle_t catchTask; int argc;
char** argv;
TaskHandle_t catchTask;
} taskParameters; } taskParameters;
void unittestTaskFunction( void *pvParameters ) { void unittestTaskFunction(void* pvParameters) {
Taskparameters* parameters = (Taskparameters*)pvParameters; Taskparameters* parameters = (Taskparameters*)pvParameters;
int result = Catch::Session().run(parameters->argc, parameters->argv); int result = Catch::Session().run(parameters->argc, parameters->argv);
@ -40,15 +43,16 @@ void unittestTaskFunction( void *pvParameters ) {
} }
#endif #endif
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
customSetup(); customSetup();
int result = 0; int result = 0;
#ifdef FSFW_OSAL_FREERTOS #ifdef FSFW_OSAL_FREERTOS
xTaskCreate( unittestTaskFunction, /* The function that implements the task. */ xTaskCreate(
"Unittests", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ unittestTaskFunction, /* The function that implements the task. */
"Unittests", /* The text name assigned to the task - for debug only as it is not used by the
kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
&taskParameters, /* The parameter passed to the task - not used in this simple case. */ &taskParameters, /* The parameter passed to the task - not used in this simple case. */
1, /* The priority assigned to the task. */ 1, /* The priority assigned to the task. */
@ -56,10 +60,10 @@ int main(int argc, char* argv[]) {
taskParameters.argc = argc; taskParameters.argc = argc;
taskParameters.argv = argv; taskParameters.argv = argv;
vTaskStartScheduler(); vTaskStartScheduler();
#else #else
// Catch internal function call // Catch internal function call
result = Catch::Session().run(argc, argv); result = Catch::Session().run(argc, argv);
#endif #endif
// global clean-up // global clean-up
customTeardown(); customTeardown();

View File

@ -6,8 +6,6 @@
#include <gcov.h> #include <gcov.h>
#endif #endif
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"

View File

@ -1,12 +1,11 @@
#include <fsfw/globalfunctions/timevalOperations.h> #include <fsfw/globalfunctions/timevalOperations.h>
#include <fsfw/timemanager/Clock.h> #include <fsfw/timemanager/Clock.h>
#include <stdio.h>
#include <array> #include <array>
#include <catch2/catch_approx.hpp> #include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include <stdio.h>
#include "CatchDefinitions.h" #include "CatchDefinitions.h"
TEST_CASE("OSAL::Clock Test", "[OSAL::Clock Test]") { TEST_CASE("OSAL::Clock Test", "[OSAL::Clock Test]") {

View File

@ -6,7 +6,7 @@
#define configUSE_TICKLESS_IDLE 0 #define configUSE_TICKLESS_IDLE 0
#define configTICK_RATE_HZ 1000 #define configTICK_RATE_HZ 1000
#define configMAX_PRIORITIES 5 #define configMAX_PRIORITIES 5
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) PTHREAD_STACK_MIN ) #define configMINIMAL_STACK_SIZE ((unsigned short)PTHREAD_STACK_MIN)
#define configMAX_TASK_NAME_LEN 16 #define configMAX_TASK_NAME_LEN 16
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
@ -30,7 +30,7 @@
/* Memory allocation related definitions. */ /* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0 #define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1 #define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024 * 1024 ) ) #define configTOTAL_HEAP_SIZE ((size_t)(1024 * 1024))
#define configAPPLICATION_ALLOCATED_HEAP 1 #define configAPPLICATION_ALLOCATED_HEAP 1
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0