Source Code Integration

The Source Code tab links Active Debug Port trace events back to the exact line of firmware source code that generated them. When you click a debug event in the waveform display, the Source Code tab automatically jumps to the corresponding file and highlights the responsible line.

This is extremely useful when you have a long debug trace and want to understand what the firmware was doing at any given moment without manually searching through code.


How It Works

When your firmware calls ACTIVEText(), ACTIVEprintf(), or ACTIVEValue() on a specific channel, those calls have a location in your source tree. The Source Code tab scans your source directory for all places in your firmware that output to each channel, and maintains a list of those locations. When you click on a trace event in the waveform, the application matches that event's channel and content to a source location and shows you the code.

This works for C, C++, Python, Verilog, VHDL, SystemVerilog, Rust, and Java source files.


Interface Components

  • Waveform Display — Shows trace events across various channels such as TX, RX, and ERROR.
  • Active Debug Port Devices ComboBox — Located at the top of the tab; select from the list of devices configured to use the Active Debug Port.
  • Active Debug Port Channels ComboBox — Choose from available channels for the selected device.
  • Source Code Directory — Input the directory path of the source code for the device's firmware project.
  • Data Output Locations List — Displays all locations within the firmware where the selected device outputs data to the chosen channel.
  • Source Code Viewer — Displays the source code file corresponding to the selected output location, highlighting the exact line of code responsible for the output.

Setup Process

  1. Select Your Device — From the Devices ComboBox, choose your device.
  2. Select the Channel — Use the Channels ComboBox to select the desired channel.
  3. Set the Source Code Directory — Click Browse to locate and set the directory containing your device's firmware source code. The search is recursive — all subdirectories are included automatically.
  4. View Data Output Locations — The list below the directory input will show all firmware locations where data is output to the selected channel.

Linking Trace Events to Source Code

From the waveform:

  1. Right-click on a line in the waveform trace that shows debug data for an Active Debug Port device and select Show Source Code from the context menu.
  2. The Source Code Viewer will automatically highlight the relevant line of code.

You can also left-click on a decoded text event in the channel's waveform row — the Source Code tab scrolls to the responsible source line automatically.

From the List tab:

  1. Click any decoded row in the List tab for an Active Debug Port channel.
  2. The waveform scrolls to that event's timestamp.
  3. The Source Code tab shows the source line that generated the event.

Tips for Maximum Usefulness

Name your channels clearly. The channel name comes from your call to ACTIVELabel() in firmware. Descriptive channel names make it much easier to navigate the source list.

Keep channels purpose-specific. One channel per firmware module or subsystem makes the source location list short and easy to read. If you mix many different kinds of events on one channel, the location list becomes long.

Instrument at decision points. Put ACTIVEprintf() calls at the key branch points and state transitions in your firmware — these are the moments you actually care about when debugging, and they are the ones where seeing the exact source line is most valuable.

Firmware runs at full speed. Unlike a debugger with a breakpoint, none of this halts your target. You can capture thousands of events over many seconds of real execution and then navigate through the source locations at your leisure.

Previous
Previous

PacketPresenter

Next
Next

Automation API