Commit Graph

10687 Commits

Author SHA1 Message Date
Tim Newsome a74e59f0fc
Improve user messages.
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-10-05 10:32:47 -07:00
Tim Newsome d4c92a5ac7 target: Try to examine unexamined target in halt()
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>
2022-10-04 13:36:18 -07:00
Tim Newsome 550a66e720
Use LOG_TARGET_FOO() functions in more places. (#731)
Change-Id: Id2266dbfb6209bf0676f28e7383a12705ce2a70e
Signed-off-by: Tim Newsome <tim@sifive.com>

Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-29 15:09:49 -07:00
Tim Newsome 23df83e830
Merge pull request #727 from riscv/poll_backoff
Make poll backoff time based.
2022-09-27 10:13:12 -07:00
Tim Newsome e53fd14f50
Merge pull request #733 from en-sc/en-sc/remove-erroneous-debuglog
Remove incorrect debug_log in wait_for_idle
2022-09-27 10:00:40 -07:00
Tim Newsome d427e136d3
Merge pull request #732 from en-sc/en-sc/error-code-regwrite-direct
Propagate error code in register_read/write_direct
2022-09-27 10:00:24 -07:00
Evgeniy Naydanov fb7c8b310a Remove incorrect debug_log in wait_for_idle
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.
2022-09-26 13:52:53 +03:00
Evgeniy Naydanov 137141249b Propagate error code in register_read/write_direct
In some cases error code returned by riscv_program_insert was ignored
2022-09-26 13:37:45 +03:00
Tim Newsome 8bb25e0079
Merge pull request #729 from mrv96/patch-1
Support for custom TMSC buffer: cJTAG OScan1 improvement
2022-09-23 09:49:50 -07:00
mrv96 4b0379fa16 Improve oSCAN1 documentation
Signed-off-by: mrv96 <mrv96@users.noreply.github.com>
2022-09-22 20:23:31 +02:00
Tim Newsome 3c5be531df Don't use const on temporary variable.
It's not part of OpenOCD style:
https://review.openocd.org/c/openocd/+/6319/5..10/src/target/aarch64.c#b1500

Change-Id: Ifb612a942507ca5ed8cac3e3ec59e0e14b0298ed
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-22 09:59:15 -07:00
mrv96 c96a24a307 Add Digilent JTAG-HS2 cJTAG configuration
Signed-off-by: mrv96 <mrv96@users.noreply.github.com>
2022-09-19 23:47:39 +02:00
mrv96 671d99b89b Support for custom TMSC buffer
Signed-off-by: mrv96 <mrv96@users.noreply.github.com>
2022-09-19 20:32:06 +02:00
Tim Newsome b7738370b7 Make large if() more readable.
Change-Id: Ie43400387ab9f290e744ebaa09786612237e6c7e
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-19 09:48:09 -07:00
Tim Newsome fa1abc63d2
Add explanatory comment.
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-19 09:44:10 -07:00
Tim Newsome 89746e111b
Fix comment indent.
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-19 09:43:51 -07:00
Tim Newsome 4004db5d3a Make polling_interval unsigned.
Hopefully fixes win32 build.

Change-Id: I13d6d475f03bada96b2eb943f2c16df05413d34f
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-16 16:52:11 -07:00
Tim Newsome 639e68a621 Make poll backoff time based.
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>
2022-09-16 15:19:21 -07:00
Tim Newsome b3d64741c2
Merge pull request #726 from riscv/timeout_msg
Add error message when dmstatus read times out.
2022-09-14 09:47:28 -07:00
Tim Newsome 8832d4be97 Add error message when dmstatus read times out.
Otherwise OpenOCD simply doesn't work without giving any indication why.

Change-Id: I21703fc1a0d9bed2f59da95f8a8395fe139484a4
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-09-13 10:18:39 -07:00
Tim Newsome 911d68ef25
Don't read dmcontrol to set hartsel (#723)
* 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>
2022-09-09 09:57:39 -07:00
Tim Newsome 04020c19d0
Remove rtos.gdb_v_packet. (#722)
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>
2022-09-02 10:47:15 -07:00
Tim Newsome 7c0ca4dd53
Add copyright line to encoding.h. (#718)
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>
2022-08-25 11:04:46 -07:00
Tim Newsome 7a16947969
encoding.h license changed to BSD-3-Clause (#717)
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>
2022-08-22 08:56:44 -07:00
Tim Newsome fb523552d2
Update encoding.h again. (#713)
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>
2022-08-18 10:10:49 -07:00
Evgeniy Naydanov 52177592f9
Fix overflow issue in write_memory_progbuf (#714)
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.
2022-08-01 08:46:36 -07:00
Tim Newsome 793def24c5
Properly set dmcs2.grouptype. (#712)
In #697 this had gotten inverted.

Change-Id: Id86e2cfee0d15c1f05846c1fd5ac83dde26575a2
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-07-25 15:54:49 -07:00
Tim Newsome 969f112321
Update debug_defines.h. (#711)
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>
2022-07-18 09:20:22 -07:00
Tim Newsome aaf0620479
Update with latest encoding from riscv-opcodes (#710)
This gets us the new license header, which was requested upstream.

Change-Id: I992b4f3bb230edb9f281e2278dd41c712098ed4c
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-07-08 13:02:13 -07:00
Tim Newsome 8488e4e863
Convert filter_openocd_log.py to use python3. (#709)
Change-Id: Ie7b42bcc3462b737cbff369ac8d3a71322699aaa
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-06-23 08:06:14 -07:00
Jan Matyas 6d359afde4
Fix: Prevent segfault in riscv_invalidate_register_cache for non-examined targets. (#692)
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>
2022-06-16 09:58:45 -07:00
Tim Newsome d85a4e8098
Remove unused code. (#707)
Change-Id: I3961a62c0c51200ff3241265d9ea3e69492bdc4e
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-06-15 10:22:19 -07:00
Tim Newsome a2da822187
Document `ftdi oscan1_mode` (#705)
Change-Id: I29b001bc6b9f29f1976aac3f02e15e4490707a4b
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-06-08 13:11:21 -07:00
Erhan Kurubas 40458f6b25
tcl: add Espressif riscv targets (ESP32-C2 & ESP32-C3) (#706)
Change-Id: I48fead33f5fd5890a7724cd5f500f2d14e2a5ffa
Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2022-06-06 08:39:05 -07:00
Huaqi Fang 9906763b89
flash: redirect gd32vf103 driver to stm32f1x (#704)
* flash: redirect gd32vf103 driver to stm32f1x

Signed-off-by: Huaqi Fang <578567190@qq.com>

* flash: add warning message to use stm32f1x instead of gd32vf103

Signed-off-by: Huaqi Fang <578567190@qq.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
2022-06-01 08:55:12 -07:00
Tim Newsome 5c34da1415
Use new debug_defines.h (#703)
* 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>
2022-05-25 10:08:43 -07:00
Tim Newsome 0fada02494
Correctly set target->smp. (#701)
This was broken by #684. Thanks to Jan for noticing.

Change-Id: I6ce115a6a333b93d7edb3ee44daae3f618d092e6
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-05-18 09:40:22 -07:00
Tim Newsome 6047fedc63
Change set_haltgroup() to more general set_group() (#697)
* 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>
2022-05-16 10:17:04 -07:00
wzgpeter a408bdc8db
fix: semihosting_fileio display the unsupported info (#699)
the abnormal info display below:
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0
semihosting: unsupported call 0

the PC did not plus 4 before resume, which cause this
abnormal info popup.

Change-Id: I15c1e7426f1925e78f607c566976f9352216506f
Signed-off-by: Wu Zhigang <zhigang.wu@starfivetech.com>

Co-authored-by: Wu Zhigang <zhigang.wu@starfivetech.com>
2022-05-16 09:57:22 -07:00
Tim Newsome a037b20f2e
Merge pull request #696 from riscv/from_upstream
From upstream
2022-05-12 12:33:12 -07:00
Tim Newsome a2c569f3be Try to fix capstone build for win32.
Change-Id: I77dd0679c24ca8cec2158ec4da71faa4a7740491
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-05-04 10:27:14 -07:00
Antonio Borneo 3cac5d279e server/gdb: fix gdb remote monitor cmd on multi-target
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")
2022-05-04 09:06:36 -07:00
Tim Newsome 8e1064f1fe Remove gd32vf103 flash driver.
Per mainline, use stm32f1x instead. Tested that this is working.

Change-Id: Icda4b2a39e06e2adf9bbfb984bd578347f43d7d1
Signed-off-by: Tim Newsome <tim@sifive.com>
2022-05-03 13:48:07 -07:00
Tim Newsome 9460f43dc3 Merge branch 'master' into from_upstream
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
2022-05-03 13:41:55 -07:00
Tim Newsome b6dddfacc0
Merge pull request #694 from riscv/trigger_hit
Look at trigger hit bits to see which trigger was hit.
2022-05-02 09:40:07 -07:00
jihongbin 66335683fe drivers/cmsis-dap: Correct the DAP protocol parameter parsing error
Fixes: 01030fb893 (drivers/cmsis-dap: tidy up buffer access)

Change-Id: Id192d3930a89980d641058b6444d12caec19ce6f
Signed-off-by: Hongbin Ji <longma@orbbec.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6954
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: jihongbin <jhb_ee@163.com>
2022-05-01 04:48:19 +00:00
fatalc 12d1ad0c75 target/disassembler: update capstone include path to <capstone.h>
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>
2022-04-30 17:53:30 +00:00
Marc Schink 8789513fa9 target/arm_cti: Fix error handling in 'cti create'
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>
2022-04-30 17:52:40 +00:00
Steve Marple 9eddc21a58 bcm2835gpio: Make buffer an output before the GPIO connected to it
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>
2022-04-30 17:48:42 +00:00
Steve Marple 20adf85f34 linuxgpiod: add SWDIO buffer
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>
2022-04-30 17:47:38 +00:00