unittests for rtems working

This commit is contained in:
2023-01-19 14:24:33 +01:00
parent fdfdce2fb0
commit adb8483bb0
5 changed files with 77 additions and 29 deletions

View File

@ -46,38 +46,53 @@ void unittestTaskFunction(void* pvParameters) {
#ifdef FSFW_OSAL_RTEMS
#include <signal.h>
int sigaltstack(const stack_t * ss, stack_t * old_ss){
return 0;
}
int sigaltstack(const stack_t* ss, stack_t* old_ss) { return 0; }
extern "C" {
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
void exit_qemu_failing(int error) {
asm(/* 0x20026 == ADP_Stopped_ApplicationExit */
"mov x1, #0x26\n\t"
"movk x1, #2, lsl #16\n\t"
"str x1, [sp,#0]\n\t");
#define CONFIGURE_UNLIMITED_OBJECTS
#define CONFIGURE_UNIFIED_WORK_AREAS
/* Exit status code. Host QEMU process exits with that status. */
asm("mov x0, %[error]\n\t" : : [error] "r" (error));
asm(
"str x0, [sp,#8]\n\t"
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
/* x1 contains the address of parameter block.
* Any memory address could be used. */
"mov x1, sp\n\t"
#define CONFIGURE_INIT
/* SYS_EXIT */
"mov w0, #0x18\n\t"
#include <rtems/confdefs.h>
#include <rtems.h>
#include <stdlib.h>
#include <stdio.h>
rtems_task Init(
rtems_task_argument ignored
)
{
printf( "\nHello World\n" );
char* argv[] = {"fsfw-test"};
int result = Catch::Session().run(1, argv);
exit( result );
/* Do the semihosting call on A64. */
"hlt 0xf000\n\t"
);
}
#include "testcfg/rtems/rtemsConfig.h"
rtems_task Init(rtems_task_argument ignored) {
rtems_time_of_day now;
now.year = 2023;
now.month = 1;
now.day = 15;
now.hour = 0;
now.minute = 0;
now.second = 0;
now.ticks = 0;
rtems_clock_set(&now);
customSetup();
const char* argv[] = {"fsfw-test", ""};
int result = Catch::Session().run(1, argv);
customTeardown();
if (result != 0) {
exit_qemu_failing(result);
}
exit(result);
}
}
#endif