Prerequisite
Before proceeding, please set up the Linux development environment first by following the Ubuntu Installation Guide or the WSL Installation Guide (either a VM or WSL works).
Method 1: Use Ai-Thinker Skills to Let AI Install the SDK Automatically (Recommended)
Ai-Thinker Skills are AI assistance capabilities curated by Ai-Thinker. After installation, the AI can clone the SDK, configure the environment, and verify the build for you automatically — no need to run commands manually. If you have never used a terminal before, this is the recommended way to start.
Installing the Ai-M6x development skill coder-ai-m62-m61 is recommended. You can also install all Skills at once.
npx skills add Ai-Thinker-Open/skills --skill coder-ai-m62-m61
# Or install all Skills at once:
npx skills add Ai-Thinker-Open/skillsStart a new session in an AI coding tool that supports Skills (such as Codex or Claude Code) and let the AI set up the SDK for you, for example:
“Please use the coder-ai-m62-m61 skill to set up the Ai-M6x Linux development environment: install dependencies, clone the official Bouffalo SDK, and build the Hello World example.”
Based on the skill guide, the AI will automatically install dependencies, clone the SDK, configure the toolchain, and verify the build. After that, you can move on to flashing and debugging.
About the skill
coder-ai-m62-m61 is a BL616/BL618 series module development guide based on bouffalo_sdk, covering GPIO, UART, SPI, I2C, DMA, and other peripheral programming. Installation and usage: Ai-Thinker Skills | GitHub Repository
Method 2: Manual Environment Setup
Manual setup may look like a lot of commands, but it is really just four things: install the build tools → download the SDK → build your first program → flash it to the board. Each step below explains what the commands do and what to do if something goes wrong — no terminal experience needed.
On the Ubuntu desktop, press Ctrl+Alt+T to open a terminal (in WSL, open Windows Terminal or the Ubuntu app), then run the command below to install the basic tools:
git: downloads code — you will need it to fetch the toolchain and the SDKmake: the build tool that turns source code into firmwareninja: optional, makes compilation fastervim: a text editor for viewing and editing code later
If the terminal asks for a password, type your login password and press Enter (nothing will appear on screen while you type — that is normal).
sudo apt-get install git vim make ninja-build -yThe toolchain translates your code into machine code that the BL616 / BL618 chip can run (its commands start with riscv64-unknown-elf-). First, download it from the official Bouffalo Lab GitHub repository into your home directory (~ is your home directory, similar to the user folder on Windows):
cd ~— go to the home directory, where downloaded files will be storedgit clone https://github.com/bouffalolab/toolchain_gcc_t-head_linux.git— download the toolchain; when it finishes, atoolchain_gcc_t-head_linuxfolder appears in your home directory
The download time depends on your network speed, so be patient. If the second command reports fatal: unable to access, the network cannot reach GitHub — check your connection and try again.
cd ~
git clone https://github.com/bouffalolab/toolchain_gcc_t-head_linux.gitCopy the toolchain to a system directory and add it to your environment variables so the terminal can call it from anywhere:
sudo cp -rf toolchain_gcc_t-head_linux/ /usr/bin— copy it to/usr/bin(requires administrator rights; the terminal will ask for your password; do not omit the trailing slash)echo "export PATH=\"$PATH:/usr/bin/toolchain_gcc_t-head_linux/bin\"" >> ~/.bashrc— append the toolchain’sbindirectory to your shell configuration (this command is long, so use the copy button in the top-right corner of the code block to avoid typos)source ~/.bashrc— apply the configuration immediately; if commands are still not found later, open a new terminal window
sudo cp -rf toolchain_gcc_t-head_linux/ /usr/bin
echo "export PATH=\"$PATH:/usr/bin/toolchain_gcc_t-head_linux/bin\"" >> ~/.bashrc
source ~/.bashrcRun these two commands to check that everything is installed:
make -v: should printGNU Makeand a version numberriscv64-unknown-elf-gcc -v: should printgcc version 10.2.0 (Xuantie-900 ...)
If you see command not found, the toolchain is not active yet: run source ~/.bashrc again, or close the terminal and open a new one.
make -v
riscv64-unknown-elf-gcc -vThe SDK is Bouffalo Lab’s official development kit — it contains chip drivers, the Wi-Fi/BLE protocol stack, and many examples. Download it into your home directory and enter the folder:
git clone https://github.com/bouffalolab/bouffalo_sdk.git— download the official SDK from GitHub (note: the Gitee mirror has not been updated for a long time, so always use the GitHub repository)cd bouffalo_sdk— enter the SDK directory; all later builds happen here
cd ~
git clone https://github.com/bouffalolab/bouffalo_sdk.git
cd bouffalo_sdkBuild the SDK’s built-in helloworld example first to verify the whole environment. Enter the example directory and run the build command:
CHIP=bl616is the chip model: the Ai-M62 (BL616) and the Ai-M61 (BL618) belong to the same series, so both usebl616, the config with the fewest pinsBOARD=bl616dkis the development board type
The first build downloads dependencies and generates the project, so be patient. When it finishes, the firmware is generated under build/build_out/.
cd examples/helloworld
make CHIP=bl616 BOARD=bl616dkConnect the development board to your computer with a USB cable, then follow these steps in order:
- Give your user serial port permissions:
sudo usermod -a -G dialout $USER(takes effect after a reboot or logging back in; if you do not want to reboot, prefix the flash command withsudo) - Check the serial port:
ls /dev/ttyUSB0— if you see output, the board is recognized - Hold the BOOT button (IO2 on the Ai-M61-32S-Kit), briefly press EN/RST and release it, then release BOOT — the board is now in download mode
- Flash the firmware (keep
CHIPthe same as in the build step):make flash CHIP=bl616 COMX=/dev/ttyUSB0— flashing is done when the progress bar completes
If you are using WSL, USB serial ports cannot be accessed directly; use the Windows flashing tool instead.
sudo usermod -a -G dialout $USER
ls /dev/ttyUSB0
make flash CHIP=bl616 COMX=/dev/ttyUSB0After flashing, press the reset button on the board and the program starts running. The terminal cannot show the module log by itself, so install the serial tool picocom and connect to the serial port (baud rate 2000000):
sudo apt-get install picocom— install the serial toolpicocom /dev/ttyUSB0 -b 2000000— connect to the serial port; when you see the log printed by the program, it is running- To exit picocom: press
Ctrl+A, thenQ
sudo apt-get install picocom
picocom /dev/ttyUSB0 -b 2000000FAQ
Cloning the SDK is slow
Use a proxy if GitHub downloads are slow — do not use the Gitee mirror, which is outdated.
Flashing fails or reports errors
Usually the board is not in download mode; hold BOOT/IO2 and briefly press EN/RST again.
Serial port permission denied
Run sudo chmod 777 /dev/ttyUSB0 or flash with sudo, and add your user to the dialout group.
Terminal tips
Press Tab to auto-complete commands; paste with Ctrl+Shift+V (or the middle mouse button).
Have questions?
For any other questions, visit the unified Q&A and discussion board: Ai-Thinker Discussions

