.. _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
(See `Platform Devices Comparison <../../ble-stack-5.x/overview-cc23xx.html>`_).

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_configurationR53_8:
.. 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_configurationR53_9:
.. 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.


Additional Steps for Off-Chip OAD and MCUBoot examples
======================================================

1. For the MCUBoot project, additionaly to the device migration, modify the MCUBoot configuration inside SysConfig.

    - Enable Overwrite-only code path.
    - Enable External Flash configuration.
    - Modify the Base Address and Image Size depending on your application.

.. _deviceview_switch_configurationR53_10:
.. figure:: resources/flash_backend_size.png
    :align: center

    SysConfig - MCUBoot.
    
2. Build both projects.