Debugging of the embedded code within a 32-bit processor is carried out by starting a debug session. Prior to starting the session, you must ensure that the design, including one or more debug-enabled processors and their respective embedded code, has been downloaded to the target physical FPGA device.
To start a debug session for the embedded code of a specific processor in the design – directly from the Devices view – simply right-click on the icon for that processor, in the Soft Devices chain of the view, and choose the Debug command from the pop-up menu that appears.
The embedded project for the software running in the processor will initially be recompiled and the debug session will commence. The relevant source code document (either Assembly or C) will be opened and the current execution point will be set to the first line of executable code (Figure 1).
Note: You can have multiple debug sessions running simultaneously – one per embedded software project associated with a processor in the Soft Devices chain.
The debug environment offers the full suite of tools you would expect to see in order to efficiently debug the embedded code. These features include:
- Setting Breakpoints
- Adding Watches
- Stepping into and over at both the source (
.C) and instruction (
- Reset, Run and Halt code execution
- Run to cursor
All of these and other feature commands can be accessed from the Debug menu or the associated Debug toolbar (Figure 2).
A debug session can be ended in one of three ways:
- By invoking the End Debug command from the right-click menu for the processor in the Devices view
- By invoking the Stop Debugging command, from the main Debug menu within the source code editor
- By clicking the button on the Debug toolbar associated with the source code editor.
Various workspace panels are accessible in the debug environment, allowing you to view/control code-specific features, such as Breakpoints, Watches and Local variables, as well as information specific to the processor in which the code is running, such as memory spaces and registers.
These panels can be accessed from the View » Workspace Panels » Embedded sub menu, or by clicking on the Embedded button at the bottom of the application window and choosing the required panel from the subsequent pop-up menu.
Full-feature debugging is of course enjoyed at the source code level – from within the source code file itself. To a lesser extent, debugging can also be carried out from a dedicated debug panel for the processor. To access this panel, first double-click on the icon representing the processor to be debugged, in the Soft Devices chain of the Devices view. The Instrument Rack - Soft Devices panel will appear, with the chosen processor instrument added to the rack (Figure 5).
Note: Each core processor that you have included in the design will appear, when double-clicked, as an Instrument in the rack (along with any other Nexus-enabled devices).
The Nexus Debugger button provides access to the associated debug panel (Figure 6), which in turn allows you to interrogate and to a lighter extent control, debugging of the processor and its embedded code, notably with respect to the registers and memory.
One key feature of the debug panel is that it enables you to specify (and therefore change) the embedded code (HEX file) that is downloaded to the processor, quickly and efficiently.