pyocd / pyOCD

Open source Python library for programming and debugging Arm Cortex-M microcontrollers
https://pyocd.io
Apache License 2.0
1.14k stars 485 forks source link

Error with `DebugDeviceUnlock` for STM32 Nucleo-H723ZG board #1739

Open pdietl opened 3 weeks ago

pdietl commented 3 weeks ago
pyOCD on ξ‚  HEAD (c684bdf) [$] via 🐍 v3.12.3 (pyOCD Venv$)
❯ git log --oneline --max-count=4
c684bdf3 (HEAD, upstream/develop) board: remove extra space in generic cortex-m warning message (#1625)
48887960 Update copyright section (#1621)
ef74216c coresight: cortex-m: always evaluate deferred read of MVFR2 (#1613)
5f02a94b target: add support for airm2m air32f103 target (#1615)

pyOCD on ξ‚  HEAD (c684bdf) [$] via 🐍 v3.12.3 (pyOCD Venv$)
❯ which pyocd
/home/pdietl/Repos/pyOCD/venv/bin/pyocd

pyOCD on ξ‚  HEAD (c684bdf) [$] via 🐍 v3.12.3 (pyOCD Venv$)
❯ pyocd list
  #   Probe/Board     Unique ID                  Target
------------------------------------------------------------------
  0   STLINK-V3       002500263233510739363634   βœ”οΈŽ stm32h723zgtx
      NUCLEO-H723ZG

pyOCD on ξ‚  HEAD (c684bdf) [$] via 🐍 v3.12.3 (pyOCD Venv$)
❯ pyocd load ~/zephyrproject/zephyr/build/zephyr/zephyr.elf
0000839 E Error while running debug sequence 'DebugDeviceUnlock' (core Cortex-M7): STLink error (5): No device connected [pack_target]
0000856 C STLink error (5): No device connected [__main__]

pyOCD on ξ‚  HEAD (c684bdf) [$] via 🐍 v3.12.3 (pyOCD Venv$)
❯ pyocd load ~/zephyrproject/zephyr/build/zephyr/zephyr.elf -vvv
0000353 D Project directory: /home/pdietl/Repos/pyOCD [session]
0000355 D Project directory: /home/pdietl/Repos/pyOCD [session]
0000359 D STLink probe 002500263233510739363634 firmware version: V3J7M2 [stlink]
0000627 D STM32H7xx_DFP DFP (STM32H723ZGTx): not loading non-default flash algorithm 'CMSIS/Flash/STM32H7B3I_EVAL_FMC-NOR.FLM' [cmsis_pack]
0000627 D STM32H7xx_DFP DFP (STM32H723ZGTx): not loading non-default flash algorithm 'CMSIS/Flash/STM32H7xx_MT25TL01G_DUAL.FLM' [cmsis_pack]
0000627 D STM32H7xx_DFP DFP (STM32H723ZGTx): not loading non-default flash algorithm 'CMSIS/Flash/MTFC4GACAJCN_STM32H750B-DISCO.FLM' [cmsis_pack]
0000627 D STM32H7xx_DFP DFP (STM32H723ZGTx): not loading non-default flash algorithm 'CMSIS/Flash/MX25LM51245G_STM32H735-Disco.FLM' [cmsis_pack]
0000628 D STM32H7xx_DFP DFP (STM32H723ZGTx): not loading non-default flash algorithm 'CMSIS/Flash/STM32H743I-eval_FMC.FLM' [cmsis_pack]
0000666 I Target type is stm32h723zgtx [board]
0000669 D STLink probe 002500263233510739363634 firmware version: V3J7M2 [stlink]
0000671 D actual SWD frequency is 1000 kHz [stlink]
0000671 D Running task load_svd [sequencer]
0000739 D Running task pre_connect [sequencer]
0000745 D Running task dp_init [sequencer]
0000750 D Running task lock_probe [sequencer]
0000755 D Running task get_probe_capabilities [sequencer]
0000760 D Running task connect [sequencer]
0000801 D Default wire protocol selected; using SWD [dap]
0000818 I DP IDR = 0x6ba02477 (v2 rev6) [dap]
0000823 D Running task clear_sticky_err [sequencer]
0000840 D Running task power_up_debug [sequencer]
0000873 D Running task check_version [sequencer]
0000873 D Running task unlock_probe [sequencer]
0000873 D Running task unlock_device [sequencer]
0000873 D Running debug sequence 'DebugDeviceUnlock' (Cortex-M7) [pack_target]
0000874 I debugvar 'DbgMCU_APB1H_Fz1' = 0x0 (0) [pack_target]
0000874 I debugvar 'DbgMCU_APB1L_Fz1' = 0x0 (0) [pack_target]
0000874 I debugvar 'DbgMCU_APB2_Fz1' = 0x0 (0) [pack_target]
0000874 I debugvar 'DbgMCU_APB3_Fz1' = 0x0 (0) [pack_target]
0000874 I debugvar 'DbgMCU_APB4_Fz1' = 0x0 (0) [pack_target]
0000874 I debugvar 'DbgMCU_CR' = 0x7 (7) [pack_target]
0000874 I debugvar 'TraceClk_Pin' = 0x40002 (262146) [pack_target]
0000874 I debugvar 'TraceD0_Pin' = 0x40003 (262147) [pack_target]
0000874 I debugvar 'TraceD1_Pin' = 0x40004 (262148) [pack_target]
0000875 I debugvar 'TraceD2_Pin' = 0x40005 (262149) [pack_target]
0000875 I debugvar 'TraceD3_Pin' = 0x40006 (262150) [pack_target]
0000875 D Running debug sub-sequence 'CheckID' (Cortex-M7) [functions]
0000877 E Error while running debug sequence 'DebugDeviceUnlock' (core Cortex-M7): STLink error (5): No device connected [pack_target]
0000877 D uninit session <pyocd.core.session.Session object at 0x7ecdf1b077d0> [session]
0000879 C STLink error (5): No device connected [__main__]
Traceback (most recent call last):
  File "/home/pdietl/Repos/pyOCD/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
             ^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/subcommands/load_cmd.py", line 100, in invoke
    with session:
  File "/home/pdietl/Repos/pyOCD/pyocd/core/session.py", line 409, in __enter__
    self.open()
  File "/home/pdietl/Repos/pyOCD/pyocd/core/session.py", line 547, in open
    self._board.init()
  File "/home/pdietl/Repos/pyOCD/pyocd/board/board.py", line 143, in init
    self.target.init()
  File "/home/pdietl/Repos/pyOCD/pyocd/coresight/coresight_target.py", line 123, in init
    super().init()
  File "/home/pdietl/Repos/pyOCD/pyocd/core/soc_target.py", line 174, in init
    seq.invoke()
  File "/home/pdietl/Repos/pyOCD/pyocd/utility/sequencer.py", line 208, in invoke
    resultSequence = call()
                     ^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/coresight/coresight_target.py", line 195, in unlock_device
    self.call_pre_discovery_debug_sequence('DebugDeviceUnlock')
  File "/home/pdietl/Repos/pyOCD/pyocd/coresight/coresight_target.py", line 180, in call_pre_discovery_debug_sequence
    self.debug_sequence_delegate.run_sequence(sequence, pname=pcore_pname)
  File "/home/pdietl/Repos/pyOCD/pyocd/target/pack/pack_target.py", line 281, in run_sequence
    executed_scope = seq.execute(context)
                     ^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 412, in execute
    self._execute_children(context)
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 286, in _execute_children
    cast(DebugSequenceNode, node).execute(context)
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 523, in execute
    interp.execute()
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 990, in execute
    return visitor.visit(self._tree)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 423, in visit
    return self._visit_tree(tree)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 431, in _visit_tree
    return f(tree)
           ^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 806, in start
    values = self.visit_children(tree)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 434, in visit_children
    return [self._visit_tree(child) if isinstance(child, Tree) else child
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 431, in _visit_tree
    return f(tree)
           ^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 848, in expr_stmt
    values = self.visit_children(tree)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 434, in visit_children
    return [self._visit_tree(child) if isinstance(child, Tree) else child
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 431, in _visit_tree
    return f(tree)
           ^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 914, in fncall
    result = impl(*fn_args)
             ^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/functions.py", line 162, in sequence
    subsequence_scope = seq.execute(self.context)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 412, in execute
    self._execute_children(context)
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 286, in _execute_children
    cast(DebugSequenceNode, node).execute(context)
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 523, in execute
    interp.execute()
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 990, in execute
    return visitor.visit(self._tree)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 423, in visit
    return self._visit_tree(tree)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 431, in _visit_tree
    return f(tree)
           ^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 806, in start
    values = self.visit_children(tree)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 434, in visit_children
    return [self._visit_tree(child) if isinstance(child, Tree) else child
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 431, in _visit_tree
    return f(tree)
           ^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 831, in assign_stmt
    values = self.visit_children(tree)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 434, in visit_children
    return [self._visit_tree(child) if isinstance(child, Tree) else child
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/venv/lib/python3.12/site-packages/lark/visitors.py", line 431, in _visit_tree
    return f(tree)
           ^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/sequences.py", line 914, in fncall
    result = impl(*fn_args)
             ^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/functions.py", line 192, in read32
    return self._get_mem_ap().read32(addr)
           ^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/debug/sequences/functions.py", line 112, in _get_mem_ap
    ap = AccessPort.create(self.target.dp, ap_addr)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/coresight/ap.py", line 392, in create
    ap = klass(dp, ap_address, idr, name, flags, cmpid)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/coresight/ap.py", line 605, in __init__
    self._accelerated_memory_interface = self.dp.probe.get_memory_interface_for_ap(self.address)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pdietl/Repos/pyOCD/pyocd/probe/stlink_probe.py", line 263, in get_memory_interface_for_ap
    self._link.open_ap(apsel)
  File "/home/pdietl/Repos/pyOCD/pyocd/probe/stlink/stlink.py", line 336, in open_ap
    self._check_status(response)
  File "/home/pdietl/Repos/pyOCD/pyocd/probe/stlink/stlink.py", line 365, in _check_status
    raise exceptions.ProbeError(error_message)
pyocd.core.exceptions.ProbeError: STLink error (5): No device connected

pyOCD on ξ‚  HEAD (c684bdf) [$] via 🐍 v3.12.3 (pyOCD Venv$)
❯