pyocd / pyocd/pyOCD

flashing LPC55S69 can fail if board not in a good state

Open
#693 5 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've somehow 'bricked' a board and than try and re-flash, I get:

[galak@localhost build]$ pyocd flash zephyr/zephyr.bin 
Secure
0001090:CRITICAL:__main__:uncaught exception: 
Traceback (most recent call last):
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/__main__.py", line 338, in run
    self._COMMANDS[self._args.cmd](self)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/__main__.py", line 475, in do_flash
    file_format=self._args.format)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/loader.py", line 160, in program
    self._loader.commit()
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/loader.py", line 504, in commit
    keep_unwritten=self._keep_unwritten)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/flash_builder.py", line 449, in program
    sector_erase_count, page_program_time = self._compute_sector_erase_pages_and_weight(fast_verify)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/flash_builder.py", line 625, in _compute_sector_erase_pages_and_weight
    self._analyze_pages_with_partial_read()
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/flash_builder.py", line 561, in _analyze_pages_with_partial_read
    self._enable_read_access()
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/flash_builder.py", line 221, in _enable_read_access
    self.flash.init(self.flash.Operation.VERIFY)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/flash/flash.py", line 235, in init
    self.target.reset_and_halt(Target.ResetType.SW)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/core/coresight_target.py", line 333, in reset_and_halt
    return self.selected_core.reset_and_halt(reset_type)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/target/builtin/target_LPC55S69JBD100.py", line 295, in reset_and_halt
    xpsr = self.read_core_register('xpsr')
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py", line 987, in read_core_register
    regValue = self.read_core_register_raw(regIndex)
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py", line 1001, in read_core_register_raw
    vals = self.read_core_registers_raw([reg])
  File "/home/galak/.local/lib/python3.7/site-packages/pyocd/coresight/cortex_m.py", line 1061, in read_core_registers_raw
    assert dhcsr_val & CortexM.S_REGRDY
AssertionError

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

Reproduce the failure with pyocd flash zephyr/zephyr.bin, then trace target_LPC55S69JBD100.py:reset_and_halt through cortex_m.py:read_core_registers_raw and the flash_builder.py call path shown in the traceback. Done means the LPC55S69 flashing path handles this board state without the S_REGRDY assertion, with regression coverage or a documented reproduction outcome.

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.