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

View File

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

View File

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

View File

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

View File

@ -230,8 +230,7 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
uint16_t payloadlength = sizeof(address) + parameterSize;
/* Generate command for CspComIF */
CspSetParamCommand setParamCmd(querySize, payloadlength, address,
parameterPtr, parameterSize);
CspSetParamCommand setParamCmd(querySize, payloadlength, address, parameterPtr, parameterSize);
size_t cspPacketLen = 0;
uint8_t* buffer = 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 */
uint8_t tableId = getParamMessage.getTableId();
if(not validTableId(tableId)) {
if (not validTableId(tableId)) {
sif::error << "GomspaceDeviceHandler: Invalid table id in get parameter"
" message"
<< std::endl;
@ -427,7 +426,7 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
}
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId,
uint16_t hkTableReplySize) {
uint16_t hkTableReplySize) {
uint16_t querySize = hkTableReplySize;
RequestFullTableCommand requestFullTableCommand(querySize, tableId);

View File

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

View File

@ -8,12 +8,13 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
class CspParamRequestBase : public SerialLinkedListAdapter<SerializeIF> {
public:
CspParamRequestBase(uint16_t querySize, uint8_t tableId): querySize(querySize), tableId(tableId) {
public:
CspParamRequestBase(uint16_t querySize, uint8_t tableId)
: querySize(querySize), tableId(tableId) {
setLinks();
}
protected:
protected:
void setLinks() {
setStart(&cspPort);
cspPort.setNext(&querySize);
@ -104,9 +105,8 @@ class CspPingCommand : public SerialLinkedListAdapter<SerializeIF> {
*/
class CspSetParamCommand : public CspParamRequestBase {
public:
CspSetParamCommand(uint16_t querySize_, uint16_t payloadlength_,
uint16_t addr_, const uint8_t *parameter_,
uint8_t parameterCount_, uint8_t tableId = 1)
CspSetParamCommand(uint16_t querySize_, uint16_t payloadlength_, uint16_t addr_,
const uint8_t *parameter_, uint8_t parameterCount_, uint8_t tableId = 1)
: CspParamRequestBase(querySize_, tableId),
addr(addr_),
parameter(parameter_, parameterCount_) {
@ -116,8 +116,8 @@ class CspSetParamCommand : public CspParamRequestBase {
CspParamRequestBase::action = GOMSPACE::ParamRequestIds::SET;
}
CspSetParamCommand(const CspSetParamCommand &command) = delete;
private:
private:
SerializeElement<uint16_t> addr;
SerializeElement<SerialBufferAdapter<uint8_t>> parameter;
};
@ -135,17 +135,15 @@ class CspGetParamCommand : public CspParamRequestBase {
/* The size of the header of a gomspace CSP packet. */
static const uint8_t GS_HDR_LENGTH = 12;
CspGetParamCommand(uint16_t querySize_, uint8_t tableId_, uint16_t addresslength_,
uint16_t addr_)
: CspParamRequestBase(querySize_, tableId_),
addr(addr_) {
CspGetParamCommand(uint16_t querySize_, uint8_t tableId_, uint16_t addresslength_, uint16_t addr_)
: CspParamRequestBase(querySize_, tableId_), addr(addr_) {
total.setNext(&addr);
CspParamRequestBase::tableId = tableId_;
CspParamRequestBase::payloadlength = addresslength_;
}
CspGetParamCommand(const CspGetParamCommand &command) = delete;
private:
private:
SerializeElement<uint16_t> addr;
};
@ -160,7 +158,7 @@ class CspGetParamCommand : public CspParamRequestBase {
class RequestFullTableCommand : public CspParamRequestBase {
public:
RequestFullTableCommand(uint16_t querySize_, uint8_t tableId_)
: CspParamRequestBase(querySize_, tableId_) {}
: CspParamRequestBase(querySize_, tableId_) {}
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..
* IDs above 50 are reserved for device specific commands.
*/
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t NONE = 2; // Set when no command is pending
static const DeviceCommandId_t REBOOT = 4; //!< [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_SET = 255; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [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 REBOOT = 4; //!< [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_SET = 255; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND]
// Not implemented yet
// 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_LATCHUPS = 33;
enum ParamRequestIds: uint8_t {
enum ParamRequestIds : uint8_t {
GET = 0x00,
REPLY = 0x55,
SET = 0xFF,
@ -62,12 +62,7 @@ enum ParamRequestIds: uint8_t {
SAVE_TO_STORE = 0x9a
};
enum TableIds: uint8_t {
BOARD_PARAMS = 0,
CONFIG = 1,
CALIBRATION = 2,
HK = 4
};
enum TableIds : uint8_t { BOARD_PARAMS = 0, CONFIG = 1, CALIBRATION = 2, HK = 4 };
} // namespace GOMSPACE

View File

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

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