Embedded Target for Texas Instruments C6000 DSPs    

C6711 DSK Tutorial 2-4--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 c6711dskwdnoisf. As with any model file, you can run this denoising demonstration by typing c6711dskwdnoisf at the MATLAB prompt. The model also appears in the MATLAB demos collection. Here is a picture of the model as it appears in the demonstration library.

Unlike the audio reverberation tutorial model (C6711 DSK Tutorial 2-3--Single Rate Application), 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 C6711 DSK as an executable COFF file.

Working and Build Directories

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

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

  1. From the File menu, choose Save As. Save a copy of the c6711dskwdnoisf model as d:/c6711dskwdnoisfex/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 Simulink Simulation 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 your model, for you to use in future sessions.

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

Figure 2-10: Solver Pane of Simulation Parameters Dialog

Selecting the Target Configuration

To specify the desired target configuration, you choose a system target file, which specifies the appropriate template makefile, and 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 select the C6000 target:

  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 from Category. Select Target configuration from Category.

Figure 2-11: 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-12: Selecting Your Target in the System Target File Browser

  1. From the list of available configurations, select ti_c6000.tlc (as in Figure 2-12) and click OK.
  1. 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-11.

  1. Select General code generation options from the Category list. The options displayed here are common to all target configurations. Check to make sure that all options are set to their defaults, as below.

  2. Select TLC debugging from Category. Clear all the check boxes in this category.
  3. Select TI C6000 compiler from Category. The options displayed here are specific to the C6711 DSK target. Check to make sure that the options are set as shown below.

    .

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

  5. Select TI C6000 runtime from Category. Set the run-time options as shown.

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

Building and Running Your Model

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 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 dir at the MATLAB command prompt.

  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 modelname_target_rtw, concatenating the name of your source model and your chosen target. In this example, your build directory is named dnoisfrtw_c6000_rtw.

dnoisfrtw_c6000_rtw contains these generated source code files:

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


  Running Models on Your C6711 DSK Creating Code Composer Studio Projects Without Building