$ 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:
The os module is not imported, and
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.
There are actually two problems:
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