Skip to content

Overview

An SDK (Software Development Kit) is a complete "development toolbox" that the vendor packages for developers: it contains ready-made example projects (blinking LEDs, UART, networking...), the compiler toolchain, and build scripts. With it, you don't need to set up an environment or write low-level drivers yourself — just modify an example and you can build your own program. All tutorials in this series are developed on this SDK.

In plain words: the SDK is like a "Lego set" that works out of the box — the box comes with blueprints (example projects), assembly tools (compiler), and a manual (docs). Your job is not to make parts from scratch, but to follow the blueprints to build your own creation. This tutorial first introduces what's inside the "set".

This tutorial is based on the official Ai-Thinker SDK (Ai-Thinker-Open/Ai-Thinker-WB2, version release_bl_iot_sdk_1.6.40). Installation steps: Linux Platform and Windows Platform.

🎯Page GoalGet to know the Ai-WB2 SDK: what it can do, what's in the directory, how to obtain it, and how to choose between the Linux/Windows environment routes.
🧰Prerequisites① A computer (Windows or Linux) ② An Ai-WB2 development board (Type-C cable).
🔗RelatedEnvironment setup: [Linux Platform](./get-start_for_Linux) / [Windows Platform](./get-start_for_Windows); after setup, start your first program with [GPIO Output (Blink LED)](../basic/gpio_led).

What is the SDK

Official Repository and Mirror

The SDK is maintained by Ai-Thinker on GitHub; users in China can also use the Gitee mirror — the content is identical:

SourceURLBest For
GitHub Official Repositoryhttps://github.com/Ai-Thinker-Open/Ai-Thinker-WB2Overseas network environments
Gitee Mirror (recommended in China)https://gitee.com/Ai-Thinker-Open/Ai-Thinker-WB2Domestic network, faster

📌 All official example projects referenced by this tutorial series live under the applications/ directory of this repository, with a uniform path format of applications/xxx/xxx/main.c. All tutorial text and code have been verified against the actual content of the official repository.

SDK Directory Structure

After cloning locally, the SDK root directory mainly contains the following parts (using release_bl_iot_sdk_1.6.40 as an example):

Directory/FilePurpose (in plain words)
applications/Official example projects (most important): blinking, UART, Wi-Fi, Bluetooth, cloud platforms... each subdirectory is a complete project that compiles and flashes directly
components/Component library: official functional modules (GPIO, UART, Wi-Fi driver, etc.); your code operates hardware by calling them
toolchain/Compiler toolchain: translates C code into machine code executable by the chip; comes in Linux/, Darwin/ (Apple), and MSYS/ (Windows) versions
make_scripts_riscv/Build scripts: the "automated pipeline" behind the make command; usually no need to touch
tools/Helper tools (serial port, flash scripts, etc.)
version.mkCurrent SDK version number

Development Workflow Overview

Once you have the SDK, the standard workflow for developing a feature is a four-step loop: "edit code → build → flash → check logs":

  1. Enter the example project: cd applications/xxx (each example is an independent directory)
  2. Modify the code: edit main.c in the project
  3. Build: make -j8 turns C code into firmware the board can run (like "turning the design into a physical product")
  4. Flash: make flash downloads the firmware into the chip over USB (like "delivering the product to your hands")
  5. Check logs: the board outputs runtime information over the serial port (like "listening to it report its work")

💡 Every tutorial in this series follows this workflow: hardware wiring → edit code → build → flash → run and verify. So once the environment is set up, the first tutorial GPIO Output (Blink LED) walks you through the entire loop — completing it first is highly recommended.

How to Choose an Environment Route

OptionSystemBest ForOfficial Support
Linux NativeUbuntu/Debian, etc.Users who already run Linux or have dual boot✅ Recommended in the official README
Windows + MSYS2WindowsUsers with only Windows computers✅ Official toolchain ships an MSYS build
Windows + WSLLinux running inside WindowsUsers who want Linux commands without dual boot⚠️ Usable, but official flash scripts need extra adaptation

💡 For Windows this tutorial uses the officially supported MSYS2 route (Windows Platform); for Linux it covers the full official README workflow (Linux Platform). Once either route is set up, the development workflow is identical.


Commands Used in This Tutorial

git clone --recursive(repository-url)

Downloads the SDK repository together with all submodules to your local machine (submodules contain some components; without --recursive the build will fail with missing files).

Parameters:

  • --recursive: recursively fetch submodules, required (otherwise some components are empty)
  • repository-url: the GitHub or Gitee repository URL; Gitee is recommended in China

Return: success if the command exits normally; if it fails midway (network interruption, etc.), simply run it again

make -j8

Builds the firmware in the example project directory (-j8 builds with 8 parallel tasks, faster).

Parameters:

  • -j8: number of parallel build cores; change the number to your CPU core count, e.g. -j4, -j16

Return: ✓ Built target xxx in the output means the build succeeded; on errors, fix the code as suggested and retry

make flash(p=serial-device b=baud-rate)

Flashes the built firmware into the chip over the serial port (hold the EN button on the board to enter download mode before flashing).

Parameters:

  • p=: serial device — /dev/ttyUSB0 style on Linux, COM3 style on Windows; use the one on your computer
  • b=: flash baud rate (transfer speed), officially fixed at 921600

Return: success when the progress bar reaches 100% and reports the flash is complete


FAQ & Troubleshooting

⚠️ Which route should I choose, Linux or Windows?
Cause: each route suits different users; choosing wrong wastes effort
Fix: if you already have a Linux environment (or are willing to dual boot), choose Linux Platform; if you only have Windows, choose Windows Platform. The development workflow is the same after either route is set up

⚠️ git clone is very slow or fails
Cause: GitHub is often slow or disconnects on domestic networks
Fix: use the Gitee mirror https://gitee.com/Ai-Thinker-Open/Ai-Thinker-WB2 — content is identical to GitHub

⚠️ Cloned without --recursive and the build reports lots of missing files
Cause: some SDK components exist as submodules; without fetching them they're empty
Fix: enter the SDK directory and run git submodule update --init --recursive to fetch the submodules

⚠️ Every tutorial starts with cd into applications/xxx — what does that mean?
Cause: cd is the "change directory" command; every example project in the SDK is an independent directory, and the build must run inside the corresponding project directory
Fix: before running make, confirm the terminal's current directory is under the target project (use pwd to check); otherwise you'll get No rule to make target — no build rule found

Self-Check

You pass this page if you can answer three questions: ① Where to get the SDK (GitHub/Gitee links) ② Which directory holds the official example projects (applications/) ③ What the four-step development workflow is (edit code → build → flash → check logs).

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