Debugging and Using The Code Profile Report

Starting the Debugger on Completion of the Build Process

As an alternative to downloading with MiniMon at the end of the build process, you can start your debugger. Depending on the features provided by your debugger, you can debug the application either on-chip or on a hardware simulator.

For this example, you use another demo model, c166_user_io. This model is designed to show you how to integrate your own hand-coded device drivers with automatically generated code using the Target Support Package IC1 product. This model is covered in detail in Integrating Your Own Device Drivers. You use it as an example here because you will typically need to use the debugger in cases where you are integrating your own code.

Also, note that running the debugger on-chip over the serial interface conflicts with the serial transmit and receive blocks. The c166_user_io model does not use serial blocks, so this avoids serial conflicts for this example. If you need to debug an application that includes the serial transmit and receive blocks, you must run the debugger using a hardware simulator; alternatively, it may be possible to run your debugger on-chip without using the serial interface, for example, if debugging over CAN or JTAG is available.

  1. Open the model c166_user_io.

  2. Select Simulation > Configuration Parameters.

  3. Select Embedded IDE Link TS in the tree.

  4. Select the Build action Create, Build and Debug Application Project.

  5. Before generating code, check that your target preferences related to the debugger are correctly configured. See Setting Target Preferences.

  6. Click OK.

  7. Right-click the controller subsystem and select Real-Time Workshop > Build Subsystem.

  8. Click Build in the next dialog box.

    Watch the progress messages in the command window as code is generated. At the end of the build process, your debugger launches automatically with the application ready to run. You may now debug the application.

RAM / ROM Code Profile Report

The c166_fuelsys model is derived from the fuelsys demo model. The floating point control algorithm from the original model has been converted to fixed point to allow efficient code generation for the Infineon C166 microcontroller.

The complete model includes a plant simulation as well as a fixed-point implementation of the control algorithm. When you generate code for this example, be sure to generate code for the control algorithm subsystem only:

  1. Open the model c166_fuelsys.

  2. Select Simulation > Configuration Parameters.

  3. Select Real Time Workshop in the tree. Note that the Generate code only option is not selected. The reason for this step is that the code generation report obtains information from MAP files that are created by your cross-compiler during the build process. If the Generate code only option is on, these files are not generated, which prevents the generation of the code generation report.

  4. Select Report in the tree, and then observe the selected check box Create code generation report.

    Select the Launch report automatically check box.

  5. Select Embedded IDE Link TS in the tree, and observe the Build Action is Create and Build Application Project. You must have one of the Build options selected to get the code profile report (with RAM/ROM usage):

  6. Close the Configuration Parameters dialog box.

  7. Right-click the fuel rate controller block.

  8. From the pop-up menu, select Real Time Workshop > Build Subsystem.

  9. On the following dialog box, click Build.

When code generation is complete, the Code Generation Report appears in your Help browser. Here you can review the RAM and ROM requirements of the model. To do this, left-click the link Code profile report in the left list. If you compared with the original floating-point version of the fuelsys control algorithm: you would find that using the fixed-point implementation results in a considerable reduction in both RAM and ROM. An example report is shown following.

  


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