zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.85k stars 6.61k forks source link

west flash not working with pyocd #31921

Closed pabigot closed 3 years ago

pabigot commented 3 years ago

As of commit 3204554841db8e51fd06f8ba47f73bcdaea05fe9 from #31881 I get the following failure:

tirzah[16]$ west update && rm -rf build && west build -b frdm_k64f
tirzah[17]$ west flash
-- west flash: rebuilding
[0/1] cd /mnt/nordic/zp/zephyr/samples/hello_world/build/zephyr/cmake/flash && /usr/bin/cmake -E echo

-- west flash: using runner pyocd
Traceback (most recent call last):
  File "/home/pab/.local/bin/west", line 8, in <module>
    sys.exit(main())
  File "/home/pab/.local/lib/python3.8/site-packages/west/app/main.py", line 779, in main
    app.run(argv or sys.argv[1:])
  File "/home/pab/.local/lib/python3.8/site-packages/west/app/main.py", line 106, in run
    self.run_command(argv)
  File "/home/pab/.local/lib/python3.8/site-packages/west/app/main.py", line 338, in run_command
    self.run_extension(args.command, argv)
  File "/home/pab/.local/lib/python3.8/site-packages/west/app/main.py", line 408, in run_extension
    command.run(args, unknown, self.topdir, manifest=self.manifest)
  File "/home/pab/.local/lib/python3.8/site-packages/west/commands.py", line 129, in run
    self.do_run(args, unknown)
  File "/mnt/nordic/zp/zephyr/scripts/west_commands/flash.py", line 29, in do_run
    do_run_common(self, my_args, runner_args)
  File "/mnt/nordic/zp/zephyr/scripts/west_commands/run_common.py", line 222, in do_run_common
    runner.run(command_name)
  File "/mnt/nordic/zp/zephyr/scripts/west_commands/runners/core.py", line 482, in run
    self.do_run(command, **kwargs)
  File "/mnt/nordic/zp/zephyr/scripts/west_commands/runners/pyocd.py", line 126, in do_run
    self.flash(**kwargs)
  File "/mnt/nordic/zp/zephyr/scripts/west_commands/runners/pyocd.py", line 131, in flash
    if os.path.isfile(self.hex_name):
  File "/usr/lib/python3.8/genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
tirzah[18]$ 
mbolivar-nordic commented 3 years ago

Sorry about that; I didn't follow the logic in this file correctly. I posted a fix now. https://github.com/zephyrproject-rtos/zephyr/pull/31935