.. _cc2340r5-cc2340r53-migration-guide:

CC2340R5 to CC2340R53 Porting Guide
***********************************

This section will describe, in general terms, how to migrate
a project developed for the |DEVICE_LOW_PLUS| device to a
|DEVICE_LOW_PLUS_RAM_UP| device running the |SDK|. However,
it is important to first assess the differences between both
devices to make sure that the project migration is possible

The primary difference between |DEVICE_LOW_PLUS| and |DEVICE_LOW_PLUS_RAM_UP|
is the SRAM size, as specified in their respective datasheets.
|DEVICE_LOW_PLUS| has |RAM_SIZE_LOW_PLUS| SRAM, and |DEVICE_LOW_PLUS_RAM_UP| has |RAM_SIZE_LOW_PLUS_RAM_UP| SRAM.

Migration Guide
===============

The recommended migration path is to start with a |DEVICE_LOW_PLUS| 
based example project from the |SDK| and follow the next steps:

1. Import the project into Code Composer Studio or you IDE of preference.

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

.. _deviceview_switch_configurationR3:
.. figure:: resources/DeviceView_Switch.png
    :align: center

    SysConfig - Switch Device.

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

.. _deviceview_switch_configurationR2_2:
.. figure:: resources/select_cc2340r53_board.png
    :align: center

    SysConfig - Select |DEVICE_LOW_PLUS_RAM_UP| device.

.. warning:: If a new linker command file is generated after migration (named ``cc23x0r53.cmd`` in the project files)
             please make sure to exclude it from build (or eliminated it from the project files) so that the original
             ``lpf3_app_freertos.cmd`` file is used during build time.

4. Build and flash the project.

.. TODO once Zigbee OAD is available
    Additional Steps for Off-Chip OAD and MCUBoot examples
    ======================================================

    1. Import MCUBoot project, go inside ``mcuboot_config`` and do the following:

        - Uncomment the following two lines: 
            .. code-block:: c
                :caption: mcuboot_config.h - Uncomment to enable external flash configuration and enable 
                        the overwrite-only code path.
                :linenos:

                    #define TI_BOOT_USE_EXTERNAL_FLASH
                    #define MCUBOOT_OVERWRITE_ONLY

        - Comment out the following line: 
            .. code-block:: c
                :caption: mcuboot_config.h - Comment to disable the direct-xip code path.
                :linenos:

                    //#define MCUBOOT_DIRECT_XIP
        
    2. Build the project.