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] FAQ: How do I use MathWorks Embedded Coder to load data/code to flash and run from RAM on a TI C2000?

MathWorks Embedded Coder with the MathWorks TI C2000 Hardware Support Package allows automatic build and execution on C2000 hardware from models developed using MATLAB and Simulink.

For embedded software which is mainly stored in and executed out of ROM, developers may wish to place certain functions in RAM instead for performance-sensitive code on devices where executing from RAM is faster than ROM. The TI compiler provides an easy mechanism to do this automatically using the ramfuncs attribute.

In the TI C2000 Hardware Support package provided by MathWorks, using this ramfuncs section, a custom storage class package labeled tic2000demospkg has been created to load the parameters/routines on the flash memory and run them from the RAM.

The shipping *.cmd file of a specific processor already has allocation of sections of flash to store RAM data. Click on the Edit button as shown below in configuration parameters:

You can find the ramfuncs section details as below:

  

You can verify the pre-existing custom storage classes by running "cscdesigner" in MATLAB command window. It will populate Custom Storage Class Designer window.

 

Select the tic2000demospkg package.

Note the above Memory sections namely code_ramfuncs and const_data_ramfuncs can be used to store the code and data in the ROM and this will be copied to RAM during execution which improves the overall performance of the system.

If you cannot find the tic2000demospkg above under the Select package, you can select the same from code generation configuration parameters as shown below. You may wish to search for “memory sections” from the search bar in configuration parameters to more easily see this option. 

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

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

>> tic2000demospkg.Parameter

And double click on the parameter in the workspace and select const_data_ramfuncs as shown below: