Skip to content

Latest commit

 

History

History
190 lines (125 loc) · 5.58 KB

Software.md

File metadata and controls

190 lines (125 loc) · 5.58 KB

Setup

$ cd <root of this repo>
$ git submodule init
$ git submodule update

For visual studio code

Go to the extensions and filter for Recommended to install the recommended extensions for this repository.

Prerequisits (for all)

Install CMAKE

https://cmake.org/download/

Install Ninja

Go to: https://github.com/ninja-build/ninja/releases, download the binary for your platform and app the path to the binary to your system PATH.

Install clang-format

$ sudo apt install clang-format

Installs for font generation

The repository enzoevers/TTF2BMH is used to generated font header files during cmake configuration with python(3) scripts.

$ python3 -m pip install fontTools pillow argparse

Using the scripts

STM32F303xc

Prerequisits

sudo apt install libnewlib-arm-none-eabi \
                 stlink-tools            \
                 openocd                 \
                 gdb-multiarch

The stlink-tools package comes from https://github.com/stlink-org/stlink.

Available scripts

  • $ ./Scripts/Stm32/Stm32f303xc/BuildStm32f303xc.sh <Application name> ["build"]
    • If no "build" argument is given only the cmake configuration is executed.
  • $ [sudo] ./Scripts/Stm32/Stm32f303xc/CleanStm32f303xcBuild.sh
  • $ ./Scripts/Stm32/Stm32f303xc/StLinkFlash.sh <Application name>
  • $ ./Scripts/Stm32/Stm32f303xc/StLinkDebug.sh <Application name>

Available applications for <Application name> are:

  • "Clock"

Debugging

This is based on https://www.youtube.com/watch?v=_1u7IOnivnM

After running ./Scripts/Stm32/Stm32f303xc/StLinkDebug.sh, type the following in the gdb window:

(gdb) target extended-remote localhost:3333

To restart the program, set a breakpoint at main and see the source code run (also see https://openocd.org/doc/html/GDB-and-OpenOCD.html#Sample-GDB-session-startup):

(gdb) monitor reset halt
...
(gdb) load
...
(gdb) b main
...
(gdb) c
...
(geb) lay src

To close the source code viewer press crtl+x+a. To bring it back use the same command. For other layouts run help lay.

To continue the program type again c.

To break, press ctrl+c.

From here on see the GDB and OpenOCD documentation on how to see variables values etc.

Testing

Prerequisits

sudo apt install gcc-12 g++-12 \
                 libstdc++-12-dev

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
rm llvm.sh

sudo apt install lcov \
                 llvm-cov

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

nvm install 21.1.0
nvm use 21.1.0

The reason for libstdc++12-devmak is described here: https://stackoverflow.com/questions/74543715/usr-bin-ld-cannot-find-lstdc-no-such-file-or-directory-on-running-flutte

Available scripts

  • $ ./Scripts/Test/BuildTest.sh ["build"]
    • If no "build" argument is given only the cmake configuration is executed.
  • $ [sudo] ./Scripts/Test/CleanTestBuild.sh
  • $ ./Scripts/Test/RunTest.sh

When creating new tests, make sure to add the test to the ./Scripts/Test/RunTest.sh script.

Coverage

After running $ ./Scripts/Test/RunTest.sh a coverage report can be found in ./Coverage/CoverageReport/. Use index.html to open it.

Documentation

Prerequisits

The Code/Doc/CMakeLists.txt makes use of the Doxygen cmake package. To use it, install Doxygen as described here: https://www.doxygen.nl/manual/install.html

$ cd <somewhere other than this repo>
$ sudo apt install flex \
                   bison

$ export DOX_VERSION=1.10.0

$ wget https://www.doxygen.nl/files/doxygen-$DOX_VERSION.src.tar.gz

$ gunzip doxygen-$DOX_VERSION.src.tar.gz
$ tar xf doxygen-$DOX_VERSION.src.tar

$ cd doxygen-$DOX_VERSION
$ mkdir build
$ cd build

$ cmake -G "Unix Makefiles" ..
$ make -j12

$ [sudo] make -j12 install

Available scripts

  • $ ./Scripts/Doc/BuildDoc.sh
  • $ ./Scripts/Doc/CleanDocBuild.sh

The index.html can then be found in Code/BuildDoc/Doc/html/index.html.

Fonts

Showing text on the display requires characters to use. These are generated by using a forked version of the TTF2BMH repository: enzoevers/TTF2BMH. The forked version doesn't change the format of the generated header files.

The fonts are generated in the build directory during cmake configuration in TextContent/CMakeLists.txt with the following line:

set(FONT_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Generated/Fonts")
set(GENERATE_FONT_SCRIPT "${PROJECT_SOURCE_DIR}/../Scripts/Fonts/GenerateFonts.sh")

execute_process(COMMAND mkdir -p ${FONT_INCLUDE_DIR})
execute_process(COMMAND ${GENERATE_FONT_SCRIPT} ${FONT_INCLUDE_DIR} "Bitstream Vera Sans Mono" 8)
execute_process(COMMAND ${GENERATE_FONT_SCRIPT} ${FONT_INCLUDE_DIR} "Bitstream Vera Sans Mono" 12)
execute_process(COMMAND ${GENERATE_FONT_SCRIPT} ${FONT_INCLUDE_DIR} "Bitstream Vera Sans Mono" 16)