pyocd / pyocd/pyOCD

Flashing Disco-WB5MMG with pyOCD core #0 is not halted

Open
#1,626 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

I am trying to flash a Disco-ST32WB5MMG with MBEd Studio. Thereby PyOCD throws an error. Flashing the .elf and .bin file via ST-Link works.

Setup:

  • Windows 11 PC
  • Disco-ST32WB5MMG
  • MBED Studio
  • MBED OS 6.15.1

Debug Commands: --target STM32WB55VGYx --erase=chip --frequency 1800000 --pack 'c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\cmsis-packs\Keil.STM32WBxx_DFP.1.1.0-small.pack' -O connect_mode=under-reset

0001113:CRITICAL:__main__:cannot read register r0 because core #0 is not halted
Traceback (most recent call last):
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 402, in run
    self._COMMANDS[self._args.cmd](self)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 579, in do_flash
    file_format=self._args.format)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\file_programmer.py", line 157, in program
    self._loader.commit()
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\loader.py", line 168, in commit
    keep_unwritten=self._keep_unwritten)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\builder.py", line 464, in program
    flash_operation = self._chip_erase_program_double_buffer(progress_cb)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\builder.py", line 706, in _chip_erase_program_double_buffer
    self.flash.erase_all()
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\flash.py", line 345, in erase_all
    result = self._call_function_and_wait(self.flash_algo['pc_eraseAll'])
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\flash.py", line 604, in _call_function_and_wait
    return self.wait_for_completion()
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\flash\flash.py", line 600, in wait_for_completion
    return self.target.read_core_register('r0')
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\soc_target.py", line 173, in read_core_register
    return self.selected_core.read_core_register(id)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 911, in read_core_register
    regValue = self.read_core_register_raw(reg_info.index)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 928, in read_core_register_raw
    vals = self.read_core_registers_raw([reg])
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 949, in read_core_registers_raw
    return self._base_read_core_registers_raw(reg_list)
  File "c:\Users\JonasAlber\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 967, in _base_read_core_registers_raw
    self.core_number))
pyocd.core.exceptions.CoreRegisterAccessError: cannot read register r0 because core #0 is not halted

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported debug command with the Disco-ST32WB5MMG setup and trace the failure from pyocd/main.py through flash.py and coresight/cortex_m.py. The issue is resolved when chip erase and flashing complete without the core #0 not halted error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.