After single step operation, we should not assume that the halt
reason is single-step. There can be a higher-priority halt cause,
e.g. a breakpoint.
The real halt reason should be obtained from the target (dcsr.cause).
Simplify the code and prevent some field of the instruction from overflowing
Change-Id: I0acade05ad351d0e1918be4b75702b1637aa02c9
Signed-off-by: Xiang W <wxjstz@126.com>
Just use regular lists in FreeRTOS.c. O(n) lookups should be fine.
Change-Id: I5dc7b2fd209e0214a87d73bd6c4b63fd664bf49a
Signed-off-by: Tim Newsome <tim@sifive.com>
Waiting until the next execute_queue() might mean the target doesn't see
the reset signal asserted for a significant amount of time.
Change-Id: Id8514ddb30e88040131a6dba2b90b65463f10b76
Signed-off-by: Tim Newsome <tim@sifive.com>
OpenOCD already defines the macro ARRAY_SIZE, while riscv code
uses a local macro DIM.
Prefer using the macro ARRAY_SIZE() instead of DIM().
Not all the riscv code has been upstreamed, yes; this patch only
covers the code already upstreamed.
Change-Id: I89a58a6d91916d85c53ba5e4091b558271f8d618
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
OpenOCD already defines the macro ARRAY_SIZE, while riscv code
uses a local macro DIM.
Prefer using the macro ARRAY_SIZE() instead of DIM().
Not all the riscv code has been upstreamed, yes; this patch only
covers the code not upstreamed.
Change-Id: Ie3e411280f76bc798f1d51c2574cfec148ee0d0d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
The array newly_halted[] is assigned but its value is never used.
Drop it!
Change-Id: I678812a31c45a3ec03716e3eee6a30b8e8947926
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
This improves CheckMisa time from 3.11s to 2.94s. (Why are both these
times slower than in yesterday's commit message? I have no idea.
Gremlins in my PC?)
Change-Id: I05bd868b8aaf4220dca265bd494dfe889552716f
Signed-off-by: Tim Newsome <tim@sifive.com>
With the bitbang performance decrease and talking to slower targets
(daisy chain spike) we more often don't meet the expected keepalive time
for gdb. This addresses the cases I ran into.
Change-Id: Ie69c2c602c3be9c156e508fdfa6d0178f104e1d8
Signed-off-by: Tim Newsome <tim@sifive.com>
We need to read more than one byte at a time to get the original speed
back. OpenOCD mailing list suggests using fread/fwrite instead of
implementing our own buffering as we did here.
Change-Id: I261c743ee6c40c54bfd57a919f074512a1c40bee
Without it the repeat read test wasn't passing any longer. This is
because 7dd323b26d reduced the remote
bitbang performance. I've notified the mailing list about this.
Change-Id: Ie71592792202423aec89fa889b9e3d2a60a3c25f
Signed-off-by: Tim Newsome <tim@sifive.com>
I may have broken memory sampling with this merge.
Conflicts:
doc/openocd.texi
src/helper/command.c
src/jtag/drivers/ftdi.c
src/rtos/FreeRTOS.c
Change-Id: I2b7e09b2d3b244db546c5212532e6b48fb66dca4
this change aims to provide a better gdb debugging experience,
by making gdb understand what's really happening.
before this change when hitting a watchpoint
- openocd reports "T05" to gdb
- gdb displays: Program received signal SIGTRAP, Trace/breakpoint trap.
after the change
- openocd reports "T05watch:20000000;" to gdb
- gdb displays:
Hardware watchpoint 1: *0x20000000
Old value = 16000000
New value = 170000000
...
Change-Id: Iac3a85eadd86663617889001dd04513a4211ced9
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6181
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
pico-debug is not a board; it is a virtual CMSIS-DAP adapter that
runs on the same RP2040 also being debugged. This is possible due
to pico-debug running on the normally-dormant second Cortex-M0+
core (Core1), providing debugging of the first core (Core0).
As such, it could be used on a variety of RP2040-based boards.
Since a flash driver is useful (if not essential), a flash driver
is included. This driver code originated on RPi's bespoke OpenOCD
fork; lipstick was added to this particular pig to make it more
presentable on OpenOCD proper.
no new Clang analyzer warnings
Change-Id: I31f98b5ea1664f0adfbc184b57efba963acfb958
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/6075
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Nowadays, when it's difficult to buy STM32F030,
the use of GD32F130 seems to be an interesting functional alternative.
This is cortex-M3 and it works with the stm32f1x driver, but unfortunately not fully.
The main difference is another offset of user option bits
(like WDG_SW, nRST_STOP, nRST_STDBY) in option byte register
(FLASH_OBR/FMC_OBSTAT 0x4002201C).
Any use of functions like lock or unlock results in change default values of the those bits stored in flash.
Thus broken microcontroller is malfunctioning, e.g. flash block programming is interrupted
by unexpected active hardware watchog (after 0.4s).
This patch is a simplified version of #4592 done by Dominik Peklo (http://openocd.zylin.com/#/c/4592/).
GigaDevice GD32F1x0 & GD32F3x0 series devices share DEV_ID
with STM32F101/2/3 medium-density line,
however they use a REV_ID different from any STM32 device,
so can be succesfully detected.
Change-Id: I252cdf738d94983b70676a3497326f90c329e292
Signed-off-by: asier70Andrzej Sierżęga <asier70@gmail.com>
Reviewed-on: http://openocd.zylin.com/6164
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Remove a use of AH_BOTTOM from configure.ac. This macro is used by
autoheader to add '#include' of some include file to the end of
config.h.in and then to config.h. OpenOCD can be built with a custom
config.h, so it's preferable to move these '#include' statement directly
in the C files that need them dropping this unneeded dependency.
It also causes problems when I want to use the gnulib library (which
comes with its own Makefile, and does not have the same include path as
the top-level Makefile).
So this change touches a lot of files, but is actually really simple. It
does not affect functionality at all.
Change-Id: I52c70bf15eb2edc1dd10e0fde23b2bcd4caec000
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/6171
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Currently, all drscan commands will cycle through DR-PAUSE before reaching
TAP-IDLE. This patch provides a different path on FTDI driver.
This change is required for the ST On Chip Emulator (OnCE), to avoid
re-enabling the OnCE tap after every DRSCAN. This is because the OnCE
TAP (see ST Application Note AN4035) gets disabled if DR-PAUSE is entered
before DR-UPDATE.
With this commit, the current path:
DR-SHIFT -> DR-EXIT1 -> DR-PAUSE -> DR-EXIT2 -> DR-UPDATE -> IDLE
is changed to:
DR-SHIFT -> DR-EXIT1 -> DR-UPDATE -> IDLE
only if IDLE is the endstate (which is the driver default).
Before this patch, once the SHIFT sequence is complete, the driver would
normally move to the nearest stable state, which is DR-PAUSE, by clocking
out a '10' binary sequence. Then it would follow the path provided by
tap_get_tms_path() to reach endstate. It is done this way because
tap_get_tms_path() only supports stable states.
After this patch, the strategy is mostly the same, with the exception that,
if TAP_IDLE is the endstate, a '110' binary sequence is output after completing
the SHIFT sequence. This takes the TAP directly to IDLE, with no further action
required.
A scheme of the DR chain is shown below. A * character is used to mark the
stable states.
----------------------------------------------------------------------
| | 0
v 1 0 0 1 0 1 1 |
IDLE* -> SEL-DR -> CAPTURE -> SHIFT* -> EXIT1 -> PAUSE* -> EXIT2 -> UPDATE
| ^
1 | |
-----------------------------
Change-Id: Ib413e5c4c0bbf75dae0b4672119bae4ef03d0258
Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com>
Reviewed-on: http://openocd.zylin.com/6123
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
auto-completion behavior:
- if there is only one matched command complete the user-command
- else if multiple matches add the common part then in second step
list all matched commands
- sub-commands are handled in the same way
- auto-completion restarts after these characters ';', '[', '{'
Change-Id: I1b81dd19191a5785e68d0bb5cd244e01a4dd0587
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6095
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
The documentation of Jim_SetResultFormatted() reports that the jim
objects passed as arguments would be freed if have zero refcount.
Remove the useless Jim_IncrRefCount()/Jim_DecrRefCount().
Remove the dangerous Jim_FreeNewObj() that should trigger a double
free(). Not tested due to lack of aice adapter.
While there, rename some CamelCase symbol.
Change-Id: Ic56704c83d6391c38f6b0efa6566784d453bc0fb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6190
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Commit 7a731eb637 ("Added HostOS variable"), merged in 2009,
adds a TCL global variable 'ocd_HostOS' that reports in a string
the OS of the host.
This was proposed as a workaround for jimtcl that didn't define
the standard TCL variable 'tcl_platform(os)'.
With commit 42f3fb7b7f46 ("Determine platform_tcl() settings with
configure"), merged in 2010 and part of jimtcl 0.70 issued in
early 2011, jimtcl provides the requires TCL standard variable
'tcl_platform(os)'.
The variable 'ocd_HostOS' has never been used by any TCL script
distributed with OpenOCD.
Drop the TCL variable 'ocd_HostOS'.
Change-Id: I27858de35cc9d30df97145ca1ccd24877be4af11
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6189
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
If malloc() fails, the just allocated Jim_Obj will leaks.
Move Jim_IncrRefCount() before the malloc() and deallocate the Jim
object with Jim_DecrRefCount() on malloc() fail.
While there, add the 'out of memory' log and fix the CamelCase
name of the symbol tclOutput.
Change-Id: Ic733db229d5aa5d477d758ea9cb88cd81d7542cd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6188
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
The files jim-nvp.[ch] were originally inside jimtcl, then in 2011
they were dropped by jimtcl and integrated in OpenOCD.
The initial purpose was to make them as an independent library,
thus the presence of an 'init' function. Being now part of OpenOCD
do not require the 'init' function anymore, that is still empty
and unused, plus its name is in violation of the coding style.
Drop the function Jim_nvpInit().
Change-Id: I429e10444c86a26dbdc22aa071315324dc5edc3e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6187
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Accordingly to OpenOCD coding style, both typedef and Camelcase
symbols are forbidden.
The type '_Bool' is not used in the code, having 'bool' as
preferred choice.
Remove the definition of '_Bool' from 'types.h'.
Change-Id: I8863f9836ccd9166e0c69fa5d75d6fef79ae7bfb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6186
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
The ELF typedef's 'Elf32_Sword' and 'Elf32_Hashelt' are not used
within OpenOCD. Plus, being their name in CamelCase require extra
effort to include them in the exceptions for checkpatch.
Remove the unused typedef's.
Change-Id: I18f039567edd5b24dbb41df5406c154f31022ae7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6178
Tested-by: jenkins
Reviewed-by: Christian Hoff <christian.hoff@advantest.com>
The existing code asserted in that case, which is not correct. This
would allow the user to crash OpenOCD with a bad ELF file, which is
not what we want. A proper error should be reported in that case and
OpenOCD should not crash.
Change-Id: Ied5a6a6fd4ee0fd163f3fe850d304a121ecbe33a
Signed-off-by: Christian Hoff <christian.hoff@advantest.com>
Reviewed-on: http://openocd.zylin.com/6172
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Libusb defines both the struct and a typedef to the struct using
the same struct name. It's then possible to use either 'struct x'
and 'x'. E.g.:
typedef struct libusb_device libusb_device;
OpenOCD is not consistent and uses a mix of 'struct x' and 'x'.
To make OpenOCD code uniform, stick at project's coding style and
use 'struct x' in place of the typedef'd name.
Change-Id: I901458b680e42830d3f371e47997157f91b7f675
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6165
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Commit a7d68878e4 ("helper/command: unregister commands through
their full-name") introduces for the first time in OpenOCD the use
of jimtcl API Jim_DeleteCommand().
The prototype of Jim_DeleteCommand() has changed with jimtcl 0.80
and the current code doesn't build with jimtcl 0.79 or older. This
is an issue for those distributions, like Debian, that provide
jimtcl as a separate package/library and have not switched yet to
the new jimtcl version.
Add a compile-time condition to cope with the jimtcl API change.
Change-Id: Ic813ab7c0ebd3c8772f27775ba3912a47d5c275c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: a7d68878e4 ("helper/command: unregister commands through their full-name")
Reviewed-on: http://openocd.zylin.com/6191
Tested-by: jenkins
fix the warning below by adding a '.' after xref in line 10184:
./doc/openocd.texi:10184: warning: `.' or `,' must follow @xref, not c
Change-Id: Ibd976ae61cf6845e925b839321444dcb25a3c04a
Reported-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6179
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
fix the warning below by adding a '.' after xref in line 4517:
../code/doc/openocd.texi:4517: warning: `.' or `,' must follow @xref, not )
Change-Id: I6e529c7e83c9f912e1dd899abf5f630c90b583d9
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6174
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Uses CMSIS-DAP v 1.2 or higher protocol command DAP_SWD_Sequence
to write to DP TARGETSEL register. This write is not acknowledged
by device so we cannot use standard DAP_Transfer
Change-Id: Ib252d09570bcc2282be5f854e0ab9a0dfda06189
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/6117
Tested-by: jenkins
Reviewed-by: Peter Lawrence <majbthrd@gmail.com>
This file has been added to OpenOCD 0.5.0 in 2011, before gerrit
gets in use, with commit ba71e8c521 ("at91: add chip register
definition and generic init support").
The only procedure in the file has never been referenced in any
other part of OpenOCD. This procedure has syntax errors while uses
its argument 'cs' and several unmatched parenthesis, which clearly
highlights that it has never been used so far.
Gerrit does not report any patch aimed at fixing it.
Even if the file seems unused and could be removed, let's fix it
in the hope it could get used.
While there, remove some useless parenthesis and format it using
the new simplified syntax required by jimtcl 0.81.
Change-Id: Ied26456262e7b99de37667a8ce418f4f12e237bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: ba71e8c521 ("at91: add chip register definition and generic init support")
Reviewed-on: http://openocd.zylin.com/6157
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>