pyocd / pyOCD

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

"pyocd commander --no-init" has an exception with pyOCD ver 0.28 (but not with ver 0.27.1) #1024

Closed eleenest closed 3 years ago

eleenest commented 3 years ago

We are using pyocd with daplink (on a separate debug board, i.e. a target isn't permanently attached).

If we try running pyocd commander with the --no-init flag on pyocd v0.28 we are seeing an exception (which isn't there on pyocd ver 0.27.1).

pyocd commander --no-init

0001109:WARNING:board:Generic 'cortex_m' target type is selected by default; is this intentional? You will be able to debug most devices, but not program flash. To set the target type use the '--target' argument or 'target_override' option. Use 'pyocd list --targets' to see available targets types. 0001133:CRITICAL:main:uncaught exception: Traceback (most recent call last): File "/Users/abcd/Library/Python/2.7/lib/python/site-packages/pyocd/main.py", line 398, in run self._COMMANDSself._args.cmd File "/Users/abcd/Library/Python/2.7/lib/python/site-packages/pyocd/main.py", line 802, in do_commander PyOCDCommander(self._args, cmds).run() File "/Users/abcd/Library/Python/2.7/lib/python/site-packages/pyocd/commands/commander.py", line 64, in run if not self.connect(): File "/Users/abcd/Library/Python/2.7/lib/python/site-packages/pyocd/commands/commander.py", line 183, in connect result = self.context.attach_session(self.session) File "/Users/abcd/Library/Python/2.7/lib/python/site-packages/pyocd/commands/execution_context.py", line 204, in attach_session assert session.is_open AssertionError

Our workaround is to: pip uninstall pyocd pip install pyocd==0.27.1

flit commented 3 years ago

Just so happens I already had fixes for --no-init issues from a day or two ago. 😁

If you can, please test the changes in #1025 and let me know if that solves your issues.