# Gdb breakpiont not work in e300 arty

**URL:** https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704
**Category:** Freedom E300
**Created:** [August 22, 2017, 1:10pm UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704 "2017-08-22T13:10:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![edisontime](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@edisontime](https://forums.sifive.com/u/edisontime)
#### Post date: [August 22, 2017, 1:10pm UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704/1 "2017-08-22T13:10:11Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![mwachs5](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mwachs5/32/13_2.png) [@mwachs5](https://forums.sifive.com/u/mwachs5)
#### Post date: [August 22, 2017, 4:25pm UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704/2 "2017-08-22T16:25:47Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![edisontime](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@edisontime](https://forums.sifive.com/u/edisontime)
#### Post date: [August 23, 2017, 2:37am UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704/3 "2017-08-23T02:37:56Z")

</div>

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](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/](http://www.gnu.org/software/gdb/bugs/).  
Find the GDB manual and other documentation resources online at:  
[http://www.gnu.org/software/gdb/documentation/](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](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

---

<div class="post-metadata">

### Author: ![edisontime](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@edisontime](https://forums.sifive.com/u/edisontime)
#### Post date: [September 11, 2017, 10:09am UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704/4 "2017-09-11T10:09:45Z")

</div>

need to use hb instead of b in gdb…

---

<div class="post-metadata">

### Author: ![pengnainqi](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/pengnainqi/32/262_2.png) [@pengnainqi](https://forums.sifive.com/u/pengnainqi)
#### Post date: [September 23, 2017, 3:15pm UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704/5 "2017-09-23T15:15:22Z")

</div>

Hi  
If you solved that problem? thank you~

---

<div class="post-metadata">

### Author: ![edisontime](https://avatars.discourse-cdn.com/v4/letter/e/9e8a1a/32.png) [@edisontime](https://forums.sifive.com/u/edisontime)
#### Post date: [September 24, 2017, 4:01pm UTC](https://forums.sifive.com/t/gdb-breakpiont-not-work-in-e300-arty/704/7 "2017-09-24T16:01:16Z")

</div>

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