
.. _cc26x2-cc23xx-migration-guide:

CC26x2 to CC23xx Porting Guide
******************************

This section will describe, in general terms, how to port
a project developed for the CC26X2 device on the 
|SDKF2| to a |DEVICE| device running 
the |SDK|.

The best way to migrate is to open a new example project 
with similar functionality in the new SDK and transfer 
your changes and application code over to the new example. 

The following sections discuss the major changes between the
CC26x2 devices and the |DEVICE| devices.


* :ref:`sec-general-considerations-cc26x2-to-cc23xx`

   * :ref:`sec-general-considerations-freertos-cc26x2-to-cc23xx`

   * :ref:`sec-general-considerations-launchpad-support-cc26x2-to-cc23xx`

   * :ref:`sec-general-sensor-controller-cc26x2-to-cc23xx`

* :ref:`sec-migration-guides-cc26x2-to-cc23xx`

   * :ref:`sec-migration-guides-freertos-cc26x2-to-cc23xx`

   * :ref:`sec-migration-guides-RF-stack-cc26x2-to-cc23xx`

   * :ref:`sec-migration-guides-ti-drivers-cc26x2-to-cc23xx`

* :ref:`sec-example-cc26x2-to-cc23xx`

   * :ref:`sec-example-simple-peripheral-port-cc26x2-to-cc23xx`

* :ref:`watchdog-example-code`

.. _sec-general-considerations-cc26x2-to-cc23xx:

General Considerations
======================

.. _sec-general-considerations-freertos-cc26x2-to-cc23xx:

FreeRTOS
--------

The |DEVICE| devices exclusively support FreeRTOS. If a project
needs to be migrated from the |SDKF2|
and uses TI-RTOS or TI-RTOS7, it will need to be converted to FreeRTOS during
the migration process.

.. _sec-general-considerations-launchpad-support-cc26x2-to-cc23xx:

CC23xx LaunchPad support
------------------------
All example applications are compatible with the CC23xx LaunchPad development
kit. These features allow for a unified development experience and empowers
developers to rapidly release to market.

`CC23xx LaunchPad Development Kit Product Page <http://www.ti.com/tool/LP-EM-CC2340R5>`_

.. _sec-general-sensor-controller-cc26x2-to-cc23xx:

Sensor Controller
-----------------
The |DEVICE| does not support the Sensor Controller. Any applications being ported
from the |SDKF2| that make use of the Sensor Controller will need to be modified
to not use the Sensor Controller in order to work with the |DEVICE|.

.. _sec-migration-guides-cc26x2-to-cc23xx:

Migration Guides
================

.. _sec-migration-guides-freertos-cc26x2-to-cc23xx:

Migrate to FreeRTOS
-------------------

An important step that must be taken in order to port an example from the
|SDKF2| to the |SDK| is to ensure that the project is implemented in FreeRTOS.
The |SDK| only supports FreeRTOS, so any projects running on TI-RTOS or 
TI-RTOS7 will not work unless they are converted to FreeRTOS. To port a
project from TI-RTOS or TI-RTOS7 to FreeRTOS please reference
:ref:`sec_freertos_migration_cc23xx_application`.

.. _sec-migration-guides-RF-stack-cc26x2-to-cc23xx:

Migrate the RF stack
--------------------

Ensure the RF features and requirements that are present in the
original example are available in the |SDK| RF stack.

.. _sec-migration-guides-ti-drivers-cc26x2-to-cc23xx:

Migrate the TI drivers
----------------------

It is important to ensure that projects that are being ported are
not using deprecated libraries. A few migration guides for libraries
that should be updated as part of the |SDKF2| to |SDK| migration are
shown below:

*  :ref:`uart_to_uart2-porting-guide`
*  :ref:`sec-cc23xx-gpio++-porting-guide`

.. _sec-example-cc26x2-to-cc23xx:

Example
=======

The following section provides an example of how to port a project
from the |SDKF2| to the |SDK|. All of
the steps shown below are essentially putting into practice the
theory discussed earlier in this document.

.. _sec-example-simple-peripheral-port-cc26x2-to-cc23xx:

Porting Simple Peripheral
-------------------------

For this porting guide, Simple Peripheral will be ported from the 
|SDKF2| using a CC26X2R1 device to the |SDK| using a |DEVICE_LOW_PLUS| 
device. To minimize project configuration differences, start with an
example project in the |DEVICE|. The recommended approach is to start
with a |SDK| project that contains the same base functionality 
as the porting target project and merge in any custom functionality. 

#. Convert the project from TI-RTOS or TI-RTOS7 to FreeRTOS. This must be done properly to
   ensure that the project behaves as expected and proper functionality is
   maintained. Please leverage the following guide 
   :ref:`sec_freertos_migration_cc23xx_application`

#. Choose a |SDK| example project that contains your target
   project's base functionality.

#. Transfer all modified application files from |SDKF2|
   project into the |SDK| example project.

   In this example, the following files from |SDKF2|
   project were moved into ``basic_ble`` |SDK| example:

      - ``simple_peripheral.c``
      - ``simple_peripheral.h``

#. Move any profiles and services that the application is using to the 
   |SDK| project.

#. Transfer the SysConfig settings either visually through the GUI or open both 
   the old and the new project .syscfg files and copy-paste the desired 
   settings.

   .. warning::
      It is highly recommended to transfer the settings visually. Some settings 
      could change from a SDK to another and forcing these settings by copy-pasting
      the desired options may lead to unexpected behavior in the application.

#. If necessary, update the project to use the newer TI drivers that are
   supplied with the |SDK|.

   The UART library has been deprecated and replaced by the UART2 library.
   Please follow the  :ref:`uart_to_uart2-porting-guide`

   The Pin and GPIO libraries are deprecated and have been replaced by the
   GPIO++ library. To update Pin or GPIO code, please reference the following
   porting guide :ref:`sec-cc23xx-gpio++-porting-guide`
 
#. Refer to the Core SDK release notes for additional information and the 
   FreeRTOS examples included with |SDK|.

   For additional information on how |SDK| uses FreeRTOS see
   :ref:`sec-freertos-overview`.

#. At this stage, most, if not all, of the modifications required have been completed.
   It is possible that some additional modifications may be required for the project
   to function as intended, but these changes can be relatively minor compared to the
   modifications already made by following this porting guide.
