Gdb breakpiont not work in e300 arty

Hi all,
i use arty board to test e300.
1 after upload program to the board, the program runs automaticly, which is not i want, ithink the monit resume command make this, can i remove them?
2 after “b main” add breakpoint, kill the current run program, and rerun it , the breakpoint never works! i noticed that the e 300 use a flash as instrution meemory, so maybe this is the reason can not insert breakpoint?

thankyou!

  1. Yes, you can remove the ‘monitor resume’ command and then it will not set the $pc to _start or run the program.

  2. If OpenOCD is correctly communicating which regions are Flash memory to GDB, then it should correctly request hardware breakpoints for the flash regions. This is generally done with the OpenOCD .cfg file What do you mean “breakpoint never works”. Do you get an error when you try to set the breakpoint? Or do you just run past it?

Hi mwachs5:
thanks for reply.

after run, can not stop at the breakpoint(main,0x2040007a), and openocd says “halted at 0x80000004 due to software breakpoint” which is not the bp i set.

here’s my log:

gdb side:
user@ubuntu14_rs 467 10:08:49 /mnt/data1/home/user/riscv/freedom-e-sdk
$ make run_gdb PROGRAM=hello BOARD=freedom-e300-arty-tiao
/mnt/data1/home/user/riscv/freedom-e-sdk/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gdb software/hello/hello -ex “set remotetimeout 240” -ex "target extended-remote localhost:3333"
GNU gdb (GDB) 7.12.50.20170505-git
Copyright © 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and “show warranty” for details.
This GDB was configured as “–host=x86_64-pc-linux-gnu --target=riscv64-unknown-elf”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from software/hello/hello…done.
Remote debugging using localhost:3333
0x20400250 in __wrap__exit (code=0)
at /mnt/data1/home/user/riscv/freedom-e-sdk/bsp/libwrap/sys/_exit.c:12
12 write(STDERR_FILENO, “\n”, 1);
(gdb) monitor flash protect 0 64 last off
cleared protection for sectors 64 through 255 on flash bank 0
(gdb) load software/hello/hello
Loading section .init, size 0x78 lma 0x20400000
Loading section .text, size 0xb91c lma 0x20400078
Loading section .rodata, size 0xd34 lma 0x2040b998
Loading section .eh_frame, size 0x68 lma 0x2040c6cc
Loading section .data, size 0x9d0 lma 0x2040c734
Start address 0x20400000, load size 53504
Transfer rate: 29 KB/sec, 7643 bytes/write.
(gdb) b main
Breakpoint 1 at 0x2040007a: file hello.c, line 5.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /mnt/data1/home/user/riscv/freedom-e-sdk/software/hello/hello
Note: automatically using hardware breakpoints for read-only addresses.

(no more message…)


openocd side:

$ sudo make run_openocd BOARD=freedom-e300-arty-tiao
[sudo] password for user:
work/build/openocd/prefix/bin/openocd -f bsp/env/freedom-e300-arty-tiao/openocd.cfg
Open On-Chip Debugger 0.10.0+dev-00046-g45f2808-dirty (2017-08-22-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
Info : Examined RISCV core; XLEN=32, misa=0x40001105
Info : Listening on port 3333 for gdb connections
Info : [0] Found 2 triggers
halted at 0x20400250 due to debug interrupt
Info : Found flash device ‘micron n25q128’ (ID 0x0018ba20)
cleared protection for sectors 64 through 255 on flash bank 0
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting ‘gdb’ connection on tcp/3333
cleared protection for sectors 64 through 255 on flash bank 0
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
halted at 0x20400250 due to debug interrupt
Info : Padding image section 0 with 4 bytes
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
halted at 0x80000004 due to software breakpoint
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=1
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=2
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=3
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=4
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=5
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=6
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=7
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=8
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=9
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=10
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=12
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=14
Info : Retrying memory read starting from 0x2040007a with more delays
Info : dtmcontrol_idle=5, dbus_busy_delay=0, interrupt_high_delay=16
Info : Retrying memory read starting from 0x2040007a with more delays
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
halted at 0x80000004 due to software breakpoint

===================
ps:
I am using TIAO USB multiprotocol adapter instead of olimex, which is also use FTDI2232HL, i guess it should work after change pid vid in the openocd cfgfile, and the openocd can connect it:

# JTAG adapter setup
adapter_khz 10000

#interface ftdi
#ftdi_device_desc “Olimex OpenOCD JTAG ARM-USB-TINY-H”
#ftdi_vid_pid 0x15ba 0x002a

#ftdi_layout_init 0x0808 0x0a1b
#ftdi_layout_signal nSRST -oe 0x0200
#ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100

interface ftdi
#ftdi_device_desc “TIAO USB Multi-Protocol Adapter A”
#ftdi_device_desc "Future Technology Devices International, Ltd TIAO Multi-Protocol Adapter"
transport select jtag
ftdi_vid_pid 0x0403 0x8a98
# 0x0403 0x6010 0x0403 0x6001
#ftdi_channel 1
#ftdi_serial “FTZ7O8O0”

ftdi_layout_init 0x0808 0x0a1b
ftdi_layout_signal nSRST -oe 0x0200
ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100
ftdi_layout_signal LED -data 0x0800

set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10e31913
# for 170819 freedom
#jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000913

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1

flash bank my_first_flash fespi 0x20000000 0 0 0 $_TARGETNAME
init
#reset
if {[ info exists pulse_srst]} {
ftdi_set_signal nSRST 0
ftdi_set_signal nSRST z
}
halt
flash protect 0 64 last off

need to use hb instead of b in gdb…

Hi
If you solved that problem? thank you~

yes,
need to use hb instead of b in gdb,
and I found “run” command not work in gdb, need use “continue” instead