Z-Stack Home Developer's Guide—5. Compilation Flags中文翻译【Z-Stack Home 1.2.0开发文档】
5. 編譯標志
5.1強制的編譯標志
在所有設備中都必須使用以下編譯標志。編譯 標志(也叫做選項)能夠生效 在f8wConfig.cfg文件使用 -D 符號,或者在編譯器的預定義常量部分中(也成為命令行)。讓某個編譯選項失效,可以在f8wConfig.cfg文件中的-D選項前放//,或者在編譯器預先定義的常量前面放一個小的“x” 在 IAR Embedded Workbench 的 Project->options -> C/C++ Compiler -> Preprocessor選項中。
下面這些編譯標志在每一個樣例程序的IAR 工程中都被定義:
- SECURE=1
TC_LINKKEY_JOIN
所有的應用程序包含下面這些族,他們在IAR 的 preprocessor選項中:
ZCL_READ
- ZCL_WRITE
- ZCL_REPORT
- ZCL_EZMODE
- ZCL_BASIC
- ZCL_IDENTIFY
在f8wZCL.cfg文件中可以找到這些編譯標志和命令的描述。
請注意,在 IAR Embedded Workbench for 8051,項目的preprocessor選擇中的編譯標志將覆蓋文件f8wconfig.cfg中設置的定義。在IAR Embedded Workbench for ARM (CC2538) 卻是
反方向,f8wConfig.cfg文件將覆蓋項目的preprocessor選項中的編譯標志。
5.2每種設備強制的編譯標志
樣例應用程序各有自己的強制標志。請注意,enabling一個族將使 enable Send和ProcessIn功能。由這個應用程序決定使用哪一方。(舉個例子,SampleSwitch 使用 ZCL_ON_OFF cluster的 Send 方,而SampleLight使用ZCL_ON_OFF Cluster的 ProcessIn方)。
SampleLight:
- ZCL_GROUPS
- ZCL_SCENES
- ZCL_ON_OFF
SampleSwitch:
- ZCL_ON_OFF
SampleDoorLock:
- ZCL_GROUPS
- ZCL_SCENES
SampleDoorLockController:
- ZCL_GROUPS
- ZCL_SCENES
- ZCL_DOORLOCK
SampleThermostat:
- ZCL_ON_OFF
- ZCL_HVAC_CLUSTER
SampleTemperatureSensor:
- ZCL_TEMPERATURE_MEASUREMENT
SampleHeatingCoolingUnit:
- ZCL_ON_OFF
- ZCL_HVAC_CLUSTER
5.3可選的編譯標志
下面的這些標志可以包含在一個 Home Automation 工程的 preprocessor 選項中,每添加一個來啟用不同的特性。
在所有的樣例項目中默認設置下列標志(出來其他特殊的):
- HOLD_AUTO_START - 防止設備在電源啟動后自動加入網絡,相反它會讓它等待外部事件。這在默認情況下是ZEDs(zigbee endpoint devices)和ZRs(zigbee router)是啟用。默認情況下,ZCs(zigbee coordinators)是禁用的。
在所有的SmartRF05EB工程默認設置以下標志: - MT_TASK - 啟用MT(Z-Stack’s Monitor and Test Layer)的所用功能,通過串口連接
- MT_APP_FUNC - 啟用MT_APP功能同主處理機
- MT_SYS_FUNC - 啟用在系統級別進行交互,這是與Z-Tool通信所必需的
ZTOOL_P1 - 與串行接口工具通信所需的
附加的標志:
- MT_UTIL_FUNC - 啟用MT_UTIL功能,比如 key press 事件仿真。
- MT_ZDO_FUNC - 啟用MT_ZDO功能,比如 發送 Mgmt_Permit_Joining_req 命令
POWER_SAVING - 當設備不活躍的時候,使終端設備休眠并且節能。應該在任何用電池供電的設備上定義。
英文原文
5. Compilation Flags
5.1 Mandatory Compilation Flags
The following compilation flags are mandatory across all devices. Compilation flags (also called options) can be
enabled using a –D in the f8wConfig.cfg, or in the compiler’s predefined constants section (also called command-
line). To disable the option, either put a // in front of the –D, or put a small “x” in front of the compiler’s predefined
constant in the IAR Embedded Workbench preprocessor section of the project (e.g. xNV_RESTORE).
These compilation flags are defined in the preprocessor section on each sample application IAR project:
? SECURE=1
? TC_LINKKEY_JOIN
All applications include these clusters and are defined in the IAR Workbench preprocessor section:
? ZCL_READ
? ZCL_WRITE
? ZCL_REPORT
? ZCL_EZMODE
? ZCL_BASIC
? ZCL_IDENTIFY
A description of the flags and commands for the specific cluster can be found in f8wZCL.cfg file.
Note that in IAR Embedded Workbench for 8051, the definitions in the project’s preprocessor defined symbols list
will override definitions set in the file f8wConfig.cfg. In IAR Embedded Workbench for ARM (CC2538) works the
opposite way, the definitions in f8wConfig.cfg file will override the project’s preprocessor defined symbols.
5.2 Mandatory Compilation Flags Per Device
The sample applications each have their own mandatory flags. Note that enabling a cluster will enable both the Send
and ProcessIn functions. It is up to the application to decide which side to use (for example, the SampleSwitch uses
the Send side of the ZCL_ON_OFF cluster, whereas the SampleLight uses the ProcessIn side of the ZCL_ON_OFF
Cluster).
SampleLight:
? ZCL_GROUPS
? ZCL_SCENES
? ZCL_ON_OFF
SampleSwitch:
? ZCL_ON_OFF
SampleDoorLock:
? ZCL_GROUPS
? ZCL_SCENES
? ZCL_DOORLOCK
SampleDoorLockController:
? ZCL_GROUPS
? ZCL_SCENES
? ZCL_DOORLOCK
SampleThermostat:
? ZCL_ON_OFF
? ZCL_HVAC_CLUSTER
SampleTemperatureSensor:
? ZCL_TEMPERATURE_MEASUREMENT
SampleHeatingCoolingUnit:
? ZCL_ON_OFF
? ZCL_HVAC_CLUSTER
5.3 Optional Compilation Flags
The following flags may be included in a Home Automation project’s options preprocessor defined symbols list,
each one adding code to enable different feature.
The following flags are set by default on all the sample projects (unless otherwise specified):
? HOLD_AUTO_START – prevents the device from automatically trying to join a network after power-up
when Factory New, and causes it to wait for an external event instead. This is enabled for ZEDs and ZRs
by default. It is disabled for ZCs by default (that is, ZigBee Coordinators starts automatically).
The following flags are set by default on all the SmartRF05EB projects:
? MT_TASK – enables any MT functionality, via serial link.
? MT_APP_FUNC - enables MT_APP functionality for communication with a host processor.
? MT_SYS_FUNC – enables interaction at system level, required for communicating with Z-Tool.
? ZTOOL_P1 – required for communicating with serial interface tool.
Additional flags:
? MT_UTIL_FUNC - enables MT_UTIL functionality, e.g. key press events emulation.
? MT_ZDO_FUNC – enables MT_ZDO functionality, e.g. sending Mgmt_Permit_Joining_req command.
? POWER_SAVING – enables an end-device to sleep and conserve power, when inactive. Should be
defined on any battery-powered device.
總結
以上是生活随笔為你收集整理的Z-Stack Home Developer's Guide—5. Compilation Flags中文翻译【Z-Stack Home 1.2.0开发文档】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 九、段总结
- 下一篇: Z-Stack Home Develop