Introduction to Android CHRE (Context Hub Runtime Environment)

The current ARM handles multiple cores, and the Android system runs on the fastest large core, usually called AP (Application Processor). APs are mainly optimized for performance and experience, and consume relatively high energy consumption. There are also several small cores in the processor. For some operations with small calculations, frequent operations and short-term completion, using small cores can save power. In terms of application development for small cores, the support provided for application development is limited, and it will rely on hardware interfaces, resulting in problems with code versatility and cross-platform. The main applications are sensors, Bluetooth, Wifi, audio, etc.

  • The goal of CHRE (Context Hub Runtime Environment) is to provide a common platform for development on low-power processors and provide standardized APIs.
  • CHRE is an operating environment. The program developed and run based on it is called nanoapp. Nanoapp can be loaded and released flexibly.
  • This function is mainly provided for low-level development such as OEM.
  • It only supports native C/C++ development and can only be accessed by applications trusted by the system.

The following figure is a reference architecture diagram, where PAL=Platform Abstract Layer

CHRE architecture diagram

CHRE is designed around an event-driven architecture, where the main unit of computation is the event passed to the nanoapp event-handling entry point. While the CHRE framework can be multi-threaded, a given nanoapp is never executed in parallel from multiple threads. The CHRE framework interacts with a given nanoapp through one of the three nanoapp entry points ( nanoappStart() , nanoappHandleEvent() , and nanoappEnd() ) or through callbacks provided in previous CHRE API calls, and nanoapps interact with the CHRE framework and through The underlying system of the CHRE API. The CHRE API provides a basic set of functionality and tools for accessing contextual signals, including sensors, GNSS, Wi-Fi, WWAN, and audio, and can be extended with additional vendor-specific functionality for vendor-specific nanoapps use.

The CHRE API is written in accordance with the C99 language standard, and the reference implementation uses a restricted subset of C++11 suitable for resource-constrained applications.

Reference implementation: aosp/system/cher

Guess you like

Origin blog.csdn.net/yinminsumeng/article/details/129463014