/playground

Misc games

Primary LanguageC++

Playground

This is Hardy’s personal playground. But everyone is free to contribute.

Mirror of the repo can be found at github.

Playground

Games

Games should not be understood literally…​ instead these are finger exercises for the (embedded) software developer.

The following exercises are targeted:

Setup / Tooling

  1. setup Eclipse, cmake and clang/gcc

  2. gitlab-runner

  3. libraries

    1. STL

    2. Boost

Unittesting

  1. GoogleTest [subdir]

    1. introduction with a simple example

    2. mocking

  2. test driven development with a simple bag module

LLVM

Several topics concerning LLVM.

Self Training

There are plenty of websites for doing some self training. My personal favourites:

Setup

C/C++

Eclipse

For C/C++ experiments, Eclipse is used as IDE. For installation details refer to Clue.

MSYS2

Toolchain etc is taken from MSYS2. Because my software is most of the time running on 32bit targets, MINGW32 packets are used for playing and testing (sizeof(void *)==4 on MINGW32, while 8 on MINGW64).

More information on MSYS2 installation can be found in Clue.

Tip
MSYS2 installation should go to the default location c:\msys64 to make everything work smoothly.
Installation
# tooling
pacman -S --needed make
pacman -S --needed mingw-w64-i686-cmake mingw-w64-i686-ninja

# gcc
pacman -S --needed mingw-w64-i686-gcc mingw-w64-i686-gdb

# clang
pacman -S --needed mingw-w64-i686-clang mingw-w64-i686-compiler-rt mingw-w64-i686-lldb mingw-w64-i686-clang-analyzer mingw-w64-i686-clang-tools-extra

Visual Studio Code

As an alternative VSC can be used. Not my real favorite, because every addition or change to it’s setup ends in >1h googling. But flexibility is great and there exists a load of extensions. The following is just a loose collection of topics concerning VSC.

.vscode/settings.json
Adding MINGW32 to the Terminal Setup
    "terminal.integrated.profiles.windows": {
        "MINGW32": {
            "path": "C:\\msys64\\usr\\bin\\bash.exe",
            "args": [
                "--login",
                "-i"
            ],
            "env": {
                "MSYSTEM": "MINGW32",
                "CHERE_INVOKING": "1"
            }
        },
    },
    "terminal.integrated.defaultProfile.windows": "MINGW32",

Linux

Setup for running the tests/everything under Linux should be quite simple: under Debian install gcc-multiarch and g++-multiarch to get 32bit applications (sometimes the tests need to be generated with -m32).

Note
Compiling with clang is most of the times much faster: the fielddevice unittests need 60s with gcc on my machine, while it took 15s with clang. Most of clangs advantage comes from better usage of multiple cores. Don’t know, what the actual cause is, that gcc behaves "bad".