6.3. Compilation Flags

Compile-time flags, also known as preprocessor symbols, enable a programmer to compile the same source code conditionally to yield different run-time behaviours. Thus, the same code can be compiled to give a binary for either PAN coordinator, FFD or RFD. Options can be configured. For example, RFD code can be compiled to enable/disable certain options or sensor interfaces depending on what sensors are present on the RFD.

Table 1 gives typical compilation flags for a production version of a device. This enables sensing of battery voltage and temperature on RFD via RFD_APP_0. Table 2 gives a complete summary of all flags in the system.

Table 1: Typical Compilation Flags for Device Programming
Device Description
PAN Coordinator AODVL_PATH_DISC_DISABLED AODVL_RT_TBL_IN_MRU_ORDER CC2520_DFLT_LPM_MODE_LPM2 CPU_ACTIVE_CLOCK_IN_MHZ=8 ECLIPSE_IDE EXT_EEPROM_EN GPIO_MGMT_ENA GW_ENA PAN_COORD PLTFRM_AT24MAC602_ENA PLTFRM_UART_ENA RADIO_CC2520 TIMER_CLK_ACLK WISENSE_HW_REV_6
FFD AODVL_PATH_DISC_DISABLED AODVL_RT_TBL_IN_MRU_ORDER CC2520_DFLT_LPM_MODE_LPM2 CPU_ACTIVE_CLOCK_IN_MHZ=8 DEV_TYPE_FFD ECLIPSE_IDE EXT_EEPROM_EN GPIO_MGMT_ENA PLTFRM_AT24MAC602_ENA RADIO_CC2520 TIMER_CLK_ACLK WISENSE_HW_REV_6
RFD AODVL_PATH_DISC_DISABLED AODVL_RT_TBL_IN_MRU_ORDER CC2520_DFLT_LPM_MODE_LPM2 CPU_ACTIVE_CLOCK_IN_MHZ=8 DEV_TYPE_RFD ECLIPSE_IDE EXT_EEPROM_EN GPIO_MGMT_ENA PLTFRM_AT24MAC602_ENA PLTFRM_ON_CHIP_TEMP_SENSOR_ENA PLTFRM_ON_CHIP_VCC_SENSE_ENA PLTFRM_UART_ENA RADIO_CC2520 RFD_APP_0 TIMER_CLK_ACLK WISENSE_HW_REV_6
Table 2: Summary of Compilation Flags
Flag Description
ADP_STATS_ENA Enable collection of ADP layer statistics, which is useful during debugging.
AODVL_PATH_DISC_DISABLED Gateway can request discovery of a path to a specific node for which route has been discovered. To allow path discovery, this flag has to be defined.
AODVL_RT_TBL_IN_MRU_ORDER Order the routing table in the Most Recent Update order.
APP_STATS_ENA Enable collection of APP layer statistics, which is useful during debugging.
BOARD_TEST Enable board testing, which is useful during debugging.
CC2520_DFLT_LPM_MODE_LPM1

Compile for operation in LPM1 low power mode for sleep. Either this flag or CC2520_DFLT_LPM_MODE_LPM2 must be defined. Note that this flag controls sleep mode for the radio. Microcontroller is programmed to sleep in LPM3. In LPM1 mode,

  • CPU is disabled.
  • ACLK and SMCLK remain active.
  • MCLK is disabled.
  • DCO’s dc generator is disabled if DCO not used in active mode.
CC2520_DFLT_LPM_MODE_LPM2

Compile for operation in LPM2 low power mode for sleep. Either this flag or CC2520_DFLT_LPM_MODE_LPM1 must be defined. Note that this flag controls sleep mode for the radio. Microcontroller is programmed to sleep in LPM3. In LPM2 mode,

  • CPU is disabled.
  • ACLK remains active.
  • MCLK and SMCLK are disabled.
  • DCO’s dc generator remains enabled.
CC2520_INTR_STATS_ENA Enable collection of CC2520 interrupt statistics, which is useful during debugging.
CC2520_STATS_ENA Enable collection of CC2520 statistics, which is useful during debugging.
CHAN_HOP_TEST Perform a channel hop test, which is useful during debugging. Channel Hopping refers to a smart feature whereby nodes dynamically keep moving across a set of frequencies for better overall performance. Note that channel hopping is currently not supported.
CPU_ACTIVE_CLOCK_IN_MHZ MSP430 can operate at different clock speeds: 1, 8, 12 or 16 MHz. For now, the MSP always runs at a fixed clock rate when in active mode. A value of 8 MHz is recommended.
CSMA_TEST Perform CSMA channel access test, which is useful during debugging. CSMA or Carrier Sense Multiple Access is the method by which multiple nodes attempt to gain access to the wireless channel for the purpose of transmission.
DEV_TYPE_FFD Compile for a Full Function Device (FFD). When this is defined, it is not allowed to define DEV_TYPE_RFD, PAN_COORD, PAN_COORD_NO_MESH, GW_ENA or RFD_CONT_TX_TEST. Likewise, RFD application enabling flags should not be used.
DEV_TYPE_FFD_NO_MESH It is possible to compile an FFD without support for mesh routing. In such a case, this flag can be defined. This is applicable only when DEV_TYPE_RFD is defined.
DEV_TYPE_RFD Compile for a Reduced Function Device (RFD). When this is defined, it is not allowed to define DEV_TYPE_FFD, PAN_COORD, PAN_COORD_NO_MESH, or GW_ENA. Likewise, RFD application enabling flags should not be used.
DIS_ENA Device Interface Specification (DIS) is enabled by defining this flag. If not, data is exchanged between nodes in user-defined proprietary encoding methods.
ECLIPSE_IDE If Eclipse IDE is used as opposed to IAR or CCS, then this flag must be defined. Specifically, interrupt service routines (ISR) are defined differently when open source mspgcc toolchain is used.
EKMC160111X_STATS_ENA Enable collection of sensor statistics, which is useful during debugging.
EXT_EEPROM_EN The MSP430 does not have any on-chip EEPROM. WiSense platform integrates two EEPROM devices, either of which could be soldered on the MSP430 controller board. These are AT24C01C or AT24MAC602. This flag enables external EEPROM. When this is enabled, either of PLTFRM_AT24C01C_ENA or PLTFRM_AT24MAC602_ENA must be enabled according to hardware configuration.
FORCE_HOP This may be used for the purpose of testing routing functionality. When defined, routing through intermediate nodes will be forced even when a single hop is sufficient to reach the destination.
GPIO_MGMT_ENA This flag is useful to simplify the management of devices on GPIO.
GW_ENA This flag enables gateway functionality. A gateway is typically the same node as the PAN coordinator. Hence, this must be defined along with PAN_COORD. This flag should not be defined if code is being compiled for RFD or FFD.
IEEE_802_15_4e This enables IEEE_802.15.4 functionality at MAC layer. It is mandatory to define this flag.
IPv4_SUPPORT_ENA This enables IPv4 support so that all nodes in the PAN can be address using IP version 4 addresses. To conserve power on battery-powered nodes, it is recommended to use only short addresses and not enable IP addressing.
MAC_DEBUG This flag is useful for debugging the MAC layer.
MAC_IFS_DELAY_DISABLED This relates to a rather low-level functionality of the MAC known as Inter- Frame Spacing (IFS). This flag disables IFS delay.
MAC_SEC_ENA Enable security at MAC layer.
MAC_STATS_ENA Enable collection of MAC statistics, which is useful during debugging.
MP3V5050GP_STATS_ENA Enable collection of sensor statistics, which is useful during debugging. This flag is applicable only when PLTFRM_MP3V5050GP_ENA is defined.
MP3V5050GP_UT For the purpose of debugging, enable test code of MP3V5050GP. This is applicable only when PLTFRM_MP3V5050GP_ENA is defined.
MPU6050_UT For the purpose of testing, enable test code of MPU6050. This is applicable only when PLTFRM_MPU6050_SENSOR_ENA is defined.
NC_STATS_ENA Enable collection of Network Coordinator (NC) statistics, which is useful during debugging. This is applicable only when PAN_COORD is defined.
NM_STATS_ENA Enable collection of Node Manager (NM) statistics, which is useful during debugging.
PAN_COORD Compile for a PAN Coordinator. When this is defined, it is not allowed to define DEV_TYPE_FFD, DEV_TYPE_RFD or RFD_CONT_TX_TEST. Likewise, RFD application enabling flags should not be used.
PAN_COORD_NO_MESH It is possible to compile the coordinator without support for mesh routing. In such a case, this flag can be defined. This is applicable only when PAN_COORD is defined.
PLTFRM_AD7797_ENA Enable platform code for interfacing to AD7797.
PLTFRM_AT24C01C_ENA Enable platform code for interfacing to EEPROM AT24C01C.
PLTFRM_AT24MAC602_ENA Enable platform code for interfacing to EEPROM AT24MAC602.
PLTFRM_AT24MAC602_TEST_ENA For the purpose of debugging, enable test code of EEPROM AT24MAC602.
PLTFRM_BATTV_SENSE_ENA Enable platform code for interfacing to battery voltage sensor.
PLTFRM_EKMC160111X_ENA Enable platform code for interfacing to PIR motion sensor EKMC160111X.
PLTFRM_LM75B_TEMP_SENSOR_ENA Enable platform code for interfacing to temperature sensor LM75B.
PLTFRM_LM75B_TEMP_SENSOR_TEST_ENA For the purpose of debugging, enable test code of temperature sensor LM75B. This applicable only when PLTFRM_LM75B_TEMP_SENSOR_ENA is defined.
PLTFRM_LOG_ENA Enable logging for the purpose of debugging.
PLTFRM_MP3V5050GP_ENA Enable platform code for interfacing to pressure sensor MP3V5050GP.
PLTFRM_MPU6050_SENSOR_ENA Enable platform code for interfacing to gyroscope/accelerator MPU6050.
PLTFRM_ON_CHIP_TEMP_SENSOR_ENA Enable platform code for interfacing to MSP430 on-chip temperature sensor.
PLTFRM_ON_CHIP_VCC_SENSE_ENA Enable platform code for interfacing to MSP430 on-chip battery voltage sensor.
PLTFRM_REED_SWITCH_ENA Enable platform code for interfacing to reed switch.
PLTFRM_SFH_7773_SENSOR_ENA Enable platform code for interfacing to ambient light and proximity sensor SFH7773.
PLTFRM_STATS_ENA Enable collection of platform statistics, which is useful during debugging.
PLTFRM_TMP102_TEMP_SENSOR_ENA Enable platform code for interfacing to temperature sensor TMP102.
PLTFRM_TMP102_UT_ENA For the purpose of testing, enable test code of temperature sensor TMP102. This is applicable only when PLTFRM_TMP102_TEMP_SENSOR_ENA is defined.
PLTFRM_TSL45315_ENA Enable platform code for interfacing to ambient light sensor TSL45315.
PLTFRM_UART_ENA Enable UART code. This is applicable only when PAN_COORD is defined and is associated with gateway functionality.
RADIO_CC2520 This enables code particular to CC2520. It is mandatory to define this flag.
REED_SWITCH_STATS_ENA Enable collection of sensor statistics, which is useful during debugging.
RFD_APP_0 RFD_APP_1 RFD_APP_2 RFD_APP_3 RFD_APP_4 RFD_APP_5 RFD_APP_6 RFD_APP_7 RFD_APP_8 RFD_APP_9 WiSense platform code includes some RFD applications as examples. Only one RFD application can be enabled at any one time. This is sufficient because a single application can handle multiple sensors. One of these flags must be defined to enable that specific RFD application. These flags are applicable only when RFD_APP is defined.
RFD_CONT_TX_TEST This is to perform continuity test on RFD. This is applicable only when RFD_APP is defined.
TIMER_CLK_ACLK This enables use of ACLK for timing. ACLK running at 32 kHz implies that one cycle is 31.25 microseconds. When not defined, SMCLK is used for timing.
TXONCCADBG This flag is typically used for debugging the radio.
UART_BAUD_RATE_115200 UART_BAUD_RATE_56000 UART_BAUD_RATE_9600 When UART functionality is enabled using PLTFRM_UART_ENA, it is necessary to define the baud rate, or the rate at which communication can happen over the UART interface. This can be either 115.2, 56 or 9.6 kbps. It is mandatory to define one of these since no default value is defined in code. If multiple rates are defined unintentionally, the lowest defined one is used.
UART_STATS_EN When UART functionality is enabled using PLTFRM_UART_ENA, this flag enables collection of statistics for the purpose of debugging.
UART_TX_INT_ENA When UART functionality is enabled using PLTFRM_UART_ENA, this flag enables interrupts on the transmit path.
WISENSE_HW_REV_2 WISENSE_HW_REV_3 WISENSE_HW_REV_4 WISENSE_HW_REV_5 WISENSE_HW_REV_6 These flags select code that is suitable for the hardware version of the node to be programmed. The common value to define is WISENSE_HW_REV_6. Others pertain to older versions used during prototyping.