hal integration done

This commit is contained in:
Robin Müller 2021-07-15 18:53:59 +02:00
parent 243cf42dc4
commit e2da68795b
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
56 changed files with 61 additions and 81 deletions

View File

@ -12,26 +12,12 @@ 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})
@ -48,40 +34,15 @@ 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
target_include_directories(${LIB_FSFW_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${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
hal/inc/CMakeLists.txt Normal file
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}
)

10
hal/src/CMakeLists.txt Normal file
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()

View File

@ -0,0 +1 @@
add_subdirectory(gpio)

View File

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

View File

@ -1,4 +1,4 @@
#include "GpioCookie.h"
#include "fsfw/hal/common/gpio/GpioCookie.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
GpioCookie::GpioCookie() {

View File

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

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):

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
)

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):

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}
)

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>

View File

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

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>

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_) :

View File

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

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>

View File

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

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>

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):

View File

@ -1,4 +1,4 @@
#include "UartComIF.h"
#include "fsfw/hal/linux/uart/UartComIF.h"
#include "OBSWConfig.h"
#include "fsfw/serviceinterface/ServiceInterface.h"

View File

@ -1,4 +1,4 @@
#include "UartCookie.h"
#include "fsfw/hal/linux/uart/UartCookie.h"
#include <fsfw/serviceinterface/ServiceInterface.h>

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
)

View File

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

View File

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

View File

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

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

View File

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