BrianPugh/gnwmanager

gnwmanger fails on Linux Mint

aminch opened this issue · 6 comments

aminch commented

gnwmanager fails with an error on Linux Mint.

Installed from pipx
openocd installed from gnwmanager

Connected with Raspberry Pi Debug Probe

When running gnwmanager info the error below is shown.
The device itself appears to have no change (i.e. the gnwmanager firmware doesn't show on the screen), but after this error, the controls on the device are no longer responsive and it needs to be power cycled to function again.

The exact same device and debug probe works when using gnwmanager on Windows 11.

minch@ASUSLaptop:~/Development$ gnwmanager info
Platform:                    Linux-5.15.0-88-generic-x86_64-with-glibc2.35
Python Version:              3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
GnWManager Executable:       /home/minch/.local/bin/gnwmanager
GnWManager Version:          0.3.1
OCD Backend:                 openocd
Traceback (most recent call last):
  File "/home/minch/.local/bin/gnwmanager", line 8, in <module>
    sys.exit(run_app())
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/cli/main.py", line 197, in run_app
    start_gnwmanager()
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/cli/_start_gnwmanager.py", line 31, in start_gnwmanager
    gnw.write_uint32("status", 0)  # To be 100% sure there's nothing residual in RAM.
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/gnw.py", line 117, in write_uint32
    return self.backend.write_uint32(_key_to_address(key), val)
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/ocdbackend/openocd_backend.py", line 181, in write_uint32
    self(f"write_memory 0x{addr:08X} 32 {{ {hex(val)} }}")
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/ocdbackend/openocd_backend.py", line 146, in __call__
    return self._receive_response(decode=decode)
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/ocdbackend/openocd_backend.py", line 161, in _receive_response
    response = _convert_hex_str_to_bytes(response)
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/ocdbackend/openocd_backend.py", line 101, in _convert_hex_str_to_bytes
    return bytes(int(h, 16) for h in hex_str.decode().split())
  File "/home/minch/.local/pipx/venvs/gnwmanager/lib/python3.10/site-packages/gnwmanager/ocdbackend/openocd_backend.py", line 101, in <genexpr>
    return bytes(int(h, 16) for h in hex_str.decode().split())
ValueError: invalid literal for int() with base 16: 'invalid'

Sorry for the 1-month turn around on this. I finally just got a Mint VM setup and can reproduce this issue. Hopefully I can identify the issue and fix it over the next day or two.

aminch commented

No stress at all, thank you for looking in to the issue.

alright, pretty simple issue. Turns out I'm using an openocd v0.12.0 only command (released March 2023), and on Mint openocd v0.11.0 is installed. Should be a pretty easy fix, just going to cleanup some other stuff to make these reports easier in the future.

this should be fixed in v0.4.1

v0.4.1 was actually quite problematic. This issue is REALLY fixed starting at v0.5.2

So, the conclusion that we've reached in Discord, is that (at least with OpenOCD v0.12.0) for some reason the device is not being reset properly. This is observable without gnwmanager, just pure OpenOCD interactions:

openocd -c "adapter speed 4000" -c "source [find interface/cmsis-dap.cfg]" -c "transport select swd" -c "source [find target/stm32h7x.cfg]"

then in another terminal:

telnet localhost 4444

and entering the command

reset halt

does not actually reset/halt the device; the screen doesn't turn black. On all other tested systems, the above command causes the screen to go black.

So, the conclusion is the following:

  1. Update the readme to say that Mint is not supported.
  2. Try and autodetect if mint is the OS and display a warning.
  3. Improve error messages.