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) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
endif() endif()
option(FSFW_BUILD_TESTS option(FSFW_BUILD_TESTS "Build unittest binary in addition to static library"
"Build unittest binary in addition to static library" OFF) OFF)
option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" 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) option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
if(FSFW_BUILD_TESTS) 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 sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg
<< " is too small for requested message depth " << messageDepth << std::endl; << " is too small for requested message depth " << messageDepth << std::endl;
sif::error << "This error can be fixed by setting the maximum " sif::error << "This error can be fixed by setting the maximum "
"allowed message depth higher" << std::endl; "allowed message depth higher"
<< std::endl;
#else #else
sif::printError( sif::printError(
"MessageQueue::MessageQueue: Default MQ size %d is too small for" "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 = static const ReturnValue_t TOO_MANY_ELEMENTS =
MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized
virtual ~SerializeIF() {} virtual ~SerializeIF() = default;
/** /**
* @brief * @brief
* Function to serialize the object into a buffer with maxSize. Size represents the written * 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 * Gets the size of a object if it would be serialized in a buffer
* @return Size of serialized object * @return Size of serialized object
*/ */
virtual size_t getSerializedSize() const = 0; [[nodiscard]] virtual size_t getSerializedSize() const = 0;
/** /**
* @brief * @brief
@ -99,7 +99,8 @@ class SerializeIF {
* @param streamEndianness * @param streamEndianness
* @return * @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; size_t tmpSize = 0;
return serialize(&buffer, &tmpSize, maxSize, streamEndianness); return serialize(&buffer, &tmpSize, maxSize, streamEndianness);
} }
@ -112,7 +113,7 @@ class SerializeIF {
* @param streamEndianness * @param streamEndianness
* @return * @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) { Endianness streamEndianness) {
return deSerialize(&buffer, &maxSize, streamEndianness); return deSerialize(&buffer, &maxSize, streamEndianness);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1 @@
target_sources(${LIB_FSFW_NAME} PRIVATE target_sources(${LIB_FSFW_NAME} PRIVATE gpio.cpp)
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 target_sources(
spiCore.cpp ${LIB_FSFW_NAME}
spiDefinitions.cpp PRIVATE spiCore.cpp
spiInterrupts.cpp spiDefinitions.cpp
mspInit.cpp spiInterrupts.cpp
SpiCookie.cpp mspInit.cpp
SpiComIF.cpp SpiCookie.cpp
stm32h743zi.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) if(FSFW_ADD_INTERNAL_TESTS)
add_subdirectory(internal) add_subdirectory(internal)
endif() endif()
if(NOT FSFW_BUILD_TESTS) if(NOT FSFW_BUILD_TESTS)
add_subdirectory(integration) add_subdirectory(integration)
endif() endif()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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