Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyocd commander fails if an elf is provided #969

Closed
saagit opened this issue Sep 29, 2020 · 1 comment · Fixed by #971
Closed

pyocd commander fails if an elf is provided #969

saagit opened this issue Sep 29, 2020 · 1 comment · Fixed by #971

Comments

@saagit
Copy link

saagit commented Sep 29, 2020

$ pyocd commander --target=stm32g031j6mx --elf DISCO.elf 
0001015:CRITICAL:__main__:uncaught exception: name 'os' is not defined
Traceback (most recent call last):
  File "/home/saa/.local/lib/python3.7/site-packages/pyocd-0.28.1.dev6-py3.7.egg/pyocd/__main__.py", line 398, in run
    self._COMMANDS[self._args.cmd](self)
  File "/home/saa/.local/lib/python3.7/site-packages/pyocd-0.28.1.dev6-py3.7.egg/pyocd/__main__.py", line 802, in do_commander
    PyOCDCommander(self._args, cmds).run()
  File "/home/saa/.local/lib/python3.7/site-packages/pyocd-0.28.1.dev6-py3.7.egg/pyocd/commands/commander.py", line 63, in run
    if not self.connect():
  File "/home/saa/.local/lib/python3.7/site-packages/pyocd-0.28.1.dev6-py3.7.egg/pyocd/commands/commander.py", line 178, in connect
    self._post_connect()
  File "/home/saa/.local/lib/python3.7/site-packages/pyocd-0.28.1.dev6-py3.7.egg/pyocd/commands/commander.py", line 218, in _post_connect
    self.target.elf = os.path.expanduser(self.args.elf)
NameError: name 'os' is not defined

There are actually two problems:

  1. The os module is not imported, and
  2. self.target.elf should be self.session.target.elf

The attached patch resolves these problems. Sorry I didn't do a pull request, but figuring out the test suite and everything was too much for me to do for a one-liner.

commander_elf.txt

@flit
Copy link
Member

flit commented Sep 29, 2020

Thanks for reporting, and thanks for the patch! This looks like a regression. I'll try to get a fix with your patch out shortly.

flit added a commit to flit/pyOCD that referenced this issue Oct 2, 2020
This test reproduces the bug reported in pyocd#969.
flit added a commit to flit/pyOCD that referenced this issue Oct 2, 2020
@flit flit closed this as completed in #971 Oct 4, 2020
ychsu-tf pushed a commit to OpenNuvoton/pyOCD that referenced this issue Apr 7, 2021
This test reproduces the bug reported in pyocd#969.
ychsu-tf pushed a commit to OpenNuvoton/pyOCD that referenced this issue Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants