Main Content

Load Data/Code to Flash and Run from RAM on TI C2000

The TI compiler simplifies the process of automatically allocating RAM data using the ramfuncs attribute. This attribute facilitates seamless integration of RAM data allocation within the flash memory.

The shipping *.cmd (Linker command file) file of a specific processor already has allocation of sections of flash to store RAM data.

  1. Open the Configuration Parameters of your model, navigate to the Hardware Implementation > Build options > Linker command file, and click on the Edit button.

  2. Find the ramfuncs section as shown.

  3. The custom storage class package tic2000demospkg in the C2000 Microcontroller Blockset enables loading parameters/routines onto flash memory and executing them from RAM using the ramfuncs section. To confirm the presence of these built-in storage classes, run the following command in the MATLAB command window:


  4. Select the tic2000demospkg package from the Custom storage class designer.

  5. In the Memory Sections tab, find sections named code_ramfuncs and const_data_ramfuncs which can be used to store code and data in the ROM but copy them into RAM during execution.

  6. To place a subsystem in the ramfuncs section, right-click on the subsystem, select Block Parameters and under the Code Generation tab, select the appropriate memory section as shown below.

  7. Similarly, to allocate a Simulink parameter to ramfuncs section, type tic2000demospkg.Parameter in the MATLAB command prompt:


    Double-click on the parameter in the workspace and select const_data_ramfuncs.

Custom Memory Section for TI C2000

You can create a custom memory section using the Custom Storage Class Designer. The following steps describe on how to align a signal buffer to start on a 512-byte boundary.

  1. Enter the following command in the MATLAB command window to open the Custom Storage Class Designer tool.


  2. Select the tic2000demospkg package.

  3. Go to the Memory Section tab and create a new memory section. Enter the pragma statement in the Pre statement section:

  4. Click on the Custom Storage Class tab, create a new custom storage class, and select the previously created memory section.

  5. Click Apply and close the window. Save the package when prompted. You may need to restart MATLAB to use the new storage class.

  6. If you are using MATLAB version R2020a and before:

    1. Apply your new Storage class to tic2000demospkg.Signal and tic2000demospkg.Parameter objects and in block parameters where required.

    2. Click OK.

  7. For R2020b and beyond: In R2020b, the Code Mappings Editor became the primary location to configure model data elements for code generation. For more information, see Code Mappings Editor – C (Simulink Coder)

See Also

| | |

Related Topics