Embedded Target for Texas Instruments C6000 DSPs    

C6701 EVM Tutorial 2-2--A More Complex Application

For this tutorial, we demonstrate an application that uses multiple stages--using wavelets to remove noise from a noisy signal. The model name is evm67xdnoisf. As with any model file, you can run this de-noising demonstration by typing c6701evmdnoisf at the MATLAB prompt. Or the model is in the MATLAB demos collection. Here is a picture of the model as it appears in the demonstration library.

Unlike the audio reverberation demo, this model is difficult to build from blocks in Simulink. It uses complicated subsystems for the Delay Alignment block and the Soft Threshold block. For this tutorial you work with a copy of the demonstration model, rather than creating the model.

This tutorial takes you through generating C code and building an executable program from the demonstration model. The resulting program runs on your C6701 EVM as an executable COFF file.

Working and Build Directories

It is convenient to work with a local copy of the c6701evmwdnoisf model, stored in its own directory, which you name (something like c6701dnoisfex). This discussion assumes that the c6701dnoisfex directory resides on drive d:. Use a different drive letter if necessary for your machine. Set up your working directory as follows:

  1. Create the new model directory from the MATLAB command line by typing
  2. Make c6701dnoisfex your working directory in MATLAB.
  3. Open the c6701evmwdnoisf model.
  1. The model appears in the Simulink window.

  1. From the File menu, choose Save As. Save a copy of the c6701evmwdnoisf model as d:/c6701dnoisfex/dnoisfrtw.mdl.

During code generation, Real-Time Workshop creates a build directory within your working directory. The build directory name is model_target_rtw, derived from the name of your source model and your chosen target. In the build directory, Real-Time Workshop stores generated source code and other files created during the build process. You examine the contents of the build directory at the end of this tutorial.

Setting Simulation Program Parameters

To generate code correctly from the dnoisfrtw model, you must change some of the simulation parameters. In particular, Real-Time Workshop uses a fixed-step solver. To set the parameters, use the Simulation Parameters dialog as follows:

  1. From the Simulation menu, choose Simulation parameters. The Simulation Parameters dialog opens.
  2. Click Solver and enter the following parameter values on the Solver pane.
  1. Start Time: 0.0

    Stop Time: inf

    Solver options: set Type to Fixed-step. Select the discrete solver algorithm.

    Fixed step size: auto

    Mode: Auto

  1. Click Apply. Then click OK to close the dialog.
  2. Save the model. Simulation parameters persist with the model, for use in future sessions.

Figure 2-5 shows the Solver pane with the correct parameter settings.

Figure 2-5: Solver Pane of Simulation Parameters Dialog

Selecting the Target Configuration

To specify the desired target configuration, you choose a system target file, a template makefile, and a make command.

In these tutorials, you do not need to specify these parameters individually. Instead, you use the ready-to-run ti_c6000.tlc target configuration.

To target your C6701 EVM:

  1. From the Simulation menu, choose Simulation Parameters. The Simulation Parameters dialog opens.
  2. Click Real-Time Workshop on the Simulation Parameters dialog. The Real-Time Workshop pane activates.
  3. The Real-Time Workshop pane has several pages, which you select via the Category option. Select Target configuration from the Category.

Figure 2-6: Real-Time Workshop Pane (Target Configuration Category)

  1. Click Browse next to the System target file field. This opens the System Target File Browser. The browser displays a list of available target configurations. When you select a target configuration, Real-Time Workshop automatically chooses the appropriate system target file, template makefile, and make command.

Figure 2-7: The System Target File Browser

  1. From the list of available configurations, select ti_c6000.tlc (as in Figure 2-7) and click OK.
  2. The Real-Time Workshop pane now displays the correct System target file (ti_c6000.tlc), Template makefile (ti_c6000.tmf), and Make command (make_rtw), as shown in Figure 2-6.
  3. To choose your specific C6000 hardware target, change Category to TI C6000 target selection.

  4. From the Code generation target type, choose C6701 EVM.
  5. To export the handle that CCS creates when you generate code from your model, select Export CCS handle to MATLAB workspace and enter a name for the handle in CCS handle name.
  6. Select General code generation options from Category. The options displayed here are common to all target configurations. Check to make sure that all options are set to their defaults, as below.

  7. Select TLC debugging from Category. Clear all the check boxes in this category.
  8. For Category, select TI C6000 code generation to specify code generation options that apply to the C6701 EVM target.
  9. Select the Inline DSP Blockset functions option, as shown.

  10. Select TI C6000 compiler from Category. The options displayed here are specific to the C6000 target. Check to make sure that the options are set as shown below.

    .

  11. Select TI C6000 linker from Category. Set the linker options as shown.

  12. Select TI C6000 runtime from Category. Set the runtime options as shown.

  13. Click OK to close the Simulation Parameters dialog. Save the model to retain your new build settings.

Building and Running the Program

The Real-Time Workshop build process generates C code from the model, and then compiles and links the generated program. To build and run the program:

  1. Access the Simulation Parameters dialog for your model.
  2. Click Build in the Simulation Parameters dialog to start the build process.
  3. A number of messages concerning code generation and compilation appear in the MATLAB command window. The initial messages are
  1. The content of the succeeding messages depends on your compiler and operating system.The final message is

  1. The working directory now contains an executable, dnoisfrtw.exe. In addition, Real-Time Workshop created a build directory, dnoisfrtw_c6000_rtw.
  1. To review the contents of the working directory after the build, type the dir command from the MATLAB command window.

  1. To run the executable from the MATLAB command window, type
  1. The "!" character passes the command that follows it to the operating system, which runs the stand-alone dnoisfrtw program.

    The program produces one line of output.

  1. To see the contents of the build directory, type

Contents of the Build Directory

The build process creates a build directory and names it model_target_rtw, concatenating the name of your source model and your chosen target. In this example, your build directory is named dnoisfrtw_c6701_rtw.

dnoisfrtw_c6701_rtw contains these generated source code files:

The build directory also contains other files used in the build process, such as the object (.obj) files and the generated makefile (dnoisfrtw.mk).


  Configuring Simulation Parameters for Your Model Targeting Your C6711 DSK