Z-Stack Home Developer's Guide—5. Compilation Flags中文翻译【Z-Stack Home 1.2.0开发文档】
5. 編譯標(biāo)志
5.1強(qiáng)制的編譯標(biāo)志
在所有設(shè)備中都必須使用以下編譯標(biāo)志。編譯 標(biāo)志(也叫做選項(xiàng))能夠生效 在f8wConfig.cfg文件使用 -D 符號(hào),或者在編譯器的預(yù)定義常量部分中(也成為命令行)。讓某個(gè)編譯選項(xiàng)失效,可以在f8wConfig.cfg文件中的-D選項(xiàng)前放//,或者在編譯器預(yù)先定義的常量前面放一個(gè)小的“x” 在 IAR Embedded Workbench 的 Project->options -> C/C++ Compiler -> Preprocessor選項(xiàng)中。
下面這些編譯標(biāo)志在每一個(gè)樣例程序的IAR 工程中都被定義:
- SECURE=1
TC_LINKKEY_JOIN
所有的應(yīng)用程序包含下面這些族,他們?cè)贗AR 的 preprocessor選項(xiàng)中:
ZCL_READ
- ZCL_WRITE
- ZCL_REPORT
- ZCL_EZMODE
- ZCL_BASIC
- ZCL_IDENTIFY
在f8wZCL.cfg文件中可以找到這些編譯標(biāo)志和命令的描述。
請(qǐng)注意,在 IAR Embedded Workbench for 8051,項(xiàng)目的preprocessor選擇中的編譯標(biāo)志將覆蓋文件f8wconfig.cfg中設(shè)置的定義。在IAR Embedded Workbench for ARM (CC2538) 卻是
反方向,f8wConfig.cfg文件將覆蓋項(xiàng)目的preprocessor選項(xiàng)中的編譯標(biāo)志。
5.2每種設(shè)備強(qiáng)制的編譯標(biāo)志
樣例應(yīng)用程序各有自己的強(qiáng)制標(biāo)志。請(qǐng)注意,enabling一個(gè)族將使 enable Send和ProcessIn功能。由這個(gè)應(yīng)用程序決定使用哪一方。(舉個(gè)例子,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可選的編譯標(biāo)志
下面的這些標(biāo)志可以包含在一個(gè) Home Automation 工程的 preprocessor 選項(xiàng)中,每添加一個(gè)來(lái)啟用不同的特性。
在所有的樣例項(xiàng)目中默認(rèn)設(shè)置下列標(biāo)志(出來(lái)其他特殊的):
- HOLD_AUTO_START - 防止設(shè)備在電源啟動(dòng)后自動(dòng)加入網(wǎng)絡(luò),相反它會(huì)讓它等待外部事件。這在默認(rèn)情況下是ZEDs(zigbee endpoint devices)和ZRs(zigbee router)是啟用。默認(rèn)情況下,ZCs(zigbee coordinators)是禁用的。
在所有的SmartRF05EB工程默認(rèn)設(shè)置以下標(biāo)志: - MT_TASK - 啟用MT(Z-Stack’s Monitor and Test Layer)的所用功能,通過串口連接
- MT_APP_FUNC - 啟用MT_APP功能同主處理機(jī)
- MT_SYS_FUNC - 啟用在系統(tǒng)級(jí)別進(jìn)行交互,這是與Z-Tool通信所必需的
ZTOOL_P1 - 與串行接口工具通信所需的
附加的標(biāo)志:
- MT_UTIL_FUNC - 啟用MT_UTIL功能,比如 key press 事件仿真。
- MT_ZDO_FUNC - 啟用MT_ZDO功能,比如 發(fā)送 Mgmt_Permit_Joining_req 命令
POWER_SAVING - 當(dāng)設(shè)備不活躍的時(shí)候,使終端設(shè)備休眠并且節(jié)能。應(yīng)該在任何用電池供電的設(shè)備上定義。
英文原文
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.
總結(jié)
以上是生活随笔為你收集整理的Z-Stack Home Developer's Guide—5. Compilation Flags中文翻译【Z-Stack Home 1.2.0开发文档】的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 九、段总结
- 下一篇: Redis 与 string 相关的常用