Skip to content

Contributed by KCrO, curated by Ai-Thinker

Preparation

Get the toolchain

Install some dependencies and tools sudo apt-get install make gcc cmake git ninja-build -y

Get the SDK (WSL proxy setup is a bit troublesome; I'll dig a hole and write a configuration tutorial later)

Refer to the configuration tutorial by 起个名字好难啊: Building the Xiao An Pai Linux development environment from scratch - Compiling and running hello world

To make Linux files easier to manage, first create a folder for the SDK in the user's home directory. Enter mkdir app to create the app directory, then enter it with cd app. Then get the SDK.

html
git clone --recursive https://github.com/Ai-Thinker-Open/AiPi-Open-kits.git
or
git clone --recursive https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git

After the download completes, enter the directory.

html
cd AiPi-Open-Kits/aithinker_Ai-M6X_SDK
then run in order
. install.sh
. export.sh

Compiling and Flashing

Compile

Return to the AiPi-Open-Kits directory and enter the AiPi-Eyes_weather directory.

html
cd ../ && cd AiPi-Eyes_weather

Then, elegantly type those few letters:

html
code .

Wait for Windows' VSCode to start. Then you can edit code with VSCode on Windows. Then compile the code; enter make in the AiPi-Eyes_weather directory.

Flash

Install USBIP

Open PowerShell on Windows and enter: winget install usbipd It will then ask whether you accept the agreement; enter Y and wait for the installation.

Download WSL-USB-GUI

Then find the releases page, download the installer (.msi file) and install it. Since usbipd has been updated, the old GUI no longer works. Download the latest version: left sidebar -> Build -> Pipelines -> Download artifacts. After downloading, install it to map USB devices to WSL. On Linux: According to the Microsoft official guide:

html
sudo apt install linux-tools-generic hwdata
sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/*-generic/usbip 20

After the download completes, you can flash with the make flash command 😄

html
make flash COMX=/dev/ttyACM0

Extra

Since the official SDK has issues when used directly in WSL, you need to enter the SDK directory.

html
cd ~/app/AiPi-Open-Kits/aithinker_Ai-M6X_SDK

Find the project.build file, locate the code shown in the figure below, and delete it. Also, every time WSL restarts, it seems you need to run the export.sh script before compiling again, so you can edit an alias or function in bashrc to call it.

First

html
code ~/.bashrc

Then copy the following code into it.

html
get-aipi-sdk(){
    NowPath=$PWD # get current directory
    cd $HOME/app/Ai-Thinker/AiPi-Open-kits/aithinker_Ai-M6X_SDK/
    . install.sh
    . export.sh
    cd $NowPath
}

Then run

source ~/.bashrc

Now you can use get-aipi-sdk to set up the environment. Of course, this function may not be standard; please point out improvements, experts 😄

References

Thanks to @mcx's tutorial -> About flashing issues under WSL2 (solved)

When will the Markdown editor be able to upload images? I really can't take it anymore!

Have questions?

For other questions, please visit the unified discussion area: Ai-Thinker Discussions

Released under the MIT License. Build Time 2026-09-11 14:52:23