What is a ZAP?
A ZentriOS Application (aka ZAP) is a custom application that runs inside ZentriOS.
A ZentriOS Application is typically the controller of a product. It contains all the logic (or 'smarts') the product requires.
The ZentriOS App is written in C, compiled natively for the ZentriOS device MCU.
A ZAP leverages all the features of ZentriOS via an Application Programming Interface (API). See Native API reference for full details. A ZAP dynamically links with ZentriOS APIs.
A ZAP also has full access to the commands and variables of the Command API, using the Native API functions for issuing commands.
Loading and Executing a ZAP
Think of a ZAP as a static library that is appended to the end of ZentriOS. The ZAP executes out of the MCU's internal flash along with ZentriOS.
A ZAP is programmed into the platform MCU's internal flash during OTA or by the SDK programmer.
A ZAP always executes on ZentriOS startup.
To temporarily disable the zap from executing on startup, use the variable zap.debug.auto_run.
Structure, Memory and Execution Contexts
A ZAP has a specific structure that must be followed. See ZentriOS App Structure.
Memory is divided into sections, the size of which varies for particular platforms. See Memory Sections.
The logic of a ZAP (the user's application specific functionality) executes in its own thread. ZentriOS applications are event driven. Some events, such as hardware IRQs, RTOS timer events, network events and HTTP requests, are handled in other execution contexts. See Execution Contexts.
The SDK compiles the ZentriOS application with GCC 4.8.2 for the ARM processor. See GCC, the GNU Compiler Collection
A ZAP is heavily optimized to minimize code space usage:
- A ZAP consists largely of application logic and buffers.
- The ZentriOS functionality, C library, peripheral drivers, and specified utilities are provided by ZentriOS
Because a ZAP runs on the same processor as ZentriOS, care should be taken to minimize processor cycles. Network and RTOS may become unstable if starved for processor cycles.
Access to MCU Registers
- As a ZAP is in native C, a ZAP has complete access to the MCU registers.