openocd.git
2 years agoCall poll at a fixed interval. 63/6363/5
Tim Newsome [Fri, 9 Jul 2021 19:58:07 +0000 (12:58 -0700)]
Call poll at a fixed interval.

The existing implementation blocks in select() for a fixed amount of
time. This change tracks when the next event (likely poll()) wants to be
run, and uses a shorter timeout in select() if necessary.

Also track all these timeouts using milliseconds as returned by
timeval_ms() instead of `struct timeval` to simplify the code.

This feature is helpful if poll() wants to do something like sample PCs
or memory values for basically the entire time that otherwise OpenOCD
would be hung in select(). See
https://github.com/riscv/riscv-openocd/pull/541 for an example of that.
The RISC-V code using this change will be upstreamed some day, too.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I67104a7cf69ed07c8399c14aa55963fc5116a67d
Reviewed-on: http://openocd.zylin.com/6363
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/cmsis-dap: update for newest protocol version 73/6373/6
PoroCYon [Wed, 21 Jul 2021 02:17:08 +0000 (04:17 +0200)]
drivers/cmsis-dap: update for newest protocol version

The capabilities INFO command can now return two bytes, without this
patch, the capabilities would simply not be read and left as 0 (i.e. no
capabilities).

cf. https://arm-software.github.io/CMSIS_5/DAP/html/group__DAP__Info.html ;
https://github.com/ARM-software/CMSIS_5/blob/116866fd74756c88096e37cbd0066fadad583cad/CMSIS/DAP/Firmware/Source/DAP.c#L100-L111

Change-Id: Ibd894971edf1c120cae08089e5515ce5e9972323
Signed-off-by: PoroCYon <porocyon@titandemo.org>
Reviewed-on: http://openocd.zylin.com/6373
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc/openocd.texi: Add documentation for bcm2835 interface 76/6376/5
Matthew Mets [Wed, 21 Jul 2021 23:25:15 +0000 (01:25 +0200)]
doc/openocd.texi: Add documentation for bcm2835 interface

This adds documentation for the bcm2835 interface configuration
parameters to the user manual. Documentation format is based on
the FTDI interface section, and was taken from the descriptions
in the driver source code.

Change-Id: I77b09b8bd44d8e8fe9cc5fb9de3c3a30550d943c
Signed-off-by: Matthew Mets <matt@blinkinlabs.com>
Reviewed-on: http://openocd.zylin.com/6376
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agointerface/jtag_hat: Add interface configuration for the JTAG HAT 72/6372/5
Matthew Mets [Mon, 19 Jul 2021 23:48:47 +0000 (01:48 +0200)]
interface/jtag_hat: Add interface configuration for the JTAG HAT

This adds support for the Blinkinlabs JTAG Hat, a Raspberry Pi
expansion board that provides JTAG and SWD connections via level-
shifting buffers.

Change-Id: I228bf6a18890b7c3d6679bbc63bfe39f726d8323
Signed-off-by: Matthew Mets <matt@blinkinlabs.com>
Reviewed-on: http://openocd.zylin.com/6372
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agodrivers/bcm2835: Add support for SWDIO direction control pin 71/6371/5
Matthew Mets [Mon, 19 Jul 2021 23:28:05 +0000 (01:28 +0200)]
drivers/bcm2835: Add support for SWDIO direction control pin

Adds a new, optional configuration "bcm2835gpio_swdio_dir_num" to
the BCM2835 driver, to control the direction of an external buffer
driver IC in SWD mode. For example, this is needed to use a level-
shifting buffer, such as the SN74LVC2T45 used on the JTAG Hat

Change-Id: If5c146f310ecf8ceae85443b3670936467d2786d
Signed-off-by: Matthew Mets <matt@blinkinlabs.com>
Reviewed-on: http://openocd.zylin.com/6371
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agojtag/aice: fix build with clang on MacOS 80/6380/2
Antonio Borneo [Sat, 24 Jul 2021 10:37:09 +0000 (12:37 +0200)]
jtag/aice: fix build with clang on MacOS

Commit fceb29d03ff9 ("jtag/aice: use macros in place of const
variables") replaces some 'static const uint8_t' with macros.
This breaks the build on MacOS because the macro values are of
'int' type that doesn't match with the printf format 'PRIx8'.

error: format specifies type 'unsigned char' but the
argument has type 'int' [-Werror,-Wformat]

Replace the printf format 'PRIx8' with 'x'.
While there, remove a useless cast to uint32_t and fix the printf
format too.

Change-Id: Ib87298a61637b75a2813f209e5209d39ab2745f8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: fceb29d03ff9 ("jtag/aice: use macros in place of const variables")
Reviewed-on: http://openocd.zylin.com/6380
Tested-by: jenkins
2 years agodoc: move the official channel to Libera.Chat 97/6297/2
Paul Fertser [Sun, 6 Jun 2021 09:09:37 +0000 (12:09 +0300)]
doc: move the official channel to Libera.Chat

Due to Freenode takeover it's likely that most of our users are going to
seek support on Libera in the nearest future.

Change-Id: I98db95bab51f4ef2ac854bf521468d22b2794e56
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/6297
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Marc Schink <dev@zapb.de>
2 years agoarm_adi_v5: Added Cortex-A76 identifiers 58/6358/2
Florian Fainelli [Tue, 6 Jul 2021 18:21:54 +0000 (11:21 -0700)]
arm_adi_v5: Added Cortex-A76 identifiers

Add identifiers of the Cortex-A76 ROM and debug unit.

Change-Id: Ieef0d990189d3c0502e8d530874dc9cbca4417d8
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-on: http://openocd.zylin.com/6358
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoarm_adi_v5: Provide Brahma-B53 identifiers 68/6368/2
Florian Fainelli [Fri, 9 Jul 2021 18:04:27 +0000 (11:04 -0700)]
arm_adi_v5: Provide Brahma-B53 identifiers

The Broadcom Brahma-B53 CPUs contains a number of custom ROM table
entries for its PMU, Debug unit, and a couple of ROM tables.

Change-Id: I1f21f07ed296579c374f24e781325789bf4ebf51
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-on: http://openocd.zylin.com/6368
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoopenocd: fix Yoda conditions with checkpatch 55/6355/3
Antonio Borneo [Sat, 3 Jul 2021 15:18:53 +0000 (17:18 +0200)]
openocd: fix Yoda conditions with checkpatch

The new checkpatch can automatically fix the code, but this
feature is still error prone and not complete.

Patch generated automatically through the new checkpatch with
flags "--types CONSTANT_COMPARISON --fix-inplace".

Some Yoda condition is detected by checkpatch but not fixed; it
will be fixed manually in a following commit.

Change-Id: Ifaaa1159e63dbd1db6aa3c017125df9874fa9703
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6355
Tested-by: jenkins
2 years agoopenocd: manually remove NULL comparisons 53/6353/3
Antonio Borneo [Sat, 3 Jul 2021 20:10:55 +0000 (22:10 +0200)]
openocd: manually remove NULL comparisons

For the remaining NULL comparisons, remove then manually.

While there, make more readable a loop, by moving the assigment
out of the loop condition.

Change-Id: I44193aaa95813156a3a79c16b80e1ad333dc1eaf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6353
Tested-by: jenkins
2 years agoopenocd: remove NULL comparisons with checkpatch [2/2] 52/6352/3
Antonio Borneo [Sat, 3 Jul 2021 19:47:55 +0000 (21:47 +0200)]
openocd: remove NULL comparisons with checkpatch [2/2]

Patch generated automatically through a modified checkpatch that
detects the patterns
if (NULL == symbol)
if (NULL != symbol)
and through flags "--types COMPARISON_TO_NULL --fix-inplace".

The unmodified checkpatch detects this pattern as Yoda condition,
but it's odd fixing it as Yoda condition and then again as NULL
comparison. This triggered the modification to the script.

Change-Id: I5fe984a85e9c4fc799f049211797aef891ebce18
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6352
Tested-by: jenkins
2 years agoopenocd: remove NULL comparisons with checkpatch [1/2] 51/6351/3
Antonio Borneo [Sat, 3 Jul 2021 19:29:32 +0000 (21:29 +0200)]
openocd: remove NULL comparisons with checkpatch [1/2]

Patch generated automatically through the new checkpatch with
flags "--types COMPARISON_TO_NULL --fix-inplace".
This only fixes the comparisons
if (symbol == NULL)
if (symbol != NULL)
The case of NULL on the left side of the comparison is not tested.

Some automatic fix is incorrect and has been massaged by hands:
- if (*psig == NULL)
+ if (*!psig)
changed as
+ if (!*psig)

Change-Id: If4a1e2b4e547e223532e8e3d9da89bf9cb382ce6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6351
Tested-by: jenkins
2 years agoopenocd: fix simple cases of NULL comparison 50/6350/3
Antonio Borneo [Sat, 3 Jul 2021 16:51:20 +0000 (18:51 +0200)]
openocd: fix simple cases of NULL comparison

There are more than 1000 NULL comparisons to be aligned to the
coding style.
For recurrent NULL comparison it's preferable using trivial
scripts in order to minimize the review effort.

Patch generated automatically with the command:
sed -i PATTERN $(find src/ -type f)
where PATTERN is in the list:
's/(\([a-z][a-z0-9_]*\) == NULL)/(!\1)/g'
's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) == NULL)/(!\1)/g'
's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) == NULL)/(!\1)/g'

's/(\([a-z][a-z0-9_]*\) != NULL)/(\1)/g'
's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) != NULL)/(\1)/g'
's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) != NULL)/(\1)/g'

's/(NULL == \([a-z][a-z0-9_]*\))/(!\1)/g'
's/(NULL == \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(!\1)/g'
's/(NULL == \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(!\1)/g'

's/(NULL != \([a-z][a-z0-9_]*\))/(\1)/g'
's/(NULL != \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(\1)/g'
's/(NULL != \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(\1)/g'

Change-Id: Ida103e325d6d0600fb69c0b7a1557ee969db4417
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6350
Tested-by: jenkins
2 years agotarget: rename CamelCase symbols 43/6343/3
Antonio Borneo [Tue, 27 Apr 2021 16:46:43 +0000 (18:46 +0200)]
target: rename CamelCase symbols

No major cross dependencies, mostly changes internal to each
file/function.

Change-Id: I7cc87458a341bae29a4f772b0af5d97b4bfc2da3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6343
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
2 years agoopenocd: manually fix Yoda conditions 56/6356/2
Antonio Borneo [Sat, 3 Jul 2021 16:18:57 +0000 (18:18 +0200)]
openocd: manually fix Yoda conditions

Fix the remaining Yoda conditions, detected by checkpatch but not
fixed automatically.

While there, apply minor style changes.

Change-Id: I6e1978b89c4d56a20aceaeb2b52968eb6384432a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6356
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agoopenocd: fix simple cases of Yoda condition 54/6354/3
Antonio Borneo [Sat, 3 Jul 2021 14:47:35 +0000 (16:47 +0200)]
openocd: fix simple cases of Yoda condition

There are ~900 Yoda conditions to be aligned to the coding style.
For recurrent Yoda conditions it's preferable using a trivial
script in order to minimize the review effort.
E.g. comparison of uppercase macro/enum with lowercase variable:
- ...(ERROR_OK == retval)...
+ ...(retval == ERROR_OK)...

Patch generated automatically with the command:
sed -i \
's/(\([A-Z][A-Z0-9_]*\) \([=!]=\) \([a-z][a-z0-9_]*\))/(\3 \2 \1)/g' \
$(find src/ -type f)

While there, remove the braces {} around a single statement block
to prevent warning from checkpatch.

Change-Id: If585b0a4b4578879c87b2dd74d9e0025e275ec6b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6354
Tested-by: jenkins
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agoflash/nor: convert enum in uppercase 49/6349/2
Antonio Borneo [Sun, 6 Jun 2021 21:59:39 +0000 (23:59 +0200)]
flash/nor: convert enum in uppercase

Change-Id: I7b31be25a651069b63c6dea6cb5e7994184390b1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6349
Tested-by: jenkins
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotarget/nds32: use lowercase for C variables 48/6348/2
Antonio Borneo [Sun, 6 Jun 2021 16:29:04 +0000 (18:29 +0200)]
target/nds32: use lowercase for C variables

Convert to lowercase the name of arrays.
Convert to macro two uppercase const variables.

Change-Id: Ic6f5cad38722dfdf78d662ff4893e94482ab423d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6348
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agoflash: use lowercase for C variables 47/6347/2
Antonio Borneo [Wed, 28 Apr 2021 22:31:29 +0000 (00:31 +0200)]
flash: use lowercase for C variables

Change-Id: I1c3cb5d1c8c0d73adb3c7320a1b8e3940183cd17
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6347
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agodrivers/buspirate: use macros in place of const variables 46/6346/2
Antonio Borneo [Sun, 6 Jun 2021 16:17:01 +0000 (18:17 +0200)]
drivers/buspirate: use macros in place of const variables

Uppercase symbols are normally used for macro or enum's values.
Convert the uppercase const variables to macros.

Change-Id: I749544c2e5deba65583824a7c2a6023e697714df
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6346
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
2 years agojtag/aice: use macros in place of const variables 45/6345/2
Antonio Borneo [Sun, 6 Jun 2021 16:14:03 +0000 (18:14 +0200)]
jtag/aice: use macros in place of const variables

Uppercase symbols are normally used for macro or enum's values.
Convert the uppercase const variables to macros.

Change-Id: I4ba47ce2d3183b50730c5a9a265f274c7b802519
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6345
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agosvf: rename CamelCase label 44/6344/2
Antonio Borneo [Sun, 6 Jun 2021 15:41:09 +0000 (17:41 +0200)]
svf: rename CamelCase label

Change-Id: I41871bbbead9810f9a66b2e440a7b26094d6cd0c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6344
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotarget/nds32: rename CamelCase symbols 42/6342/2
Antonio Borneo [Sun, 6 Jun 2021 15:48:48 +0000 (17:48 +0200)]
target/nds32: rename CamelCase symbols

Change-Id: I4619eb47cd051f52e60a3fdbc49aaf71e13a81e2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6342
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotarget/mips: rename CamelCase symbols 41/6341/2
Antonio Borneo [Tue, 27 Apr 2021 16:50:34 +0000 (18:50 +0200)]
target/mips: rename CamelCase symbols

No major cross dependencies, mostly changes internal to each
file/function.

Change-Id: Iec58f7fe1d65f621ae0c841b5e25ef222885792b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6341
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotarget/arm: opcodes: rename CamelCase symbols and uppercase variables 40/6340/2
Antonio Borneo [Tue, 27 Apr 2021 22:25:03 +0000 (00:25 +0200)]
target/arm: opcodes: rename CamelCase symbols and uppercase variables

No major cross dependencies, mostly changes internal to each
file/function.

Change-Id: I1325560ef0350517d86d4927cb17ceaae81b75d2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6340
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotarget/cortex_m: rename CamelCase symbol 39/6339/2
Antonio Borneo [Sun, 6 Jun 2021 15:20:30 +0000 (17:20 +0200)]
target/cortex_m: rename CamelCase symbol

Change-Id: I67d803e15ba9fd08f2b31361fb3604275e483605
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6339
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotarget/arm: rename CamelCase symbols 38/6338/2
Antonio Borneo [Tue, 27 Apr 2021 13:58:26 +0000 (15:58 +0200)]
target/arm: rename CamelCase symbols

No major cross dependencies, mostly changes internal to each
file/function.

Change-Id: I3f0879f0f33c6badc36a0dc60229323978a7e280
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6338
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Xiang W <wxjstz@126.com>
2 years agotcl: Adapt config files to new ftdi command syntax 33/6333/3
Marc Schink [Wed, 23 Jun 2021 18:54:49 +0000 (20:54 +0200)]
tcl: Adapt config files to new ftdi command syntax

The patch was created automatically using the following
script:

%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---
(cat << EOF
ftdi_device_desc ftdi device_desc
ftdi_serial ftdi serial
ftdi_channel ftdi channel
ftdi_layout_init ftdi layout_init
ftdi_layout_signal ftdi layout_signal
ftdi_set_signal ftdi set_signal
ftdi_get_signal ftdi get_signal
ftdi_vid_pid ftdi vid_pid
ftdi_tdo_sample_edge ftdi tdo_sample_edge
EOF
) | while read a b; do
sed -i "s/$a/$b/g" $(find tcl -type f -name "*.cfg" )
done
%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---

Change-Id: Iff781f37bb5511b7e15cbe6dcdf6d28e89fb174f
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6333
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/ftdi: Group adapter commands 32/6332/3
Marc Schink [Wed, 23 Jun 2021 17:39:24 +0000 (19:39 +0200)]
drivers/ftdi: Group adapter commands

Use a command group 'ftdi' with subcommands instead of individual
commands with 'ftdi_' prefix.

The old commands are still available for backward compatibility but
marked as deprecated.

Change-Id: I93a0ae7070226cd2fdea566effeb14a141269de8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6332
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget: add support for 64bit data in mem2array and array2mem 86/6286/5
Jan Matyas [Thu, 3 Jun 2021 14:26:37 +0000 (16:26 +0200)]
target: add support for 64bit data in mem2array and array2mem

- Added support for reading and writing 64-bit data items
  using TCL commands "mem2array" and "array2mem". Until now,
  data items only up to 32 bits were supportd.

- Cleaned up functions target_array2mem() and
  target_mem2array(), especially data types of variables
  and variable declarations (scope).

Change-Id: Ia0ba427804f8fd8d7568f12714ab36984d6d5e24
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6286
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget: add 64-bit address array command support 46/6246/3
Daniel Goehring [Wed, 7 Apr 2021 02:33:13 +0000 (22:33 -0400)]
target: add 64-bit address array command support

Add 64-bit address support to the target mem2array and array2mem commands

Change-Id: Ibdcc076ca5581f4fd87e92318aab33907e22d6ce
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: http://openocd.zylin.com/6246
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/semihosting: Fix of close(): Never close standard streams 91/6291/2
Jan Matyas [Fri, 4 Jun 2021 08:44:44 +0000 (10:44 +0200)]
target/semihosting: Fix of close(): Never close standard streams

This change fixes behavior of the SEMIHOSTING_SYS_CLOSE operation.
It ensures that OpenOCD's own stdin/stdout/stderr streams are never
closed, not even if the target requests it via semihosting.

Change-Id: Ia85af5963d1a3516284fd834f7197369a8fb268c
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6291
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/semihosting: Capture errno in SEMIHOSTING_SYS_ISTTY 92/6292/2
Jan Matyas [Fri, 4 Jun 2021 09:41:36 +0000 (11:41 +0200)]
target/semihosting: Capture errno in SEMIHOSTING_SYS_ISTTY

Capture the value of "errno" in semihosting isatty() call,
as is done in other syscalls.

Change-Id: I41b72175635f06c000536f583e3efa30fb57379e
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6292
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface/ftdi: Fix Digilent JTAG-SMT2 config 79/4179/2
Patrick Stewart [Thu, 6 Jul 2017 16:32:31 +0000 (17:32 +0100)]
tcl/interface/ftdi: Fix Digilent JTAG-SMT2 config

Drive the output enable for TMS and TDI

Change-Id: Ib23afd2f5149d4ce402d88781e68dcf0f074f395
Signed-off-by: Patrick Stewart <patstew@gmail.com>
Reviewed-on: http://openocd.zylin.com/4179
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2 years agoconfig/ftdi: Add tristate capability to sheevaplug config 63/3663/2
Andreas Fritiofson [Sat, 13 Aug 2016 08:48:53 +0000 (10:48 +0200)]
config/ftdi: Add tristate capability to sheevaplug config

The legacy ft2232 driver suggests that the adapter has tristate
buffers on both nSRST and nTRST, even though they were not used as
such.

Change-Id: I971692ea6b3439ac93311b89877825a5cc21df46
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/3663
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl: Update Flyswatter product links 37/6337/2
Florian Fainelli [Mon, 28 Jun 2021 16:46:12 +0000 (09:46 -0700)]
tcl: Update Flyswatter product links

The Flyswatter URL is dead and requires us to use web.archive.org since
the product is discontinued. The Flyswatter 2 is still active and
accessible at a different URL.

Change-Id: Ib2d9de70a9728b0f0ef73f5e479bca81f958442c
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-on: http://openocd.zylin.com/6337
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/cortex_a: Replace printf() with LOG_DEBUG() 36/6336/2
Marc Schink [Mon, 28 Jun 2021 11:11:37 +0000 (13:11 +0200)]
target/cortex_a: Replace printf() with LOG_DEBUG()

Change-Id: I38fa8e21959b398033741cbd779b632d572c7ce4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6336
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/aarch64: Replace printf() with LOG_DEBUG() 35/6335/2
Marc Schink [Mon, 28 Jun 2021 11:10:51 +0000 (13:10 +0200)]
target/aarch64: Replace printf() with LOG_DEBUG()

Change-Id: If32bc320c48259dec4b81d457b848e972bcda784
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6335
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/mips64: Replace printf() with LOG_ERROR() 34/6334/2
Marc Schink [Mon, 28 Jun 2021 11:08:48 +0000 (13:08 +0200)]
target/mips64: Replace printf() with LOG_ERROR()

Change-Id: I73956dc3485a23b761aecd869cc37d657c393bde
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6334
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoAdd RTOS memory read/write functions. 27/6327/3
Tim Newsome [Mon, 21 Jun 2021 21:37:41 +0000 (14:37 -0700)]
Add RTOS memory read/write functions.

If not implemented, these specify to regular target read/write. However,
if individual threads in an RTOS can have different address translation
configured then the RTOS support can use this to do the right thing.

Use this in hwthread, where of course address translation can be set up
differently for different real cores.

Change-Id: I62c501cff1f863d855ee197dee7b73204ea8885a
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/6327
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget: check return value of register get/set callbacks 93/6293/2
Jan Matyas [Fri, 4 Jun 2021 10:54:02 +0000 (12:54 +0200)]
target: check return value of register get/set callbacks

- In "reg" TCL command handler, the return value of register get()
  and set() callbacks must be checked, in the same manner as it is
  done in e.g. gdb_set_register_packet() or gdb_get_register_packet().

- Minor cleanup of variable definitions in the "reg" command
  handler.

Change-Id: I8c57e7c087fe31d1abffa3c4d1f79a01af4c9c97
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6293
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/stm8: Remove unused member 'stm8_common' 25/6325/2
Marc Schink [Sun, 20 Jun 2021 17:04:32 +0000 (19:04 +0200)]
target/stm8: Remove unused member 'stm8_common'

Change-Id: Ie8b59a82142bfdf2ee9395d38b1bedc27de728b8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6325
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/adiv5: Large Physical Address Extension 76/5576/8
Kevin Burke [Tue, 9 Feb 2021 22:27:03 +0000 (17:27 -0500)]
target/adiv5: Large Physical Address Extension

Provides ARM LPAE support to allow 64-bit TAR setting
on MEM AP accesses.

Tested on a 4-core ARM ARES Processor system using an
AXI Access Port.

Change-Id: I88f7a0a57a6abb58665032929194a41dd8729f6b
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: http://openocd.zylin.com/5576
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agortos/eCos: rename CamelCase symbols 06/6306/2
Antonio Borneo [Sun, 6 Jun 2021 17:22:30 +0000 (19:22 +0200)]
rtos/eCos: rename CamelCase symbols

Convert CamelCase enum in uppercase and the other symbols in
lowercase.

Change-Id: I141c55bdfe6ef2a2da28d1da15a283a644ae7cb2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6306
Tested-by: jenkins
2 years agortos: rename CamelCase symbols 05/6305/3
Antonio Borneo [Tue, 25 May 2021 07:55:22 +0000 (09:55 +0200)]
rtos: rename CamelCase symbols

Only one exported symbol from eCos is included in this patch.
The eCos code is left untouched to prevent conflicts with patches
currently under review.

While there, remove an unused camelcase macro

Change-Id: I8d22dec6e243c00665d99a8b8ba00474b4f088db
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6305
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
2 years agortos: convert CamelCase enum in uppercase 04/6304/3
Antonio Borneo [Tue, 25 May 2021 07:53:15 +0000 (09:53 +0200)]
rtos: convert CamelCase enum in uppercase

The eCos code is not part of this patch to prevent conflicts with
patches currently under review.

Change-Id: I71369165f2eef419b83a79ffcff50287f77949c6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6304
Tested-by: jenkins
2 years agoserver: rename CamelCase symbols 03/6303/3
Antonio Borneo [Sun, 25 Apr 2021 21:57:01 +0000 (23:57 +0200)]
server: rename CamelCase symbols

No cross dependency, just changes internal to each file/function.

Change-Id: I04153a5720b0540bc1998bafe526d523b2ee5515
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6303
Tested-by: jenkins
2 years agojtag/swd: rename CamelCase macros 02/6302/3
Antonio Borneo [Sun, 6 Jun 2021 15:20:10 +0000 (17:20 +0200)]
jtag/swd: rename CamelCase macros

Change-Id: I4bce678b67d3d2347e88da9507820837697b5aa7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6302
Tested-by: jenkins
2 years agojtag: rename CamelCase symbols 01/6301/4
Antonio Borneo [Sun, 25 Apr 2021 21:41:15 +0000 (23:41 +0200)]
jtag: rename CamelCase symbols

No major cross dependency, just changes internal to each file or
function.

Change-Id: Ie6258a090ce53de5db65df6a77d57ac6bb899488
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6301
Tested-by: jenkins
2 years agohelper: rename camelcase symbols 00/6300/3
Antonio Borneo [Sun, 25 Apr 2021 20:38:32 +0000 (22:38 +0200)]
helper: rename camelcase symbols

No cross dependency, just changes internal to each file/function.

Change-Id: I16568ddcd8304f5e6748c2e19f32421b047b0357
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6300
Tested-by: jenkins
2 years agoflash: rename CamelCase symbols 99/6299/4
Antonio Borneo [Mon, 26 Apr 2021 21:53:42 +0000 (23:53 +0200)]
flash: rename CamelCase symbols

Each driver is almost self-contained, with no cross dependency.
Changing symbol names in one drive does not impact the other.

Change-Id: Ic09f844f922a35cf0a9dc23fcd61d035b38308b3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6299
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
2 years agoflash/nor/cfi: fix CamelCase symbols in cfi_spansion_pri_ext 98/6298/3
Antonio Borneo [Sun, 25 Apr 2021 14:07:15 +0000 (16:07 +0200)]
flash/nor/cfi: fix CamelCase symbols in cfi_spansion_pri_ext

The struct cfi_spansion_pri_ext has few symbols in CamelCase.
Change all them accordingly to OpenOCD coding style.
Patch created automatically with the script below:

%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---
(cat << EOF
VppMin          vpp_min
VppMax          vpp_max
TopBottom       top_bottom
TmpBlkUnprotect tmp_blk_unprotected
SimultaneousOps simultaneous_ops
SiliconRevision silicon_revision
PageMode        page_mode
EraseSuspend    erase_suspend
BurstMode       burst_mode
BlkProtUnprot   blk_prot_unprot
BlkProt         blk_prot
EOF
) | while read a b; do
    sed -i "s/$a/$b/g" src/flash/nor/*cfi*
done
%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---

Change-Id: I135331539ca9aa84765fdffc51c87a07a46ee77a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6298
Tested-by: jenkins
2 years agostlink: fix SIGSEGV with libusb v1.0.24-33-g32a2206 (11618) 31/6331/2
Antonio Borneo [Wed, 23 Jun 2021 14:52:16 +0000 (16:52 +0200)]
stlink: fix SIGSEGV with libusb v1.0.24-33-g32a2206 (11618)

The stlink driver incorrectly uses a NULL pointer for libusb's
struct libusb_context.
The correct value to be used is local in libusb_helper.c.

Move in the helper file, in a wrapper function, the only call that
requires the above value, and let stlink driver to use this
wrapper.

This issue has not triggered any visible problem until a code
refactoring [1] in libusb has made OpenOCD crashing on Windows and
on MacOS.

Change-Id: Id1818c8af7cf0d4d17dfa1d22aad079da01ef740
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/308/
Fixes: https://github.com/libusb/libusb/issues/928/
Fixes: 42d8fa899c6a ("stlink_usb: Submit multiple USB URBs at once to improve performance")
Link: [1] https://github.com/libusb/libusb/commit/32a22069428c
Reported-by: Andrzej Sierżęga <asier70@gmail.com>
Co-developed-by: Andrzej Sierżęga <asier70@gmail.com>
Co-developed-by: Xiaofan Chen <xiaofanc@gmail.com>
Reviewed-on: http://openocd.zylin.com/6331
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2 years agoflash/nor/stm32l4: Fix stm32l4_probe() 26/6326/5
Marc Schink [Mon, 21 Jun 2021 14:18:38 +0000 (16:18 +0200)]
flash/nor/stm32l4: Fix stm32l4_probe()

The current implementation fails due to the assert() statements in
get_stm32l4_rev_str() and get_stm32l4_bank_type_str(). Rearrange the
code in order to fix the problem.

Change-Id: If19c648dec8ddd3ef2fb801150114104b34c3bf2
Signed-off-by: Marc Schink <dev@zapb.de>
Fixes: 64c2e03b23 ("flash/nor: improved API of flash_driver.info & fixed buffer overruns")
Reviewed-on: http://openocd.zylin.com/6326
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/breakpoints: Remove dead code and cleanup 21/6321/2
Marc Schink [Tue, 15 Jun 2021 14:49:37 +0000 (16:49 +0200)]
target/breakpoints: Remove dead code and cleanup

Change-Id: I8027178b6e771753775514a8641a050c6e63a1d5
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6321
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoarmv7m: replace flag 'stlink' with 'is_hla_target' 06/6206/4
Antonio Borneo [Sat, 14 Nov 2020 15:38:38 +0000 (16:38 +0100)]
armv7m: replace flag 'stlink' with 'is_hla_target'

The HLA target is not anymore used by ST-Link only, but required
by Nu-Link and TI-ICDI too.

Rename the flag 'stlink' as 'is_hla_target'.

Change-Id: Id2ee2c0a1e8bf1f1e899f7a560140c34eefeeee5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6206
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agotarget/dsp563xx: Use bool data type for 'hardware_breakpoints_cleared' 24/6324/2
Marc Schink [Thu, 17 Jun 2021 13:50:47 +0000 (15:50 +0200)]
target/dsp563xx: Use bool data type for 'hardware_breakpoints_cleared'

Change-Id: Ic18973d3e90d74c211b48627bdaac4cf3357b682
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6324
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/dsp563xx: Handle return values 23/6323/3
Marc Schink [Thu, 17 Jun 2021 13:47:11 +0000 (15:47 +0200)]
target/dsp563xx: Handle return values

This fixes 'dead assignment' bugs identified by the clang static analyzer.

Change-Id: I140ed55f0043e06a533f45f50a36887614585b04
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6323
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/board: Add Renesas Falcon board 15/6315/3
Marek Vasut [Sat, 12 Jun 2021 18:19:30 +0000 (20:19 +0200)]
tcl/board: Add Renesas Falcon board

Add board configuration for Renesas Falcon board based on the R8A779A0 V3U SoC.

Change-Id: If8369f2e2b97dfea9ccbee2c9b916ef7094f9b92
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/6315
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/target: Add support for Renesas R8A779A0 V3U SoC 14/6314/3
Marek Vasut [Sun, 30 May 2021 15:34:10 +0000 (17:34 +0200)]
tcl/target: Add support for Renesas R8A779A0 V3U SoC

The V3U SoC is unique in that it now has 8x CA76 and CR52,
while the previous SoCs had CA57/CA53/CR7 . This can still
be handled without too complex modifications to the gen3
configuration file, so add the logic to handle it there.

Change-Id: I7ab33eacc1fd379d369988d3d6690d2e82346c7e
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/6314
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/target: Select default boot core on Renesas R-Car Gen2/Gen3 13/6313/3
Marek Vasut [Sat, 12 Jun 2021 18:48:51 +0000 (20:48 +0200)]
tcl/target: Select default boot core on Renesas R-Car Gen2/Gen3

On SMP Renesas R-Car Gen2/Gen3 systems, select the boot core as
the default target using the 'targets' command. This way, the
user can start debugging code running on the boot core without
having to switch to the boot core by explicitly invoking 'targets'
command first, since it is likely the debugged code will run on
the boot core. Note that most of the code is already in place, it
was just not used, so this is more of a fix to make the original
intention work.

Change-Id: I727808adce617c1d9ebd6ffa34f60f5882cdae60
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/6313
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/riscv: Implement get_gdb_arch() 22/6322/4
Jesse Sheridan [Wed, 16 Jun 2021 17:38:00 +0000 (10:38 -0700)]
target/riscv: Implement get_gdb_arch()

Change-Id: I5f4ab5243104df41031950682f688f2448a09b17
Signed-off-by: Jesse Sheridan <jesse.sheridan@gmail.com>
Reviewed-on: http://openocd.zylin.com/6322
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl: Add support for the Digilent Nexys Video board 64/4364/5
Rohit Singh [Fri, 19 Jan 2018 09:54:26 +0000 (20:54 +1100)]
tcl: Add support for the Digilent Nexys Video board

* https://store.digilentinc.com/nexys-video-artix-7-fpga-trainer-board-for-multimedia-applications/
* https://reference.digilentinc.com/_media/nexys-video:nexys_video_sch.pdf

The Nexys Video board has FTDI FT2232 whose channel B is connected to
Artix-7 FPGA's JTAG pins, and can be supported by OpenOCD's
ftdi interface. Tested to be working fine on real hardware.

Change-Id: I2996166dc8c2b6c08a9390958adfcdec8fc2bd37
Signed-off-by: Rohit Singh <rohit91.2008@gmail.com>
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/4364
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoDoc fix: echo writes to the log, and not to stdout 72/6272/3
R. Diez [Sun, 23 May 2021 10:18:36 +0000 (12:18 +0200)]
Doc fix: echo writes to the log, and not to stdout

Fixes bug #202

Change-Id: I855a1b8570af71379891634f405b4cc726917cb2
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: http://openocd.zylin.com/6272
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc/openocd: Fix typo 96/6296/5
Marc Schink [Sat, 5 Jun 2021 12:01:10 +0000 (14:01 +0200)]
doc/openocd: Fix typo

Change-Id: I8cf679190d6911de2dee181879c8895b55466835
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6296
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoUse boolean argument for register_get_by_name() 95/6295/2
Marc Schink [Fri, 4 Jun 2021 12:38:17 +0000 (14:38 +0200)]
Use boolean argument for register_get_by_name()

Change-Id: Ie913630c6ab3b600532d8e375e2fc11ca202cf5e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6295
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/register: Minor code cleanup 94/6294/2
Marc Schink [Fri, 4 Jun 2021 12:31:57 +0000 (14:31 +0200)]
target/register: Minor code cleanup

Change-Id: Ie02a112c0339ae5d3b3763483e493370b487be98
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6294
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/stm32fxx.c: do not read CPUID as this info is stored in cortex_m_common 40/6240/7
Tarek BOCHKATI [Thu, 13 May 2021 13:28:24 +0000 (14:28 +0100)]
flash/stm32fxx.c: do not read CPUID as this info is stored in cortex_m_common

In these drivers we read CPUID to check the Cortex-M PARTNO,
but now the PARTNO is stored in struct cortex_m_common.core_info.

Change-Id: I5bb3b95210ab6e23b8e1252686dd81015740bf68
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6240
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agocortex_m: enhance core and arch detection 33/6233/10
Tarek BOCHKATI [Tue, 11 May 2021 13:03:47 +0000 (14:03 +0100)]
cortex_m: enhance core and arch detection

Rework core detection by adding cortex_m_partno enum to detect all CPUs
using the same method.

Instead of checking the core PARTNO then assign the arch, use the stored
information within cortex_m parts[] with the flags inside which can help
simplifying a bit the cortex_m_examine code.

This change fixes:
 - the Cortex-M1 detection as ARMv6-M Core (was managed as ARMv7-M)
 - the displayed CPU name for Cortex-M0+ (was displayed Cortex-M0)

Change-Id: I40b6e03f7cf3664c85e297adfc25323196dfe90b
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6233
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/arm: optimize architecture flags 29/6229/7
Tarek BOCHKATI [Tue, 11 May 2021 08:28:00 +0000 (09:28 +0100)]
target/arm: optimize architecture flags

In target/arm.h the struct arm do contain 3 flags to retain architecture
version for some tweaks.
The proposal is to have only one enumerated flag 'arch' for the same purpose.

Change-Id: Ia5d5accfed8158ca21eb54af2fdea8e36f0266ae
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6229
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agocontrib/itmdump.c: fix implicit declaration warning 12/6312/3
Diego Herranz [Fri, 11 Jun 2021 07:58:04 +0000 (08:58 +0100)]
contrib/itmdump.c: fix implicit declaration warning

atoi used but stdlib.h wasn't included.
Also, include statements reordered alphabetically.

Change-Id: I7fcdbf3fa940a172204ec811399e1a7fdebdc979
Signed-off-by: Diego Herranz <diegoherranz@diegoherranz.com>
Reviewed-on: http://openocd.zylin.com/6312
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget: Rename 'linked_BRP' to 'linked_brp' 16/6316/2
Marc Schink [Sun, 13 Jun 2021 08:49:17 +0000 (10:49 +0200)]
target: Rename 'linked_BRP' to 'linked_brp'

Change-Id: I9dd67ac3e8cd5dd9cdeffce56020b387a8f298fa
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6316
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoarmv4_5: do not read/write non-existent registers 64/6064/3
Tarek BOCHKATI [Sun, 14 Feb 2021 12:22:03 +0000 (13:22 +0100)]
armv4_5: do not read/write non-existent registers

Change-Id: I4a0c401a325e57ba5d4d93d83b7e6b71a4d0865e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6064
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoarm_dpm: do not read/write non-existent registers 63/6063/4
Tarek BOCHKATI [Sun, 14 Feb 2021 12:21:36 +0000 (13:21 +0100)]
arm_dpm: do not read/write non-existent registers

Change-Id: I6a991899bb178ee0c6b41870a45d0a9439d9dc1e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6063
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agoarmv8_dpm: do not read/write non-existent registers 62/6062/3
Tarek BOCHKATI [Sun, 14 Feb 2021 11:39:33 +0000 (12:39 +0100)]
armv8_dpm: do not read/write non-existent registers

Change-Id: I0f3fffa8cf1746569f6acce0233e9544d3862f51
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6062
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor: improved API of flash_driver.info & fixed buffer overruns 82/6182/7
Jan Matyas [Fri, 23 Apr 2021 08:47:17 +0000 (10:47 +0200)]
flash/nor: improved API of flash_driver.info & fixed buffer overruns

1) The API of "info" callback in "struct flash_driver" has been
improved. Fixed buffers for strings

2) Removed the calls to snprintf() from the flash_driver.info
implementations. Many of them were used in an unsafe manner
(buffer overruns were possible).

Change-Id: I42ab8a8018d01f9af43c5ba49f650c3cb5d31dcb
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6182
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoAdd remote bitbang write buffer. 83/6283/5
Tim Newsome [Fri, 28 May 2021 20:38:50 +0000 (13:38 -0700)]
Add remote bitbang write buffer.

Change 7dd323b26 reduced remote bitbang performance a lot. This change
gets most of that performance back again, by reintroducing a write
buffer.

Performance numbers collected using DebugBreakpoint test from
riscv-tests/debug against a single 64-bit spike (RISC-V simulator)
instance. (Ubuntu 20.04.2, AMD Ryzen 5 3600)
Before Windows support was added: 3.09s
After Windows support was added: 12.67s
After this change: 4.69s

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I72ff4912cbbf316a30ef065e5b8f461a555f06cc
Reviewed-on: http://openocd.zylin.com/6283
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/cortex_a: Use bool data type 89/6289/3
Marc Schink [Thu, 3 Jun 2021 21:11:18 +0000 (23:11 +0200)]
target/cortex_a: Use bool data type

Change-Id: Ieea3dc05809263aa0eba5125d52fef3fe77e9c5a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6289
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/startup.tcl: Do not use 'Yoda conditions' 84/6284/4
Marc Schink [Sat, 29 May 2021 10:09:28 +0000 (12:09 +0200)]
target/startup.tcl: Do not use 'Yoda conditions'

Change-Id: I5e1bbaf032659dda1b365ef4ec6ea4a635d921ce
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6284
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoAvoid non-standard conditionals with omitted operands. 71/6271/3
R. Diez [Sun, 23 May 2021 10:01:48 +0000 (12:01 +0200)]
Avoid non-standard conditionals with omitted operands.

Fixes bug #257.

Change-Id: I05fc6468306d46399e769098e031e7e588798afc
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: http://openocd.zylin.com/6271
Tested-by: jenkins
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoAdd target_data_bits(). 49/6249/4
Tim Newsome [Thu, 13 May 2021 23:38:51 +0000 (16:38 -0700)]
Add target_data_bits().

This is used to compute memory block read alignment, and specifically
allows 64-bit targets to ensure that memory block reads are only
requested on 64-bit boundaries.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: Idb1a27b9fc02c46245556bb0f3d6d94b368c4817
Reviewed-on: http://openocd.zylin.com/6249
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agocmsis_dap: add support for swo commands 20/5820/19
Adrian Negreanu [Wed, 19 May 2021 10:33:30 +0000 (13:33 +0300)]
cmsis_dap: add support for swo commands

Replaced mixed snake_case_CamelCase with snake_case.
Define variables at first-use location.

CMSIS-DAP SWO specification:

    https://arm-software.github.io/CMSIS_5/DAP/html/group__DAP__swo__gr.html

Change-Id: Ieba79b16efd445143f964b614673d041aae74f92
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/5820
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget: Use 'bool' for 'reset_halt' 62/6262/3
Marc Schink [Mon, 17 May 2021 10:53:16 +0000 (12:53 +0200)]
target: Use 'bool' for 'reset_halt'

Change-Id: I974a6360ea7467067511541ac212f2e9d3de7895
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6262
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/jlink: Remove trailing dots 74/6274/2
Marc Schink [Tue, 3 Nov 2020 13:09:37 +0000 (14:09 +0100)]
drivers/jlink: Remove trailing dots

This makes the messages consistent with most of the rest of
the OpenOCD output.

Change-Id: I915a01187e7fc317e02483ac0bbd39ec077d6321
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6274
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/renesas_rz_g2: Introduce tcl config file for RZ/G2 devices 50/6250/10
micbis [Mon, 10 May 2021 08:24:49 +0000 (10:24 +0200)]
target/renesas_rz_g2: Introduce tcl config file for RZ/G2 devices

Initial support for Renesas RZ/G2 MPU family

Change-Id: I5ca74cddfd0c105a5307de56c3ade7084f9c28d2
Signed-off-by: micbis <michele.bisogno.ct@renesas.com>
Reviewed-on: http://openocd.zylin.com/6250
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agogdb_server: Log both incoming and outgoing GDB packets 69/6269/4
Jan Matyas [Fri, 21 May 2021 06:02:29 +0000 (08:02 +0200)]
gdb_server: Log both incoming and outgoing GDB packets

- Made sure that also outgoing GDB packets are logged,
  not only the incoming ones.

- Improved the treatment of non-printable characters
  in the packets to make it more robust.

Prior to this change:

- Outgoing packets were not printed unless OpenOCD was
  re-compiled with _DEBUG_GDB_IO_.
- Non-prinable characters were only treated in incoming
  'X' packets.

After this change:

- Both incoming and outgoing GDB packets are logged
  on debug_level >= 3, so that both directions of the
  GDB channel are visible.
- Non-printable characters are checked for in every packet
  so that hey do not interfere with the terminal.

Change-Id: I0613e57ae5059b3279b0abcb71276cf5719a8699
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6269
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoMakefile: add special target .DELETE_ON_ERROR 35/6235/5
R. Diez [Thu, 13 May 2021 10:36:27 +0000 (12:36 +0200)]
Makefile: add special target .DELETE_ON_ERROR

The special .DELETE_ON_ERROR deletes the target file on recipe error.
Otherwise, an incomplete output file may be considered up to date
the next time around. .DELETE_ON_ERROR provides reasonable
protection at virtually no cost.

Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Change-Id: I67dca47ae5ddf3786993c87b9991b3046a85f00b
Reviewed-on: http://openocd.zylin.com/6235
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/target/stm32f4x: fix hardcoded chip name 77/6277/2
Tarek BOCHKATI [Wed, 26 May 2021 15:10:39 +0000 (16:10 +0100)]
tcl/target/stm32f4x: fix hardcoded chip name

Fixes: c945d6e61605 ("tcl/target: start using the new TPIU/SWO support")
Change-Id: I4543c9a204f7b4b3b14e6eabc5042653106aff0e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6277
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agohelper/list.h: add mention to the example in contrib 81/6281/3
Antonio Borneo [Thu, 27 May 2021 12:21:13 +0000 (14:21 +0200)]
helper/list.h: add mention to the example in contrib

Without such reference, it could be difficult to find the example.

Change-Id: Ia9ffb06bc1a45446c2c7b53197ab3400e1d8a9e9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6281
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
2 years agocontrib: add an example of using list.h 80/6280/2
Andreas Fritiofson [Thu, 27 May 2021 07:45:28 +0000 (09:45 +0200)]
contrib: add an example of using list.h

Change-Id: Ic3d399d7ad2e4d10677cf78d64968040941b74e5
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6280
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
2 years agohelper/list.h: align file to Linux v5.12 76/6276/3
Antonio Borneo [Wed, 26 May 2021 12:48:10 +0000 (14:48 +0200)]
helper/list.h: align file to Linux v5.12

Main improvement is in the doxygen comments.
Minimize the delta with kernel file.
Skip the functions hlist_unhashed_lockless() and
__list_del_clearprev() that are relevant only in kernel.
Remove gcc extension "omitted conditional operand".

Change-Id: I2e9ddb54cfe2fa5f7cf18f44726acd144e1f98b9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6276
Reviewed-by: <rdiezmail-openocd@yahoo.de>
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2 years agoserver/telnet: fix autocomplete for jimtcl commands 82/6282/2
Antonio Borneo [Thu, 27 May 2021 13:25:43 +0000 (15:25 +0200)]
server/telnet: fix autocomplete for jimtcl commands

Current autocomplete filters-out some command reported by "info
commands". One of the filter rule concerns the command's private
data.
Every command registered by OpenOCD has its 'struct command' as
private data.

By ignoring commands without private data, we loose several TCL
commands registered by jimtcl, e.g. 'foreach', 'llength'.

By assuming that every command with non-NULL private data has
'struct command' as private data, we risk at best to access
inconsistent data, at worst to trigger a segmentation fault.

Export the already available functions:
- to check if a command has been registered by OpenOCD and
- to get the private data.
While there, rename jimcmd_is_ocd_command() as
jimcmd_is_oocd_command().
Don't filter-out jimtcl commands with no private data.
Check the private data only on OpenOCD commands.

Change-Id: Ib5bf8d2bc5c12440c0cfae438f637c38724a79b7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6282
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agohelper/jim-nvp: comply with coding style [2/2] 84/6184/4
Antonio Borneo [Sat, 24 Apr 2021 22:48:14 +0000 (00:48 +0200)]
helper/jim-nvp: comply with coding style [2/2]

With the API fixed to comply with OpenOCD coding style, fix all
the references in the code.

Patch generated automatically with the script below.
The list is in reverse order to replace a common prefix after the
replacement of the symbols with the same prefix.

%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---
(cat << EOF
Jim_SetResult_NvpUnknown         jim_set_result_nvp_unknown
Jim_Nvp_value2name_simple        jim_nvp_value2name_simple
Jim_Nvp_value2name_obj           jim_nvp_value2name_obj
Jim_Nvp_value2name               jim_nvp_value2name
Jim_Nvp_name2value_simple        jim_nvp_name2value_simple
Jim_Nvp_name2value_obj_nocase    jim_nvp_name2value_obj_nocase
Jim_Nvp_name2value_obj           jim_nvp_name2value_obj
Jim_Nvp_name2value_nocase_simple jim_nvp_name2value_nocase_simple
Jim_Nvp_name2value_nocase        jim_nvp_name2value_nocase
Jim_Nvp_name2value               jim_nvp_name2value
Jim_Nvp                        struct jim_nvp
Jim_GetOpt_Wide                  jim_getopt_wide
Jim_GetOpt_String                jim_getopt_string
Jim_GetOpt_Setup                 jim_getopt_setup
Jim_GetOpt_Obj                   jim_getopt_obj
Jim_GetOpt_NvpUnknown            jim_getopt_nvp_unknown
Jim_GetOpt_Nvp                   jim_getopt_nvp
Jim_GetOpt_Enum                  jim_getopt_enum
Jim_GetOpt_Double                jim_getopt_double
Jim_GetOpt_Debug                 jim_getopt_debug
Jim_GetOptInfo                 struct jim_getopt_info
Jim_GetNvp                       jim_get_nvp
Jim_Debug_ArgvString             jim_debug_argv_string
EOF
) | while read a b; do
    sed -i "s/$a/$b/g" $(find src -type f ! -name jim-nvp.\? )
done
%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---

Change-Id: I10a12bd64bb8b17575fd9150482c989c92b298a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6184
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
2 years agohelper/jim-nvp: comply with coding style [1/2] 83/6183/5
Antonio Borneo [Sat, 24 Apr 2021 22:06:00 +0000 (00:06 +0200)]
helper/jim-nvp: comply with coding style [1/2]

The helper jim-nvp does not comply with OpenOCD coding style due
to typedef of struct and CamelCase symbol names.
While it's trivial fixing the helper and all its current use in
the code, changing these APIs will potentially break a number of
patches pending in gerrit. Gerrit will not trigger any alert, but
the code will generate compile error after the merge.

Add the compile flag "-Wno-error=deprecated-declarations" to keep
as warning (not as error) the use of "deprecated" functions and
types.
Rename all the CamelCase symbols is lowercase and provide struct
prototypes in place of the typedef.
Add a DEPRECATED section to 'jim-nvp.h' where the old CamelCase
symbols and the old typedef are re-declared with compile attribute
'deprecated'.

With this change OpenOCD compiles, but generates warnings.
The remaining changes allover OpenOCD code will be fixed in a
separate patch for easier review.

The patches merged later that still use the old deprecated API
will compile with warnings. This will permit to identify and fix
these cases.

Change-Id: I786385d0f662dbb1be5be313ae42623156d68ce5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6183
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
2 years agotarget/cortex_a: fix memory leak on watchpoints 10/6210/3
Antonio Borneo [Fri, 7 May 2021 14:17:32 +0000 (16:17 +0200)]
target/cortex_a: fix memory leak on watchpoints

The memory allocated to hold the watchpoints is not freed at
OpenOCD exit.

Free the watchpoint memory at OpenOCD exit.

Change-Id: I518c9ce0dc901cde2913d752e3154734f878b854
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6210
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2 years agotarget/cortex_a: add support for watchpoint length of 1, 2 and 4 bytes 97/6197/3
Antonio Borneo [Thu, 29 Apr 2021 08:49:50 +0000 (10:49 +0200)]
target/cortex_a: add support for watchpoint length of 1, 2 and 4 bytes

Use byte address select for 1 and 2 bytes length.
Use normal mode for 4 bytes length.

Change-Id: I28d182f25145d0635de64d0361d456f1ad96640e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6197
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2 years agotarget/cortex_a: fix number of watchpoints 96/6196/3
Antonio Borneo [Thu, 29 Apr 2021 07:22:00 +0000 (09:22 +0200)]
target/cortex_a: fix number of watchpoints

Decrement the available watchpoints only when succeed setting it.
Initialize the available watchpoint with the correct value.

Change-Id: I0f93b347300b8ebedbcd9e718d4ba32b26cf6846
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6196
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2 years agotarget/cortex_a: add support for watchpoints 13/3913/7
Chengyu Zheng [Wed, 14 Dec 2016 11:18:10 +0000 (12:18 +0100)]
target/cortex_a: add support for watchpoints

The current implementation of OpenOCD does not support watchpoints for
cortex_a architecture. So, I replaced the add_watchpoint and
remove_watchpoint with the specific implementation for the
cortex a and using the breakpoint implementation and the arm
documentation [1] as reference. In particular, I have made the
following changes:

* added the following functions

- cortex_a_add_watchpoint
  This wrapper function check whether there are any watchpoint
  available on the target device by calling cortex_a_set_watchpoint.

- cortex_a_set_watchpoint
  This function is responsible for settings the watchpoint register
  pair. In particular, it sets the WVR and the WCR registers with
  the cortex_a_dap command.

- cortex_a_remove_watchpoint
  This wrapper function the selected watchpoint on the target device
  by calling cortex_a_unset_watchpoint.

- cortex_a_unset_watchpoint
  This function sets both the WVR and the WCR registers to zero, thus
  unsetting the watchpoint.

[1]
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464f/BCGDHIEJ.html

Change-Id: I86611dab474cb84836662af572b17636dc68e282
Signed-off-by: Chengyu Zheng <chengyu.zheng@polimi.it>
Reviewed-on: http://openocd.zylin.com/3913
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
2 years agotarget/arm_adi_v5: Fix clear sticky overrun flag during replay of commands 78/6278/7
micbis [Wed, 26 May 2021 17:11:05 +0000 (19:11 +0200)]
target/arm_adi_v5: Fix clear sticky overrun flag during replay of commands

When a WAIT occurs the commands after the WAIT are replayed and the
STICKYORUN is cleared. However if another WAIT occurs during the
command replay, the command itself is resent but the STICKYORUN bit
shall also be cleared. If this is not done, the MEM-AP hangs.

Change-Id: I14e8340cd5d8f58f4de31509da96cfa2ecb630d1
Signed-off-by: micbis <michele.bisogno.ct@renesas.com>
Reviewed-on: http://openocd.zylin.com/6278
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)