Merge pull request 'v1.5.0' (#60) from mueller/v1.5.0-staging into develop

Reviewed-on: #60
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
Jakob Meier 2021-07-25 16:23:06 +02:00
commit 8b14e1a31e
10 changed files with 124 additions and 19 deletions

View File

@ -21,7 +21,7 @@ int main(void)
std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
<< SW_SUBVERSION << "." << SW_REVISION << " -- " << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission();

View File

@ -1,7 +1,8 @@
#include "InitMission.h"
#include <OBSWVersion.h>
#include "OBSWVersion.h"
#include <fsfw/tasks/TaskFactory.h>
#include "fsfw/FSFWVersion.h"
#include "fsfw/tasks/TaskFactory.h"
#include <iostream>
@ -21,8 +22,9 @@ int main(void)
{
std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
FSFW_REVISION << "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission();

View File

@ -1,10 +1,12 @@
#include "CoreController.h"
#include "q7sConfig.h"
#include "OBSWVersion.h"
#include "fsfw/FSFWVersion.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "../memory/scratchApi.h"
#include "../memory/SdCardManager.h"
#include "bsp_q7s/memory/scratchApi.h"
#include "bsp_q7s/memory/SdCardManager.h"
#include <filesystem>
@ -46,6 +48,7 @@ ReturnValue_t CoreController::initialize() {
sif::warning << "CoreController::initialize: Setting up alloc failure "
"count failed" << std::endl;
}
return HasReturnvaluesIF::RETURN_OK;
}
@ -180,6 +183,14 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
}
}
ReturnValue_t CoreController::initializeAfterTaskCreation() {
ReturnValue_t result = versionFileInit();
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
}
return result;
}
ReturnValue_t CoreController::sdCardColdRedundantInit(SdCardManager* sdcMan,
SdCardManager::SdStatusPair& statusPair) {
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
@ -254,3 +265,86 @@ ReturnValue_t CoreController::incrementAllocationFailureCount() {
count++;
return scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, count);
}
ReturnValue_t CoreController::versionFileInit() {
std::string unameFileName = "/tmp/uname_version.txt";
std::string unameCmd = "uname -a > " + unameFileName;
int result = std::system(unameCmd.c_str());
if(result != 0) {
utility::handleSystemError(result, "CoreController::versionFileInit");
}
std::ifstream unameFile(unameFileName);
std::string unameLine;
if(not std::getline(unameFile, unameLine)) {
sif::warning << "CoreController::versionFileInit: Retrieving uname line failed"
<< std::endl;
}
std::string fullObswVersionString = "OBSW: v" + std::to_string(SW_VERSION) + "." +
std::to_string(SW_SUBVERSION) + "." + std::to_string(SW_REVISION);
std::string fullFsfwVersionString = "FSFW: v" + std::to_string(FSFW_VERSION) + "." +
std::to_string(FSFW_SUBVERSION) + "." + std::to_string(FSFW_REVISION);
std::string systemString = "System: " + unameLine;
std::string mountPrefix = SdCardManager::instance()->getCurrentMountPrefix();
std::string versionFilePath = mountPrefix + "/conf/version.txt";
std::fstream versionFile;
if(not std::filesystem::exists(versionFilePath)) {
sif::info << "Writing version file " << versionFilePath << ".." << std::endl;
versionFile.open(versionFilePath, std::ios_base::out);
versionFile << fullObswVersionString << std::endl;
versionFile << fullFsfwVersionString << std::endl;
versionFile << systemString << std::endl;
return HasReturnvaluesIF::RETURN_OK;
}
// Check whether any version has changed
bool createNewFile = false;
versionFile.open(versionFilePath);
std::string currentVersionString;
uint8_t idx = 0;
while(std::getline(versionFile, currentVersionString)) {
if(idx == 0) {
if(currentVersionString != fullObswVersionString) {
sif::info << "OBSW version changed" << std::endl;
sif::info << "From " << currentVersionString << " to " <<
fullObswVersionString << std::endl;
createNewFile = true;
}
}
else if(idx == 1) {
if(currentVersionString != fullFsfwVersionString) {
sif::info << "FSFW version changed" << std::endl;
sif::info << "From " << currentVersionString << " to " <<
fullFsfwVersionString << std::endl;
createNewFile = true;
}
}
else if(idx == 2) {
if(currentVersionString != systemString) {
sif::info << "System version changed" << std::endl;
sif::info << "Old: " << currentVersionString << std::endl;
sif::info << "New: " << systemString << std::endl;
createNewFile = true;
}
}
else {
sif::warning << "Invalid version file! Rewriting it.." << std::endl;
createNewFile = true;
}
idx++;
}
// Overwrite file if necessary
if(createNewFile) {
sif::info << "Rewriting version.txt file with updated versions.." << std::endl;
versionFile.close();
versionFile.open(versionFilePath, std::ios_base::out | std::ios_base::trunc);
versionFile << fullObswVersionString << std::endl;
versionFile << fullFsfwVersionString << std::endl;
versionFile << systemString << std::endl;
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -18,6 +18,8 @@ public:
ReturnValue_t initialize() override;
ReturnValue_t initializeAfterTaskCreation() override;
ReturnValue_t executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
@ -37,6 +39,9 @@ private:
sd::SdCard sdCard, sd::SdStatus status, std::string sdString);
ReturnValue_t sdCardColdRedundantInit(SdCardManager* sdcMan,
SdCardManager::SdStatusPair& statusPair);
ReturnValue_t versionFileInit();
};

View File

@ -1,8 +1,11 @@
#include "obsw.h"
#include "OBSWVersion.h"
#include "InitMission.h"
#include "fsfw/tasks/TaskFactory.h"
#include "OBSWConfig.h"
#include "InitMission.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/FSFWVersion.h"
#include <iostream>
int obsw::obsw() {
@ -12,8 +15,9 @@ int obsw::obsw() {
#else
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
#endif
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
FSFW_REVISION << "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission();

View File

@ -4,7 +4,7 @@
const char* const SW_NAME = "eive";
#define SW_VERSION 1
#define SW_SUBVERSION 4
#define SW_SUBSUBVERSION 0
#define SW_SUBVERSION 5
#define SW_REVISION 0
#endif /* COMMON_CONFIG_OBSWVERSION_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit b83259592a1f0ae5af20b00d1aef813fa26cd350
Subproject commit c5b4b0136217219a4443d858f42c368af9b15f27

View File

@ -566,7 +566,7 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" name="eive-q7s-debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null" parent="org.eclipse.cdt.build.core.emptycfg">
<configuration artifactName="${ProjName}" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" name="eive-q7s-debug" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.enablement=null,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.image=null,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=null" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689." name="/" resourcePath="">
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1439714522" name="Arm Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1064018737" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
@ -648,7 +648,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1527860624" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1772224733" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1331264991" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
@ -658,7 +658,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/common/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/linux/fsfwconfig}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1143219558" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -673,7 +673,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/common/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1199844227" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>

2
tmtc

@ -1 +1 @@
Subproject commit 941f46401e13fb6ee5fc653875eebff8496133ec
Subproject commit 2e942ec21e47485b9ab6416a0341b9ab8ec30543