Skip to content

OpenOCD for sc_riscv32

Pavel S. Smirnov edited this page Aug 22, 2017 · 13 revisions

Prerequisites

Packages

You will need to install several packages to compile and run OpenOCD. Open a terminal window and type:

sudo apt-get install make libtool autoconf texinfo libusb-dev doxygen

OpenOCD

Clone OpenOCD

Clone any available repository to working directory

git clone -b syntacore_riscv32i --recursive https://github.com/syntacore/openocd.git

Build OpenOCD

See http://elinux.org/Compiling_OpenOCD

Go to working directory and create Makefile

./bootstrap
./configure --enable-maintainer-mode --disable-werror --enable-ftdi

Invoke the make

touch src/openocd.c && time nice make -j

Call of touch src/openocd.c updates build timestamp and git version

$ src/openocd --version
Open On-Chip Debugger 0.10.0+dev-00920-g98813c7 (2017-08-22-18:02)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

Install OpenOCD

If build is successful, you can install OpenOCD and headers

sudo make install

To deinstall library and headers

sudo make uninstall

OpenOCD run

Run OpenOCD as TCP server with selected configuration files (even without install).

Use sudo if policy for your USB device is not configured.

For example ./tcl folder contains set of configuration files, using olimex-arm-usb-ocd interface for syntacore_riscv32i 2 TAPs target:

sudo src/openocd -f tcl/interface/ftdi/olimex-arm-usb-ocd.cfg -f tcl/target/syntacore_riscv32i_2tap.cfg |& tee ocd.log

After initialization OpenOCD waiting for command from the network.

OpenOCD remote session

Run telnet application in other console:

telnet localhost 4444

Print help to show list of commands. For example:

# show targets (usually last configured target is current core)
targets

# set core #0 as current core (usually for multicore configuration all but #0 cores are in parking state)
targets sc_rv32i0.cpu

# halt core (debug mode state)
halt

# load some elf image to memory
load_image /home/tools32i/test/scr5-baremetal-example/build/scr-test.elf

# resume execution from elf start address
resume 0x200

# halt core (if you need to examine registers or memory)
halt

# shutdown openocd server
shutdown
Clone this wiki locally