Main Content

Optimize Code for ARM Cortex-M Processors

You can configure your model to replace generic code with ARM® CMSIS code that is optimized for ARM Cortex®-M processors.

To measure the effects of optimization, you can perform Execution profiling before and after completing this procedure. For more information, see Replace Code for Embedded Targets.

To enable the code replacement libraries for ARM Cortex-M processors:

  1. (Optional) To see the code replacement libraries that the code generation process will, enter:

    crviewer('ARM Cortex-M')

    Code Replacement Viewer opens and displays the code replacement libraries.

  2. In the model, open the Modeling tab and press CTRL+E to open the Configuration Parameters dialog box. Go to Hardware Implementation > Hardware board and ensure that the Device vendor is set to ARM compatible and Device type is ARM Cortex.

  3. In the Configuration Parameters dialog box, expand Code Generation, and select the Interface pane.

  4. Click Select of Code replacement library parameter. A Choose one or multiple Code replacement libraries for code generation dialog box is opened.

  5. Select ARM Cortex-M to the selected code replacement libraries-prioritized and click OK.