expand serialize IF further

This commit is contained in:
Robin Müller 2022-07-23 10:06:42 +02:00
parent 42a1d6cccd
commit ddad97033d
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
28 changed files with 68 additions and 125 deletions

View File

@ -104,8 +104,8 @@ if(FSFW_GENERATE_SECTIONS)
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
endif()
option(FSFW_BUILD_TESTS
"Build unittest binary in addition to static library" OFF)
option(FSFW_BUILD_TESTS "Build unittest binary in addition to static library"
OFF)
option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" OFF)
option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
if(FSFW_BUILD_TESTS)

View File

@ -292,7 +292,8 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag
sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg
<< " is too small for requested message depth " << messageDepth << std::endl;
sif::error << "This error can be fixed by setting the maximum "
"allowed message depth higher" << std::endl;
"allowed message depth higher"
<< std::endl;
#else
sif::printError(
"MessageQueue::MessageQueue: Default MQ size %d is too small for"

View File

@ -34,7 +34,7 @@ class SerializeIF {
static const ReturnValue_t TOO_MANY_ELEMENTS =
MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized
virtual ~SerializeIF() {}
virtual ~SerializeIF() = default;
/**
* @brief
* Function to serialize the object into a buffer with maxSize. Size represents the written
@ -66,7 +66,7 @@ class SerializeIF {
* Gets the size of a object if it would be serialized in a buffer
* @return Size of serialized object
*/
virtual size_t getSerializedSize() const = 0;
[[nodiscard]] virtual size_t getSerializedSize() const = 0;
/**
* @brief
@ -99,7 +99,8 @@ class SerializeIF {
* @param streamEndianness
* @return
*/
virtual ReturnValue_t serialize(uint8_t* buffer, size_t maxSize, Endianness streamEndianness) {
virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize,
Endianness streamEndianness) const {
size_t tmpSize = 0;
return serialize(&buffer, &tmpSize, maxSize, streamEndianness);
}
@ -112,7 +113,7 @@ class SerializeIF {
* @param streamEndianness
* @return
*/
virtual ReturnValue_t deSerialize(const uint8_t* buffer, size_t maxSize,
virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t maxSize,
Endianness streamEndianness) {
return deSerialize(&buffer, &maxSize, streamEndianness);
}

View File

@ -2,9 +2,9 @@ add_subdirectory(devicehandlers)
add_subdirectory(common)
if(UNIX)
add_subdirectory(linux)
add_subdirectory(linux)
endif()
if(FSFW_HAL_ADD_STM32H7)
add_subdirectory(stm32h7)
add_subdirectory(stm32h7)
endif()

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
GpioCookie.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE GpioCookie.cpp)

View File

@ -1,5 +1,3 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
GyroL3GD20Handler.cpp
MgmRM3100Handler.cpp
MgmLIS3MDLHandler.cpp
)
target_sources(
${LIB_FSFW_NAME} PRIVATE GyroL3GD20Handler.cpp MgmRM3100Handler.cpp
MgmLIS3MDLHandler.cpp)

View File

@ -1,25 +1,21 @@
if(FSFW_HAL_ADD_RASPBERRY_PI)
add_subdirectory(rpi)
add_subdirectory(rpi)
endif()
target_sources(${LIB_FSFW_NAME} PRIVATE
UnixFileGuard.cpp
CommandExecutor.cpp
utility.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE UnixFileGuard.cpp CommandExecutor.cpp
utility.cpp)
if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS)
if(FSFW_HAL_LINUX_ADD_LIBGPIOD)
add_subdirectory(gpio)
endif()
add_subdirectory(uart)
# Adding those does not really make sense on Apple systems which
# are generally host systems. It won't even compile as the headers
# are missing
if(NOT APPLE)
add_subdirectory(i2c)
add_subdirectory(spi)
endif()
if(FSFW_HAL_LINUX_ADD_LIBGPIOD)
add_subdirectory(gpio)
endif()
add_subdirectory(uart)
# Adding those does not really make sense on Apple systems which are generally
# host systems. It won't even compile as the headers are missing
if(NOT APPLE)
add_subdirectory(i2c)
add_subdirectory(spi)
endif()
endif()
add_subdirectory(uio)

View File

@ -1,16 +1,12 @@
# This abstraction layer requires the gpiod library. You can install this library
# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need
# to install the package before syncing the sysroot to your host computer.
# This abstraction layer requires the gpiod library. You can install this
# library with "sudo apt-get install -y libgpiod-dev". If you are
# cross-compiling, you need to install the package before syncing the sysroot to
# your host computer.
find_library(LIB_GPIO gpiod)
if(${LIB_GPIO} MATCHES LIB_GPIO-NOTFOUND)
message(STATUS "gpiod library not found, not linking against it")
message(STATUS "gpiod library not found, not linking against it")
else()
target_sources(${LIB_FSFW_NAME} PRIVATE
LinuxLibgpioIF.cpp
)
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
${LIB_GPIO}
)
target_sources(${LIB_FSFW_NAME} PRIVATE LinuxLibgpioIF.cpp)
target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_GPIO})
endif()

View File

@ -1,8 +1 @@
target_sources(${LIB_FSFW_NAME} PUBLIC
I2cComIF.cpp
I2cCookie.cpp
)
target_sources(${LIB_FSFW_NAME} PUBLIC I2cComIF.cpp I2cCookie.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
GpioRPi.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE GpioRPi.cpp)

View File

@ -1,8 +1 @@
target_sources(${LIB_FSFW_NAME} PUBLIC
SpiComIF.cpp
SpiCookie.cpp
)
target_sources(${LIB_FSFW_NAME} PUBLIC SpiComIF.cpp SpiCookie.cpp)

View File

@ -1,4 +1 @@
target_sources(${LIB_FSFW_NAME} PUBLIC
UartComIF.cpp
UartCookie.cpp
)
target_sources(${LIB_FSFW_NAME} PUBLIC UartComIF.cpp UartCookie.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PUBLIC
UioMapper.cpp
)
target_sources(${LIB_FSFW_NAME} PUBLIC UioMapper.cpp)

View File

@ -2,6 +2,4 @@ add_subdirectory(spi)
add_subdirectory(gpio)
add_subdirectory(devicetest)
target_sources(${LIB_FSFW_NAME} PRIVATE
dma.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE dma.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
GyroL3GD20H.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE GyroL3GD20H.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
gpio.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE gpio.cpp)

View File

@ -1,2 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
)
target_sources(${LIB_FSFW_NAME} PRIVATE)

View File

@ -1,9 +1,9 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
spiCore.cpp
spiDefinitions.cpp
spiInterrupts.cpp
mspInit.cpp
SpiCookie.cpp
SpiComIF.cpp
stm32h743zi.cpp
)
target_sources(
${LIB_FSFW_NAME}
PRIVATE spiCore.cpp
spiDefinitions.cpp
spiInterrupts.cpp
mspInit.cpp
SpiCookie.cpp
SpiComIF.cpp
stm32h743zi.cpp)

View File

@ -1,2 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
)
target_sources(${LIB_FSFW_NAME} PRIVATE)

View File

@ -1,7 +1,7 @@
if(FSFW_ADD_INTERNAL_TESTS)
add_subdirectory(internal)
add_subdirectory(internal)
endif()
if(NOT FSFW_BUILD_TESTS)
add_subdirectory(integration)
add_subdirectory(integration)
endif()

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TestAssembly.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE TestAssembly.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TestController.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE TestController.cpp)

View File

@ -1,5 +1,2 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TestCookie.cpp
TestDeviceHandler.cpp
TestEchoComIF.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE TestCookie.cpp TestDeviceHandler.cpp
TestEchoComIF.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TestTask.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE TestTask.cpp)

View File

@ -1,8 +1,6 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
InternalUnitTester.cpp
UnittDefinitions.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE InternalUnitTester.cpp
UnittDefinitions.cpp)
add_subdirectory(osal)
add_subdirectory(serialize)
add_subdirectory(globalfunctions)
add_subdirectory(globalfunctions)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
TestArrayPrinter.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE TestArrayPrinter.cpp)

View File

@ -1,5 +1,2 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
testMq.cpp
testMutex.cpp
testSemaphore.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE testMq.cpp testMutex.cpp
testSemaphore.cpp)

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE
IntTestSerialization.cpp
)
target_sources(${LIB_FSFW_NAME} PRIVATE IntTestSerialization.cpp)