Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Project Generator Tutorial

This example shows how to generate code from a Simulink® model using IDE Link component for Texas Instruments™ (TI) Code Composer Studio™ (CCS). A simple model is used to guide the user to generate a working algorithmic project specific to TI processors.

Supported IDE/tool chain:

  • Texas Instruments™ Code Composer Studio™

Supported processors:

Recommended tutorial:

Model used in this example:

Introduction

IDE Link component integrates Simulink and MATLAB® with CCS tools. It lets you develop and validate algorithmic designs from concept through code. IDE Link uses C code generated by code generated by code generation software and CCS development tools to generate executable and library projects for supported TI processors.

This example shows you how to use the project generation feature of IDE Link. It assumes you are already familiar with MATLAB and Simulink.

NOTE: Before continuing, verify that you have configured at least one board in CCS. If not, please go to CCS Setup and select a board based on a supported TI processor.

Task 1 - Configure Your Environment for Code Generation

Code generation software requires specific versions of third-party tools and software in order to generate code. For up-to-date system requirements, refer to System RequirementsSystem Requirements.

Get the List of System Requirements

Make sure you have all the required third-party tools and software. To list the system requirements for a board or processor from MATLAB, use the checkEnvSetup function with the 'list' option.

For example, if you are working with F2812 processor, invoke the following command:

  checkEnvSetup('ccs', 'F2812', 'list')

The MATLAB command window responds with a report similar to the following text:

1. CCS (Code Composer Studio)
   Required version: 3.3.82.13
   Required for    : Automation and Code Generation

2. CGT (Texas Instruments C2000 Code Generation Tools)
   Required version: 5.2.1
   Required for    : Code generation

3. DSP/BIOS (Real Time Operating System)
   Required version: 5.33.05
   Required for    : Real-Time Data Exchange (RTDX)

4. Flash Tools (TMS320C2812 Flash APIs)
   Required version: 2.10
   Required for    : Flash Programming
   Required environment variables (name, value):
   (FLASH_2812_API_INSTALLDIR, "<Flash Tools installation folder>")

Depending on what you are trying to accomplish, you may not need certain third-party tools. For the example above, you would only need the Flash Tools (TMS320C2812 Flash APIs) if you were programming flash memory for stand alone booting.

Set Up Your Environment to Satisfy the System Requirements

To set up your software environment so it satisfies the system requirements, use the checkEnvSetup function with the 'setup' option. This option lists the system requirements for a board or processor, compares them with the software in your environment, and helps you configure the software to satisfy the system requirements.

For example, if you are working with F2812 processor, invoke the following command:

  checkEnvSetup('ccs', 'F2812', 'setup')

You might be prompted to browse for the installation folder of certain third-party tools as shown below:

If the third-party tool complies with the product requirements, one or more environment variables will be created to point to the installation folder of the third-party tool as shown below. These environment variables are used during code generation to include third-party source files, include directories and libraries into the generated project.

After successfully configuring your environment, you can proceed with the rest of the example. For more information about checkEnvSetup, type help checkEnvSetuphelp checkEnvSetup at the MATLAB command line.

Task 2 - Design and Simulate Algorithm

The following figure shows an algorithmic model that calculates the sum and difference of two random signal vectors containing 16 data points of int16 type.

1. Open the sumdiff_ccsdemosumdiff_ccsdemo model.

2. Click the Start button to run the simulation.

Task 3 - Configure Model for Code Generation

IDE Link provides parameters you can configure as part of the simulation configuration parameters of the model. For more information, please refer to product documentation.

In this task, you will modify one option for example purposes.

1. Open the Model Configuration Parameters dialog, set the "System target file" parameter under "Code Generation" to either "idelink_ert.tlc" or "idelink_grt.tlc" and click "Apply".

2. Next, select "Coder Target" under "Code Generation". Click "Target Hardware Resources" and set the parameters to match your target hardware. Click "OK".

For more information on configuring the model for your target hardware see this sectionthis section in the IDE Link documentation.

3. Click "Tool Chain Automation" tab.

The "Build format" drop-down allows you to choose the format of the output of the model build process. You can either generate a project or a makefile. Leave the "Build format" selection to Project.

The "Build action" drop-down allows you to specify the actions that take place during the model build process. Leave the "Build action" selection to Build_and_execute. This build action will generate code for your model, create a project in the CCS IDE, build the project and run the resulting program on your processor.

4. The "Overrun notification" allows you to specify the type of notification to put in the generated code when an interrupt overrun happens. Choose Print_message from the "Overrun notification" drop-down list. In this task, you will only modify this one option for example purposes.

For more information on other parameters in this dialog, please refer to the IDE Link documentation.

5. Click "OK" to apply above settings.

Task 4 - Build the Model

  • In your model click, the "Build Model" button to build the model.

Notice in the CCS IDE that the project has been created and built, the program has been loaded, and the processor is running. You can look at the generated code either by opening source files in the IDE or by going through the generated HTML report.

Summary

This example showed the steps to generate a project and code specific to TI processors using IDE Link component. You started with an algorithmic model, configured the model for code generation, built the model, and ran the generated code on the processor.

Was this topic helpful?