How nrfconnect/asset-tracker-template works
The project is an embedded firmware application for nRF91-based IoT devices, designed as an Asset Tracker Template. It uses the nRF Connect SDK and Zephyr OS, built with a modular framework. The firmware is structured around a main application module (main.c) and several feature-specific modules (located under app/src/modules), each implementing its own state machine via Zephyr’s State Machine Framework and communicating through a message bus (zbus). The architecture emphasizes low-power operation and configurability via Kconfig and CMake.
Main Components
• Main Application: Represent the main module (main.c) as the central hub that ties together all functionalities. This component orchestrates the state machines, message-based interactions, and overall business logic.
• Feature Modules: Create individual blocks for each module (e.g., Button, Cloud, Environmental, FOTA, LED, Location, Network, Power). Note that each module has its own source files, Kconfig entries, and CMake integration.
• Communication Bus: Include a component for the message bus (zbus) that enables inter-module communication. All modules sending or receiving messages should point to this central intermediary.
• Configuration/Build System: Although less active at runtime, indicate the existence of configuration via Kconfig and the build orchestration through CMakeLists.txt. This helps illustrate how the firmware is tailored and constructed.
Architectural Patterns and Design Principles
• Modular Design: Emphasize that each module is isolated, has its specific functionality, and interacts via a common bus.
• Message-based Communication: Clearly illustrate that modules do not directly call each other but instead exchange messages via zbus.
Relevant Technologies and Frameworks
• Zephyr OS and nRF Connect SDK as the underlying platform.
• Zephyr’s State Machine Framework (SMF) for module behavior.
• zbus for message passing.
• CMake and Kconfig for build configuration and compile-time feature selection.