Some targets fail to examine during `init`, e.g. for timing reasons. The
right solution is a better config script, but that ends up being
complicated to figure out. This is a bit of a hack, but hopefully
silently fixes the problem so users won't have to deal with it at all.
Change-Id: Ib04d0680eb4136f06c383caa6775dd2581a08ce0
Signed-off-by: Tim Newsome <tim@sifive.com>
According to RISC-V External Debug Support Version 0.13.2 (paragraph
3.12.6), cmderr field contains a valid value only if busy is 0, so it is
incorrect to analize it on timeout.
Requested in https://review.openocd.org/c/openocd/+/6964.
I'm making the change here so I have a chance to test it properly before
pushing it upstream.
A nice effect of this change is that we avoid some unnecessary polling
early on when gdb is connecting and we would poll once every time we
send gdb a qXfer packet.
Change-Id: I4bdb9f05839e8c1e01ff6dde49d6589595418095
Signed-off-by: Tim Newsome <tim@sifive.com>
Otherwise OpenOCD simply doesn't work without giving any indication why.
Change-Id: I21703fc1a0d9bed2f59da95f8a8395fe139484a4
Signed-off-by: Tim Newsome <tim@sifive.com>
* Don't read dmcontrol to set hartsel
We already know what dmcontrol should be. This addresses a long-standing
TODO. In a toy test, this reduced the number of scans by 10+%. (Most of
those are probably in poll(), so don't actually affect perceived
performance.)
Change-Id: I18e5ca391f0f5fb35f30d44dfef834e5a66aee20
Signed-off-by: Tim Newsome <tim@sifive.com>
* Make code easier to read
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
It was a left-over from `-rtos riscv` and isn't used.
Change-Id: Ie7e380600cd1331c6d382f654474270efad9f127
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
Hopefully this will be the final version.
Change-Id: Ib2f8cd6f613c5e0f8e8bf7a16c3edbf2d9b439b2
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
See https://github.com/riscv/riscv-opcodes/pull/139
Change-Id: I77ae5ab369e6cde26ad44d177dcae38c0fbe08ef
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
Now we get the license comment on the first line, which is required.
Change-Id: I54414db3c89ee6027e159ce9348459bc923b8595
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
If range's upper bound was equal to 2^64 or the range was wrapping around 0
(which is perfectly legal), writes were not performed due to riscv_addr_t
overflow.
This one doesn't have the license in there, which means now it's
acceptable to GPLv2 again.
Change-Id: I8ba27801172ffa955470d2627fa656cad282ee99
Signed-off-by: Tim Newsome <tim@sifive.com>
This gets us the new license header, which was requested upstream.
Change-Id: I992b4f3bb230edb9f281e2278dd41c712098ed4c
Signed-off-by: Tim Newsome <tim@sifive.com>
The segfault could be triggered if:
- At least one target failed to get examined (therefore does not have the
register cache set up yet),
- and "reset" TCL command was issued, which internally tries to
invalidate the register cache.
Minor cleanup: "registers_initialized" member removed from riscv_info_t
because it is not used anywhere.
Change-Id: I6288c0d4343ef6a330fb2a6b49d388e7eafa32a2
Signed-off-by: Jan Matyas <matyas@codasip.com>
* Update debug_defines from the spec.
Now it includes constants for field values, so use them instead of
duplicating that here.
Change-Id: I2fca6e89f25123c39d4bf483b8244e47aefb0f88
* Remove unused #defines
Change-Id: Id20351851c9ed2c3aa82ccf8c04b604bef11692a
* Use debug spec constants in a few more places
Change-Id: Ic4578729c89e3c6a26a72772e1635c5345bd6a52
Signed-off-by: Tim Newsome <tim@sifive.com>
* Use macros for trigger action types.
Which were added with the very latest debug_defines.h.
Change-Id: I47f73e11d2ec529c720f2e1df05f7b0d3026e43a
Signed-off-by: Tim Newsome <tim@sifive.com>
* Change set_haltgroup() to more general set_group()
Change-Id: Ib91a252ac63604e54b756f70c549ccd47241fd10
Signed-off-by: Tim Newsome <tim@sifive.com>
* Properly use enum.
Change-Id: I0edef6053fac388db38a22fe7557623fa93ec705
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
* Style changes suggested in review.
Change-Id: I29e83d3dbef09cb971ec0355aff733191a6e4679
Signed-off-by: Tim Newsome <tim@sifive.com>
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Commit 5ebb1bdea1 ("server/gdb: fix return of gdb remote monitor
command") replaces the call to command_run_line() with call to
Jim_EvalObj() but does not properly set the "context".
In multi-target environment, his can cause the erroneously
execution of the command on the wrong target.
Copy from the code in command_run_line() the proper setup before
executing Jim_EvalObj().
Change-Id: I56738c80779082ca146a06c01bc30e28bc835fd3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Bohdan Tymkiv <bohdan200@gmail.com>
Fixes: 5ebb1bdea1 ("server/gdb: fix return of gdb remote monitor command")
Per mainline, use stm32f1x instead. Tested that this is working.
Change-Id: Icda4b2a39e06e2adf9bbfb984bd578347f43d7d1
Signed-off-by: Tim Newsome <tim@sifive.com>
Conflicts:
tcl/target/gd32vf103.cfg
I kept our version, except I changed the flash device as happened in
mainline. Once this file settles down in mainline, we can copy it
wholesale into this fork.
Change-Id: I4c5b21fec0734b5e08eba392883e006a46386b1c
on macos (homebrew base) `pkg-config --cflags capstone` output with
`-I/opt/homebrew/Cellar/capstone/4.0.2/include/capstone`
gcc not find headers on parent "include" path,
causes build error `fatal error: 'capstone/capstone.h' file not found`
it's ok to change to <capstone.h> for all platforms.
Signed-off-by: fatalc <cnfatal@gmail.com>
Change-Id: Ia2e2058024d4fc1a57a8b4ea847c664d74f67efb
Reviewed-on: https://review.openocd.org/c/openocd/+/6946
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Handle JIM_CONTINUE return value of adiv5_jim_mem_ap_spot_configure(),
otherwise OpenOCD silently quits when an unknown option is provided.
Change-Id: I9b1351c0911e74999d8dd1260ede9760088510d7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6944
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
The correct ordering is required to prevent two outputs connected
together.
Change-Id: I634a9ca7e0ccf337d1723011b8aee1f2d81efbcf
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6937
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
The SWDIO buffer requires a direction pin to select input or output
direction. Output is selected by a high logic level (matches
bcm2835gpio driver).
Change-Id: I240cb99a5dfea08121bb33d4b5e2108ce7597468
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6936
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>