Use Eclipse™ and Cygwin™, a free software integration development environment (IDE) and free compiler, for the examples Build Integrated Code Outside the Simulink Environment and Test Generated Code.
For information about the example model and other examples in this series, see Prepare a Control Algorithm Model for C Code Generation.
1. Open Eclipse.
2. Select File > New > C Project.
3. Use the C Project dialog box to configure the project.
a. Specify the project name.
b. Select the project location.
c. Select the project type as Makefile.
d. Select the Cygwin GCC toolchain and click Finish.
4. Select Project > Properties. Use Advanced settings to fully configure the project.
a. Select the C/C++ Build properties.
b. On the Builder Settings tab, select Generate Makefiles automatically.
c. View the Behaviour tab.
d. Select Build on resource save (Auto build).
5. Compile the generated code with Eclipse.
After you define the files, Eclipse determines the main function and builds the project with the managed make environment. The build details appear in the Console window.
1. Select Run > Debug Configurations.
2. Use the Debug Configurations dialog box to configure the debugger.
a. Select C/C++ Application.
b. Click the new configuration button.
c. Select the project.
d. Click Apply. Do not click Run.
If required, select the executable. Eclipse automatically finds the exe
file.
3. To start the debugger, from the primary Eclipse window, select Run > Debug.
During the build process, Cygwin creates a virtual drive, /cygdrive/c/
. To run the debugger, Eclipse either remaps the drive or locates the files. After locating the first file, Eclipse finds the remaining files.
4. Run the debugger on the generated code.
You can use these commands from the debugger context menu:
F5: Step into
F6: Step over
F7: Step out
F8: Resume
Ctrl+Shift+B: Toggle break point
Ctrl+Shift+R: Run to line
Shift+F5: Use Step Filters