riscv-rust / riscv-rust-quickstart

A template for building Rust applications for HiFive1 boards
205 stars 24 forks source link

<type 'exceptions.ImportError'> No module named gdb #15

Closed githubquestions closed 4 years ago

githubquestions commented 4 years ago

Ran into similar issue to @engineerJishnu where JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333 -nogui stays on Waiting for GDB connection.... Tried solution to cargo run --example led_gpio, but then receive new error:

Python Exception <type 'exceptions.ImportError'> No module named gdb:
riscv64-unknown-elf-gdb: warning:
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

Reading symbols from target/riscv32imac-unknown-none-elf/debug/examples/led_gpio...
db_init:4: Error in sourced command file:
:3333: Interrupted system call.
(gdb)

Any ideas?

Disasm commented 4 years ago

Are you launching JLinkGDBServer before cargo run?

githubquestions commented 4 years ago

Yes, but tried with order reversed to same result. Including full output from JLinkGDBServer in case useful

Command line: -device FE310 -if JTAG -speed 4000 -port 3333 -nogui
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     3333
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 FE310
Target interface:              JTAG
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-K22-SiFive compiled Mar  3 2020 13:20:23
Hardware: V1.00
S/N: 979014433
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 3333
Connecting to target...

J-Link found 1 JTAG device, Total IRLen = 5
JTAG ID: 0x20000913 (RISC-V)
Connected to target
Waiting for GDB connection...
Disasm commented 4 years ago

That's strange. Could you check that you do not have firewall blocking 3333 port?

githubquestions commented 4 years ago

no firewall. same error seen when running on other ports

edit: perhaps related 🤷‍♂️

githubquestions commented 4 years ago

Tweaked downloads (tried downloading openocd prebuilt binaries from SiFive, but still get variant of same error

gdb_init:4: Error in sourced command file   
:3333: Operation timed out.  
(gdb)

edit: also trying riscv-openocd in attempt to sidestep apparent problems with JLink, but am running into similar problems there

githubquestions commented 4 years ago

Created thread in SiFive forums. Link here

githubquestions commented 4 years ago

Turned out to be openocd related