This repository provides a common application-development layer for multiple Ai-Thinker module platforms. It keeps application code under application/, abstracts chip and RTOS differences under adt/, and delegates final firmware generation to the selected vendor SDK under os/.
The top-level build integration currently contains adapters for BL602, BL616, BL618, and LN882H. Other vendor-named directories may exist in individual applications, but their presence alone does not mean that the top-level build supports or validates them.
| Path | Purpose |
|---|---|
application/<name>/src/ |
Portable application code. Each application normally defines aiio_main. |
application/<name>/vendor/<chip>/ |
Per-application Kconfig and vendor build configuration. |
adt/adt_os/ |
Common API, core components, platform ports, and the firmware-to-application startup bridge. |
build/<chip>_make/ |
Chip-specific source assembly, vendor build invocation, cleanup, and artifact collection. |
os/<chip>_sdk_lts/ |
Vendor SDK and toolchain integration. |
tmp/ |
Generated, assembled build tree. Do not treat it as an application source directory. |
out/<chip>/<application>/ |
Firmware binaries, ELF files, and map files produced by a build. |
tools/ |
Environment, configuration, formatting, documentation, and maintenance scripts. |
See Code entry and Architecture for the traced startup and build flows.
- Linux, or WSL2 with a Linux distribution.
build.shintentionally rejects non-Linux environments. - Bash and Git.
- The packages installed by
./build.sh environmentwhen a clean environment is used. Review that command before running it: it usessudo apt-getandpip, and therefore changes the host environment and needs network access. - Enough disk space for the included vendor SDKs, extracted toolchains,
tmp/, andout/.
Run commands from the repository root:
./build.sh help
./build.sh versionConfigure and build the smallest reference application for BL602:
./build.sh bl602 demo defconfig
./build.sh bl602 demo cn debugInteractive configuration is also available:
./build.sh bl602 demo menuconfigThe build command has this form:
./build.sh <chip> <application> <country> <level>
<chip>: a chip with bothos/<chip>_sdk_lts/andbuild/<chip>_make/; currentlybl602,bl616,bl618, orln882h.<application>: a directory name belowapplication/.<country>:cnoren.<level>:debug,debug_tmp,debug_ram, orrelease.
Successful builds place artifacts in out/<chip>/<application>/bin, elf, and map.
The vendor startup macro expands MAIN_ENTRY() in adt/adt_os/adapter_main/main/aiio_main_init.c. That bridge initializes the selected chip, logging, and manufacturer data, creates the aiio_main task, and starts the scheduler. Applications provide that task in application/<name>/src/main.c.
The reference entry is:
vendor startup
-> MAIN_ENTRY()
-> chip/log/manufacturer initialization
-> aiio_main task creation
-> application/demo/src/main.c:aiio_main()
# Clean every output
./build.sh clean
# Clean one application
./build.sh bl602 demo clean
# Regenerate interface documentation
./build.sh docsUse the maintenance commands carefully:
./build.sh updatesynchronizes managed source areas and may overwrite local changes../build.sh resetdeletes managed directories, runsgit reset --hard, and then updates them. Commit or back up work first.- Build configuration and toolchain preparation can extract archives and modify generated/vendor work trees.
Repository structure, startup flow, build routing, shell syntax, help/version dispatch, bilingual document pairs, and local document links are covered by the recorded checks in Validation.
A complete firmware build, flashing, boot test, peripheral test, wireless test, and hardware regression were not completed by that documentation review. Do not interpret a documentation check as device validation.
error: unkonw os: run the build from Linux or WSL2, not directly from PowerShell or Command Prompt.- No adaptation for a chip/application: confirm the matching
os/<chip>_sdk_lts,build/<chip>_make,application/<name>, andapplication/<name>/vendor/<chip>paths exist. - Missing configuration: run
defconfigormenuconfigbefore the four-argument build command. - Toolchain extraction or package errors: verify archive integrity, available disk space, permissions, and the prerequisites listed above.
- Unexpected changes after update/reset: restore from your own commit or backup; these commands are intentionally destructive.
Keep reusable application logic in application/<name>/src, platform-specific configuration in application/<name>/vendor/<chip>, and chip adaptation code in adt. Before opening a change:
- Build at least one affected chip/application pair from a clean configuration.
- Record the exact command, warnings, output artifacts, and untested hardware scope.
- Update both English
.mdand Chinese.zh.mddocuments when behavior changes. - Avoid committing generated
tmp/orout/content unless the repository policy explicitly requires it.
This repository is distributed under the Apache License 2.0. See license.txt.