Skip to content

Instantly share code, notes, and snippets.

@btashton
Last active December 30, 2020 21:34
Show Gist options
  • Save btashton/fb813b28210c4aeb8d7d269d844c930f to your computer and use it in GitHub Desktop.
Save btashton/fb813b28210c4aeb8d7d269d844c930f to your computer and use it in GitHub Desktop.
BL602 Notes

Notes for BL602

Flashing part

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

Using JTAG

Grab the openocd configuration here https://github.com/sipeed/bl602-rust-guide

cd ~/nuttx/bl602-rust-guide
openocd

UART

Python can give us an easy terminal

python -m serial.tools.miniterm /dev/ttyUSB0 115200

Using GDB with openocd

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment