/cuckoo-firmware

Firmware sourcecode for Cuckoo - an embedded open-source lap timer.

Primary LanguageC++MIT LicenseMIT

Cuckoo Firmware

This repo contains code for Cuckoo - an embedded lap timer.

Hardware requirements

Follow the instructions in our DIY instruction to create hardware compatible with the firmware.

Build requirements

Install following dependencies:

Building firmware

After that point you can build firmware with following script (change paths and binaries if needed):

#!/bin/bash

set -eo pipefail

rm -rf build

cmake  \
    -DCMAKE_TOOLCHAIN_FILE=cmake/arm-none-eabi.cmake \
    -DTOOLCHAIN_PREFIX=/Users/przemyslawlenart/toolchains/gcc-arm-none-eabi/ \
    -DNRF5_SDK_PATH=/Users/przemyslawlenart/toolchains/nRF5_SDK_15.3.0/ \
    -DNRFJPROG=/usr/local/bin/nrfjprog \
    -DNRF_TARGET=pca10059 \
    -S . -B build/

cmake --build build

Building unit tests

Without specifying toolchain tests will be built:

#!/bin/bash

set -eo pipefail

rm -rf build

cmake  \
    -S . -B build/

cmake --build build

VSCode integration:

Download following plugins:

  • CMake Tools (vector-of-bool.cmake-tools)
  • CMake (twxs.cmake)
  • C/C++ (ms-vscode.cpptools)
  • Cortex Debug (marus25.cortex-debug)

Config files

Please add following config files to .vscode directory and update paths to directories and binaries.

cmake-kits.json - add ARM toolchain

[{
    "name": "ARM-GCC-NONE-EABI",
    "toolchainFile": "cmake/arm-none-eabi.cmake",
    "cmakeSettings": {
        "TOOLCHAIN_PREFIX": "/Users/przemyslawlenart/toolchains/gcc-arm-none-eabi/"
    }
}]

launch.json - configure debugging

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug nRF52840_xxAA",
            "cwd": "${workspaceRoot}",
            "executable": "${workspaceRoot}/build/lap_timer.out",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "device": "nRF52840_xxAA",
            "svdFile": "${config:cmake.configureSettings.NRF5_SDK_PATH}/modules/nrfx/mdk/nrf52840.svd"
        },
        {
            "name": "Debug tests",
            "cwd": "${workspaceRoot}",
            "program": "${workspaceRoot}/build/tests/test_lap_timer",
            "request": "launch",
            "type": "cppdbg",
            "MIMode": "lldb"
        }
    ]
}

settings.json - local settings with variables

{
    "C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools",
    "cortex-debug.armToolchainPath": "/Users/przemyslawlenart/toolchains/gcc-arm-none-eabi/bin",
    "cmake.configureSettings": {
        "NRF5_SDK_PATH": "/Users/przemyslawlenart/toolchains/nRF5_SDK_15.3.0/",
        "NRFJPROG": "/usr/local/bin/nrfjprog",
        "NRF_TARGET": "pca10059",
    },
}