This chapter focuses on developing firmware using strictly command-line tools.
This chapter will go over using multiple tools like CMake and ninja, it will also go over our command-line flashing tool. There is a separate chapter on Firmware Flashing Tool where you can learn how to install it.
You will need to install a few tools so you will be able to build your project:
All of these have to be in PATH.
To clone the firmware use:
git clone https://github.com/hardwario/twr-skeleton.git --recursivenote
--recursiveflag is needed to clone all submodules as well, mainly SDK submodule.
Open the project in your favorite editor
Make some changes to the code
Run CMake to generate build files:
cmake -B obj/debug . -G Ninja -DTYPE=debug -DCMAKE_TOOLCHAIN_FILE=sdk/toolchain/toolchain.cmake
Run ninja to generate the final firmware binary:
ninja -C obj/debug
Flash firmware to your device with
bcf(you will be prompted to select the device that you want to flash)
If you want to attach the console to your device for some debugging, run
--logflag or just run
bcf flash --log
To clean output so you can compile everything from scratch just run:
ninja -t clean
Repeat these steps until you have the final firmware that you want