1
0
forked from fsfw/fsfw
This commit is contained in:
2023-01-26 13:40:44 +01:00
parent 941bf61f28
commit e37af4fe70
32 changed files with 94 additions and 104 deletions

View File

@ -20,9 +20,9 @@ add_subdirectory(globalfunctions)
add_subdirectory(timemanager)
add_subdirectory(tmtcpacket)
add_subdirectory(cfdp)
IF(NOT FSFW_OSAL MATCHES "rtems")
add_subdirectory(hal)
ENDIF()
if(NOT FSFW_OSAL MATCHES "rtems")
add_subdirectory(hal)
endif()
add_subdirectory(internalerror)
add_subdirectory(devicehandler)
add_subdirectory(tmtcservices)

View File

@ -51,31 +51,29 @@ extern "C" {
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");
"mov x1, #0x26\n\t"
"movk x1, #2, lsl #16\n\t"
"str x1, [sp,#0]\n\t");
/* 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"
/* 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"
/* x1 contains the address of parameter block.
* Any memory address could be used. */
"mov x1, sp\n\t"
/* x1 contains the address of parameter block.
* Any memory address could be used. */
"mov x1, sp\n\t"
/* SYS_EXIT */
"mov w0, #0x18\n\t"
/* SYS_EXIT */
"mov w0, #0x18\n\t"
/* Do the semihosting call on A64. */
"hlt 0xf000\n\t"
);
/* Do the semihosting call on A64. */
"hlt 0xf000\n\t");
}
#include <rtemsConfig.h>
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code){
if ( source == RTEMS_FATAL_SOURCE_EXIT ) {
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code) {
if (source == RTEMS_FATAL_SOURCE_EXIT) {
if (error_code != 0) {
printk("*** EXIT STATUS NOT ZERO ***\n");
printk("Quitting qemu with exit code %i\n", error_code);

View File

@ -30,7 +30,7 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
CHECK(localSet.getSid() == lpool::testSid);
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
size_t maxSize = localSet.getLocalPoolIdsSerializedSize(true);
uint8_t localPoolIdBuff[ 3 * sizeof(lp_id_t) + sizeof(uint8_t)];
uint8_t localPoolIdBuff[3 * sizeof(lp_id_t) + sizeof(uint8_t)];
/* Skip size field */
auto* lpIds = reinterpret_cast<lp_id_t*>(localPoolIdBuff + 1);
size_t serSize = 0;
@ -108,7 +108,7 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
CHECK(maxSize == sizeof(uint8_t) + sizeof(float) + sizeof(uint16_t) * 3);
serSize = 0;
/* Already reserve additional space for validity buffer, will be needed later */
std::vector<uint8_t> buffer(maxSize+1);
std::vector<uint8_t> buffer(maxSize + 1);
uint8_t* buffPtr = buffer.data();
CHECK(localSet.serialize(&buffPtr, &serSize, maxSize, SerializeIF::Endianness::MACHINE) ==
returnvalue::OK);
@ -157,8 +157,8 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
CHECK(maxSize == sizeof(uint8_t) + sizeof(uint16_t) * 3 + sizeof(float) + 1);
serSize = 0;
buffPtr = buffer.data();
CHECK(localSet.serialize(&buffPtr, &serSize, buffer.size(), SerializeIF::Endianness::MACHINE) ==
returnvalue::OK);
CHECK(localSet.serialize(&buffPtr, &serSize, buffer.size(),
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
CHECK(rawUint8 == 232);
std::memcpy(&rawFloat, buffer.data() + sizeof(uint8_t), sizeof(float));
CHECK(rawFloat == Catch::Approx(-2324.322));
@ -203,12 +203,12 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
}
/* Common fault test cases */
//LocalPoolObjectBase* variableHandle = poolOwner.getPoolObjectHandle(lpool::uint32VarId);
//CHECK(variableHandle != nullptr);
//CHECK(localSet.registerVariable(variableHandle) == static_cast<int>(DataSetIF::DATA_SET_FULL));
//variableHandle = nullptr;
//REQUIRE(localSet.registerVariable(variableHandle) ==
// static_cast<int>(DataSetIF::POOL_VAR_NULL));
// LocalPoolObjectBase* variableHandle = poolOwner.getPoolObjectHandle(lpool::uint32VarId);
// CHECK(variableHandle != nullptr);
// CHECK(localSet.registerVariable(variableHandle) ==
// static_cast<int>(DataSetIF::DATA_SET_FULL)); variableHandle = nullptr;
// REQUIRE(localSet.registerVariable(variableHandle) ==
// static_cast<int>(DataSetIF::POOL_VAR_NULL));
}
SECTION("MorePoolVariables") {

View File

@ -419,7 +419,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
CHECK(poolOwner.changedVariableCallbackWasCalled(gpidToCheck, storeId) == true);
CHECK(gpidToCheck == lpool::uint8VarGpid);
//poolOwner.poolManager.printPoolEntry(lpool::uint8VarId);
// poolOwner.poolManager.printPoolEntry(lpool::uint8VarId);
}
/* we need to reset the subscription list because the pool owner

View File

@ -1,10 +1,10 @@
#include <etl/crc32.h>
#include <array>
#include <catch2/catch_test_macros.hpp>
#include <filesystem>
#include <fstream>
#include <random>
#include <array>
#include "fsfw/serialize/SerializeIF.h"
#include "fsfw_hal/host/HostFilesystem.h"

View File

@ -5,9 +5,9 @@
#include "fsfw/serialize/SerializeIF.h"
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
//not multibyte encoding safe!
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(), filename.end());
// not multibyte encoding safe!
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(),
filename.end());
if (not std::filesystem::exists(native_filename)) {
return returnvalue::FAILED;

View File

@ -20,8 +20,9 @@
class FilesystemMock : public HasFileSystemIF {
public:
struct FileWriteInfo {
FileWriteInfo(std::basic_string<std::filesystem::path::value_type> filename, size_t offset, const uint8_t *data, size_t len)
: offset(offset) {
FileWriteInfo(std::basic_string<std::filesystem::path::value_type> filename, size_t offset,
const uint8_t *data, size_t len)
: offset(offset) {
this->filename = filename;
this->data.insert(this->data.end(), data, data + len);
}
@ -47,8 +48,8 @@ class FilesystemMock : public HasFileSystemIF {
std::map<std::basic_string<std::filesystem::path::value_type>, DirInfo> dirMap;
struct RenameInfo {
RenameInfo(std::basic_string < std::filesystem::path::value_type> oldName,
std::basic_string < std::filesystem::path::value_type> newName)
RenameInfo(std::basic_string<std::filesystem::path::value_type> oldName,
std::basic_string<std::filesystem::path::value_type> newName)
: oldName(std::move(oldName)), newName(std::move(newName)) {}
std::basic_string<std::filesystem::path::value_type> oldName;
@ -56,8 +57,7 @@ class FilesystemMock : public HasFileSystemIF {
};
std::queue<RenameInfo> renameQueue;
std::basic_string<std::filesystem::path::value_type> truncateCalledOnFile;
ReturnValue_t feedFile(const std::string &filename,
std::ifstream &file);
ReturnValue_t feedFile(const std::string &filename, std::ifstream &file);
bool fileExists(FilesystemParams params) override;
ReturnValue_t truncateFile(FilesystemParams params) override;

View File

@ -1,5 +1,5 @@
target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestClock.cpp)
if(FSFW_OSAL MATCHES "linux" OR FSFW_OSAL MATCHES "freertos")
target_sources(${FSFW_TEST_TGT} PRIVATE TestSemaphore.cpp)
target_sources(${FSFW_TEST_TGT} PRIVATE TestSemaphore.cpp)
endif()

View File

@ -8,7 +8,7 @@
#include "CatchDefinitions.h"
//TODO setClock()
// TODO setClock()
TEST_CASE("OSAL::Clock Test", "[OSAL::Clock Test]") {
SECTION("Test getClock") {

View File

@ -4,7 +4,6 @@
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
// perform set-up here
SemaphoreIF* binSemaph = SemaphoreFactory::instance()->createBinarySemaphore();

View File

@ -63,7 +63,7 @@
#define configMAX_API_CALL_INTERRUPT_PRIORITY [dependent on processor and application]
/* Define to trap errors during development. */
//#define configASSERT( ( x ) ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
// #define configASSERT( ( x ) ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
/* FreeRTOS MPU specific definitions. */
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0

View File

@ -1,9 +1,8 @@
#pragma once
#include <rtems/extension.h>
#include <rtems/bspIo.h>
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code);
#include <rtems/extension.h>
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code);
#define RTEMS_USE_UNLIMITED_OBJECTS_ALLOCATION 0
@ -24,7 +23,8 @@ void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_e
//! Around 41 kB extra task stack for now.
#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE)
#define CONFIGURE_INITIAL_EXTENSIONS { NULL, NULL, NULL, NULL, NULL, NULL, NULL, user_handle_fatal, NULL }
#define CONFIGURE_INITIAL_EXTENSIONS \
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, user_handle_fatal, NULL }
#define CONFIGURE_INIT