I hit the "stop" button which exits the debugger and ash-riscv-gdb-server.
I'm not 100% sure what you mean by removed, but I never deleted the run configuration. I just hit "stop", waited 15 seconds, then hit "debug" again.
I was also able to reproduce the error using the cli directly. The steps:
- Program the .sof to start in clean state using: quartus_pgm --no_banner --mode=jtag -o "p;$PWD/../output_files/top.sof@2".
- Run the ash-riscv-gdb-server: ~/intelFPGA/23.1.1/riscfree/debugger/gdbserver-riscv/ash-riscv-gdb-server --probe-type usb-blaster-2 --transport-type jtag --device 0x02D020DD --auto-detect true --jtag-frequency 24 --gdb-port 3333. This server starts without Memory access -> System bus.
- Connect to the server using the debugger: ~/intelFPGA/23.1.1/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gdb -ex "target remote :3333" -ex "load" -ex "break main" -ex "c" app/build/Debug/hello.elf
- You can connect to the server as many times as you want and it will work provided you don't shut it down.
- Killed the server with 'Q'.
- Run the ash-riscv-gdb-server with same command line above. The server starts with the Memory access -> System bus.
- Connect to the server using the debugger with the command above. End up getting the message "Cannot insert breakpoint 1....Cannot access memory at address 0x6b0".
I added a bad_niosv.txt of all the output above.
I also did some digging. The debugging spec seems to give three different ways of letting the debugger access memory.
- System bus
- Program buffer
- Abstract access memory
On the first run only Program buffer and Abstract access memory are available. The System bus method does not appear to be implemented by the Nios V (just guessing here). The System Bus Access Control and Status (sbcs, at 0x38) from the debugging spec reports if the System Bus method is supported. It would seem that this register is changed between the two invocations of the ash-riscv-gdb-server. I'm assuming the debugger is trying to use the system bus to write an instruction to implement the break point but fails because the system bus method is not supported and as such fails.
I also wanted to note that if you run openocd in step 2 instead of ash-riscv-gdb-server it also can cause Memory access -> System bus to show up in step 6. It doesn't happen always but its pretty common. Also note that openocd will use Program buffer to write memory over system bus and abstract access memory which is why is might be working while ash-riscv-gdb-server is failing (I'm assuming that it prioritizes System bus for memory access). Remember, if I use openocd in step 2 and step 6 then it all works.
Some other things I have tried to fix. Nothing worked:
- Slowed the clock on my design down.
- Slowed the JTAG clock down to 1MHZ.
- Tried on both Nios V/g and Nios V/m with the same results. I am using the Nios V/m in my design.