Stack configuration¶
Most stack features are configured at compile time using C preprocessor (conditional compilation).
Configuration parameters are numbers, such as timeout constants and table sizes, and conditions that switch on or off some source code parts.
- platform: Linux/PC, Linux/ARM, 8051
- hardware: real transceiver or network simulator
- device role: ZC/ZR/ZE
See stack/include/zb_config.h for details.
To switch some branch on/off in zb_config.h, specific macro definitions must be defined in the compiler's command line. These definitions are put into build system files.
Compile-time definitions¶
Compile-time definitions are more actual for Keil build than for a Linux build: they are changed more often. By convention, instead of removing a definition, add 'x' letter to its beginning.
DEBUG – some additional run-time checks. Do not use it for 8051 ZB_PLATFORM_8051_SIM - must be always defined for 8051 KEIL - must be always defined for 8051 C8051F120 – must be defined for UZ2400, must be undefined for UZ2410 ZB_UZ2410 – must be defined for UZ2410, must be undefined for UZ2400 ZB_UZ2410_256 – must be defined for UZ2410 with 256k ROM, must be undefined for UZ2410 with 64k ROM ZB_TRACE_LEVEL=2 – must be defined to switch on trace, must be undefined to exclude trace ZB_NS_BUILD – must defined for simulator build without adapter, must be undefined for HW build ZB_DBG_NO_IDLE – do not go sleep when idle. Must be defined for UZ2410, do not care for UZ2400 ZB_TRAFFIC_DUMP_ON – define it to enable internal traffic dump, undefine to disable traffic dump ZB_TEXT_ONLY_TRACE – if defined, use text-only trace, no traffic dump or win_ com_dump utility usage possible. Depreciated. ZB_ED_ROLE – define it to build ZED, undefine to build ZR or ZC ZB_SECURITY – define it to include security feature. Usually defined. ZB_USE_NVRAM – define it to read some parameters from NVRAM. Usually undefined. ZB_NVRAM_WRITE_CFG – define it to write into NVRAM. Usually undefined.
Example of definition set for UZ2410/256 build for ZC/ZR, with traffic dump and security, without debug trace:
xDEBUG ZB_PLATFORM_8051_SIM KEIL xC8051F120 ZB_UZ2410 ZB_UZ2410_256 xZB_TRACE_LEVEL=2 xZB_NS_BUILD ZB_DBG_NO_IDLE ZB_TRAFFIC_DUMP_ON xZB_TEXT_ONLY_TRACE xZB_ED_ROLE ZB_SECURITY xZB_USE_NVRAM xZB_NVRAM_WRITE_CFG
Also, need additional configuration to switch between UZ2400 and UZ2410 builds in Keil.
For UZ2410/256:- Devices->Mentor Graphics Co->M8051EW
- Target->Code banking->8
- C51->Define → xC8051F120 ZB_UZ2410 ZB_UZ2410_256
- A51->Misc Controls->DEFINE (ZB_UZ2410_256)
- Devices ->Mentor Graphics Co ->M8051EW
- Target->Code banking->unset
- C51->Define → xC8051F120 ZB_UZ2410 xZB_UZ2410_256
- A51->Misc Controls->DEFINE (xZB_UZ2410_256)
- Devices ->Silicon Laborotories, inc. ->C8051F124
- Target->Code banking->4
- C51->Define → C8051F120 xZB_UZ2410 xZB_UZ2410_256
- A51->Misc Controls->DEFINE (xZB_UZ2410_256)
See also file zb_config.h