Merge branch 'development' into mueller/tmstorage
This commit is contained in:
commit
e30d020445
@ -139,5 +139,4 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
|||||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
||||||
${WARNING_FLAGS}
|
${WARNING_FLAGS}
|
||||||
${COMPILER_FLAGS}
|
${COMPILER_FLAGS}
|
||||||
${ABI_FLAGS}
|
|
||||||
)
|
)
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "objects/systemObjectList.h"
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
#include "returnvalues/classIds.h"
|
#include "returnvalues/classIds.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
namespace config {
|
namespace config {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -682,8 +682,10 @@ void DeviceHandlerBase::doGetRead() {
|
|||||||
replyRawData(receivedData, receivedDataLen, requestedRawTraffic);
|
replyRawData(receivedData, receivedDataLen, requestedRawTraffic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == MODE_RAW and defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
|
if (mode == MODE_RAW) {
|
||||||
replyRawReplyIfnotWiretapped(receivedData, receivedDataLen);
|
if (defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
|
||||||
|
replyRawReplyIfnotWiretapped(receivedData, receivedDataLen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parseReply(receivedData, receivedDataLen);
|
parseReply(receivedData, receivedDataLen);
|
||||||
|
@ -13,9 +13,11 @@ target_sources(${LIB_FSFW_NAME}
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME}
|
target_link_libraries(${LIB_FSFW_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
rt
|
rt
|
||||||
pthread
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
@ -18,8 +18,14 @@ target_sources(${LIB_FSFW_NAME}
|
|||||||
Timer.cpp
|
Timer.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME}
|
find_package(Threads REQUIRED)
|
||||||
PRIVATE
|
|
||||||
rt
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||||
pthread
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
|
rt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${LIB_FSFW_NAME} INTERFACE
|
||||||
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
|
)
|
||||||
|
|
||||||
|
18
osal/rtems/CMakeLists.txt
Normal file
18
osal/rtems/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME}
|
||||||
|
PRIVATE
|
||||||
|
Clock.cpp
|
||||||
|
CpuUsage.cpp
|
||||||
|
InitTask.cpp
|
||||||
|
InternalErrorCodes.cpp
|
||||||
|
MessageQueue.cpp
|
||||||
|
MultiObjectTask.cpp
|
||||||
|
Mutex.cpp
|
||||||
|
MutexFactory.cpp
|
||||||
|
PollingTask.cpp
|
||||||
|
QueueFactory.cpp
|
||||||
|
RtemsBasic.cpp
|
||||||
|
TaskBase.cpp
|
||||||
|
TaskFactory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
|||||||
#include "../../timemanager/Clock.h"
|
|
||||||
#include "RtemsBasic.h"
|
#include "RtemsBasic.h"
|
||||||
|
|
||||||
|
#include "../../timemanager/Clock.h"
|
||||||
|
#include "../../ipc/MutexHelper.h"
|
||||||
|
|
||||||
#include <rtems/score/todimpl.h>
|
#include <rtems/score/todimpl.h>
|
||||||
|
#include <rtems/rtems/clockimpl.h>
|
||||||
|
|
||||||
uint16_t Clock::leapSeconds = 0;
|
uint16_t Clock::leapSeconds = 0;
|
||||||
MutexIF* Clock::timeMutex = nullptr;
|
MutexIF* Clock::timeMutex = nullptr;
|
||||||
@ -33,15 +37,24 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::setClock(const timeval* time) {
|
ReturnValue_t Clock::setClock(const timeval* time) {
|
||||||
//TODO This routine uses _TOD_Set which is not
|
|
||||||
timespec newTime;
|
timespec newTime;
|
||||||
newTime.tv_sec = time->tv_sec;
|
newTime.tv_sec = time->tv_sec;
|
||||||
|
if(time->tv_usec < 0) {
|
||||||
|
// better returnvalue.
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
newTime.tv_nsec = time->tv_usec * TOD_NANOSECONDS_PER_MICROSECOND;
|
newTime.tv_nsec = time->tv_usec * TOD_NANOSECONDS_PER_MICROSECOND;
|
||||||
//SHOULDDO: Not sure if we need to protect this call somehow (by thread lock or something).
|
|
||||||
//Uli: rtems docu says you can call this from an ISR, not sure if this means no protetion needed
|
ISR_lock_Context context;
|
||||||
//TODO Second parameter is ISR_lock_Context
|
_TOD_Lock();
|
||||||
_TOD_Set(&newTime,nullptr);
|
_TOD_Acquire(&context);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
Status_Control status = _TOD_Set(&newTime, &context);
|
||||||
|
_TOD_Unlock();
|
||||||
|
if(status == STATUS_SUCCESSFUL) {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
// better returnvalue
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
||||||
@ -91,6 +104,7 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
||||||
|
// TIsn't this a bug? Are RTEMS ticks always microseconds?
|
||||||
rtems_time_of_day* timeRtems = reinterpret_cast<rtems_time_of_day*>(time);
|
rtems_time_of_day* timeRtems = reinterpret_cast<rtems_time_of_day*>(time);
|
||||||
rtems_status_code status = rtems_clock_get_tod(timeRtems);
|
rtems_status_code status = rtems_clock_get_tod(timeRtems);
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
@ -34,8 +34,10 @@ ReturnValue_t InternalErrorCodes::translate(uint8_t code) {
|
|||||||
return OUT_OF_PROXIES;
|
return OUT_OF_PROXIES;
|
||||||
case INTERNAL_ERROR_INVALID_GLOBAL_ID:
|
case INTERNAL_ERROR_INVALID_GLOBAL_ID:
|
||||||
return INVALID_GLOBAL_ID;
|
return INVALID_GLOBAL_ID;
|
||||||
|
#ifndef STM32H743ZI_NUCLEO
|
||||||
case INTERNAL_ERROR_BAD_STACK_HOOK:
|
case INTERNAL_ERROR_BAD_STACK_HOOK:
|
||||||
return BAD_STACK_HOOK;
|
return BAD_STACK_HOOK;
|
||||||
|
#endif
|
||||||
// case INTERNAL_ERROR_BAD_ATTRIBUTES:
|
// case INTERNAL_ERROR_BAD_ATTRIBUTES:
|
||||||
// return BAD_ATTRIBUTES;
|
// return BAD_ATTRIBUTES;
|
||||||
// case INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY:
|
// case INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY:
|
||||||
|
@ -9,9 +9,11 @@ MessageQueue::MessageQueue(size_t message_depth, size_t max_message_size) :
|
|||||||
rtems_status_code status = rtems_message_queue_create(name, message_depth,
|
rtems_status_code status = rtems_message_queue_create(name, message_depth,
|
||||||
max_message_size, 0, &(this->id));
|
max_message_size, 0, &(this->id));
|
||||||
if (status != RTEMS_SUCCESSFUL) {
|
if (status != RTEMS_SUCCESSFUL) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "MessageQueue::MessageQueue: Creating Queue " << std::hex
|
sif::error << "MessageQueue::MessageQueue: Creating Queue " << std::hex
|
||||||
<< name << std::dec << " failed with status:"
|
<< name << std::dec << " failed with status:"
|
||||||
<< (uint32_t) status << std::endl;
|
<< (uint32_t) status << std::endl;
|
||||||
|
#endif
|
||||||
this->id = 0;
|
this->id = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,10 @@ ReturnValue_t MultiObjectTask::startTask() {
|
|||||||
rtems_status_code status = rtems_task_start(id, MultiObjectTask::taskEntryPoint,
|
rtems_status_code status = rtems_task_start(id, MultiObjectTask::taskEntryPoint,
|
||||||
rtems_task_argument((void *) this));
|
rtems_task_argument((void *) this));
|
||||||
if (status != RTEMS_SUCCESSFUL) {
|
if (status != RTEMS_SUCCESSFUL) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "ObjectTask::startTask for " << std::hex << this->getId()
|
sif::error << "ObjectTask::startTask for " << std::hex << this->getId()
|
||||||
<< std::dec << " failed." << std::endl;
|
<< std::dec << " failed." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
switch(status){
|
switch(status){
|
||||||
case RTEMS_SUCCESSFUL:
|
case RTEMS_SUCCESSFUL:
|
||||||
@ -63,7 +65,9 @@ void MultiObjectTask::taskFunctionality() {
|
|||||||
char nameSpace[8] = { 0 };
|
char nameSpace[8] = { 0 };
|
||||||
char* ptr = rtems_object_get_name(getId(), sizeof(nameSpace),
|
char* ptr = rtems_object_get_name(getId(), sizeof(nameSpace),
|
||||||
nameSpace);
|
nameSpace);
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "ObjectTask: " << ptr << " Deadline missed." << std::endl;
|
sif::error << "ObjectTask: " << ptr << " Deadline missed." << std::endl;
|
||||||
|
#endif
|
||||||
if (this->deadlineMissedFunc != nullptr) {
|
if (this->deadlineMissedFunc != nullptr) {
|
||||||
this->deadlineMissedFunc();
|
this->deadlineMissedFunc();
|
||||||
}
|
}
|
||||||
|
@ -10,16 +10,20 @@ Mutex::Mutex() :
|
|||||||
RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0,
|
RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0,
|
||||||
&mutexId);
|
&mutexId);
|
||||||
if (status != RTEMS_SUCCESSFUL) {
|
if (status != RTEMS_SUCCESSFUL) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "Mutex: creation with name, id " << mutexName << ", " << mutexId
|
sif::error << "Mutex: creation with name, id " << mutexName << ", " << mutexId
|
||||||
<< " failed with " << status << std::endl;
|
<< " failed with " << status << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex::~Mutex() {
|
Mutex::~Mutex() {
|
||||||
rtems_status_code status = rtems_semaphore_delete(mutexId);
|
rtems_status_code status = rtems_semaphore_delete(mutexId);
|
||||||
if (status != RTEMS_SUCCESSFUL) {
|
if (status != RTEMS_SUCCESSFUL) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "Mutex: deletion for id " << mutexId
|
sif::error << "Mutex: deletion for id " << mutexId
|
||||||
<< " failed with " << status << std::endl;
|
<< " failed with " << status << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,15 +35,19 @@ rtems_task PollingTask::taskEntryPoint(rtems_task_argument argument) {
|
|||||||
PollingTask *originalTask(reinterpret_cast<PollingTask*>(argument));
|
PollingTask *originalTask(reinterpret_cast<PollingTask*>(argument));
|
||||||
//The task's functionality is called.
|
//The task's functionality is called.
|
||||||
originalTask->taskFunctionality();
|
originalTask->taskFunctionality();
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "Polling task " << originalTask->getId()
|
sif::debug << "Polling task " << originalTask->getId()
|
||||||
<< " returned from taskFunctionality." << std::endl;
|
<< " returned from taskFunctionality." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PollingTask::missedDeadlineCounter() {
|
void PollingTask::missedDeadlineCounter() {
|
||||||
PollingTask::deadlineMissedCount++;
|
PollingTask::deadlineMissedCount++;
|
||||||
if (PollingTask::deadlineMissedCount % 10 == 0) {
|
if (PollingTask::deadlineMissedCount % 10 == 0) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PST missed " << PollingTask::deadlineMissedCount
|
sif::error << "PST missed " << PollingTask::deadlineMissedCount
|
||||||
<< " deadlines." << std::endl;
|
<< " deadlines." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +55,10 @@ ReturnValue_t PollingTask::startTask() {
|
|||||||
rtems_status_code status = rtems_task_start(id, PollingTask::taskEntryPoint,
|
rtems_status_code status = rtems_task_start(id, PollingTask::taskEntryPoint,
|
||||||
rtems_task_argument((void *) this));
|
rtems_task_argument((void *) this));
|
||||||
if (status != RTEMS_SUCCESSFUL) {
|
if (status != RTEMS_SUCCESSFUL) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PollingTask::startTask for " << std::hex << this->getId()
|
sif::error << "PollingTask::startTask for " << std::hex << this->getId()
|
||||||
<< std::dec << " failed." << std::endl;
|
<< std::dec << " failed." << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
switch(status){
|
switch(status){
|
||||||
case RTEMS_SUCCESSFUL:
|
case RTEMS_SUCCESSFUL:
|
||||||
@ -75,8 +81,10 @@ ReturnValue_t PollingTask::addSlot(object_id_t componentId,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "Component " << std::hex << componentId <<
|
sif::error << "Component " << std::hex << componentId <<
|
||||||
" not found, not adding it to pst" << std::endl;
|
" not found, not adding it to pst" << std::endl;
|
||||||
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,11 @@ TaskBase::TaskBase(rtems_task_priority set_priority, size_t stack_size,
|
|||||||
}
|
}
|
||||||
ReturnValue_t result = convertReturnCode(status);
|
ReturnValue_t result = convertReturnCode(status);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "TaskBase::TaskBase: createTask with name " << std::hex
|
sif::error << "TaskBase::TaskBase: createTask with name " << std::hex
|
||||||
<< osalName << std::dec << " failed with return code "
|
<< osalName << std::dec << " failed with return code "
|
||||||
<< (uint32_t) status << std::endl;
|
<< (uint32_t) status << std::endl;
|
||||||
|
#endif
|
||||||
this->id = 0;
|
this->id = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
unittest/CMakeLists.txt
Normal file
2
unittest/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
add_subdirectory(internal)
|
||||||
|
add_subdirectory(tests)
|
Loading…
Reference in New Issue
Block a user