Using CLI

Note

In order to use the KNoT CLI, it is necessary to fulfill the requirements.

There are many commands that you can call when using the knot script (cli.py). Some of their functions are:


Set default target board

  • You can set the default target board with the command:

$ knot board {BOARD}

Note

Currently, KNoT support dk (nrf52840_pca10056) or dongle (nrf52840_pca10059) board. Replace {BOARD} with one of them.


Set external OpenThread path

To avoid downloading the OpenThread repo on every new build, set an external path.

  • Clone Openthread Github repository:

$ git clone https://github.com/openthread/openthread.git
  • Checkout to the compatible hash and set it as default:

$ cd openthread
$ git checkout -b knot_hash f9d757a161fea4775d033a1ce88cf7962fe24a93
$ knot ot-path `pwd`

Clear project and building

Warning

The build command must be run from an application folder.

The user can delete old building files before compiling again.

Note

This is especially useful when the project had important changes like different target board or dependency repository.

  • Clear old files and compiling:

$ knot make --clean

Compile for your target board

Warning

The build command must be run from an application folder.

Currently, KNoT supports dk (nrf52840_pca10056) or dongle (nrf52840_pca10059) board. Replace {BOARD} by one of them.

$ knot make -b {BOARD}

Note

If you already set the default board is not necessary compile with -b option.


Use an external DTS overlay file

Warning

The build command must be run from an application folder.

It is possible to use an external DTS overlay file on the project by passing the absolute file path.

$ knot make --dts_ovl_path {PATH}

Note

If the application folder has an overlay file this command will ignore it.


Flash board when done

Warning

The build command must be run from an application folder.

The user can flash the board just after building it.

  • Flash board after building:

$ knot make --flash

Note

This option also flashes the bootloader when targeting the Dongle.


Flash bootloader

When using the DK, it’s possible for the board to be flashed without the bootloader. To fix that, the user should flash it separately.

  • Flash bootloader to board:

$ knot mcuboot

Note

This option also erases the main app when targeting the Dongle.


Other commands

These and the other commands are described when using the help command:

$ knot --help