Development With Command Line Tools
If you want to develop using a GUI tool, please visit About HARDWARIO Code or TOWER VSCode Extension chapter.
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.
Installation
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.
- Windows
- Linux
- macOS
Development cycle
First, you need to clone some firmware from our GitHub. For a blank start, there is the twr-skeleton firmware available
To clone the firmware use:
git clone https://github.com/hardwario/twr-skeleton.git --recursive
noteThe
--recursive
flag 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)bcf flash
If you want to attach the console to your device for some debugging, run
bcf
with--log
flag or just runbcf log
:bcf flash --log
OR
bcf 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