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.

猜你喜欢

转载自blog.csdn.net/qq_29542611/article/details/81350196