Compile Linux files conditionally for Host #322

Merged
muellerr merged 3 commits from mueller/compile_linux_files_conditionally_for_host into develop 2022-11-15 13:40:18 +01:00
7 changed files with 29 additions and 14 deletions

View File

@ -233,7 +233,7 @@ set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json) set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF) set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
set(EIVE_ADD_LINUX_FILES False) set(EIVE_ADD_LINUX_FILES OFF)
# Analyse different OS and architecture/target options, determine BSP_PATH, # Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc. # display information about compiler etc.
@ -253,12 +253,15 @@ if(TGT_BSP)
set(FSFW_CONFIG_PATH "linux/fsfwconfig") set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE) if(NOT BUILD_Q7S_SIMPLE_MODE)
set(EIVE_ADD_LINUX_FILES TRUE) set(EIVE_ADD_LINUX_FILES TRUE)
set(EIVE_ADD_LINUX_FSFWCONFIG TRUE)
set(ADD_GOMSPACE_CSP TRUE) set(ADD_GOMSPACE_CSP TRUE)
set(ADD_GOMSPACE_CLIENTS TRUE) set(ADD_GOMSPACE_CLIENTS TRUE)
set(FSFW_HAL_ADD_LINUX ON) set(FSFW_HAL_ADD_LINUX ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON) set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON) set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
endif() endif()
elseif(UNIX)
set(EIVE_ADD_LINUX_FILES ON)
endif() endif()
if(TGT_BSP MATCHES "arm/raspberrypi") if(TGT_BSP MATCHES "arm/raspberrypi")
@ -393,7 +396,7 @@ if(EIVE_ADD_JSON_LIB)
add_subdirectory(${LIB_JSON_PATH}) add_subdirectory(${LIB_JSON_PATH})
endif() endif()
add_subdirectory(thirdparty/rapidcsv) add_subdirectory(thirdparty)
if(EIVE_ADD_LINUX_FILES) if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LIB_ARCSEC_PATH}) add_subdirectory(${LIB_ARCSEC_PATH})

View File

@ -3,3 +3,4 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp gpioInit.cpp
add_subdirectory(boardconfig) add_subdirectory(boardconfig)
add_subdirectory(boardtest) add_subdirectory(boardtest)
add_subdirectory(fsfwconfig)

View File

@ -3,7 +3,10 @@ add_subdirectory(utility)
add_subdirectory(callbacks) add_subdirectory(callbacks)
add_subdirectory(boardtest) add_subdirectory(boardtest)
add_subdirectory(devices) add_subdirectory(devices)
add_subdirectory(fsfwconfig)
add_subdirectory(ipcore) add_subdirectory(ipcore)
if(EIVE_ADD_LINUX_FSFWCONFIG)
add_subdirectory(fsfwconfig)
endif()
target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp InitMission.cpp) target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp InitMission.cpp)

View File

@ -6,6 +6,7 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include "eive/objects.h"
void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler,
PeriodicTaskIF*& scexReaderTask) { PeriodicTaskIF*& scexReaderTask) {

View File

@ -333,14 +333,12 @@ void SpiTestClass::performPeriodicMax1227Test() {
} }
void SpiTestClass::performMax1227Test() { void SpiTestClass::performMax1227Test() {
std::string deviceName = "";
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
std::string deviceName = q7s::SPI_DEFAULT_DEV; deviceName = q7s::SPI_DEFAULT_DEV;
#elif defined(RASPBERRY_PI) #elif defined(RASPBERRY_PI)
std::string deviceName = "";
#elif defined(EGSE) #elif defined(EGSE)
std::string deviceName = "";
#elif defined(TE0720_1CFA) #elif defined(TE0720_1CFA)
std::string deviceName = "";
#endif #endif
int fd = 0; int fd = 0;
UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface"); UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface");
@ -381,8 +379,9 @@ void SpiTestClass::max1227RadSensorTest(int fd) {
DiffSel::NONE_0); DiffSel::NONE_0);
spiTransferStruct[0].len = 1; spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR); transfer(fd, gpioIds::CS_RAD_SENSOR);
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 7, spiTransferStruct[0].len); size_t tmpSz = spiTransferStruct[0].len;
size_t tmpLen = spiTransferStruct[0].len; max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 7, tmpSz);
size_t tmpLen = tmpSz;
spiTransferStruct[0].len = 1; spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR); transfer(fd, gpioIds::CS_RAD_SENSOR);
std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, tmpLen - 1); std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, tmpLen - 1);
@ -403,7 +402,8 @@ void SpiTestClass::max1227RadSensorTest(int fd) {
for (int idx = 0; idx < 8; idx++) { for (int idx = 0; idx < 8; idx++) {
sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl; sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl;
} }
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), spiTransferStruct[0].len); tmpSz = spiTransferStruct[0].len;
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), tmpSz);
spiTransferStruct[0].len = 1; spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::CS_RAD_SENSOR); transfer(fd, gpioIds::CS_RAD_SENSOR);
usleep(65); usleep(65);
@ -467,7 +467,8 @@ void SpiTestClass::max1227SusTest(int fd, SusTestCfg &cfg) {
spiTransferStruct[0].len = 1; spiTransferStruct[0].len = 1;
transfer(fd, cfg.gpioId); transfer(fd, cfg.gpioId);
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 5, spiTransferStruct[0].len); size_t tmpSz = spiTransferStruct[0].len;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 5, tmpSz);
transfer(fd, cfg.gpioId); transfer(fd, cfg.gpioId);
uint16_t adcRaw[6] = {}; uint16_t adcRaw[6] = {};
adcRaw[0] = (recvBuffer[1] << 8) | recvBuffer[2]; adcRaw[0] = (recvBuffer[1] << 8) | recvBuffer[2];
@ -552,7 +553,9 @@ void SpiTestClass::max1227PlPcduTest(int fd) {
spiTransferStruct[0].len = 1; spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS); transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint8_t n = 11; uint8_t n = 11;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len); size_t tmpSz = spiTransferStruct[0].len;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, tmpSz);
spiTransferStruct[0].len = tmpSz;
size_t dummy = 0; size_t dummy = 0;
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len, max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len,
dummy); dummy);
@ -585,9 +588,11 @@ void SpiTestClass::max1227PlPcduTest(int fd) {
spiTransferStruct[0].len = 1; spiTransferStruct[0].len = 1;
transfer(fd, gpioIds::PLPCDU_ADC_CS); transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint8_t n = 11; uint8_t n = 11;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len); size_t tmpLen = spiTransferStruct[0].len;
max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, tmpLen);
max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len, max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len,
spiTransferStruct[0].len); tmpLen);
spiTransferStruct[0].len = tmpLen;
transfer(fd, gpioIds::PLPCDU_ADC_CS); transfer(fd, gpioIds::PLPCDU_ADC_CS);
uint16_t adcRaw[n + 1] = {}; uint16_t adcRaw[n + 1] = {};
for (uint8_t idx = 0; idx < n + 1; idx++) { for (uint8_t idx = 0; idx < n + 1; idx++) {

View File

@ -13,6 +13,7 @@
#include <string> #include <string>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "eive/objects.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "fsfw/globalfunctions/DleEncoder.h" #include "fsfw/globalfunctions/DleEncoder.h"
#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/globalfunctions/arrayprinter.h"

1
thirdparty/CMakeLists.txt vendored Normal file
View File

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