Skip to content

Feature: implementation of jtagtap_cycle for JLink backend#2182

Merged
dragonmux merged 3 commits intoblackmagic-debug:mainfrom
ALTracer:feature/jtagtap_cycle_jlink
Feb 6, 2026
Merged

Feature: implementation of jtagtap_cycle for JLink backend#2182
dragonmux merged 3 commits intoblackmagic-debug:mainfrom
ALTracer:feature/jtagtap_cycle_jlink

Conversation

@ALTracer
Copy link
Contributor

Detailed description

  • This is a minor new feature.
  • The problem is rudimentary/poor implementation of jtagtap_cycle() in jlink.c backend used by BMDA. (and it didn't even exist until very recently)
  • This PR solves it by providing one moderately optimized variant.

Tracking: #2180.
Note that jlink_jtag_init() used to rely on a direct jlink_transfer() of a baked byte buffer with 56 idle clocks and SWD-to-JTAG switch sequence, I replaced that with a jlink_jtag_cycle() call for 56-5=51 clocks and a shorter, 16-bit sequence. The caveat is that new function may raise an exception, and at scan time it results in immediate SIGABRT because it's unhandled (by any TRY-CATCH up the callsite). It also happens to be the first 0xCF opcode transfer. If such behaviour is unwanted, discard commit 1.

Tested on J-Link V9 against a RISC-V MCU.

Your checklist for this pull request

Closing issues

@ALTracer ALTracer force-pushed the feature/jtagtap_cycle_jlink branch from 91d9770 to 1bb302e Compare February 2, 2026 05:35
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

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

Couple of things we notice reviewing this, but with them fixed we'll be happy to merge this.

@dragonmux dragonmux added this to the v2.1 release milestone Feb 2, 2026
@dragonmux dragonmux added Enhancement General project improvement BMD App Black Magic Debug App (aka. PC hosted) (not firmware) labels Feb 2, 2026
@ALTracer ALTracer force-pushed the feature/jtagtap_cycle_jlink branch from 1bb302e to d8a5c4d Compare February 2, 2026 21:34
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

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

The suggested other way to express the cycle logic we think fits quite well - doesn't need byte ordering shenanigans, or wide shift and subtract - with the first block of the #if/#else removed and the two small notes below addressed, we'll be happy to merge this.

@ALTracer ALTracer force-pushed the feature/jtagtap_cycle_jlink branch from 8b6f9af to 6af9486 Compare February 6, 2026 17:51
@ALTracer ALTracer force-pushed the feature/jtagtap_cycle_jlink branch from 6af9486 to 82a0581 Compare February 6, 2026 17:52
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

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

LGTM, merging. Thank you for the contribution and this improvement to the J-Link backend!

@dragonmux dragonmux merged commit 82a0581 into blackmagic-debug:main Feb 6, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BMD App Black Magic Debug App (aka. PC hosted) (not firmware) Enhancement General project improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants