branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into mueller/master

This commit is contained in:
Robin Müller 2022-02-11 17:04:36 +01:00
commit 602a6cd86e
10 changed files with 360 additions and 311 deletions

View File

@ -19,8 +19,9 @@
12. [Static Code Analysis](#static-code-analysis) 12. [Static Code Analysis](#static-code-analysis)
13. [Eclipse](#eclipse) 13. [Eclipse](#eclipse)
14. [Running the OBSW on a Raspberry Pi](#rpi) 14. [Running the OBSW on a Raspberry Pi](#rpi)
15. [FSFW](#fsfw) 15. [Manually preparing sysroots to compile gpsd](#gpsd)
16. [Coding Style](#coding-style) 16. [FSFW](#fsfw)
17. [Coding Style](#coding-style)
# <a id="general"></a> General information # <a id="general"></a> General information
@ -1133,6 +1134,9 @@ sudo apt-get install gpiod libgpiod-dev
to install the required GPIO libraries before cloning the system root folder. to install the required GPIO libraries before cloning the system root folder.
# <a id="gpsd"></a> Manually preparing sysroots to compile gpsd
Copy all header files from [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/gpsd&fileid=1189985) to the /usr/include directory and all static libraries to /usr/lib.
# <a id="fsfw"></a> Flight Software Framework (FSFW) # <a id="fsfw"></a> Flight Software Framework (FSFW)
An EIVE fork of the FSFW is submodules into this repository. An EIVE fork of the FSFW is submodules into this repository.

View File

@ -350,18 +350,17 @@ void initmission::createPusTasks(TaskFactory& factory,
void initmission::createTestTasks(TaskFactory& factory, void initmission::createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || OBSW_ADD_I2C_TEST_CODE == 1 || \ #if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
(BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#endif static_cast<void>(result); // supress warning in case it is not used
PeriodicTaskIF* testTask = factory.createPeriodicTask( PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); "TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
#if OBSW_ADD_TEST_TASK == 1
result = testTask->addComponent(objects::TEST_TASK); result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
} }
#endif /* OBSW_ADD_TEST_TASK == 1 */
#if OBSW_ADD_SPI_TEST_CODE == 1 #if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST); result = testTask->addComponent(objects::SPI_TEST);
@ -375,6 +374,13 @@ void initmission::createTestTasks(TaskFactory& factory,
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST); initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
} }
#endif #endif
#if OBSW_ADD_UART_TEST_CODE == 1
result = testTask->addComponent(objects::UART_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
}
#endif
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 #if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
result = testTask->addComponent(objects::LIBGPIOD_TEST); result = testTask->addComponent(objects::LIBGPIOD_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
@ -382,4 +388,6 @@ void initmission::createTestTasks(TaskFactory& factory,
} }
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */ #endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
taskVec.push_back(testTask); taskVec.push_back(testTask);
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
} }

View File

@ -1,6 +1,7 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <linux/boardtest/I2cTestClass.h> #include <linux/boardtest/I2cTestClass.h>
#include <linux/boardtest/UartTestClass.h>
#include <sstream> #include <sstream>
@ -1154,4 +1155,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if OBSW_ADD_I2C_TEST_CODE == 1 #if OBSW_ADD_I2C_TEST_CODE == 1
new I2cTestClass(objects::I2C_TEST, q7s::I2C_DEFAULT_DEV); new I2cTestClass(objects::I2C_TEST, q7s::I2C_DEFAULT_DEV);
#endif #endif
#if OBSW_ADD_UART_TEST_CODE == 1
new UartTestClass(objects::UART_TEST);
#endif
} }

View File

@ -11,26 +11,22 @@
#include <fcntl.h> // Contains file controls like O_RDWR #include <fcntl.h> // Contains file controls like O_RDWR
#include <unistd.h> // write(), read(), close() #include <unistd.h> // write(), read(), close()
<<<<<<< Updated upstream
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "lwgps/lwgps.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"
#include "fsfw/serviceinterface.h" #include "fsfw/serviceinterface.h"
#include "mission/devices/devicedefinitions/SCEXDefinitions.h" #include "mission/devices/devicedefinitions/SCEXDefinitions.h"
>>>>>>> Stashed changes
#define GPS_REPLY_WIRETAPPING 0 #define GPS_REPLY_WIRETAPPING 0
UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) {} UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) { mode = TestModes::SCEX; }
ReturnValue_t UartTestClass::initialize() { ReturnValue_t UartTestClass::initialize() {
if (mode == TestModes::GPS) { if (mode == TestModes::GPS) {
gpsInit(); gpsInit();
} else if (mode == TestModes::SCEX) {
scexInit();
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -39,6 +35,8 @@ ReturnValue_t UartTestClass::performOneShotAction() { return HasReturnvaluesIF::
ReturnValue_t UartTestClass::performPeriodicAction() { ReturnValue_t UartTestClass::performPeriodicAction() {
if (mode == TestModes::GPS) { if (mode == TestModes::GPS) {
gpsPeriodic(); gpsPeriodic();
} else if (mode == TestModes::SCEX) {
scexPeriodic();
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -20,16 +20,20 @@ class UartTestClass : public TestTask {
enum TestModes { enum TestModes {
GPS, GPS,
// Solar Cell Experiment // Solar Cell Experiment
SCE SCEX
}; };
void gpsInit(); void gpsInit();
void gpsPeriodic(); void gpsPeriodic();
void scexInit();
void scexPeriodic();
TestModes mode = TestModes::GPS; TestModes mode = TestModes::GPS;
lwgps_t gpsData = {}; lwgps_t gpsData = {};
struct termios tty = {}; struct termios tty = {};
int serialPort = 0; int serialPort = 0;
std::array<uint8_t, 512> recBuf; std::array<uint8_t, 64> cmdBuf = {};
std::array<uint8_t, 4096> recBuf = {};
uint8_t recvCnt = 0; uint8_t recvCnt = 0;
}; };

View File

@ -68,8 +68,8 @@ debugging. */
#define OBSW_SYRLINKS_SIMULATED 1 #define OBSW_SYRLINKS_SIMULATED 1
#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_TEST_PST 0
#define OBSW_ADD_TEST_TASK 0 #define OBSW_ADD_TEST_TASK 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
// If this is enabled, all other I2C code should be disabled // If this is enabled, all other I2C code should be disabled

View File

@ -0,0 +1,13 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_
#include <cstdint>
// Definitions for the Solar Cell Experiment
namespace scex {
static constexpr uint8_t CMD_PING = 0x4e;
}
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_ */

View File

@ -49,6 +49,13 @@ def handle_args():
action="store_true", action="store_true",
help="Copy from Q7S to host instead. Always copies to current directory.", help="Copy from Q7S to host instead. Always copies to current directory.",
) )
parser.add_argument(
"-f",
"--flatsat",
default=False,
action="store_true",
help="Copy to flatsat instead"
)
# Positional argument(s) # Positional argument(s)
parser.add_argument( parser.add_argument(
"source", help="Source files to copy or target files to copy back to host" "source", help="Source files to copy or target files to copy back to host"
@ -61,17 +68,28 @@ def build_cmd(args):
cmd = "scp " cmd = "scp "
if args.recursive: if args.recursive:
cmd += "-r " cmd += "-r "
address = ""
port_args = ""
target = args.target target = args.target
if args.invert and target == "": if args.flatsat:
target = "." address = "eive@flatsat.eive.absatvirt.lw"
elif target == "":
target = f"/tmp"
if args.invert:
cmd += f"-P {args.port} root@localhost:{args.source} {target}"
else: else:
cmd += f"-P {args.port} {args.source} root@localhost:{target}" address = "root@localhost"
if args.target: port_args=f"-P {args.port}"
cmd += args.target if args.invert:
if target == "":
target = "."
else:
target = args.target
else:
if target == "":
target = f"/tmp"
else:
target = args.target
if args.invert:
cmd += f"{port_args} {address}:{args.source} {target}"
else:
cmd += f"{port_args} {args.source} {address}:{target}"
return cmd return cmd