.. _sec-migrate-zigbee-specific:

4. Migrate Configuration Header File
------------------------------------

``ti_zstack_config.h`` contains build configuration settings. The values of these defines 
depend on the saved SysConfig GUI settings. Note that GPD examples have a completely 
separate set of configurables compared to all other examples, but they are still 
generated to ``default/sysconfig/ti_zstack_config.h``. Below is a list of the 
correspondence between SysConfig configurable name and ``ti_zstack_config.h`` define names.

Non-GPD examples:

+-----------------------------------+------------------------------------------------+-------------------------------+
| **Submodule**                     | **Configuration**                              | **Definition**                |
+===================================+================================================+===============================+
| Touchlink Commissioning Endpoint  | Touchlink Enabled                              | *N/A*                         |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Touchlink Commissioning Endpoint  | Touchlink Commissioning Mode                   | BDB_TL_[INITIATOR/TARGET]     |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Power Management                  | Power Mode of Operation                        | RFD_RCVC_ALWAYS_ON            |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Power Management                  | Minimal Poll Period (ms)                       | MINIMUM_APP_POLL_RATE         |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Power Management                  | Poll Period (ms)                               | POLL_RATE                     |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Power Management                  | Queued Message Poll Period (ms)                | QUEUED_POLL_RATE              |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Power Management                  | Data Response Poll Period (ms)                 | RESPONSE_POLL_RATE            |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Power Management                  | Rejoin Message Poll Period                     | REJOIN_POLL_RATE              |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Radio                             | Primary Channels                               | DEFAULT_CHANLIST              |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Radio                             | Secondary Channels                             | SECONDARY_CHANLIST            |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Radio                             | Transmit Power                                 | TXPOWER                       |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | PAN ID                                         | ZDAPP_CONFIG_PAN_ID           |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | Extended PAN ID to Extended Address            | SET_EPID_AS_EXT_ADDR          |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | Extended PAN ID                                | ZDAPP_CONFIG_EPID             |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | Default Network Key                            | DEFAULT_KEY                   |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | Distributed Global Link Key                    | DISTRIBUTED_GLOBAL_LINK_KEY   |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | TC Link Key                                    | DEFAULT_TC_LINK_KEY           |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | Network Maximum Device List                    | NWK_MAX_DEVICE_LIST           |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | ZDSECMGR_TC_DEVICE_MAX                         | ZDSECMGR_TC_DEVICE_MAX        |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Network                           | End Device Timeout                             | END_DEV_TIMEOUT_VALUE         |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Routing                  | Route Expiry Time (s)                          | ROUTE_EXPIRY_TIME             |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Routing                  | Network Indirect Message Timeout(s)            | NWK_INDIRECT_MSG_TIMEOUT      |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Routing                  | Max Route Request Entires                      | MAX_RREQ_ENTRIES              |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Packet Sending           | MAC Frame Retries                              | ZMAC_MAX_FRAME_RETRIES        |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Packet Sending           | NWK Data Retries                               | NWK_MAX_DATA_RETRIES          |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Packet Sending           | APS Retries                                    | APSC_MAX_FRAME_RETRIES        |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Packet Sending           | APS ACK Wait Duration (ms)                     | APSC_ACK_WAIT_DURATION_POLLED |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Packet Sending           | MAC Data Poll Retries                          | MAC_DATA_POLL_RETRIES         |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Max Table Sizes          | Group Table Size                               | APS_MAX_GROUPS                |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Max Table Sizes          | Routing Table Size                             | MAX_RTG_ENTRIES               |
+-----------------------------------+------------------------------------------------+-------------------------------+
| Advanced/Max Table Sizes          | Binding Table Size                             | NWK_MAX_BINDING_ENTRIES       |
+-----------------------------------+------------------------------------------------+-------------------------------+

GPD examples:

+------------------+------------------------------+-----------------------+
| **Submodule**    | **Configuration**            | **Definition**        |
+==================+==============================+=======================+
| Radio            | Channel                      | GPD_CHANNEL           |
+------------------+------------------------------+-----------------------+
| Radio            | TX Power                     | TXPOWER               |
+------------------+------------------------------+-----------------------+
| Network          | Green Power Device Type      | DEVICE_ID             |
+------------------+------------------------------+-----------------------+
| Network          | Green Power Device ID Type   | GPD_APP_ID            |
+------------------+------------------------------+-----------------------+
| Network          | Green Power Device ID        | GPD_ID                |
+------------------+------------------------------+-----------------------+
| Security         | Data Frame Security Level    | GP_SECURITY_LEVEL     |
+------------------+------------------------------+-----------------------+
| Security         | Data Frame Security Key Type | EXT_OPT_KEY_TYPE      |
+------------------+------------------------------+-----------------------+
| Security         | Data Frame Security Key      | GP_SECURITY_KEY       |
+------------------+------------------------------+-----------------------+
| Advanced         | Data Frame Retries           | GPDF_FRAME_DUPLICATES |
+------------------+------------------------------+-----------------------+
| Advanced         | Auto-commissioning           | AUTO_COMMISSIONING    |
+------------------+------------------------------+-----------------------+
| Advanced         | Radio Receive After Transmit | RX_AFTER_TX           |
+------------------+------------------------------+-----------------------+
| Advanced         | Sequence Number Capability   | SEQUENCE_NUMBER_CAP   |
+------------------+------------------------------+-----------------------+

SysConfig should already come with the standard defaults for both TI-Driver 
and Z-Stack configurations.
Once all values have been defined inside of SysConfig, building the project will generate the ``ti_zstack_config.h`` file.
When you have eventually built the project with SysConfig enabled, 
you will find the SysConfig-built version of ``ti_zstack_config.h`` in the output 
``default/sysconfig`` folder of the project.

.. note::
   Currently, manually changing the CCS/IAR project creation files (projectspec/ewp, 
   etc.) could have unseen side effects.  An easier path may be to import one 
   of the Z-Stack SysConfig examples and migrate your application accordingly.
