Compare commits

...
15 Commits
73 changed files with 145 additions and 157 deletions
+1
View File
@@ -86,6 +86,7 @@ message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(hal)
add_subdirectory(contrib)
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it.
+5 -52
View File
@@ -5,35 +5,14 @@ find_library(LIB_FSFW_NAME fsfw REQUIRED)
option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Required gpiod library" OFF)
option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF)
option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF)
option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
set(LIB_FSFW_HAL_NAME fsfw_hal)
set(LINUX_HAL_PATH_NAME linux)
set(STM32H7_PATH_NAME stm32h7)
add_library(${LIB_FSFW_HAL_NAME})
if(NOT LIB_FSFW_NAME)
message(ERROR "LIB_FSFW_NAME needs to be set as a linkable target")
endif()
add_subdirectory(devicehandlers)
add_subdirectory(common)
if(FSFW_HAL_ADD_LINUX)
add_subdirectory(${LINUX_HAL_PATH_NAME})
endif()
if(FSFW_HAL_ADD_STM32H7)
add_subdirectory(${STM32H7_PATH_NAME})
endif()
target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE
${LIB_FSFW_NAME}
)
add_subdirectory(src)
add_subdirectory(inc)
foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS})
if(IS_ABSOLUTE ${INCLUDE_PATH})
@@ -50,40 +29,14 @@ foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS})
list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH})
endforeach()
target_include_directories(${LIB_FSFW_HAL_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
target_include_directories(${LIB_FSFW_NAME} PRIVATE
${FSFW_HAL_ADD_INC_PATHS_ABS}
)
target_compile_definitions(${LIB_FSFW_HAL_NAME} PRIVATE
target_compile_definitions(${LIB_FSFW_NAME} PRIVATE
${FSFW_HAL_DEFINES}
)
target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
${FSFW_HAL_LINK_LIBS}
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(NOT DEFINED FSFW_WARNING_FLAGS)
set(FSFW_WARNING_FLAGS
-Wall
-Wextra
-Wimplicit-fallthrough=1
-Wno-unused-parameter
)
endif()
target_compile_options(${LIB_FSFW_NAME} PRIVATE
"-ffunction-sections"
"-fdata-sections"
)
target_link_options(${LIB_FSFW_NAME} PRIVATE
"Wl,--gc-sections"
)
if(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC)
list(APPEND WARNING_FLAGS "-Wshadow=local")
endif()
endif()
+7
View File
@@ -0,0 +1,7 @@
target_include_directories(${LIB_FSFW_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
)
@@ -9,6 +9,4 @@ void initializeGpioClock(GPIO_TypeDef* gpioPort);
}
#endif /* FSFW_HAL_STM32H7_GPIO_GPIO_H_ */
@@ -5,8 +5,8 @@
#include "fsfw/devicehandlers/DeviceCommunicationIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/FreeRTOS/BinarySemaphore.h"
#include "fsfw_hal/stm32h7/spi/spiDefinitions.h"
#include "fsfw/osal/freertos/BinarySemaphore.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h"
#include "stm32h7xx_hal_spi.h"
#include "stm32h743xx.h"
@@ -1,11 +1,12 @@
#ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_
#define FSFW_HAL_STM32H7_SPI_SPICORE_H_
#include <fsfw_hal/stm32h7/dma.h>
#include "fsfw/hal/stm32h7/dma.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h"
#include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_dma.h"
#ifdef __cplusplus
extern "C" {
#endif
+10
View File
@@ -0,0 +1,10 @@
add_subdirectory(devicehandlers)
add_subdirectory(common)
if(FSFW_HAL_ADD_LINUX)
add_subdirectory(${LINUX_HAL_PATH_NAME})
endif()
if(FSFW_HAL_ADD_STM32H7)
add_subdirectory(${STM32H7_PATH_NAME})
endif()
+1
View File
@@ -0,0 +1 @@
add_subdirectory(gpio)
+1 -1
View File
@@ -1,3 +1,3 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
GpioCookie.cpp
)
+1 -1
View File
@@ -1,4 +1,4 @@
#include "GpioCookie.h"
#include "fsfw/hal/common/gpio/GpioCookie.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
GpioCookie::GpioCookie() {
+1 -1
View File
@@ -1,3 +1,3 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
GyroL3GD20Handler.cpp
)
+2 -2
View File
@@ -1,6 +1,6 @@
#include "GyroL3GD20Handler.h"
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h"
#include <fsfw/datapool/PoolReadGuard.h>
#include "fsfw/datapool/PoolReadGuard.h"
GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication,
CookieIF *comCookie):
+1 -1
View File
@@ -2,7 +2,7 @@ if(FSFW_HAL_ADD_RASPBERRY_PI)
add_subdirectory(rpi)
endif()
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
UnixFileGuard.cpp
utility.cpp
)
+1 -1
View File
@@ -1,4 +1,4 @@
#include "UnixFileGuard.h"
#include "fsfw/hal/linux/UnixFileGuard.h"
UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
std::string diagnosticPrefix):
+2 -2
View File
@@ -1,4 +1,4 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
LinuxLibgpioIF.cpp
)
@@ -7,6 +7,6 @@ target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
# to install the package before syncing the sysroot to your host computer.
find_library(LIB_GPIO gpiod REQUIRED)
target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
${LIB_GPIO}
)
+3 -3
View File
@@ -1,6 +1,6 @@
#include "LinuxLibgpioIF.h"
#include <common/gpio/gpioDefinitions.h>
#include <common/gpio/GpioCookie.h>
#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw/hal/common/gpio/gpioDefinitions.h"
#include "fsfw/hal/common/gpio/GpioCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
+1 -1
View File
@@ -1,4 +1,4 @@
target_sources(${LIB_FSFW_HAL_NAME} PUBLIC
target_sources(${LIB_FSFW_NAME} PUBLIC
I2cComIF.cpp
I2cCookie.cpp
)
+4 -4
View File
@@ -1,8 +1,8 @@
#include "I2cComIF.h"
#include "../utility.h"
#include "../UnixFileGuard.h"
#include "fsfw/hal/linux/i2c/I2cComIF.h"
#include "fsfw/hal/linux/utility.h"
#include "fsfw/hal/linux/UnixFileGuard.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
#include "fsfw/serviceinterface/ServiceInterface.h"
#include <unistd.h>
#include <fcntl.h>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "I2cCookie.h"
#include "fsfw/hal/linux/i2c/I2cCookie.h"
I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_,
std::string deviceFile_) :
+1 -1
View File
@@ -1,3 +1,3 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
GpioRPi.cpp
)
+4 -3
View File
@@ -1,6 +1,7 @@
#include "GpioRPi.h"
#include "../../common/gpio/GpioCookie.h"
#include <FSFWConfig.h>
#include "fsfw/FSFW.h"
#include "fsfw/hal/linux/rpi/GpioRPi.h"
#include "fsfw/hal/common/gpio/GpioCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
+1 -1
View File
@@ -1,4 +1,4 @@
target_sources(${LIB_FSFW_HAL_NAME} PUBLIC
target_sources(${LIB_FSFW_NAME} PUBLIC
SpiComIF.cpp
SpiCookie.cpp
)
+5 -5
View File
@@ -1,8 +1,8 @@
#include "SpiComIF.h"
#include "SpiCookie.h"
#include "../utility.h"
#include "../UnixFileGuard.h"
#include "FSFWConfig.h"
#include "fsfw/FSFW.h"
#include "fsfw/hal/linux/spi/SpiComIF.h"
#include "fsfw/hal/linux/spi/SpiCookie.h"
#include "fsfw/hal/linux/utility.h"
#include "fsfw/hal/linux/UnixFileGuard.h"
#include <fsfw/ipc/MutexFactory.h>
#include <fsfw/globalfunctions/arrayprinter.h>
+1 -1
View File
@@ -1,4 +1,4 @@
#include "SpiCookie.h"
#include "fsfw/hal/linux/spi/SpiCookie.h"
SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev,
const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed):
+1 -1
View File
@@ -1,4 +1,4 @@
target_sources(${TARGET_NAME} PUBLIC
target_sources(${LIB_FSFW_NAME} PUBLIC
UartComIF.cpp
UartCookie.cpp
)
+1 -1
View File
@@ -1,4 +1,4 @@
#include "UartComIF.h"
#include "fsfw/hal/linux/uart/UartComIF.h"
#include "OBSWConfig.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "UartCookie.h"
#include "fsfw/hal/linux/uart/UartCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
+6 -1
View File
@@ -1,4 +1,9 @@
#include <fsfw_hal/linux/utility.h>
#include "fsfw/FSFW.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/hal/linux/utility.h"
#include <cerrno>
#include <cstring>
void utility::handleIoctlError(const char* const customPrintout) {
#if FSFW_VERBOSE_LEVEL >= 1
+1 -1
View File
@@ -2,6 +2,6 @@ add_subdirectory(spi)
add_subdirectory(gpio)
add_subdirectory(devicetest)
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
dma.cpp
)
+1 -1
View File
@@ -1,3 +1,3 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
GyroL3GD20H.cpp
)
+6 -6
View File
@@ -1,10 +1,10 @@
#include "GyroL3GD20H.h"
#include "fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h"
#include "../spi/mspInit.h"
#include "../spi/spiDefinitions.h"
#include "../spi/spiCore.h"
#include "../spi/spiInterrupts.h"
#include "../spi/stm32h743ziSpi.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
+1 -1
View File
@@ -1,3 +1,3 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
gpio.cpp
)
+1 -1
View File
@@ -1,4 +1,4 @@
#include "gpio.h"
#include "fsfw/hal/stm32h7/gpio/gpio.h"
#include "stm32h7xx_hal_rcc.h"
+1 -1
View File
@@ -1,2 +1,2 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
)
+1 -1
View File
@@ -1,4 +1,4 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
spiCore.cpp
spiDefinitions.cpp
spiInterrupts.cpp
+7 -7
View File
@@ -1,12 +1,12 @@
#include "SpiComIF.h"
#include "SpiCookie.h"
#include "fsfw/hal/stm32h7/spi/SpiComIF.h"
#include "fsfw/hal/stm32h7/spi/SpiCookie.h"
#include "fsfw/tasks/SemaphoreFactory.h"
#include "fsfw/osal/FreeRTOS/TaskManagement.h"
#include "fsfw_hal/stm32h7/spi/spiCore.h"
#include "fsfw_hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw_hal/stm32h7/spi/mspInit.h"
#include "fsfw_hal/stm32h7/gpio/gpio.h"
#include "fsfw/osal/freertos/TaskManagement.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/gpio/gpio.h"
#include "stm32h7xx_hal_gpio.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "SpiCookie.h"
#include "fsfw/hal/stm32h7/spi/SpiCookie.h"
SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode,
+6 -5
View File
@@ -1,13 +1,14 @@
#include <fsfw_hal/stm32h7/dma.h>
#include "mspInit.h"
#include "spiCore.h"
#include "spiInterrupts.h"
#include "fsfw/hal/stm32h7/dma.h"
#include "fsfw/hal/stm32h7/spi/mspInit.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h"
#include "stm32h743xx.h"
#include "stm32h7xx_hal_spi.h"
#include "stm32h7xx_hal_dma.h"
#include "stm32h7xx_hal_def.h"
#include <stdio.h>
#include <cstdio>
spi::msp_func_t mspInitFunc = nullptr;
spi::MspCfgBase* mspInitArgs = nullptr;
+3 -2
View File
@@ -1,5 +1,6 @@
#include "spiDefinitions.h"
#include "spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h"
#include <cstdio>
SPI_HandleTypeDef* spiHandle = nullptr;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "spiDefinitions.h"
#include "fsfw/hal/stm32h7/spi/spiDefinitions.h"
void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) {
switch(spiMode) {
+2 -2
View File
@@ -1,5 +1,5 @@
#include "spiInterrupts.h"
#include "spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_dma.h"
+4 -3
View File
@@ -1,6 +1,7 @@
#include "stm32h743ziSpi.h"
#include "spiCore.h"
#include "spiInterrupts.h"
#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h"
#include "fsfw/hal/stm32h7/spi/spiCore.h"
#include "fsfw/hal/stm32h7/spi/spiInterrupts.h"
#include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_rcc.h"
+1 -1
View File
@@ -1,2 +1,2 @@
target_sources(${LIB_FSFW_HAL_NAME} PRIVATE
target_sources(${LIB_FSFW_NAME} PRIVATE
)
+3 -1
View File
@@ -79,7 +79,9 @@ public:
static void setCreateDirectoryCommand(CommandMessage* message,
store_address_t storeId);
static void setDeleteDirectoryCommand(CommandMessage* message,
store_address_t storeId);
store_address_t storeId, bool deleteRecursively);
static store_address_t getDeleteDirectoryCommand(const CommandMessage* message,
bool& deleteRecursively);
static void setSuccessReply(CommandMessage* message);
static void setFailureReply(CommandMessage* message,
+22 -7
View File
@@ -36,9 +36,8 @@ public:
//! [EXPORT] : P1: Sequence number missing
static constexpr ReturnValue_t SEQUENCE_PACKET_MISSING_READ = MAKE_RETURN_CODE(16);
virtual ~HasFileSystemIF() {}
/**
* Function to get the MessageQueueId_t of the implementing object
* @return MessageQueueId_t of the object
@@ -46,7 +45,7 @@ public:
virtual MessageQueueId_t getCommandQueue() const = 0;
/**
* Generic function to append to file.
* @brief Generic function to append to file.
* @param dirname Directory of the file
* @param filename The filename of the file
* @param data The data to write to the file
@@ -63,12 +62,12 @@ public:
uint16_t packetNumber, void* args = nullptr) = 0;
/**
* Generic function to create a new file.
* @brief Generic function to create a new file.
* @param repositoryPath
* @param filename
* @param data
* @param size
* @param args Any other arguments which an implementation might require.
* @param args Any other arguments which an implementation might require
* @return
*/
virtual ReturnValue_t createFile(const char* repositoryPath,
@@ -76,14 +75,30 @@ public:
size_t size = 0, void* args = nullptr) = 0;
/**
* Generic function to delete a file.
* @brief Generic function to delete a file.
* @param repositoryPath
* @param filename
* @param args
* @param args Any other arguments which an implementation might require
* @return
*/
virtual ReturnValue_t deleteFile(const char* repositoryPath,
const char* filename, void* args = nullptr) = 0;
/**
* @brief Generic function to create a directory
* @param repositoryPath
* @param args Any other arguments which an implementation might require
* @return
*/
virtual ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) = 0;
/**
* @brief Generic function to remove a directory
* @param repositoryPath
* @param args Any other arguments which an implementation might require
*/
virtual ReturnValue_t removeDirectory(const char* repositoryPath,
bool deleteRecurively = false, void* args = nullptr) = 0;
};
-15
View File
@@ -1,15 +0,0 @@
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/tmtc/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/devices/*.cpp)
INCLUDES += $(CURRENTPATH)
INCLUDES += $(CURRENTPATH)/objects
INCLUDES += $(CURRENTPATH)/returnvalues
INCLUDES += $(CURRENTPATH)/tmtc
INCLUDES += $(CURRENTPATH)/events
INCLUDES += $(CURRENTPATH)/devices
INCLUDES += $(CURRENTPATH)/pollingsequence
INCLUDES += $(CURRENTPATH)/ipc
+8 -1
View File
@@ -34,8 +34,9 @@ void GenericFileSystemMessage::setReportFileAttributesReply(CommandMessage *mess
}
void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message,
store_address_t storeId) {
store_address_t storeId, bool deleteRecursively) {
message->setCommand(CMD_DELETE_DIRECTORY);
message->setParameter(deleteRecursively);
message->setParameter2(storeId.raw);
}
@@ -133,6 +134,12 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message,
return message->getParameter();
}
store_address_t GenericFileSystemMessage::getDeleteDirectoryCommand(const CommandMessage *message,
bool &deleteRecursively) {
deleteRecursively = message->getParameter();
return getStoreId(message);
}
ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) {
switch(message->getCommand()) {
case(CMD_CREATE_FILE):
+7 -8
View File
@@ -1,9 +1,8 @@
target_sources(${LIB_FSFW_NAME}
PRIVATE
CCSDSTime.cpp
Countdown.cpp
Stopwatch.cpp
TimeMessage.cpp
TimeStamper.cpp
ClockCommon.cpp
target_sources(${LIB_FSFW_NAME} PRIVATE
CCSDSTime.cpp
Countdown.cpp
Stopwatch.cpp
TimeMessage.cpp
TimeStamper.cpp
ClockCommon.cpp
)