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
A Zap is loaded into the non-volatile memory (NVM) of a ZentriOS enabled device.
ZentriOS is then configured or commanded to load the Zap and begin executing it.
See the zap_run command, and the zap.auto_run variable.
From there the Zap takes over and controls the ZentriOS enabled device.
Execution Details for Specified Platforms
- On the AMW004 and AMW106 platforms, a Zap executes out of ARM processor's RAM.
- On the NXP-SCCK platform, a Zap executes out of Flash bank B of the LPC43S67.
For more details see Memory Sections.
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.
Compiler
The SDK compiles the ZentriOS application with GCC 4.8.2 for the ARM processor. See GCC, the GNU Compiler Collection
Optimization
- 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
- For the AMW004 and AMW106 - the ZOS_LOG() message strings are loaded from serial flash
(i.e. they're not loaded into RAM with the rest of the executable code).
- 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
See also Memory Optimizations.
Access to MCU Registers
- As a Zap is in native C, a Zap has complete access to the MCU's registers