Building a Demo Binary and Flashing K210 Using the Kflash Utility - GaloisInc/betaflight GitHub Wiki

This document explains how to compile a program in the Kendryte SDK and flash it to the K210 board. It assumes you have already installed the Kendryte SDK and Kendryte-GNU-Toolchain.

Compiling a basic example

You don’t need to purge the /build folder but I did so for examples sake. Download all or one of the example demo’s from https://github.com/kendryte/kendryte-standalone-demo . Then place it inside the /src folder. With the example code in the /src folder go to your /build folder or wherever you want to create the project. Execute the following command:

cmake .. -DPROJ=gpio_led -DTOOLCHAIN=/opt/kendryte-toolchain/bin && make

Note that the .. is to go up one level to the SDK’s root directory. If you build your program 2 levels deep you would need to cmake ../.. for example.

The following picture visually shows the above inputs and the resulting outputs.

If it builds successfully it will end like this and you will see the following 7 files generated.

Flashing the board.

Now that it has built successfully it’s time to flash the board. For complete instructions go to: https://github.com/kendryte/kflash.py

For Ubuntu 18.04 users the following should suffice.

sudo pip3 install kflash

You can confirm its there by entering kflash with no arguments. Next confirm which USB port the board is connected to by checking your /dev folder. Typing tree /dev/serial will return names that can help in identifying exactly which ports are connected to which.

Once you know which USB port to use run the following command:

kflash -p /dev/ttyUSB0 <binary.bin>

If successful you will see the above output and the board will begin blinking. By default the gpio_led example is set to the pin labeled 24 on the board.

Last note, if done in a Virtual Box make sure you have enabled USB.

⚠️ **GitHub.com Fallback** ⚠️