Update Power Modules #287

Merged
meierj merged 18 commits from mueller/update-p60-module-code into develop 2022-08-29 08:27:36 +02:00
10 changed files with 78 additions and 75 deletions
Showing only changes of commit d098ed6403 - Show all commits

View File

@ -170,6 +170,9 @@ set(LIB_ETL_TARGET etl::etl)
set(LIB_CSP_NAME libcsp) set(LIB_CSP_NAME libcsp)
set(LIB_LWGPS_NAME lwgps) set(LIB_LWGPS_NAME lwgps)
set(LIB_ARCSEC wire) set(LIB_ARCSEC wire)
set(LIB_GOMSPACE_CLIENTS gs_clients)
set(LIB_GOMSPACE_CSP gs_csp)
set(THIRD_PARTY_FOLDER thirdparty) set(THIRD_PARTY_FOLDER thirdparty)
set(LIB_CXX_FS -lstdc++fs) set(LIB_CXX_FS -lstdc++fs)
set(LIB_CATCH2 Catch2) set(LIB_CATCH2 Catch2)
@ -190,7 +193,6 @@ set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg) set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
set(LIB_EIVE_MISSION_PATH mission) set(LIB_EIVE_MISSION_PATH mission)
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl) set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2) set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps) set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
@ -218,8 +220,8 @@ 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(ADD_CSP_LIB TRUE) set(ADD_GOMSPACE_CSP TRUE)
set(ADD_GOMSPACE_LIB 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)
@ -301,30 +303,30 @@ set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS set(WARNING_FLAGS
"-Wall" "-Wall"
"-Wextra" "-Wextra"
"-Wimplicit-fallthrough=1" "-Wimplicit-fallthrough=1"
"-Wno-unused-parameter" "-Wno-unused-parameter"
"-Wno-psabi" "-Wno-psabi"
"-Wduplicated-cond" # check for duplicate conditions "-Wduplicated-cond" # check for duplicate conditions
"-Wduplicated-branches" # check for duplicate branches "-Wduplicated-branches" # check for duplicate branches
"-Wlogical-op" # Search for bitwise operations instead of logical "-Wlogical-op" # Search for bitwise operations instead of logical
"-Wnull-dereference" # Search for NULL dereference "-Wnull-dereference" # Search for NULL dereference
"-Wundef" # Warn if undefind marcos are used "-Wundef" # Warn if undefind marcos are used
"-Wformat=2" # Format string problem detection "-Wformat=2" # Format string problem detection
"-Wformat-overflow=2" # Formatting issues in printf "-Wformat-overflow=2" # Formatting issues in printf
"-Wformat-truncation=2" # Formatting issues in printf "-Wformat-truncation=2" # Formatting issues in printf
"-Wformat-security" # Search for dangerous printf operations "-Wformat-security" # Search for dangerous printf operations
"-Wstrict-overflow=3" # Warn if integer overflows might happen "-Wstrict-overflow=3" # Warn if integer overflows might happen
"-Warray-bounds=2" # Some array bounds violations will be found "-Warray-bounds=2" # Some array bounds violations will be found
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14) "-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
"-Wcast-qual" # Warn if the constness is cast away "-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4" "-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access # -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives -Warith-conversion # Use with # -Wconversion # Creates many false positives -Warith-conversion # Use
# Wconversion to find more implicit conversions -fanalyzer # Should be used # with Wconversion to find more implicit conversions -fanalyzer # Should
# to look through problems # be used to look through problems
) )
target_compile_options(${OBSW_NAME} PRIVATE ${WARNING_FLAGS}) target_compile_options(${OBSW_NAME} PRIVATE ${WARNING_FLAGS})
target_compile_options(${LIB_EIVE_MISSION} PRIVATE ${WARNING_FLAGS}) target_compile_options(${LIB_EIVE_MISSION} PRIVATE ${WARNING_FLAGS})
target_compile_options(${LIB_DUMMIES} PRIVATE ${WARNING_FLAGS}) target_compile_options(${LIB_DUMMIES} PRIVATE ${WARNING_FLAGS})
@ -365,7 +367,7 @@ if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH}) add_subdirectory(${LINUX_PATH})
endif() endif()
add_subdirectory(${BSP_PATH}) add_subdirectory(${BSP_PATH})
if(ADD_GOMSPACE_LIB) if(ADD_GOMSPACE_CSP OR ADD_GOMSPACE_CLIENTS)
add_subdirectory(${LIB_GOMSPACE_PATH}) add_subdirectory(${LIB_GOMSPACE_PATH})
endif() endif()
add_subdirectory(${COMMON_PATH}) add_subdirectory(${COMMON_PATH})
@ -458,8 +460,12 @@ if(TGT_BSP MATCHES "arm/egse")
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
endif() endif()
if(ADD_CSP_LIB) if(ADD_GOMSPACE_CSP)
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_CSP_NAME} libp60client) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CSP})
endif()
if(ADD_GOMSPACE_CLIENTS)
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS})
endif() endif()
if(EIVE_ADD_ETL_LIB) if(EIVE_ADD_ETL_LIB)

View File

@ -58,8 +58,8 @@
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1
#define OBSW_SYRLINKS_SIMULATED 1 #define OBSW_SYRLINKS_SIMULATED 1
#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_TEST_CODE 1
#define OBSW_ADD_TEST_TASK 0 #define OBSW_ADD_TEST_TASK 1
#define OBSW_ADD_TEST_PST 0 #define OBSW_ADD_TEST_PST 0
// If this is enabled, all other SPI code should be disabled // If this is enabled, all other SPI code should be disabled
#define OBSW_ADD_SPI_TEST_CODE 0 #define OBSW_ADD_SPI_TEST_CODE 0

View File

@ -6,6 +6,7 @@
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <gps.h> #include <gps.h>
#include <libgpsmm.h> #include <libgpsmm.h>
#include <param/param_string.h>
#include <cstdio> #include <cstdio>
#include <ctime> #include <ctime>
@ -18,10 +19,8 @@
#include "bsp_q7s/memory/scratchApi.h" #include "bsp_q7s/memory/scratchApi.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/timemanager/Stopwatch.h" #include "fsfw/timemanager/Stopwatch.h"
#include "test/DummyParameter.h"
#include "p60pdu.h" #include "p60pdu.h"
#include <param/param_string.h> #include "test/DummyParameter.h"
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) { Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
doTestSdCard = false; doTestSdCard = false;
@ -38,15 +37,18 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
if (doTestScratchApi) { if (doTestScratchApi) {
testScratchApi(); testScratchApi();
} }
uint8_t p60pdu_node = 3; if (DO_TEST_GOMSPACE_API) {
uint8_t hk_mem[P60PDU_HK_SIZE]; uint8_t p60pdu_node = 3;
param_index_t p60pdu_hk{}; uint8_t hk_mem[P60PDU_HK_SIZE];
p60pdu_hk.physaddr = hk_mem; param_index_t p60pdu_hk{};
if (!p60pdu_get_hk(&p60pdu_hk, p60pdu_node, 1000)) { p60pdu_hk.physaddr = hk_mem;
printf("Error getting p60pdu hk\n"); if (!p60pdu_get_hk(&p60pdu_hk, p60pdu_node, 1000)) {
} else { printf("Error getting p60pdu hk\n");
//param_list(&p60pdu_hk, 1); } else {
param_list(&p60pdu_hk, 1);
}
} }
// testJsonLibDirect(); // testJsonLibDirect();
// testDummyParams(); // testDummyParams();
if (doTestProtHandler) { if (doTestProtHandler) {

View File

@ -16,6 +16,7 @@ class Q7STestTask : public TestTask {
private: private:
bool doTestSdCard = false; bool doTestSdCard = false;
bool doTestScratchApi = false; bool doTestScratchApi = false;
static constexpr bool DO_TEST_GOMSPACE_API = true;
bool doTestGpsShm = false; bool doTestGpsShm = false;
bool doTestGpsSocket = false; bool doTestGpsSocket = false;
bool doTestProtHandler = false; bool doTestProtHandler = false;

View File

@ -230,8 +230,7 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
uint16_t payloadlength = sizeof(address) + parameterSize; uint16_t payloadlength = sizeof(address) + parameterSize;
/* Generate command for CspComIF */ /* Generate command for CspComIF */
CspSetParamCommand setParamCmd(querySize, payloadlength, address, CspSetParamCommand setParamCmd(querySize, payloadlength, address, parameterPtr, parameterSize);
parameterPtr, parameterSize);
size_t cspPacketLen = 0; size_t cspPacketLen = 0;
uint8_t* buffer = cspPacket; uint8_t* buffer = cspPacket;
result = setParamCmd.serialize(&buffer, &cspPacketLen, sizeof(cspPacket), result = setParamCmd.serialize(&buffer, &cspPacketLen, sizeof(cspPacket),
@ -269,7 +268,7 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm
} }
/* Get an check table id to read from */ /* Get an check table id to read from */
uint8_t tableId = getParamMessage.getTableId(); uint8_t tableId = getParamMessage.getTableId();
if(not validTableId(tableId)) { if (not validTableId(tableId)) {
sif::error << "GomspaceDeviceHandler: Invalid table id in get parameter" sif::error << "GomspaceDeviceHandler: Invalid table id in get parameter"
" message" " message"
<< std::endl; << std::endl;
@ -427,7 +426,7 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
} }
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId, ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId,
uint16_t hkTableReplySize) { uint16_t hkTableReplySize) {
uint16_t querySize = hkTableReplySize; uint16_t querySize = hkTableReplySize;
RequestFullTableCommand requestFullTableCommand(querySize, tableId); RequestFullTableCommand requestFullTableCommand(querySize, tableId);

View File

@ -116,6 +116,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb); std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb);
static bool validTableId(uint8_t id); static bool validTableId(uint8_t id);
private: private:
SetParamMessageUnpacker setParamCacher; SetParamMessageUnpacker setParamCacher;
/** /**

View File

@ -8,12 +8,13 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h> #include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
class CspParamRequestBase : public SerialLinkedListAdapter<SerializeIF> { class CspParamRequestBase : public SerialLinkedListAdapter<SerializeIF> {
public: public:
CspParamRequestBase(uint16_t querySize, uint8_t tableId): querySize(querySize), tableId(tableId) { CspParamRequestBase(uint16_t querySize, uint8_t tableId)
: querySize(querySize), tableId(tableId) {
setLinks(); setLinks();
} }
protected:
protected:
void setLinks() { void setLinks() {
setStart(&cspPort); setStart(&cspPort);
cspPort.setNext(&querySize); cspPort.setNext(&querySize);
@ -104,9 +105,8 @@ class CspPingCommand : public SerialLinkedListAdapter<SerializeIF> {
*/ */
class CspSetParamCommand : public CspParamRequestBase { class CspSetParamCommand : public CspParamRequestBase {
public: public:
CspSetParamCommand(uint16_t querySize_, uint16_t payloadlength_, CspSetParamCommand(uint16_t querySize_, uint16_t payloadlength_, uint16_t addr_,
uint16_t addr_, const uint8_t *parameter_, const uint8_t *parameter_, uint8_t parameterCount_, uint8_t tableId = 1)
uint8_t parameterCount_, uint8_t tableId = 1)
: CspParamRequestBase(querySize_, tableId), : CspParamRequestBase(querySize_, tableId),
addr(addr_), addr(addr_),
parameter(parameter_, parameterCount_) { parameter(parameter_, parameterCount_) {
@ -116,8 +116,8 @@ class CspSetParamCommand : public CspParamRequestBase {
CspParamRequestBase::action = GOMSPACE::ParamRequestIds::SET; CspParamRequestBase::action = GOMSPACE::ParamRequestIds::SET;
} }
CspSetParamCommand(const CspSetParamCommand &command) = delete; CspSetParamCommand(const CspSetParamCommand &command) = delete;
private:
private:
SerializeElement<uint16_t> addr; SerializeElement<uint16_t> addr;
SerializeElement<SerialBufferAdapter<uint8_t>> parameter; SerializeElement<SerialBufferAdapter<uint8_t>> parameter;
}; };
@ -135,17 +135,15 @@ class CspGetParamCommand : public CspParamRequestBase {
/* The size of the header of a gomspace CSP packet. */ /* The size of the header of a gomspace CSP packet. */
static const uint8_t GS_HDR_LENGTH = 12; static const uint8_t GS_HDR_LENGTH = 12;
CspGetParamCommand(uint16_t querySize_, uint8_t tableId_, uint16_t addresslength_, CspGetParamCommand(uint16_t querySize_, uint8_t tableId_, uint16_t addresslength_, uint16_t addr_)
uint16_t addr_) : CspParamRequestBase(querySize_, tableId_), addr(addr_) {
: CspParamRequestBase(querySize_, tableId_),
addr(addr_) {
total.setNext(&addr); total.setNext(&addr);
CspParamRequestBase::tableId = tableId_; CspParamRequestBase::tableId = tableId_;
CspParamRequestBase::payloadlength = addresslength_; CspParamRequestBase::payloadlength = addresslength_;
} }
CspGetParamCommand(const CspGetParamCommand &command) = delete; CspGetParamCommand(const CspGetParamCommand &command) = delete;
private:
private:
SerializeElement<uint16_t> addr; SerializeElement<uint16_t> addr;
}; };
@ -160,7 +158,7 @@ class CspGetParamCommand : public CspParamRequestBase {
class RequestFullTableCommand : public CspParamRequestBase { class RequestFullTableCommand : public CspParamRequestBase {
public: public:
RequestFullTableCommand(uint16_t querySize_, uint8_t tableId_) RequestFullTableCommand(uint16_t querySize_, uint8_t tableId_)
: CspParamRequestBase(querySize_, tableId_) {} : CspParamRequestBase(querySize_, tableId_) {}
RequestFullTableCommand(const RequestFullTableCommand &command) = delete; RequestFullTableCommand(const RequestFullTableCommand &command) = delete;

View File

@ -30,13 +30,13 @@ static const uint8_t P60_PORT_GNDWDT_RESET = 9;
* Device commands are derived from the rparam.h of the gomspace lib.. * Device commands are derived from the rparam.h of the gomspace lib..
* IDs above 50 are reserved for device specific commands. * IDs above 50 are reserved for device specific commands.
*/ */
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t NONE = 2; // Set when no command is pending static const DeviceCommandId_t NONE = 2; // Set when no command is pending
static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND]
// Not implemented yet // Not implemented yet
// static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND] // static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND]
@ -45,7 +45,7 @@ static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMM
static const DeviceCommandId_t PRINT_SWITCH_V_I = 32; static const DeviceCommandId_t PRINT_SWITCH_V_I = 32;
static const DeviceCommandId_t PRINT_LATCHUPS = 33; static const DeviceCommandId_t PRINT_LATCHUPS = 33;
enum ParamRequestIds: uint8_t { enum ParamRequestIds : uint8_t {
GET = 0x00, GET = 0x00,
REPLY = 0x55, REPLY = 0x55,
SET = 0xFF, SET = 0xFF,
@ -62,12 +62,7 @@ enum ParamRequestIds: uint8_t {
SAVE_TO_STORE = 0x9a SAVE_TO_STORE = 0x9a
}; };
enum TableIds: uint8_t { enum TableIds : uint8_t { BOARD_PARAMS = 0, CONFIG = 1, CALIBRATION = 2, HK = 4 };
BOARD_PARAMS = 0,
CONFIG = 1,
CALIBRATION = 2,
HK = 4
};
} // namespace GOMSPACE } // namespace GOMSPACE

View File

@ -23,6 +23,7 @@ if command -v ${cmake_fmt} &> /dev/null; then
for dir in ${folder_list[@]}; do for dir in ${folder_list[@]}; do
find ${dir} ${file_selectors} | xargs ${cmake_fmt} -i find ${dir} ${file_selectors} | xargs ${cmake_fmt} -i
done done
${cmake_fmt} -i ./thirdparty/gomspace-sw/CMakeLists.txt
else else
echo "No ${cmake_fmt} tool found, not formatting CMake files" echo "No ${cmake_fmt} tool found, not formatting CMake files"
fi fi

@ -1 +1 @@
Subproject commit b99ea7371f5af591846df267d0a6d72e53f2cd88 Subproject commit 6b9db5e60cadcb9bbe1712f0f1b50aede2cbf7be