Rename GEMINI.md to AGENTS.md to align with standard AI agent customization and configuration naming conventions. Update the main document heading inside the file to reflect the new filename while preserving all existing project overview, build, and test instructions.
3.3 KiB
OpenThread (openthread)
Project Overview
OpenThread is an open-source implementation of the Thread networking protocol, released by Google. It is designed to be OS and platform-agnostic, with a small memory footprint, making it highly portable. It supports both system-on-chip (SoC) and network co-processor (NCP) designs and is a Thread Certified Component.
The project is primarily written in C and C++, with Python used for scripting and tooling. It uses a variety of build systems, including CMake and GN, and is actively maintained with a strong emphasis on code quality and style, enforced through continuous integration.
Building and Running
The project uses both CMake and GN as build systems. A collection of scripts in the script/ directory simplifies the build and test process.
Prerequisites
- Compilers:
gccandclang - Build tools:
make,ninja-build - Other tools:
python3,yapf(v0.43.0),clang-format(v19),pylint,shellcheck,iwyu
A bootstrap script is provided to install the required tools:
./script/bootstrap
Building with CMake
The project provides CMake presets for easier configuration.
Configure:
cmake --preset simulation
Build:
cmake --build --preset simulation
Building with Scripts
The script/ directory contains several scripts for building the project for different configurations:
- Simulation Build:
script/check-simulation-build - POSIX Build:
script/check-posix-build - ARM Build:
script/check-arm-build - GN Build:
script/check-gn-build
Testing
The project uses CTest for testing.
To run the tests after building with the simulation preset:
ctest --preset simulation
Nexus Tests
Nexus is a test framework that allows simulating multiple OpenThread nodes within a single process, enabling faster and more scalable network simulations.
Build Nexus tests:
top_builddir=nexus_test ./tests/nexus/build.sh
Run all Nexus tests:
top_builddir=nexus_test ./tests/nexus/run_nexus_tests.sh
Run a specific Nexus test:
top_builddir=nexus_test ./tests/nexus/run_nexus_tests.sh <test_name>
For more details, see tests/nexus/README.md.
Development Conventions
Code Style
The project has a strict coding style, which is enforced by the script/make-pretty script. Before submitting a pull request, ensure your code is formatted correctly.
Check code style:
script/make-pretty check
Format code:
script/make-pretty
Key style points:
- Indentation: 4 spaces.
- Naming:
UpperCamelCasefor types (classes, structs, enums), methods, functions.lowerCamelCasefor variables.gprefix for globals,sfor statics,mfor members,afor arguments.
- Comments: Doxygen is used for API documentation.
For more details, see the STYLE_GUIDE.md.
Commits and Pull Requests
The project follows the "Fork-and-Pull" model. All contributions must be accompanied by a Contributor License Agreement (CLA). Pull requests are tested using GitHub Actions, and all checks must pass before merging.
For more details, see the CONTRIBUTING.md.