| Contents | Index |
| On this page… |
|---|
Introducing IDE Project Generator |
IDE Project Generator provides the following features for developing projects and generating code:
Automated project building for VisualDSP++ software that lets you create VisualDSP++ software projects from code generated by Simulink Coder and Embedded Coder software. IDE Project Generator populates projects in the VisualDSP++ software development environment.
Blocks in the library idelinklib_adivdsp for controlling the scheduling and timing in generated code.
Highly configurable code generation using model Configuration Parameters and Target Preferences block options.
Capability to use one of two system target files to generate code specific to your processor.
Highly configurable project build process.
Automatic downloading and running of your generated projects on your processor.
To configure your Simulink software models to use the IDE Project Generator component, do one or both of the following tasks:
Open the Simulink Library Browser and search for "Target Preferences". Copy the Target Preferences block from the search results to your model.
To use the asynchronous scheduler capability in Embedded Coder software, add one or more hardware interrupt blocks or idle task block from the idelinklib_adivdsp library.
The following sections describe the blockset and the blocks in it, the scheduler, and the IDE Project Generator component.
In this tutorial you build a model and generate a project from the model into VisualDSP++ IDE.
Note The model demonstrates project generation only. You cannot build and run the model on your processor without additional blocks. |
To generate a project from a model, complete the following tasks:
Use Simulink blocks, DSP System Toolbox blocks, and blocks from other blocksets to create the model application.
Open the Simulink Library Browser and search for "Target Preferences". Copy the Target Preferences block from the search results to your model.
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
To build the model for audio reverberation, follow these steps:
Create a new model by selecting File > New > Model from the Simulink menu bar.
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.
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.
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:
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.
Note Generated code does not honor Simulink stop time from the simulation. Stop time is interpreted as inf. To implement a stop in generated code, you must put a Stop Simulation block in your model. |
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:
In the Configuration Parameters dialog box, select the Code Generation pane.
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.
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.
In the Configuration Parameters dialog box, select the Hardware Implementation pane.
Verify that Device type matches the target processor, such as ADI Blackfin, ADI SHARC, or ADI TigerSHARC.
Set the following Run-Time options:
Build action: Create_project.
Interrupt overrun notification method: Print_message.
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:
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 lets your model include other models as modular components. This technique is useful because it provides the following capabilities:
Simplifies working with large models by letting you build large models from smaller ones, or even large ones.
Lets you generate code once for all the modules in the entire model and then only regenerate code for modules that change.
Lets you develop the modules independently.
Lets you reuse modules and models by reference, rather than including the model or module multiple times in your model. Also, multiple models can refer to the same model or module.
Your Simulink Coder documentation provides much more information about model reference.
Model reference behaves differently in simulation and in code generation. For this discussion, you need to know the following terms:
The top-model is the root model block or model. It refers to other blocks or models. In the model hierarchy, this is the topmost model.
Referenced models are blocks or models that other models reference, such as models the top-model refers to. All models or blocks below the top-model in the hierarchy are reference models.
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:
Whether and how you change the models.
The Rebuild parameter on the Model Reference pane in the Configuration Parameters dialog.
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.
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:
Select Simulation > Configuration Parameters from the model menus.
In the Configuration Parameters dialog box, expand the node for the Code Generation pane and select the IDE Link pane.
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:
Interrupt overrun notification method
Compiler options string
Linker options string
System stack size (MAUs)
Profile real-time execution
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:
No noninlined S-functions
None of the following blocks:
Target Preferences
Memory Allocate
Memory Copy
Idle Task
Hardware Interrupt for SHARC, TigerSHARC, or Blackfin DSPs
When you create models to use in Model Referencing, keep in mind the following considerations:
Your model must use a system target file derived from the ERT or GRT targets files.
When you generate code from a model that references other models, you must configure the top-level model and the referenced models for the same system target file.
Simulink Coder software builds and Embedded Coder software do not support External mode in model reference. If you select the External mode option, it is ignored during code generation.
Your TMF must support use of the shared utilities folder, as described in Supporting Shared Utility Directories in the Build Process in the Simulink Coder documentation.
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.
![]() | IDE Automation Interface | Reported Limitations and Tips | ![]() |

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 |