.. _sec-mcuboot-flash-layout-dual-image-cc23xx:

Flash Layout for Dual-Image OAD
===============================

This section will describe the method for placing images
in internal flash when using dual-image OAD.

.. _sec-mcuboot-dual-image-cc23xx:


Constraints and Requirements for Dual-Image
-------------------------------------------

The following points must be considered for Dual-Image OAD
applications:

  - The user application must be sufficiently small in order
    to fit into the flash layout system described below.

  - Only one operational user application image may be
    stored in flash at any time. 

.. _sect-mcuboot-dual-image-cc23xx-memory-layout:

Internal Flash Memory Layout
----------------------------

The internal flash of the device contains the active 
application,  the download application and the MCUboot
bootloader. Each application's role is defined below.


+------------------------+----------------------------------------------------------------------+
| Application Name       | Description                                                          |
+------------------------+----------------------------------------------------------------------+
| MCUboot bootloader     | - Search for the proper image in FLASH                               |
|                        | - Ensure validity and security of image before running               |
|                        | - Jump to the valid and newest image                                 |
+------------------------+----------------------------------------------------------------------+
| Download application   | - Providing download area equivalent to the active application space |
+------------------------+----------------------------------------------------------------------+
| Active application     | - Active application                                                 |
|                        | - Must implement OAD reset service                                   |
|                        | - Implementing customer defined behavior                             |
+------------------------+----------------------------------------------------------------------+

.. _fig-mcuboot-dual-image-cc23xx-oad-target-memory-partition:
.. ditaa::
    :--no-separation:

                                                       Internal Flash
                                                   +---------------------+ <- 0x00000000
                                                   |   MCUboot           |
                                                   |   Bootloader        |
                                                   |      cRED           |
                                                   +---------------------+ <- 0x00006000
                                                   | Active Application  |
                                                   | Header              |
                                                   | c7AF                |
                                                   +---------------------+
                                                   | Active Application  |  Primary Slot
                                                   |       c7AF          |
                                                   +---------------------+ 
                                                   | Download            |
                                                   | Application Header  |
                                                   | c7AF                |
                                                   +---------------------+
                                                   |  Download           |
                                                   |  Application        | Secondary Slot
                                                   |      c7AF           |
                                                   |                     |
                                                   |                     |
                                                   |                     |
                                         /-------> +---------------------+ <- Device Flash Size - 0x4000
     +------------------------------+    |         |   NV Space          |
     |  NV Information is           |    |         |   Reserved for      |
     |  shared between              |    |         |   Bonding           |
     |  Active  Application and     |    |         |   Information       |
     |  Download Application        |    |         |        c777         |
     |                              |    |         |                     |
     +------------------------------+----\-------> +---------------------+ <- Device Flash Size

The location of the download application varies depending
on the flash size available for the selected device variant.
This is done to maximize the active application space.

Refer to the linker command file (.cmd) define to further
determine where precisely the each application is located.

.. warning::

    The description above provides the starting flash layout
    for dual images.


