CC2340R5 to CC2340R2 Porting Guide

This section will describe, in general terms, how to migrate a project developed for the CC2340R5 device to a CC2340R2 device running the SimpleLink Low Power F3 SDK. However, it is important to first assess the differences between both devices to make sure that the project migration is possible (See Platform Devices Comparison).

Software Pre-requisites

Warning

Please make sure to use Code Composer Studio 12.5 and Uniflash 8.6.0 or higher versions when working with the CC2340R2 device.

If you are using Code Composer Studio 12.5, you need to first install the support package for the CC2340R2 device. The following steps are not required if using Code Composer Studio 12.6 or higher versions.

  1. Inside Code Composer Studio, go to HelpInstall New SoftwareWork with select Code Composer Studio v12 Updates and look for LPCS Device Support. Choose the support package based on your Operative System and continue to click Next until installation is complete.

../../_images/CCS_supportpack.png

Figure 167. Code Composer Studio - Install CC2340R2 Support Package.

Migration Guide

The recommended migration path is to start with a CC2340R5 based example project from the SimpleLink Low Power F3 SDK and follow the next steps:

  1. Import the project into Code Composer Studio.

  2. Open SysConfig, go to Device View and click on SWITCH.

../../_images/DeviceView_Switch.png

Figure 168. SysConfig - Switch Device.

  1. Once the Switch Board or Device window is opened, select the CC2340R2 board, or CC2340R2 device and click on CONFIRM. Make sure to save the project changes so that the migration takes place.

../../_images/Select_R2device.png

Figure 169. SysConfig - Select CC2340R2 device.

  1. Right click on the imported project folder and select Properties. Validate that the CC2340R2 name shows up at the Variant and core field.

../../_images/check_project_properties.png

Figure 170. Project Properties - Check migration to CC2340R2 device.

  1. Open the Linker command file .cmd and modify the Flash size and RAM size to 256 kB and 28 kB respectively.

    Listing 152. cc23x0_app_freertos.cmd - Replace FLASH_SIZE and RAM_SIZE values.
    1#define FLASH_SIZE   0x40000
    2#define RAM_SIZE     0x7000
    
  2. Open SysConfig and reduce the heap size, under FreeRTOS → Stack and Heap Sizing. For an out-of-the-box implementation of the examples, consider the following heap sizes:

    • basic_ble / basic_ble_profiles: 0x00003F50

    • host_test / data_stream: 0x00003000

../../_images/change_heap_size.png

Figure 171. SysConfig - Modify Heap Size.

Warning

Depending on the RAM size consumed by your application, this new value may require a modification.

  1. Open SysConfig and reduce the interval NVS size, under NVS → Internal Flash. For an out-of-the-box implementation of the examples, consider using 0x3C000 as the region base value.

../../_images/change_NVS_basic_ble.png

Figure 172. SysConfig - Modify NVS base region.

  1. For project examples that require reallocation of pins due to differences in package size between CC2340R5 and CC2340R2 devices. Open SysConfig and modify the GPIO information with the available pins you have depending on your application. You can see below how this is done for the case of the host_test project example.

../../_images/host_test_GPIOchange.png

Figure 173. SysConfig - Modify GPIOs.

  1. Build the project.

Additional Steps for Off-Chip OAD and MCUBoot examples

Note

The CC2340R2 device does not support On-Chip and Dual Image OAD due to reduced Flash size.

  1. Inside the Off-Chip OAD project, open SysConfig and update NVS External Configuration as seen below:

../../_images/offchip_externalNVS_config1.png

Figure 174. SysConfig - Modify size of NVS External Flash to match the size of the External Flash available on the board.

../../_images/offchip_externalNVS_config2.png

Figure 175. SysConfig - Modify SPI pins.

  1. Right click on the project file and select Properties. Modify the post build steps so that the slot sizes match the ones of the CC2340R2 device.

../../_images/modify_post_build_offchip.png

Figure 176. Project Properties - Modify post build steps.

  1. Import MCUBoot project, modify the flash_map_backend.h replacing the following lines of code. In addition, add DeviceFamily_CC23X0R2 as part of the Predefined Symbols of the project (right click on Properties → Predefined Symbols).

    Listing 153. flash_map_backend.h - Replace BOOT_PRIMARY_1_SIZE and BOOT_SECONDARY_1_SIZE values.
    1    #elif defined DeviceFamily_CC23X0R2
    2        #define BOOTLOADER_BASE_ADDRESS                 0x00000000
    3        #define BOOT_BOOTLOADER_SIZE                    0x00006000
    4
    5        #define BOOT_PRIMARY_1_BASE_ADDRESS             0x00006000
    6        #define BOOT_PRIMARY_1_SIZE                     0x00036000
    7
    8        #define BOOT_SECONDARY_1_BASE_ADDRESS           0x00023000
    9        #define BOOT_SECONDARY_1_SIZE                   0x00036000
    
  2. To finish with the MCUBoot project, go inside mcuboot_config and do the following:

    • Uncomment the following two lines:
      Listing 154. mcuboot_config.h - Uncomment to enable external flash configuration and enable the overwrite-only code path.
      1    #define TI_BOOT_USE_EXTERNAL_FLASH
      2    #define MCUBOOT_OVERWRITE_ONLY
      
    • Comment out the following line:
      Listing 155. mcuboot_config.h - Comment to disable the direct-xip code path.
      1    //#define MCUBOOT_DIRECT_XIP
      
  3. Build both projects.

Note

For implementing Off-Chip OAD example project, follow the same process specified for the CC2340R5 device. The mcuboot .hex file and the basic_ble_oad_offchip .bin file can be found inside the Release folder of the project. Make sure to flash the .bin file at 0x00006000 address.