Chapter 8. Hints and Troubleshooting
- Keyboard shortcuts
Ctrl+Shift+Lwithin Eclipse will display a popup window with all the current keyboard bindings. If you press
Ctrl+Shift+Lagain, you will be taken to the Keys preferences page from which you can change or set keyboard bindings for various Commands within Eclipse and its installed plug- ins.
- Build Automatically
If this option is set and you change, add or delete a file within a project, the builder will automatically attempt to build that project in the background. This option is set by default and can be found in the C/C++ perspective within the Project sub-menu.
- Build Order
The order in which projects are built is important. For example, eCos configuration projects must be built before the eCos application projects or static libraries which refer to them are built. Normally the Eclipse Workbench will build all pre-requisites first but occassionally it may be desirable to build projects in a specific order. The Workbench allows users to explicitly define the order in which projects are built through the Build Order Window which can be reached through → → → → . The build order is applied for both building the entire workspace or for a group of projects.
- Clean Project
The Clean... option within the Project sub-menu will remove all artifacts created by Eclipse for all or just selected projects. If you have the Build Automatically option set, the artifacts of the chosen projects will be rebuilt automatically following a clean. If the option is off, clean will remove the artifacts and stop, allowing you invoke Build manually later.
The Clean option within a project context (i.e. a project) will automatically clean the selected project and all the projects referenced. For example, if this option is selected in an eCos application project that also refers to a static library, all of the application project, eCos configuration project and static library project will be cleaned. If you also have the → option set, all those projects will be rebuilt after they have been cleaned.
- Eclipse and the eCos Configuration Tool
As described in the “eCos configuration projects” section, the eCos Configuration Tool is used by Eclipse as a standalone tool to create and edit eCos configurations. However, when editing an eCos configuration with the eCos Configuration Tool in this manner, certain features of the eCos Configuration Tool are disabled which will tie the tool to the specific eCos configuration file that is being edited. This is known as the Eclipse Lockdown Mode of the eCos Configuration Tool. For example, you cannot Save As or Open other configuration projects, nor can you change Profiles, alter the eCos Repository or modify the Path to the host or GNU tools. This ensures that the Eclipse workspace as well as the eCos configuration and its elements remain consistent with the state Eclipse believes the eCos configuration project to be in.
When the eCos Configuration Tool is started normally from the command line, the Desktop or a Desktop menu, it is run in its normal Default mode with all its normal functionality available to you. However, you should not use the eCos Configuration Tool in this mode to edit or create eCos configurations, or build eCos configurations within an Eclipse Workspace as this may result in unexpected consequences and inconsistent behaviour. Always use Eclipse to start the eCos Configuration Tool when you wish to modify an eCos configuration file that is part of an Eclipse eCos Configuration Project.
- Disable optimizations
Compiler optimization can result in code being re-ordered, particularly at assembly-level, to provide fast and efficient code, or just smaller code sizes. This makes the job of source- level debuggers to match assembly-level instructions with lines of source code at times difficult, if not impossible, as single stepping of source code is often performed at assembly-level. It is unsurprising then that your source-level debugger may jump around when executing a seemingly sequential set of source code operations, or sometimes the source-level debugger may even fail to hit a breakpoint or stop at an apparently arbitrary location, when debugging optimized code.
Figure 8.1. Find CYGBLD_GLOBAL_CFLAGS in configuration
To follow the logical source-code progression of execution of an eCos application you must turn off optimizations for both your eCos application and the eCos library, or project, against which your application is linked. To do this, edit your active configuration from within the configuration project, and search for the
CYGBLD_GLOBAL_CFLAGSmacro using the search dialog, → (Ctrl+F), illustrated in Figure 8.1, “Find CYGBLD_GLOBAL_CFLAGS in configuration” to take you to the generic option and change the
-O0. For additional debug support, developers are also encouraged to add the
CYGPKG_INFRAInfrastructure package to their configuration: → (Ctrl+P) (add
CYGPKG_INFRAinto the keywords field and ensure the Infrastructure package appears under Use these pachages, followed by - See Figure 8.2, “Packages Dialog - Add CYGPKG_INFRA”) and to enable the
CYGPKG_INFRA_DEBUGAsserts & Tracing option within the configuration tree.
Figure 8.2. Packages Dialog - Add CYGPKG_INFRA
- Error in final launch sequence, Failed to execute MI command
Slow host PCs or remote target communications can occasionally result in a GDB timeout. This in turn can result in errors such as “Error in final launch sequence, Failed to execute MI command” error within Eclipse/CDT, or debug sessions locking up and becoming unresponsive.
This issue can be resolved by extending the timeout used by GDB for remote communications. Use a GDB command file containing the line below:
set remotetimeout 30
When using an eCos Hardware Debug
configuration, within the
Debugging” tab, select the GDB command file within the “
GDB Command File” section; or
When using an eCos Remote Debug
configuration, within the
Debugger” tab and under the “
Debugger Options” in the “
Main” tab, enter the GDB command file alongside the “
GDB Command File” option.
You should now be able to debug without the error occurring.
- When using an eCos Hardware Debug configuration, within the “