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)
if(FSFW_OSAL MATCHES "freertos")
message(
STATUS
"${MSG_PREFIX} Downloading FreeRTOS with FetchContent"
)
message(STATUS "${MSG_PREFIX} Downloading FreeRTOS with FetchContent")
include(FetchContent)
set(FreeRTOS_PORT posix)
@ -251,8 +248,6 @@ if(FSFW_FETCH_CONTENT_TARGETS)
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
endif()
endif()
set(FSFW_CORE_INC_PATH "inc")

View File

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

View File

@ -11,7 +11,7 @@
* Architecture dependant portmacro.h function call.
* Should be implemented in bsp.
*/
//extern "C" void vRequestContextSwitchFromISR();
// extern "C" void vRequestContextSwitchFromISR();
/*!
* 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
* words.
*/
//size_t getTaskStackHighWatermark(TaskHandle_t task = nullptr);
// size_t getTaskStackHighWatermark(TaskHandle_t task = nullptr);
}; // namespace TaskManagement

View File

@ -2,12 +2,12 @@
#include <cstddef>
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.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;

View File

@ -10,24 +10,27 @@
#define CATCH_CONFIG_COLOUR_WINDOWS
#include <catch2/catch_session.hpp>
#include <fsfw/osal/osal.h>
#include <catch2/catch_session.hpp>
#ifdef FSFW_OSAL_FREERTOS
#include <FreeRTOS.h>
#include "task.h"
#include <FreeRTOS.h>
#include "task.h"
#endif
extern int customSetup();
extern int customTeardown();
#ifdef FSFW_OSAL_FREERTOS
struct Taskparameters {
int argc; char** argv;TaskHandle_t catchTask;
int argc;
char** argv;
TaskHandle_t catchTask;
} taskParameters;
void unittestTaskFunction( void *pvParameters ) {
void unittestTaskFunction(void* pvParameters) {
Taskparameters* parameters = (Taskparameters*)pvParameters;
int result = Catch::Session().run(parameters->argc, parameters->argv);
@ -40,15 +43,16 @@ void unittestTaskFunction( void *pvParameters ) {
}
#endif
int main(int argc, char* argv[]) {
customSetup();
int result = 0;
#ifdef FSFW_OSAL_FREERTOS
xTaskCreate( 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. */
#ifdef FSFW_OSAL_FREERTOS
xTaskCreate(
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. */
&taskParameters, /* The parameter passed to the task - not used in this simple case. */
1, /* The priority assigned to the task. */
@ -56,10 +60,10 @@ int main(int argc, char* argv[]) {
taskParameters.argc = argc;
taskParameters.argv = argv;
vTaskStartScheduler();
#else
#else
// Catch internal function call
result = Catch::Session().run(argc, argv);
#endif
#endif
// global clean-up
customTeardown();

View File

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

View File

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

View File

@ -6,7 +6,7 @@
#define configUSE_TICKLESS_IDLE 0
#define configTICK_RATE_HZ 1000
#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 configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
@ -30,7 +30,7 @@
/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#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 configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0