diff --git a/README.md b/README.md index 1c1a48eb..ba18152d 100644 --- a/README.md +++ b/README.md @@ -140,18 +140,30 @@ When using Windows, run theses steps in MSYS2. or to set up the [PATH and the CROSS_COMPILE variable permanently](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path) in the `.profile` file. -4. Run the CMake configuration to create the build system in a `Debug` folder. - Navigate into the `eive_obsw` folder first. - +4. Run the CMake configuration to create the build system in a `build-Debug-Q7S` folder. + Add `-G "MinGW Makefiles` in MinGW64 on Windows. + + ```sh + mkdir build-Debug-Q7S && cd build-Debug-Q7S + cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DOS_FSFW=linux .. + cmake --build . -j + ``` + + You can also use provided shell scripts to perform these commands + ```sh cd cmake/scripts/Q7S ./create_cmake_debug.sh cd ../../.. ``` - + This will invoke a Python script which in turn invokes CMake with the correct arguments to configure CMake for Q7S cross-compilation. + You can build the hosted variant of the OBSW by replacing `-DOS_FSFW=linux` with + `-DOS_FSFW=host`. There are also different values for `-DTGT_BSP` to build for the Raspberry Pi + or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`. + 5. Build the software with ```sh cd Debug @@ -553,6 +565,38 @@ GET out_en[0] = 1 * Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel) * Remote File Path: /tmp/eive_obsw.elf +## Running cppcheck on the Software + +Static code analysis can be useful to find bugs. +`cppcheck` can be used for this purpose. On Windows you can use MinGW64 to do this. + +```sh +pacman -S mingw-w64-x86_64-cppcheck +``` + +On Ubuntu, install with + +```sh +sudo apt-get install cppcheck +``` + +You can use the Eclipse integration or you can perform the scanning manually from the command line. +CMake will be used for this. + +Run the CMake build generation commands specified above but supply +`-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to the build generation. Invoking the build command will +generate a `compile_commands.json` file which can be used by cppcheck. + +```sh +cppcheck --project=compile_commands.json --xml 2> report.xml +``` + +Finally, you can convert the generated `.xml` file to HTML with the following command + +```sh +cppcheck-htmlreport --file=report.xml --report-dir=cppcheck --source-dir=.. +``` + ## Libgpiod Detect all gpio device files: