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

openocd.py on Windows #1182

Closed
minco3 opened this issue Jul 10, 2024 · 2 comments · Fixed by #1183
Closed

openocd.py on Windows #1182

minco3 opened this issue Jul 10, 2024 · 2 comments · Fixed by #1183

Comments

@minco3
Copy link
Contributor

minco3 commented Jul 10, 2024

Just started looking into using modm on windows using CMake, building and programming seem to work ok however when I tried to debug using the debug CMake target, there was a python error from openocd.py.

[build] Traceback (most recent call last):
[build]   File "<frozen runpy>", line 198, in _run_module_as_main
[build]   File "<frozen runpy>", line 88, in _run_code
[build]     call(args.backend(args), args.source, args.config, args.commands, args.ui)
[build]   File "C:\Users\marco\projects\keyboard_firmware\modm\modm_tools\gdb.py", line 48, in call
[build]     with backend.scope():
[build]   File "C:\Users\marco\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 144, in __exit__
[build]     next(self.gen)
[build]   File "C:\Users\marco\projects\keyboard_firmware\modm\modm_tools\backend.py", line 35, in scope
[build]     self.stop()
[build]   File "C:\Users\marco\projects\keyboard_firmware\modm\modm_tools\openocd.py", line 70, in stop
[build]     os.waitpid(os.getpgid(self.process.pid), 0)
[build]                ^^^^^^^^^^

Which is from here:

def stop(self):
if self.process is not None:
if "Windows" in platform.platform():
os.kill(self.process.pid, signal.CTRL_BREAK_EVENT)
else:
os.killpg(os.getpgid(self.process.pid), signal.SIGTERM)
os.waitpid(os.getpgid(self.process.pid), 0)
self.process = None

Maybe there's a missing indent on line 70?

@salkinium
Copy link
Member

Yes that seems likely. I remember that windows was annoying to get to work and some things are still not implemented properly due to the differences in process management. We should probably switch to PyOCD instead.

Please quickly fix it, you can do it online even.

@minco3
Copy link
Contributor Author

minco3 commented Jul 10, 2024

created a pull request #1183

@salkinium salkinium linked a pull request Jul 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants