This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] How to correctly migrate an application from RAM to Flash

Other Parts Discussed in Thread: C2000WARE, UNIFLASH

I want to move my application which currently runs from RAM into Flash, but I am having issues. How do I get my application to run from Flash correctly?

  • To migrate an existing application that is configured to run from RAM to a Flash-based linker configuration, follow these steps:

    1. Replace the RAM linker command file with a Flash linker command file. For examples of Flash-based linker command files, see the device_support\<device>\common\cmd directory.
    2. When modifying the Flash-based linker command file, be sure to map any initialized sections to Flash memory regions.
    3. Make sure the boot mode pins are configured for Flash boot. This tells the boot ROM to redirect execution to the application programmed into Flash memory after boot code execution is complete. For more information on boot mode configuration, see Detailed Description⏵Device Boot Modes in the device data sheet.
    4. When the device is configured for Flash boot, the boot ROM redirects execution to the Flash entry point location (defined as BEGIN in TI-provided Flash linker command files) at the end of boot code execution. Make sure there is a branch instruction at the Flash entry point to your code initialization (for example, _c_int00) function. In the C2000Ware examples, the entry point code is specified in the codestartbranch.asm file.
    5. To achieve best performance for Flash execution, configure the Flash wait states as per the device operating clock frequency, as specified in the device data sheet. In addition, enable prefetch mode and data cache mode. Calling the Flash_initModule() driverlib function achieves these steps. Note that code that initializes the Flash module must execute from a RAM location. This is accomplished by assigning the Flash initialization function to the .TI.ramfunc section. In the linker command file, map this section to Flash for load, and RAM for execution. The example cmd files provided in C2000Ware show how to do this correctly.
    6. For any functions that require 0- or 1-wait state performance, be sure to map to RAM for execution in the linker command file, similar to the Flash initialization function. The .TI.ramfunc section in the TI-provided Flash linker command files accomplishes this purpose.
    7. Align all code and data sections to 128-bit address boundaries when mapping to Flash memory, using the ALIGN directive in the linker command file.
    8. For EABI executable formats, define all uninitialized sections mapped to RAM as NOINIT sections (using the directive "type=NOINIT") in the linker command file.
    9. Be sure to program ECC bits correctly for the Flash application image. Keep the AutoEccGeneration option enabled in the Code Composer Studio Flash Plugin or UniFlash GUI.