SD Card, Scratch Buffer and README updates #52

Merged
meierj merged 41 commits from mueller/first-sd-tests into develop 2021-07-09 22:02:31 +02:00
4 changed files with 49 additions and 7 deletions
Showing only changes of commit 743efa3e95 - Show all commits

View File

@ -576,7 +576,7 @@ When using Eclipse, there are two special build variables in the project propert
the sysroot path in those variables to get any additional includes like `gpiod.h` in the the sysroot path in those variables to get any additional includes like `gpiod.h` in the
Eclipse indexer. Eclipse indexer.
# Q7S Utilities # Q7S Utilities and Troubleshooting
## Creating files with cat and echo ## Creating files with cat and echo
@ -591,6 +591,17 @@ cat /tmp/test.txt
For more useful combinations, see this [link](https://www.freecodecamp.org/news/the-cat-command-in-linux-how-to-create-a-text-file-with-cat-or-touch/). For more useful combinations, see this [link](https://www.freecodecamp.org/news/the-cat-command-in-linux-how-to-create-a-text-file-with-cat-or-touch/).
## Using `system` when debugging
Please note that when using a `system` call in C++/C code and debugging, a new thread will be
spawned which will appear on the left in Eclipse or Xilinx SDK as a `sh` program.
The debugger might attach to this child process automatically, depending on debugger configuration,
and the process needs to be selected and continued/started manually. You can enable or disable
this behaviour by selecting or deselecting the `Attach Process Children` option in the Remote
Application Configuration for the TCF plugin like shown in the following picture
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/ProcessSettings.png" width="50%"> <br>
## Libgpiod ## Libgpiod
Detect all gpio device files: Detect all gpio device files:
@ -666,9 +677,10 @@ candump can0
## Useful Q7S Linux Commands ## Useful Q7S Linux Commands
Rebooting currently running image: Rebooting currently running image:
````
```sh
xsc_boot_copy -r xsc_boot_copy -r
```` ```
# Running the EIVE OBSW on a Raspberry Pi # Running the EIVE OBSW on a Raspberry Pi

View File

@ -1,6 +1,8 @@
#include "Q7STestTask.h" #include "Q7STestTask.h"
#include "fsfw/timemanager/Stopwatch.h" #include "fsfw/timemanager/Stopwatch.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <cstdio> #include <cstdio>
@ -16,10 +18,27 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
void Q7STestTask::sdCardTests() { void Q7STestTask::sdCardTests() {
using namespace std; using namespace std;
Stopwatch stopwatch; Stopwatch stopwatch;
ofstream testFile("/tmp/test.txt"); int result = std::system("q7hw sd info all > /tmp/sd_status.txt");
testFile << "Hallo Welt" << endl; if(result != 0) {
testFile.close(); sif::debug << "system call failed with " << result << endl;
//FILE* testFile = popen("q7hw sd info all", "r"); }
ifstream sdStatus("/tmp/sd_status.txt");
string line;
uint8_t idx = 0;
while (std::getline(sdStatus, line)) {
std::istringstream iss(line);
string word;
while(iss >> word) {
if(word == "on") {
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
}
else if(word == "off") {
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
}
}
idx++;
}
std::remove("/tmp/sd_status.txt");
//TaskFactory::delayTask(3000); //TaskFactory::delayTask(3000);
//int result = system(); //int result = system();
//std::fstream fs(testFile); //std::fstream fs(testFile);
@ -43,3 +62,13 @@ void Q7STestTask::sdCardTests() {
// system("q7hw sd set 0 off > /tmp/sd_set.txt"); // system("q7hw sd set 0 off > /tmp/sd_set.txt");
// stopwatch.stop(true); // stopwatch.stop(true);
} }
void Q7STestTask::fileTests() {
using namespace std;
ofstream testFile("/tmp/test.txt");
testFile << "Hallo Welt" << endl;
testFile.close();
system("echo \"Hallo Welt\" > /tmp/test2.txt");
system("echo \"Hallo Welt\"");
}

View File

@ -10,6 +10,7 @@ private:
ReturnValue_t performOneShotAction() override; ReturnValue_t performOneShotAction() override;
void sdCardTests(); void sdCardTests();
void fileTests();
}; };

BIN
doc/img/ProcessSettings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB