myriadrf / LimeSDR_GW

LiteX-based gateware for LimeSDR boards.
0 stars 2 forks source link

GDB internal-error #4

Closed vbuitvydas closed 2 months ago

vbuitvydas commented 2 months ago

Having issues while stepping trough code: image

Steps to reproduce:

# Build and load gateware
./LimeSDR_XTRX.py --integrated-main-ram-size 0x8000 --uart-name=gpio_serial --cpu-type=vexriscv_smp --with-rvc  --with-privileged-debug --hardware-breakpoints 4 --csr-csv=csr.csv --build --load

# Load firmware trough serial (after loading execute 'reboot' command in terminal to load firmware)
litex_term --csr-csv csr.csv /dev/ttyUSB0 --kernel firmware/demo.bin

# Run OpenOCD with the specified configurations:
openocd -f ./limesdr_xtrx.cfg -c "set TAP_NAME xc7.tap" -f ./riscv_jtag_tunneled.tcl

# Connect GDB for Debugging:
gdb-multiarch -q firmware/demo.elf -ex "target extended-remote localhost:3333"

# In GDB set breakpoint:
break main.c:156

# In GDB continue running code
c

# In litex_term execute command:
gpioled

# Program should stop at specified breakpoint. Step trough code with s multiple times and 'internal-error' as shown in screenshot arises  
trabucayre commented 2 months ago

Hi. Tried to reproduces your issue using an up to date ubuntu 22.04.4. Just modified openOCD cfg file to use a digilent HS2 with

adapter driver ftdi
ftdi_vid_pid 0x0403 0x6014
ftdi_channel 0
ftdi_layout_init 0x00e8 0x60eb
reset_config none

Everything is working. Could you provides riscv toolchain version you use (from package manager / downloaded), same question for openOCD (ubuntu version or riscv ?) Thanks

vbuitvydas commented 2 months ago

hi @trabucayre,

thanks for looking into this.

I am using: Ubuntu 22.04.04 on WSL2. OpenOCD - Open On-Chip Debugger 0.11.0+dev-04033-g058dfa50d (2024-04-11-15:48) GDB - GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1

both OpenOCD and GDB are installed from package manager.

trabucayre commented 2 months ago

Ok its looks similar to my setup. Could you try with a computer running a native Linux? Maybe something fails with usbip ? Or wsl2 version is a bit different than official ubuntu ?

vbuitvydas commented 2 months ago

Looks like issues was caused by using Ubuntu on WSL2. Tested on different machine using native Linux and setting breakpoints and stepping trough code works fine. Thanks @trabucayre!

Is it possible to set up some IDE such as eclipse to debug CPU code instead of executing commands trough GDB?

trabucayre commented 2 months ago

Great! for IDE I think so but I have never used this type of tools.