swj-dp.tcl 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # ARM Debug Interface V5 (ADI_V5) utility
  3. # ... Mostly for SWJ-DP (not SW-DP or JTAG-DP, since
  4. # SW-DP and JTAG-DP targets don't need to switch based
  5. # on which transport is active.
  6. #
  7. # declare a JTAG or SWD Debug Access Point (DAP)
  8. # based on the transport in use with this session.
  9. # You can't access JTAG ops when SWD is active, etc.
  10. # params are currently what "jtag newtap" uses
  11. # because OpenOCD internals are still strongly biased
  12. # to JTAG .... but for SWD, "irlen" etc are ignored,
  13. # and the internals work differently
  14. # for now, ignore non-JTAG and non-SWD transports
  15. # (e.g. initial flash programming via SPI or UART)
  16. # split out "chip" and "tag" so we can someday handle
  17. # them more uniformly irlen too...)
  18. if [catch {transport select}] {
  19. echo "Error: unable to select a session transport. Can't continue."
  20. shutdown
  21. }
  22. proc swj_newdap {chip tag args} {
  23. if [using_jtag] {
  24. eval jtag newtap $chip $tag $args
  25. } elseif [using_swd] {
  26. eval swd newdap $chip $tag $args
  27. } else {
  28. echo "Error: transport '[ transport select ]' not supported by swj_newdap"
  29. shutdown
  30. }
  31. }