Add BDM hardware debugging support (P&E TBDML/USB Multilink, USBDM) #6

Open
opened 2026-09-24 09:54:32 +02:00 by sid · 0 comments
Owner

CodeWarrior's debugger connects to S12/S12X hardware through Background Debug Mode (BDM) probes (P&E TBDML, USB Multilink, USBDM, Abatron). This repo's GDB supports only target sim; there is no hardware debugging path, so breakpoints, memory inspection, and register access on real hardware are impossible.

Current state

  • gdb-sim is configured with --enable-sim; the only working target is the instruction-set simulator (pkgs/gdb-sim.nix).
  • GDB's generic remote target exists but no BDM backend or probe transport (P&E's protocol, USBDM's protocol) is provided, and no board/device description files exist.

Motivation

  • Simulation cannot replace on-target debugging for timing-sensitive or peripheral-bound firmware.
  • Users migrating from CodeWarrior expect a debugger that talks to their existing BDM hardware.

Proposed scope

  • Implement a BDM target backend for GDB:
    • a remote-protocol bridge (GDB target remote over serial/USB) to a BDM probe, or
    • native support for a probe protocol (start with USBDM, which is open and cheap; P&E protocols are documented).
  • BDM primitives: reset, halt/resume, single-step, register r/w, memory r/w, flash-aware memory access, breakpoint insertion (software + hardware).
  • Board/device description files integrated with the device support pack (issue #03) so target remote brings up the right device.

Acceptance criteria

  • m68hc11-elf-gdb connects to a BDM probe and can halt/resume, set a breakpoint, and read/write CPU registers and memory on a real S12/S12X.
  • The same GDB session works for -m68hc12 and -m9s12x targets.
  • A CI test mocks the BDM probe (against the sim's instruction engine) to verify the protocol stack without hardware.

References

  • pkgs/gdb-sim.nix
  • tests/s12/run-trace.sh, tests/s12/run-vectors.sh (existing GDB driver harness, currently sim-only)
CodeWarrior's debugger connects to S12/S12X hardware through Background Debug Mode (BDM) probes (P&E TBDML, USB Multilink, USBDM, Abatron). This repo's GDB supports only `target sim`; there is no hardware debugging path, so breakpoints, memory inspection, and register access on real hardware are impossible. ## Current state - `gdb-sim` is configured with `--enable-sim`; the only working target is the instruction-set simulator (`pkgs/gdb-sim.nix`). - GDB's generic remote target exists but no BDM backend or probe transport (P&E's protocol, USBDM's protocol) is provided, and no board/device description files exist. ## Motivation - Simulation cannot replace on-target debugging for timing-sensitive or peripheral-bound firmware. - Users migrating from CodeWarrior expect a debugger that talks to their existing BDM hardware. ## Proposed scope - Implement a BDM target backend for GDB: - a remote-protocol bridge (GDB `target remote` over serial/USB) to a BDM probe, or - native support for a probe protocol (start with USBDM, which is open and cheap; P&E protocols are documented). - BDM primitives: reset, halt/resume, single-step, register r/w, memory r/w, flash-aware memory access, breakpoint insertion (software + hardware). - Board/device description files integrated with the device support pack (issue #03) so `target remote` brings up the right device. ## Acceptance criteria - `m68hc11-elf-gdb` connects to a BDM probe and can halt/resume, set a breakpoint, and read/write CPU registers and memory on a real S12/S12X. - The same GDB session works for `-m68hc12` and `-m9s12x` targets. - A CI test mocks the BDM probe (against the sim's instruction engine) to verify the protocol stack without hardware. ## References - `pkgs/gdb-sim.nix` - `tests/s12/run-trace.sh`, `tests/s12/run-vectors.sh` (existing GDB driver harness, currently sim-only)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sid/m68hc11-toolchain#6
No description provided.