8.3.2 Project Options, Configurations, and Defined Symbols
Every project has a set of options, including settings for the compiler, linker, debugger, and so forth.
To view the project options, do the following:
- Right-click on the project name at the top of the file list.
- Select Options… (See Figure 8-2.)
After clicking Options…, a window will pop-up displaying the project options. You might need to have a few different configurations of options for different setups, like when using multiple hardware platforms. The IAR lets you create configurations. You can select these configurations through the drop-down menu in the top of the Workspace pane, see Figure 8-2.
The default configuration in the SimpleBLEPeripheral project is the CC2540DK-MINI Keyfob configuration, which is targeted toward the keyfob hardware platform included with the CC2540/41DK mini development kit. Alternatively, CC2540 is optimized for the SmartRF05 + CC2540 EM included with the full development kit. Other configurations include a 128-KB part, an OAD, and so forth:
Compiler preprocessor definitions or symbols are important settings when building a project, see Figure 8-4.
You can find and set these values by doing the following:
- Click the C/C++ Compiler category on the left.
- Click the Preprocessor tab on the right:
When preceded by an x, the symbol has no valid definition and can be considered disabled. Removing the preceding x to restore the proper name of the symbol reenables the feature or definition.
Symbols can be defined in configuration files, which are included when compiling. The Extra Options tab under the compiler settings let you set up the configuration files to be included. You must include the config.cfg file with every build because it defines some required universal constants. The buildConfig.h file included with the software development kit defines the appropriate symbols for the project, see Figure 8-5.
Select the Use command line option box through the Extra Options tab shown in Figure 8-6 to supply the compiler with additional options.
The Bluetooth Low Energy protocol stack and software uses the following symbols. You can find them in the sample project:
Symbols Mandatory for Bluetooth Low Energy Stack
- INT_HEAP_LEN – This symbol defines the size of the heap used by the OSAL Memory Manager in bytes, see Section 3.4. The default value in the sample project is 3072. You can increase this value if the application requires additional heap memory. If this value is increased too much, you may exceed the RAM limit. If the application requires additional memory for local variables, you may need to increase this value. The memory set aside for the heap shows up in the map file under the OSAL_Memory module. For more information on the map file, see section Section 8.3.4.
- HALNODEBUG – Define this symbol for all projects to disable HAL assertions.
- OSAL_CBTIMER_NUM_TASKS – This symbol defines the number of OSAL callback timers that you can use. The Bluetooth Low Energy protocol stack uses the OSAL callback timer. You must define this value as either 1 or 2 (a maximum of two callback timers are allowed). For applications without any callback timers such as the sample application, define this value as 1.
- HAL_AES_DMA – Define this symbol as TRUE because the Bluetooth Low Energy stack uses DMA for AES encryption.
- HAL_DMA – This value must be defined as TRUE for all Bluetooth Low Energy projects, as the DMA controller is used by the stack when reading and writing to flash.
Optional Symbols
- POWER_SAVING – When defined, this symbol configures the system to go into sleep mode when free of any pending tasks.
- PLUS_BROADCASTER – This symbol indicates that the device is using the GAP Peripheral/Broadcaster multirole profile rather than the single GAP Peripheral role profile. The default option in the simpleBLEPeripheral project is undefined.
- HAL_LCD – This symbol indicates whether to include and use the LCD driver when set to TRUE. If not defined, it is set to TRUE.
- HAL_LED – This symbol indicates whether to include the LED driver when set to TRUE. If not defined, it is set to TRUE.
- HAL_KEY – This symbol indicates whether to include the KEY driver when set to TRUE. If not defined, it is set to TRUE.
- HAL_UART – This symbol indicates whether to include the UART driver when set to TRUE. If not defined, it is set to FALSE.
- CC2540_MINIDK – Define this symbol when using the keyfob board in the CC2540/41DK-MINI development kit. This symbol configures the hardware based on the keyfob board layout.
- HAL_UART_DMA – This symbol sets the UART interface to use DMA mode when set to 1. When HAL_UART is defined, set either HAL_UART_DMA or HAL_UART_ISR to 1.
- HAL_UART_ISR – This symbol sets the UART interface to use ISR mode when set to 1. When HAL_UART is defined, set either HAL_UART_DMA or HAL_UART_ISR to 1.
- HAL_UART_SPI – This symbol indicates whether to include the SPI driver.
- GAP_BOND_MGR – The HostTestRelease network processor project uses this symbol. When this symbol is defined for slave and peripheral configurations, use the GAP peripheral bond manager security profile to manage bonds and handle keys. For more information on the peripheral bond manager, see Section 5.4.
- GATT_DB_OFF_CHIP – The HostTestRelease network processor project uses this symbol. This symbol sets a GATT client in a network processor configuration to manage the attributes in the application processor instead of the CC2540/41.
Other definitions relating to specific use cases such as the serial bootloader, OAD, and so forth are defined in the documentation.