| Contents | Index |
| On this page… |
|---|
Eclipse (www.eclipse.org) is an integrated development environment for developing and debugging embedded software. Cygwin (www.cygwin.com) is an environment that is similar to the Linux environment, but runs on Windows and includes the GCC compiler and debugger.
This section contains instructions for using the Eclipse IDE with Cygwin tools to build, run, test, and debug projects that include generated code, as described in Integrate Generated Code into External Environment and Verify Generated Code. There are many other software packages and tools that can work with code generation software to perform similar tasks.
Installing the Eclipse IDE and Cygwin Debugger contains instructions for installing Eclipse and Cygwin. Before proceeding, be sure you have installed Eclipse and Cygwin, as described in that section.
Note To use Eclipse IDE with embedded IDEs and target processors, see Working with Eclipse IDE under Embedded IDEs and Embedded TargetsDesktop IDEs and Desktop Targets. |
To use Cygwin, your build folder must be on your C drive. The folder path cannot include any spaces.
Integrate Generated Code into External Environment and Verify Generated Code both use the instructions in this section, but the project names and file names differ. Where you see ## in a project name or file name, substitute:
externenv, if you are working in Integrate Generated Code into External Environment
testcode, if you are working in Verify Generated Code
In Eclipse, choose File > New > C Project. A C Project dialog box opens.
In the C Project dialog box:
In the Project name field, type the project name throttlecntrl_## (## is externenv or testcode) .
In the Location field, specify the location of your build folder (for example, C:\EclipseProjects\throttlecntrl\externenv).
In the Project type selection box, select and expand Makefile project.
Click the Empty Project node.
Under Other Toolchains, select Cygwin GCC .
Click Next. A Select Configurations dialog box opens.
In the Select Configurations dialog box, click Advanced settings. The Properties dialog box appears.
In the Properties dialog box:
Select C/C++ Build.
Select Generate Makefiles automatically.
Select the Behavior tab.
Select Build on resource save (Auto build).
Click Apply and OK.
The Properties box closes.
In the Select Configurations dialog box, click Finish.
In Eclipse, choose Run > Debug Configurations. The Debug Configurations dialog box opens.
Double-click C/C++ Application. A throttlecntrl_externenv Default entry appears under C/C++ Application. The Main tab of the configuration pane appears on the right side of the dialog box with the following parameter settings:
| Parameter | Setting |
|---|---|
| Name | throttlecntrl_externenv Default |
| C/C++ Application | Default\throttlecntrl_externenv.exe |
| Project | throttlecntrl_externenv |
| Build configuration | Default |
| Enable auto build | Cleared |
| Disable auto build | Cleared |
| Use workspace settings | Selected |
Click Close.
To start the debugger:
In the main Eclipse window, select Run > Debug. A Confirm Perspective Switch dialog box opens.
Click Yes. Tabbed debugger panes that display debugging information and controls are displayed in the main Eclipse window.
Specify the location of the project files. The Cygwin debugger creates a virtual drive (for example, main() at /cygdrive/) during the build process. To run the debugger, Eclipse remaps the drive or locates your project files. Once Eclipse locates the first file, it automatically finds the remaining files. In the Eclipse window, click Locate File. The Open dialog box opens.
For information on using the Edit Source Lookup Path button, see Setting the Cygwin Path.
Navigate to the example_main.c file and click Open. Your program opens in the debugger software.
The first time you run Eclipse, you get an error related to the Cygwin path.
To provide the path information:
Open the Debug Configurations dialog box by selecting Run > Debug Configurations > C/C++ Application.
Click the Source tab.
Click Add. The Add Source dialog box opens.
Select Path Mapping and click OK. The Path Mappings dialog box opens.
Click Add. In the Compilation path field, type \cygdrive\c\.
In the Local file system path field, click the Browse button, navigate to your C:\ drive, and click OK.
Click Apply.
Click Close.
The following actions and commands are available in the debugger.
| Action | Command |
|---|---|
| Step into | F5 |
| Step over | F6 |
| Step out | F7 |
| Resume | F8 |
| Toggle break point | Ctrl + Shift + B |
![]() | Installing the Eclipse IDE and Cygwin Debugger |

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 |