Skip to Main Content Skip to Search
Product Documentation

IDE Project Generator

Introducing IDE Project Generator

IDE Project Generator provides the following features for developing projects and generating code:

To configure your Simulink software models to use the IDE Project Generator component, do one or both of the following tasks:

The following sections describe the blockset and the blocks in it, the scheduler, and the IDE Project Generator component.

IDE Project Generator Tutorial

In this tutorial you build a model and generate a project from the model into VisualDSP++ IDE.

To generate a project from a model, complete the following tasks:

  1. Use Simulink blocks, DSP System Toolbox blocks, and blocks from other blocksets to create the model application.

  2. Open the Simulink Library Browser and search for "Target Preferences". Copy the Target Preferences block from the search results to your model.

  3. Set the Configuration Parameters for your model, including the following parameters:

    • Solver parameters such as simulation start and solver options

    • Software options such as processor configuration and processor compiler selection

  4. Generate your project.

  5. Review your project in VisualDSP++ software.

Building the Model

To build the model for audio reverberation, follow these steps:

  1. Start Simulink software.

  2. Create a new model by selecting File > New > Model from the Simulink menu bar.

  3. Use Simulink blocks and DSP System Toolbox blocks to create the following model.

    Look for the Delay block in the Discrete library of Simulink and the Gain block in the Commonly Used Blocks library. Do not add the Target Preferences block at this time.

  4. Name and save your model before continuing.

Adding the Target Preferences Block to Your Model

To configure your model to work with Analog Devices processors, add a Target Preferences block to your model, as described in Target Preferences.

You have completed the model. Next, configure the model Configuration Parameters to generate a project in VisualDSP++ IDE from your model.

Specifying Simulink Configuration Parameters for Your Model

The following sections describe how to configure the build and run parameters for your model. Generating a project, or building and running a model on the processor, starts with configuring model options in the Configuration Parameters dialog box in Simulink software.

Setting Solver Options.  After you have designed and implemented your digital signal processing model in Simulink software, complete the following steps to set the Configuration Parameters for the model:

  1. Open the Configuration Parameters dialog box and set the right options on the Solver category for your model and for Embedded Coder software.

    • Set Start time to 0.0 and Stop time to inf (model runs without stopping). If you set a stop time, your generated code does not honor the setting. Set this to inf for completeness.

    • Under Solver options, set Type to fixed-step and set Solver to discrete (no continuous states). For PIL, set Type and Solver to any setting.

    • For Fixed step size (fundamental sample time), enter Auto, and set Tasking mode for periodic sample times to SingleTasking.

Ignore the Data Import/Export, Diagnostics, and Optimization panes in the Configuration Parameters dialog box. The default settings are right for your new model.

Setting Code Generation Options.  To configure Simulink Coder software to use the right processor files and to compile and run your model executable file, set the options in the Code Generation pane in the Configuration Parameters dialog box. Follow these steps to set the Simulink Coder software options to generate code tailored for your DSP:

  1. In the Configuration Parameters dialog box, select the Code Generation pane.

  2. In Target selection, click Browse to select the system target file for Analog Devices processors—vdsplink_grt.tlc. It may already be the selected target file.

    Clicking Browse opens the System Target File Browser to allow you to changes the system target file.

  3. On the System Target File Browser, select the system target file vdsplink_grt.tlc, and click OK to close the browser.

Setting IDE Link Options.  Set the IDE Link options for your Analog Devices processor.

  1. In the Configuration Parameters dialog box, select the Hardware Implementation pane.

  2. Verify that Device type matches the target processor, such as ADI Blackfin, ADI SHARC, or ADI TigerSHARC.

  3. Under Code Generation, select IDE Link pane.

  4. Set the following Run-Time options:

    • Build action: Create_project.

    • Interrupt overrun notification method: Print_message.

  5. Set the following options in the dialog box under Vendor Tool Chain:

    • Set Configuration to Custom.

    • Set Compiler options string and Linker options string to blank.

You have configured the Code Generation pane settings to generate a project for your processor. A few of the panes under the node for the Code Generation pane, such as Comments and Symbols do not require configuration.

For your new model, the default values for the options in these panes are right. For other models you develop, you may want to set the options in these panes to provide information during the build and to run TLC debugging when you generate code. Refer to your Simulink and Simulink Coder documentation for more information about setting the Configuration Parameters.

Creating Your Project.  After you set the Configuration Parameters and configure Simulink Coder software to create the files you need, you direct the software to create your project:

  1. Click OK to close the Configuration Parameters dialog box.

  2. Click Incremental Build on the model toolbar to generate your project into VisualDSP++ IDE.

    When you perform an incremental build with Build action set to Create_project, the automatic build process starts VisualDSP++ software and populates a new project in the development environment.

Model Reference

Model reference lets your model include other models as modular components. This technique is useful because it provides the following capabilities:

Your Simulink Coder documentation provides much more information about model reference.

How Model Reference Works

Model reference behaves differently in simulation and in code generation. For this discussion, you need to know the following terms:

The following sections describe briefly how model reference works. More details are available in your Simulink Coder documentation in the online Help system.

Model Reference in Simulation.  When you simulate the top-model, Simulink Coder software detects that your model contains referenced models. Simulink software generates code for the referenced models and uses the generated code to build shared library files for updating the model diagram and simulation. It also creates an executable (.mex file) for each reference model that is used to simulate the top-model.

When you rebuild reference models for simulations or when you run or update a simulation, Simulink software rebuilds the model reference files. Whether reference files or models are rebuilt depends on:

Model Reference in Code Generation.  Simulink Coder software requires executables to generate code from models. If you have not simulated your model at least once, Simulink Coder software creates a .mex file for simulation.

Next, for each referenced model, the code generation process calls make_rtw and builds each referenced model. This build process creates a library file for each of the referenced models in your model.

After building all the referenced models, the software calls make_rtw on the top-model, linking to all the library files it created for the associated referenced models.

Using Model Reference

With few limitations or restrictions, Embedded Coder software provides full support for generating code from models that use model reference.

Build Action Setting.  The most important requirement for using model reference with the Analog Devices targets is that you must set the Build action (select Configuration Parameters > IDE Link) for all models referred to in the simulation to Archive_library.

To set the build action, perform the following steps:

  1. Open your model.

  2. Select Simulation > Configuration Parameters from the model menus.

  3. In the Configuration Parameters dialog box, expand the node for the Code Generation pane and select the IDE Link pane.

  4. In the right pane, under Run-Time, select Archive_library from the Build action list.

If your top-model uses a reference model that does not have the build action set to Archive_library, the build process automatically changes the build action to Archive_library and issues a warning about the change.

Selecting the Archive_library setting removes the following options from the dialog box:

Target Preferences Blocks in Reference Models.  Each referenced model and the top-model must include a Target Preferences block for the right processor. You must configure all the Target Preferences blocks for the same processor.

The referenced models need Target Preferences blocks to provide information about which compiler and which archiver to use. Without these blocks, the compile and archive processes do not work.

Other Block Limitations.  Model reference with Embedded Coder software does not allow you to use the following blocks or S-functions in reference models:

Configuring Targets to Use Model Reference

When you create models to use in Model Referencing, keep in mind the following considerations:

To use an existing processor, or a new processor, with Model Reference, set the ModelReferenceCompliant flag for the processor. For information about setting this option, refer to ModelReferenceCompliant in the online Help system.

If you start with a model that was created prior to MATLAB release R14SP3, use the following command to set the ModelReferenceCompliant flag to On to make your model compatible with model reference:

set_param(bdroot,'ModelReferenceCompliant','on')

Code that you generate from Simulink software models by using Embedded Coder software automatically include the model reference capability. You do not need to set the flag.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS