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 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

Process for Building and Generating a Project

In this tutorial, you build a model and generate a project from the model into Green Hills MULTI.

This is an overview of the process for generating a project from a model:

  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 and configure the settings , as described in Target Preferences.

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

    • Solver parameters such as simulation start and solver options. Choose the discrete solver when you generate executables. If you are using PIL, select any setting from the Type and Solver lists.

    • Code Generation settings such as processor configuration and processor compiler selection

  4. Generate your project.

  5. Review your project in MULTI.

Create the Model

To build the model for this tutorial, follow these steps:

  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 and configure the settings , as described in Target Preferences.

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

    • Solver parameters such as simulation start and solver options. Choose the discrete solver when you generate executables. If you are using PIL, select any setting from the Type and Solver lists.

    • Code generation settings such as processor configuration and processor compiler selection

  4. Generate your project.

  5. Review your project in MULTI.

  1. Start Simulink.

  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. This model implements an audio signal reverberation scheme. Part of the input audio signal passes directly to the output. A delayed version passes through a feedback loop before reaching the output. The result is an echo, or reverberation, added to the audio output.

  4. Name and save the model before continuing.

Adding the Target Preferences Block to Your Model

To configure your model to work with the processors your IDE supports, 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 Green Hills MULTI 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.

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

  1. Open the Configuration Parameters dialog box and set the 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 parameter 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 valid for your new model.

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

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

  2. Click the Browse button next to System target file and set the system target file to idelink_grt.tlc or idelink_ert.tlc (if you use Embedded Coder software).

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

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

Setting IDE Link Options.  After you set the Configuration Parameters for code generation, set the options that apply to your Embedded Coder software run-time and build processes.

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

  2. Set the following Run-Time options:

    • Build action: Create_project.

    • Interrupt overrun notification method: Print_message.

  3. (optional) Under Link Automation, verify that Export MULTI link handle to base workspace is selected and provide a name for the handle in MULTI link handle name.

  4. If you are using an actual board, identify a Board Support Package (BSP) in the Compiler options string (under Vendor Tool Chain). For example, enter "-bsp=at91rm9200". If you do not provide this type of information, the software can generate errors that do not identify the absence of linker directives as the cause.

  5. Under Code Generation, clear all of the options.

  6. Select the Hardware Implementation pane.

  7. Verify that the Device type is valid for your processor—Analog Devices, NEC, or Freescale.

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 valid. For other models you develop, setting the options in these panes provides more information during the build process. Some of the options configure the model 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 to create the files you need, you direct Simulink Coder to create your project:

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

  2. To verify that you configured your Embedded Coder software, issue the following command at the prompt to open the IDE Link Configuration dialog box.

    ghsmulticonfig
  3. Verify the settings in the Embedded Coder dialog box.

  4. After you verify the settings, click OK to close the dialog box.

  5. Enter cd at the prompt to verify that your working folder is the right one to store your project results.

  6. Click Incremental Build ( ) on the model toolbar to generate your project into Green Hills MULTI IDE.

    When you press with Create_project selected for Build action, the build process starts the Green Hills MULTI application and populates a new project.

Model Reference

About 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. This discussion uses 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 detects that your model contains referenced models. Simulink 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 requires executables to generate code from models. If you have not simulated your model at least once, Simulink Coder 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, Simulink Coder calls make_rtw on the top-model. The call to make_rtw links to the library files Simulink Coder 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 Green Hills MULTI software supported processors is 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.

    The Configuration Parameters dialog box opens.

  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 Archive_library disables the Interrupt overrun notification method, Export MULTI link handle to the base workspace, and System stack size options for the referenced models.

Target Preferences Blocks in Reference Models.  Each referenced model and the top-model must include a Target Preferences block for the right processor. 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 code generation options does not allow you to use noninlined S-functions in reference models. Verify that the blocks in your model do not use noninlined S-functions.

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 before MATLAB release R14SP3, use the following command to make your model compatible with model reference :

% Set the Model Reference Compliant flag to on.
set_param(bdroot,'ModelReferenceCompliant','on') 

Code that you generate from Simulink models by using Embedded Coder software includes 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