ZAP Memory Sections

There are various memory sections of which a programmer must be aware when writing a ZAP.

High Level Memory Sections

At the highest level there are three memory sections:

ZAP Image

Code

Data

Memory Size and Availability by Platform

Memory Optimizations

Since the ZAP code section resides in RAM for the AMW004 and AMW106, numerous optimizations are in place to ensure only essential memory is loaded into RAM.

Note that code optimizations are not required for the NXP-SCCK platform, as the ZAP executes directly from the Code section stored in user flash, is not loaded into RAM and does not consume memory.

Using the application settings feature can save RAM. See Settings and Resources, Memory Saving on AMW004 and AMW106 Platforms.

Parts of the ZAP that are static and rarely used are kept in the ZAP image on extended serial flash and loaded on demand:

Log Strings

Log strings, such as:

ZOS_LOG("This is a log string");

The string is stored in the ZAP image and loaded when the log function is called.

Variables with RO_MEM Attribute

If a global data variable contains this attribute, then the variable's read-only data is stored in the ZAP image and loaded with the API: zn_load_ro_memory()

Example:

RO_MEM uint8_t read_only_buffer[] = { 1, 2, 3, 4 };

zn_load_ro_memory(local_buffer, 4, read_only_buffer, 0);