Skip to content

Conversation

AFOliveira
Copy link
Contributor

@AFOliveira AFOliveira commented Oct 15, 2025

This PR introduces a new Zephyr runner lldbac that provides interactive debugging support for ARC-V targets using the run-lldbac tool from Synopsys ARC MetaWare Development Toolkit (MWDT).

The runner supports both simulator (nSIM) and physical hardware debugging. For simulator mode, it uses --nsim with board-configured properties or optional --tcf files. For hardware mode, it provides flash and debug capabilities via board.json JTAG configuration. Hardware mode requires explicit --board-json argument to prevent accidental misconfigurations.

The debug command is available for both simulator and hardware, while flash is hardware-only (simulator users should use the existing arc-nsim runner for non-interactive execution). TCF and props are mutually exclusive for simulator mode, with TCF taking precedence if both are specified.

Example usage:

# Simulator debugging
west debug --runner lldbac

# Hardware debugging and flashing
west debug --runner lldbac --hardware --board-json=board.json
west flash --runner lldbac --hardware --board-json=board.json

Tested on nsim_arc_v/rmx100 board target.

@AFOliveira AFOliveira force-pushed the afoliveira/lldbac-runner branch 2 times, most recently from b83a976 to 7bb4d56 Compare October 15, 2025 17:29
@sonarqubecloud
Copy link

@AFOliveira AFOliveira requested a review from pdgendt October 16, 2025 07:15
@pdgendt
Copy link
Contributor

pdgendt commented Oct 16, 2025

Re-assigning because I have zero experience with ARC

@pdgendt pdgendt assigned evgeniy-paltsev and unassigned pdgendt Oct 16, 2025
Copy link
Member

@ruuddw ruuddw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, but it seems to need some more work/discussion/testing.
E.g. on Windows I had to change the name of the command to "run-lldbac.bat" to ensure the executable (script) was found.

@ruuddw ruuddw assigned ruuddw and unassigned evgeniy-paltsev Oct 16, 2025

def __init__(self, cfg, props, tcf=None, hardware=False, board_json=None, gui=False):
super().__init__(cfg)
self.lldbac_cmd = ['run-lldbac']
Copy link
Contributor

@marc-hb marc-hb Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.lldbac_cmd = ['run-lldbac']
self.lldbac_cmd = [shutil.which('run-lldbac')]

shutil.which() automatically appends .bat or .exe on Windows, which solves the Windows problem reported by @ruuddw in #97635 (review)

This is already used in dozens of places in this repo.

(I have not looked at the code; I only saw @ruuddw 's comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip @marc-hb!

Introduce a new Zephyr runner, `lldbac`, providing interactive debugging
for both nSIM (simulator) and physical hardware using the run-lldbac
tool from Synopsys ARC MWDT.

This runner provides two distinct operation modes:

1. Integrated mode (debug/flash): Runner manages debug server internally
   via run-lldbac wrapper tool
2. Client-only mode (debugserver): Connect lldbac client to externally
   managed GDB server (works for both simulator and hardware)

Key features:
- Hardware mode: Flash and debug on physical hardware using JTAG flags
  (requires --jtag-device parameter)
- Simulator mode: Interactive debugging on nSIM using run-lldbac with
  --nsim flag (props or --tcf). Enable with --simulator flag.
- Board-driven config: Boards can specify defaults in board.cmake
- TCF support: Optional --tcf for simulator mode (mutually exclusive
  with --nsim-props)
- GUI support: Optional --gui flag for VS Code debugging
- Client-only mode: Connect to pre-started GDB server for advanced
  workflows and remote debugging

Runner capabilities:
- flash: Available for hardware only (simulator should use arc-nsim)
- debug: Available for both simulator and hardware (integrated mode)
- debugserver: Connect to existing GDB server (client-only mode)

Hardware configuration (flag-based):
- --jtag-device: JTAG device name (required, e.g., JtagHs2)
- --jtag: JTAG adapter type (default: jtag-digilent)
- --jtag-frequency: JTAG clock frequency (default: 500KHz)

Simulator configuration:
- --simulator: Enable simulator mode (required)
- --nsim-props: nSIM properties file path
- --tcf: Tool Configuration File (alternative to --nsim-props)

Client-only mode:
- --gdb-host: GDB server hostname/IP (default: localhost)
- --gdb-port: GDB server port (default: 3333)

The debugserver command uses raw `lldbac` instead of `run-lldbac` to
avoid automatic platform connection, enabling clean client-only
operation for remote debugging and advanced workflows.

Signed-off-by: Afonso Oliveira <[email protected]>
Add lldbac runner configuration to arc_v nSIM board family for
simulator debugging with run-lldbac tool.

Configure --nsim-props argument using the same NSIM_PROPS variable as
arc-nsim runner for consistency. This enables the lldbac runner to
use the board-specific nSIM properties for simulator mode debugging.

The lldbac runner supports both simulator and hardware modes, with
simulator mode being enabled via the --simulator flag. For hardware
debugging, users need to provide --board-json configuration separately.

Signed-off-by: Afonso Oliveira <[email protected]>
Add comprehensive documentation for using the lldbac runner with arc_v
nSIM board targets, covering simulator and hardware debugging workflows.

Signed-off-by: Afonso Oliveira <[email protected]>
@AFOliveira AFOliveira force-pushed the afoliveira/lldbac-runner branch from 7bb4d56 to 71111bf Compare October 22, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants