Use this OSS flashing tool here https://github.com/spacemeowx2/blflash
NOTE IO8 must be pulled HI on reset to enter ISP mode
cd ~/nuttx/blagain
./blflash-linux-amd64 flash ../wrk/nuttx/nuttx.bin --port /dev/ttyUSB0
Grab the openocd configuration here https://github.com/sipeed/bl602-rust-guide
cd ~/nuttx/bl602-rust-guide
openocd
Python can give us an easy terminal
python -m serial.tools.miniterm /dev/ttyUSB0 115200
openocd.gdb
target extended-remote :3333
# print demangled symbols
set print asm-demangle on
# set backtrace limit to not have infinite backtrace loops
set backtrace limit 32
mem 0x22008000 0x22014000 rw
mem 0x42008000 0x42014000 rw
mem 0x22014000 0x22020000 rw
mem 0x42014000 0x42020000 rw
mem 0x22020000 0x22030000 rw
mem 0x42020000 0x42030000 rw
mem 0x22030000 0x2204C000 rw
mem 0x42030000 0x4204C000 rw
mem 0x23000000 0x23400000 ro
mem 0x40000000 0x40010000 ro
load
break __start
break bfl_main
# start the process but immediately halt the processor
stepi
Run gdb:
riscv64-unknown-elf-gdb nuttx -x ../openocd.gdb