deadsy / rvdbg

RISC-V Debugger
MIT License
16 stars 7 forks source link

rvdb disables mouse #2

Open UweBonnes opened 3 years ago

UweBonnes commented 3 years ago

Hello,

I can see the GD32FV chips now. Debugger is a LPCLinkV2 with newest firmware.

./cmd/rvdbg/rvdbg --i daplink -t gd32v 2020/12/02 19:32:43 main.go:136 main(): INFO using debug interface: daplink 2020/12/02 19:32:43 rv13.go:68 New(): INFO 0.13 debug module 2020/12/02 19:32:44 rv13.go:133 New(): INFO hartsellen 10 2020/12/02 19:32:44 rv13.go:157 New(): INFO sbasize 0 2020/12/02 19:32:44 rv13.go:193 New(): INFO progbufsize 2 impebreak 1 autoexecprogbuf true 2020/12/02 19:32:44 rv13.go:194 New(): INFO datacount 4 autoexecdata true 2020/12/02 19:32:44 rv13.go:228 New(): INFO 1 hart(s) found 2020/12/02 19:32:44 hart.go:326 examine(): INFO hart0: MXLEN 32 2020/12/02 19:32:44 hart.go:334 examine(): INFO hart0: MISA 0x40901105 2020/12/02 19:32:44 hart.go:383 examine(): INFO hart0: unable to determine FLEN 2020/12/02 19:32:44 hart.go:407 examine(): INFO hart0: MHARTID 0 2020/12/02 19:32:44 hart.go:419 examine(): INFO hart0: nscratch 2 words 2020/12/02 19:32:44 hart.go:420 examine(): INFO hart0: datasize 4 words 2020/12/02 19:32:44 hart.go:421 examine(): INFO hart0: dataaccess memory(1) 2020/12/02 19:32:44 hart.go:422 examine(): INFO hart0: dataaddr 0xc0 2020/12/02 19:32:44 hart.go:432 examine(): INFO hart0: disassembler ISA RV32 ext "acim" gd32v.0r> exit However when started, the mouse Bus 001 Device 015: ID 046d:c050 Logitech, Inc. RX 250 Optical Mouse gets unresponsive. Nothing in dmesg. Un/replug the mouse makes it usable again, until the next start of rvdb. Is your scan of the USB bus too aggressive?

deadsy commented 3 years ago

So CMSIS-DAP is a HID device , and so is your mouse. I access them via the hidapi library. https://github.com/libusb/hidapi If you haven't done so I recommend that you get and install the latest version of this library. I haven't seen any interference issues between this code and other HID devices so the hidapi library being used may be a source of variance.

UweBonnes commented 3 years ago

I installed 0.9.0 for OpenSuse, but the problem persists. From the git page, hidapi-0.9.0 seems the latest. Otherwise I use hidapi also for the black magic probe debugger https://github.com/blacksphere/blackmagic/ . But I search via libusb for CMSIS-DAP devices and only later handle a cmsid-dap device found with hidapi.

BMP is also the cause for my interest in rvdbg. There is https://github.com/blacksphere/blackmagic/pull/292 and another branch starting riscv support. As BMP now also works with cmsis-dap and jlink, I can have one setup and test with rvdbg and bmp and so hope to get riscv support going. #292 is not for the present riscv debug version.

deadsy commented 3 years ago

0.10.1 is the latest. That ok, I've actually been running 0.8.rc1. After a 6 year break they've started doing work on the library again.

If you have a segger jlink you might want to try that. 1) It's not HID so I don't think it'll have a problem with mice. 2) It's faster than CMSIS-DAP - that may be a bug in my cmsis-dap interface code, but at the moment the jlink is quite a bit faster.

UweBonnes commented 3 years ago

It is OK with 0.10.1 . Regarding speed: CMSIS-DAP can read and write chunks of memory on ARM with one USB command, so reading chunks on riscv needs to be assembled from lower level commands and probably needs a lot of USB round trips. libjaylink probably is more intelligent here.

deadsy commented 3 years ago

OK with 0.10.1

Good to know.

read and write chunks of memory on ARM with one USB command

For my usage of CMSIS-DAP and Jlink they both use basic JTAG operations - neither supports any macro operations to read/write RISC-V memory. But yes- fast USB is about minimising round trip transactions, and it may be that I can do something else to bundle together multiple state machine operations into a single USB transaction thereby achieve some speedup.

UweBonnes commented 3 years ago

Getting RISCV support into BMP would be another option. BMP can be used as is, with the GDB server running on the dongle and gdb attaching to the dongle usb-serial gdb device or with the gdb server running on the host and the PC exchanging low-and high level (SWD/Jtag) commands with the dongle via USB/serial. Running the server on the PC helps to develop algorithms.

deadsy commented 3 years ago

I'm not a big fan on the "gdb server on dongle" approach the BMP guys are using. I tend to like the idea of dongles just being jtag/swd so you can use put all the smarts in the host software. E.g. platform specific register field decodes.

In any case I tried hidapi 0.10.1 and that works fine for me. This is the CMSIS-DAP device I use:

https://www.artekit.eu/products/debug/ak-cmsis-dap/