Using the Debugger

The debugger supplied with Simplicity Studio® 5 (SSv5) is based on the Eclipse EDC debugger. It is a full featured debugger that offers the ability to step through code, set breakpoints, examine memory, variables and registers. Silicon Labs supplies the debug models for each of their devices so that all of the registers can be examined and modified using the debugger.

The debugger runs in the Debug perspective. The debug perspective can be opened in a variety of ways, but most commonly by clicking the Debug button in the Simplicity IDE perspective once a project has reached a point where it will build and link correctly.

If a debug session has never been started before, a warning that a debug configuration does not exist might appear. Click the down arrow next to the debug icon, select Debug as... and then select either Silicon Labs ARM Program for 32-bit parts or Silicon Labs 8051 Program for EFM8 and C8051 parts.

If a single debug adapter is available, SSv5 automatically downloads the code to that device. If more than one debug adapter is available, SSv5 will prompt to select one.

Debug Perspective

The Debug Perspective by default is composed of the editor (A) and three tabbed view panes.

The Debug view (B) shows the call stack and call hierarchy that can help debug and find where functions are called. The Project Explorer view is available as a tab.

The right pane (C) includes four views.

The Memory view in the bottom pane (D) displays the contents of the CODE, RAM, and XRAM memory. To experiment, click Add Memory Monitor. Select Enter memory space and address, select a memory space such as CORE and enter an address to view, such as 0x0000. Click OK. A memory monitor is added to the Memory view that displays the contents of the space starting at the address you provided.

Depending on your actions, additional views may open in either the right or bottom pane.

Buttons in the Debug perspective toolbar (E) are shown below.

NumberCommandDescription
1SkipSkips all breakpoints.
2ResumeRuns the application after reset or hitting a breakpoint.
3SuspendHalts the application.
4TerminateTerminates the session.
5DisconnectTerminates the session and disconnects the debug adapter. SSv5 automatically switches back to the Simplicity IDE perspective.
6Step intoSingle steps into the first line of a function.
7Step overSingle steps over a function, executing the entire function.
8Step returnSteps out of a function, executing the rest of the function.
9Instruction Stepping ModeToggles assembly single stepping. When enabled, single stepping executes a single assembly instruction at a time. If clicked, opens a Disassembly view in the right pane that shows the assembly code corresponding to the source code at the current line of execution.
10Reset the devicePerforms a hardware reset.
11Create snapshotCreates a snapshot when clicked (default). Drop down the menu to select Create when Stopped or Create at Breakpoints. See About Snapshots for more information.
12DebugStarts a new debug session. An active debug session must be disconnected before starting a new session using the same debug adapter.

A debug adapter can only support a single debug session at a time. An active debug session must be disconnected before code can be recompiled and a new debug session started.

To set a breakpoint, double-click in the blue bar to the left of the code editor or right-click on a line of code and select Add Breakpoint.

About Snapshots

A snapshot saves the values of the registers on a device at a particular point in time. This feature is useful when comparing the states of two systems next to each other or looking at the state of the hardware at separate points in time.

Once you take a snapshot, the Snapshot Album view opens in the bottom view pane.

In the Debug perspective, if you do not see the Snapshot Album view, select Window > Show View > Other > Snapshot Albums.

To view a snapshot, right-click a snapshot in the list and select Launch Snapshot. This adds a debug session in the Debug window as it was at the time of the snapshot, with a Snapshot label at the start of the debug configuration. However, it is not an active debug session on hardware. To switch back to a debug session on hardware, select the Silicon Labs ARM debug configuration in the Debug window if a hardware debug session was active or else select Run > Debug if a session is not active.