openocd.git
19 months agoflash: nor: use binary prefixes consistently 16/6416/3
Paul Fertser [Sat, 7 Aug 2021 18:55:30 +0000 (21:55 +0300)]
flash: nor: use binary prefixes consistently

When printing memory sizes standard ISO 80000-1 prefixes should be used.
Also a space should be added between any number and its unit according
to papers publication rules.

Change-Id: Id1d35e210766b55c201de4e80ac165d8d0414d0a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6416
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: fix clang analyzer warnings and gcc12 build errors 37/7137/2
Erhan Kurubas [Sat, 20 Aug 2022 20:22:47 +0000 (23:22 +0300)]
target/xtensa: fix clang analyzer warnings and gcc12 build errors

Fix Unused code Dead assignment at line 657
Fix Memory error Double free at line 2851
Fix Memory error Memory leak at line 2530
Fix error: 'a3' may be used uninitialized at line 758
Fix error: '%04x' directive writing between 4 and 8 bytes
into a region of size 5 at line 2471

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I0382a622bc7c4108a335fd741816577e79240397
Reviewed-on: https://review.openocd.org/c/openocd/+/7137
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoGeneric Xtensa target config files 83/7083/3
Ian Thompson [Mon, 11 Jul 2022 00:35:50 +0000 (17:35 -0700)]
Generic Xtensa target config files

- Add new Xtensa TCL board files
- Add new Xtensa KC705 on-board FTDI interface
- Add new generic Xtensa and VDebug Xtensa target files

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I4acb15c83d1b7b8e6063833ce829530cb22a795e
Reviewed-on: https://review.openocd.org/c/openocd/+/7083
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget: add generic Xtensa LX support 55/7055/18
Ian Thompson [Sat, 25 Jun 2022 05:27:32 +0000 (22:27 -0700)]
target: add generic Xtensa LX support

Generic Xtensa LX support extends the original Espressif/Xtensa
patch-set to support arbitrary Xtensa configurations, as defined in
a core-specific .cfg file.  Not yet fully-featured.  Additional
functionality to be added:
- Xtensa NX support
- DAP/SWD support
- File-IO support
- Generic Xtensa multi-core support

Valgrind-clean, no new Clang analyzer warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I08e7bf8fa57c25b5d0cb75a1aa7a2ac13a380c52
Reviewed-on: https://review.openocd.org/c/openocd/+/7055
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotcl/interface: add linuxgpiod cfg for Aspeed AST2600 12/7112/4
Jae Hyun Yoo [Thu, 20 Jan 2022 20:07:58 +0000 (12:07 -0800)]
tcl/interface: add linuxgpiod cfg for Aspeed AST2600

Add linuxgpiod cfg for Aspeed AST2600 for a case if JTAG master needs
to be implemented using linuxgpiod intead of hardware JTAG master mode.

These AST2600 GPIOs will be mapped to JTAG/SWD signals.
+-----------+-------------+-------------+
| signal    | GPIO name   | gpio offset |
+-----------+-------------+-------------+
| TCK/SWCLK | GPIOI2      | 66          |
| TMS/SWDIO | GPIOI3      | 67          |
| TDI       | GPIOI1      | 65          |
| TDO       | GPIOI4      | 68          |
| nTRST     | GPIOI0      | 64          |
+-----------+-------------+-------------+

Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Change-Id: I19278402b0895be12d38c0ecea8fdbc56fd491b8
Reviewed-on: https://review.openocd.org/c/openocd/+/7112
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
19 months agotcl/fpga: add Lattice MachXO3 family support 13/7113/5
Jae Hyun Yoo [Thu, 20 Jan 2022 20:31:18 +0000 (12:31 -0800)]
tcl/fpga: add Lattice MachXO3 family support

Add support for Lattice MachXO3 FPGA family.

Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Change-Id: I01fcec0ee458e809246e4505019d15047655dd47
Reviewed-on: https://review.openocd.org/c/openocd/+/7113
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoserver/gdb_server: Add support for default thread, use by IDA debugger 17/7017/9
MadSquirrel [Sat, 4 Jun 2022 20:01:11 +0000 (22:01 +0200)]
server/gdb_server: Add support for default thread, use by IDA debugger

Signed-off-by: Benoit Forgette <benoit.forgette@ci-yow.com>
Change-Id: Ia3a29a3377be650f0ccad11a0ae4fe4da78b3ab4
Reviewed-on: https://review.openocd.org/c/openocd/+/7017
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/semihosting: drop type casting from semihosting->result 11/7111/3
Erhan Kurubas [Wed, 10 Aug 2022 23:32:25 +0000 (01:32 +0200)]
target/semihosting: drop type casting from semihosting->result

Also used type helper (PRId64) to specify format of int64_t

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I594863eab594aff621c26fefcc69a1872e9730ee
Reviewed-on: https://review.openocd.org/c/openocd/+/7111
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/espressif: remove author lines from esp32xx and xtensa files 04/7104/4
Erhan Kurubas [Mon, 1 Aug 2022 23:15:12 +0000 (01:15 +0200)]
target/espressif: remove author lines from esp32xx and xtensa files

Some files have author info some doesn't. For the consistency we removed all.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie6f1ec012302e3a954c75c5106f12820722cb715
Reviewed-on: https://review.openocd.org/c/openocd/+/7104
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/linuxgpiod: Migrate to adapter gpio commands 48/7048/9
Steve Marple [Tue, 21 Jun 2022 22:06:25 +0000 (23:06 +0100)]
drivers/linuxgpiod: Migrate to adapter gpio commands

Use the new "adapter gpio" commands to configure the GPIOs used by the
linuxgpiod driver.

Adds support for drive mode and resistor pull options on all signals.

Change-Id: Ic90cb4f06db82435294228b6793330107a9f3606
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7048
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/am335xgpio: Release resources on error and when quitting 47/7047/8
Steve Marple [Wed, 22 Jun 2022 14:43:51 +0000 (15:43 +0100)]
drivers/am335xgpio: Release resources on error and when quitting

The /dev/mem file descriptor can be closed without invalidating the
mappings so close as soon as possible.

munmap() all memory, either on error or from quit.

Change-Id: I9466edd2f43791e64f2dce719957c67728f3ec06
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7047
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/am335xgpio: Migrate to adapter gpio commands 84/6984/16
Steve Marple [Tue, 17 May 2022 20:51:17 +0000 (21:51 +0100)]
drivers/am335xgpio: Migrate to adapter gpio commands

Use the new "adapter gpio" commands to configure the GPIOs used by the
am335xgpio driver. The AM335x has 4 GPIO 'chips' (chip number 0-3
inclusive), with each one providing 32 GPIOs (gpio_num 0-31 inclusive).

Change-Id: I7c63c0e4763657ea51790c43fc40d32b7c3580bb
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6984
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agojtag/adapter: Add command 'adapter gpio' 67/6967/21
Steve Marple [Wed, 4 May 2022 21:51:48 +0000 (22:51 +0100)]
jtag/adapter: Add command 'adapter gpio'

Most adapters define their own commands to obtain the GPIO number and
other GPIO configuration information such as chip number, output drive
type, active high/low.

Define a general command 'adapter gpio' as replacement for the
driver-specific ones.

Change-Id: I1ca9ca94f0c7df5713172e9f62ffb0ad64e9ee97
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6967
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/cortex_m: supress historical reset detection 09/7109/4
Tomas Vanek [Tue, 2 Aug 2022 09:44:43 +0000 (11:44 +0200)]
target/cortex_m: supress historical reset detection

The S_RESET_ST sticky bit is reset after DHCSR read.
It is set at power-on reset and keeps active until the debuger reads DHCSR.

Ignore S_RESET_ST at the very first read after OpenOCD start
and suppress possibly misleading message "external reset detected"
if we cannot guarantee the reset happened recently.

While on it add a TODO comment.

Change-Id: I15217c2ca6f69ac97aff8be86bce67cba94a42cd
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7109
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoloaders/reset/espressif: replace the GPL-2.0-or-later license tag 05/7105/4
Erhan Kurubas [Mon, 1 Aug 2022 23:38:09 +0000 (01:38 +0200)]
loaders/reset/espressif: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Iddccae2bd8906a3587a2aa2684124356a340fc74
Reviewed-on: https://review.openocd.org/c/openocd/+/7105
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agogdb_server: custom target-specific GDB queries 82/7082/4
Ian Thompson [Mon, 11 Jul 2022 00:14:10 +0000 (17:14 -0700)]
gdb_server: custom target-specific GDB queries

Provide a customizable hook for handling target-specific GDB queries

Valgrind-clean, no new Clang analyzer warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I684a259ed29f3651cbce668101cff421e522f79e
Reviewed-on: https://review.openocd.org/c/openocd/+/7082
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agogdb_server: support sparse register maps 03/7103/3
Ian Thompson [Mon, 1 Aug 2022 22:47:52 +0000 (15:47 -0700)]
gdb_server: support sparse register maps

Add additional error handling for targets where gaps may exist in reg_list[]

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I65232429e2de08f5d54eeca53aea0db8ce2b58af
Reviewed-on: https://review.openocd.org/c/openocd/+/7103
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoopenocd: prevent target polling during 'init' 07/7007/4
Antonio Borneo [Mon, 30 May 2022 13:32:24 +0000 (15:32 +0200)]
openocd: prevent target polling during 'init'

The command 'init' causes the execution of few lower level
commands, e.g. 'target init', and switches from command mode
COMMAND_CONFIG to COMMAND_EXEC, with an intermediate switch back
to mode COMMAND_CONFIG.

A timed target polling can occur during the execution of 'init'
and the target's status can trigger the execution of some events.
E.g. if a target has been left halted by a previous execution of
OpenOCD, the first poll will find the target halted, calling the
corresponding 'halted' event.
The event handler can use commands that can only be executed in
mode COMMAND_EXEC. If the poll happens while OpenOCD is in mode
COMMAND_CONFIG, the triggered handler will fail.

Prevent the target polling to operate during the execution of the
'init' command.

Change-Id: Ia435a5d2039be9b247e2336616dab53ed5d983ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7007
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
20 months agotarget: add API to temporarily mask target polling 09/7009/3
Antonio Borneo [Mon, 30 May 2022 20:49:12 +0000 (22:49 +0200)]
target: add API to temporarily mask target polling

The same flag 'jtag_poll' is currently used as local data for the
command 'poll' and to temporarily mask the target polling.
This can cause unexpected behavior if the command 'poll' is
executed while polling is temporarily masked.

Add a new flag 'jtag_poll_en' to hold the temporarily mask
condition and keep 'jtag_poll' for the 'poll' command only.

While there, change the initial assignment of 'jtag_poll' using
the proper boolean value.

Change-Id: I18dcf7c65b07aefadf046caaa2fcd2d74fa6fbae
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7009
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
20 months agogdb_server: add "not supported" Z-packet reply 02/7102/5
Ian Thompson [Mon, 1 Aug 2022 22:22:32 +0000 (15:22 -0700)]
gdb_server: add "not supported" Z-packet reply

GDB remote serial protocol specifies breakpoint/watchpoint packet
responses can be an empty string to indicate the specified breakpoint
type is not supported.  Add support for this response alongside existing
"OK", "E NN" replies.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: Iaf6280e4c936eb95a92bc80cc74d451ebb328dc3
Reviewed-on: https://review.openocd.org/c/openocd/+/7102
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoadapter: run at default speed when clock speed not specified 04/7004/6
Erhan Kurubas [Thu, 26 May 2022 20:43:41 +0000 (22:43 +0200)]
adapter: run at default speed when clock speed not specified

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I8d2db4a1f618790907265a45d28a212551800b6c
Reviewed-on: https://review.openocd.org/c/openocd/+/7004
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
20 months agortos: Support for "none" rtos 92/7092/3
Asier Llano [Thu, 21 Jul 2022 10:27:11 +0000 (12:27 +0200)]
rtos: Support for "none" rtos

After a certain RTOS has been configured there is no mechanism
to go back to no RTOS support. It may be useful for debugging
purposes. With the provided modification, the "none" option
of RTOS is provided as a valid option.

It has been tested in two different board (Cortex M4 and Cortex M33).
Documentation has also been updated.

Signed-off-by: Asier Llano <allano@hubbell.com>
Change-Id: I602210bff31ccadd41c41e9454c52b5fffa1671e
Reviewed-on: https://review.openocd.org/c/openocd/+/7092
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/riscv: Update debug_defines.h. 87/7087/4
Tim Newsome [Mon, 18 Jul 2022 16:20:22 +0000 (09:20 -0700)]
target/riscv: Update debug_defines.h.

This one doesn't have the license in there, which means now it's
acceptable to GPLv2 again.

See https://github.com/riscv/riscv-openocd/pull/711

Change-Id: I8ba27801172ffa955470d2627fa656cad282ee99
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7087
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/arm: do not expose 'arm reg', 'arm mcr/mrc' commands on Cortex-M 01/7101/2
Tomas Vanek [Mon, 1 Aug 2022 17:28:18 +0000 (19:28 +0200)]
target/arm: do not expose 'arm reg', 'arm mcr/mrc' commands on Cortex-M

Tcl commands 'arm reg', 'arm mcr/mrc' do not work on M-profile based devices.
Isolate them from 'arm core_state' and 'arm disassemble' and do not chain
them from armv7m_command_handlers.

Change-Id: I2c6befdf82575e95cf05ed158ab5e6faa1a182c3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7101
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
20 months agotarget/arm: make 'arm core_state' command compatible with Cortex-M 00/7100/3
Tomas Vanek [Mon, 1 Aug 2022 17:06:35 +0000 (19:06 +0200)]
target/arm: make 'arm core_state' command compatible with Cortex-M

Tcl command 'arm core_state' was exposed even on Cortex-M devices.
However it returned message "Unsupported Command" without error status
on such device.

Set the only possible arm->core_state ARM_STATE_THUMB in armv7m init.
Block setting core_state to arm on Cortex-M.

Change-Id: I9525553ac8863a6cf77bbacbcd57e354b6cfe1ca
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7100
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
20 months agotarget/cortex_m: prevent segmentation fault in cortex_m_poll() 08/7108/3
Tomas Vanek [Tue, 2 Aug 2022 09:33:07 +0000 (11:33 +0200)]
target/cortex_m: prevent segmentation fault in cortex_m_poll()

If a Cortex-M MCU become unresponsive during a debug session and
re-examination fails to find MEM-AP, debug_ap pointer is set to NULL.

Eventual call of cortex_m_poll() dereferences debug_ap.

Check debug_ap validity at the begin of cortex_m_poll().

Change-Id: I9519f48760c91a48a9e5e8c34634d247098cb14a
Fixes: 35a503b08d14 (arm_adi_v5: add ap refcount and add get/put around ap use)
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7108
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget: move parent target structs just after common_magic 03/7003/2
Tomas Vanek [Thu, 26 May 2022 14:25:34 +0000 (16:25 +0200)]
target: move parent target structs just after common_magic

Just a cosmetic refactoring.

Change-Id: I7fbc05324e346fafc98d1b42691d33d3d8fbd04e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7003
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
20 months agotarget/aarch64: fix duplicate common magic 97/6997/2
Tomas Vanek [Thu, 26 May 2022 08:18:43 +0000 (10:18 +0200)]
target/aarch64: fix duplicate common magic

AARCH64_COMMON_MAGIC was same as CORTEX_A_COMMON_MAGIC, probably copy pasta.
Define unique AARCH64_COMMON_MAGIC

Change-Id: Ie30e0028453a1fce5624ecad9bf73d5ac3791281
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6997
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget: consolidate existing target/algo common_magic 96/6996/3
Tomas Vanek [Thu, 26 May 2022 08:01:45 +0000 (10:01 +0200)]
target: consolidate existing target/algo common_magic

Unify common_magic type to unsigned int
Move common_magic to be the first member of the struct
Add unsigned specifier to xxx_COMMON_MAGIC #defines

Change-Id: If961d33232698529514ba3720e04418baf6dc6fe
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6996
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoflash/nor: remove useless setting of bus_width and chip_width 98/7098/3
Tomas Vanek [Sun, 31 Jul 2022 06:01:23 +0000 (08:01 +0200)]
flash/nor: remove useless setting of bus_width and chip_width

The flash/nor subsystem uses bus_width and chip_width for CFI
external flash only. Drop setting these values for internal flash.

Change-Id: I64e79ab38b6e39e845ff96fbf4f60145e3b9690a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7098
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget: fix unaligned return of target_get_working_area_avail() 96/7096/2
Tomas Vanek [Sat, 30 Jul 2022 10:15:43 +0000 (12:15 +0200)]
target: fix unaligned return of target_get_working_area_avail()

The working area allocation routines use 4 byte word alignment.
In the corner case the size of the working area is not aligned,
target_alloc_working_area() of size = target_get_working_area_avail()
will fail because the size gets aligned up and does not fit to the area
which size is aligned down.

Align down the result of target_get_working_area_avail() to cope with that
corner case.

While on it use fancy ALIGN_... macros instead of bitwise and operator.

Change-Id: Ia2a1e861c401c2c78fe6323379a3776fb4f47b06
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7096
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agofix Kinetis 100 MHz rev 1.x programming 15/7015/3
Martin Hierholzer [Fri, 27 May 2022 13:22:25 +0000 (15:22 +0200)]
fix Kinetis 100 MHz rev 1.x programming

Kinetis 100 MHz rev 1.x devices have no SMC and hence need different
checking of the run mode. Details about the differences between rev 1.x
and 2.x of the Kinetis 100 MHz series can be found here:
https://www.nxp.com.cn/docs/en/application-note/AN4445.pdf

Signed-off-by: Martin Hierholzer <martin.hierholzer@desy.de>
Change-Id: Ib705385a931275159bdae9b31caecc6ec9c0da1e
Reviewed-on: https://review.openocd.org/c/openocd/+/7015
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
20 months agoFreeRTOS: Always show current execution before scheduler is started 35/6935/2
Frank Dischner [Mon, 18 Apr 2022 02:24:28 +0000 (21:24 -0500)]
FreeRTOS: Always show current execution before scheduler is started

Previously, if the target was halted before the FreeRTOS scheduler was
started but after at least one thread was created, then the current thread
would be set to whichever thread had the highest priority. In addition to
being misleading, because that thread is not actually running, it can
cause issues with gdb. For instance, breaking somewhere before the first
thread is created will show the current execution as the current thread,
but stepping over a line that creates a thread will cause the current
thread to switch to the newly created thread and the current execution to
disappear. The sudden disappearance of the current execution thread seems
to confuse some versions of gdb.

With this change, the value of xSchedulerRunning is checked to determine
whether the scheduler has been started. If it hasn't, then a fake
'current execution' thread is always created and made the current thread.

Signed-off-by: Frank Dischner <frank.dischner@gmail.com>
Change-Id: Ide0fe7d9ffb9fac95cee4c805735f434c7c4934d
Reviewed-on: https://review.openocd.org/c/openocd/+/6935
Tested-by: jenkins
Reviewed-by: Asier Llano <asierllano@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
20 months agoFreeRTOS: Fix current thread ID when no threads are active 34/6934/2
Frank Dischner [Mon, 18 Apr 2022 02:12:39 +0000 (21:12 -0500)]
FreeRTOS: Fix current thread ID when no threads are active

When there are no rtos threads or none are active, a fake thread with
ID 1 is created for the current execution, but the current thread ID was
never set to this new fake ID. This would lead to an incorrect attempt to
read stacked registers for this fake thread. Explicitly setting the
current thread ID to the fake ID ensures that the registers are read from
the core instead of calling freertos_get_thread_reg_list.

Signed-off-by: Frank Dischner <frank.dischner@gmail.com>
Change-Id: I694509a0e01df089429b20ff1b879fc0592b532d
Reviewed-on: https://review.openocd.org/c/openocd/+/6934
Tested-by: jenkins
Reviewed-by: Asier Llano <asierllano@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
20 months agotarget/cortex_a: remove unused CORTEX_A15_COMMON_MAGIC 99/7099/3
Tomas Vanek [Mon, 1 Aug 2022 09:05:47 +0000 (11:05 +0200)]
target/cortex_a: remove unused CORTEX_A15_COMMON_MAGIC

Change-Id: I7dddc6cb7b0ee8aec7164998f1124b522e899f3d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reported-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7099
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoflash/nor/fespi: check target type 01/7001/2
Tomas Vanek [Thu, 26 May 2022 11:51:18 +0000 (13:51 +0200)]
flash/nor/fespi: check target type

Change-Id: I09d3ed20966b37ec63c09c2ffb0e0403986cb1e5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7001
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
20 months agotarget/riscv: add common magic 99/6999/2
Tomas Vanek [Thu, 26 May 2022 09:33:27 +0000 (11:33 +0200)]
target/riscv: add common magic

Add common_magic member to struct riscv_info.
Introduce is_riscv() helper.

Change-Id: I1af05988ad869342ba5dc6d4d0ba0ec6a8bf7bc7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6999
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
20 months agotarget/riscv: use struct riscv_info instead of typedef riscv_info_t 98/6998/2
Tomas Vanek [Thu, 26 May 2022 11:08:48 +0000 (13:08 +0200)]
target/riscv: use struct riscv_info instead of typedef riscv_info_t

Make the main RISC-V structure more compliant with OpenOCD coding style.
Other typedefs remains as is.

Change-Id: I5657ad28fea8108fd66ab27b2dfe1c868dc5805b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6998
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
20 months agoarm_adi_v5: Adding Nuvoton NPCX quirk 30/6630/8
Ben Bender [Tue, 5 Oct 2021 07:58:57 +0000 (10:58 +0300)]
arm_adi_v5: Adding Nuvoton NPCX quirk

We found that the NPCX has an issue with the byte lanes so that non byte
aligned writes aren't working. To overcome this, for byte accesses we
copy the byte to be written to all of the byte lanes.

doc: Document command nu_npcx_quirks

Signed-off-by: benjbender <benjbender@gmail.com>
[Andreas Fritiofson: Squashed commits]
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Change-Id: I9ef63bf692f4e68f57459e1ec33f3abcbf533cd2
Reviewed-on: https://review.openocd.org/c/openocd/+/6630
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/vdebug: add support for DAP level interface 65/6965/6
Jacek Wuwer [Wed, 4 May 2022 08:15:57 +0000 (10:15 +0200)]
drivers/vdebug: add support for DAP level interface

This patch adds support for DAP interface to Cadence vdebug driver.
It implements a new transport layer for dapdirect_swd.

Change-Id: I64b02a9e1ce91e552e07fca692879655496f88b6
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6965
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/semihosting: export semihosting_common_handlers[] from header file 75/7075/2
Erhan Kurubas [Sun, 3 Jul 2022 08:38:17 +0000 (11:38 +0300)]
target/semihosting: export semihosting_common_handlers[] from header file

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I4add0c1dc7888497ee90fd02754607a16434b66f
Reviewed-on: https://review.openocd.org/c/openocd/+/7075
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotcl: ngultra: add target config file 46/7046/3
Adrien Grassein [Wed, 22 Jun 2022 09:23:31 +0000 (11:23 +0200)]
tcl: ngultra: add target config file

ngultra is a Quad-R52 SoC + an FPGA.

Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Change-Id: I6a04eab3d9a7610e9dfa3d9f647868e579b6bd8a
Reviewed-on: https://review.openocd.org/c/openocd/+/7046
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agohelper/jim-nvp: avoid camelcase error by deprecated API 52/7052/2
Antonio Borneo [Mon, 26 Apr 2021 06:57:28 +0000 (08:57 +0200)]
helper/jim-nvp: avoid camelcase error by deprecated API

Commit b8e18d292eb6 ("helper/jim-nvp: comply with coding style
[1/2]") tags as deprecated the old CamelCase API of jim-nvp, so
that old patches already in gerrit or in user's local git can
still build while dumping a deprecated message.

So far, we have not found any such case, so the deprecated API can
be safely dropped in preparation of v0.12.0-rc1.

Drop the compile flag "-Wno-error=deprecated-declarations" and the
deprecated API.

Change-Id: I52ce47eda69a51c2dd29aac15f16e285492d89b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7052
Tested-by: jenkins
20 months agoopenocd: src: replace SPDX to remaining files 73/7073/2
Antonio Borneo [Mon, 27 Jun 2022 14:10:57 +0000 (16:10 +0200)]
openocd: src: replace SPDX to remaining files

With most of the files already processed through scripts, replace
manually the license to the few remaining files.

Change-Id: I3c7131e66b89ddad482f1074b5be5a9a69fdf6fd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7073
Tested-by: jenkins
20 months agoopenocd: src: replace the GPL-2.0-or-later license tag 72/7072/2
Antonio Borneo [Sun, 26 Jun 2022 23:26:22 +0000 (01:26 +0200)]
openocd: src: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I30cd66ac7d737f1973c68fdbb841ffcf00e917c4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7072
Tested-by: jenkins
20 months agoopenocd: src/target: replace the GPL-2.0-or-later license tag 71/7071/2
Antonio Borneo [Sun, 26 Jun 2022 23:24:07 +0000 (01:24 +0200)]
openocd: src/target: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I255ad17235ff1e01bf0aa4deed4d944e1d693ddb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7071
Tested-by: jenkins
20 months agoopenocd: src/rtos: replace the GPL-2.0-or-later license tag 70/7070/2
Antonio Borneo [Sun, 26 Jun 2022 23:10:12 +0000 (01:10 +0200)]
openocd: src/rtos: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: If0194089baded7f58dc5d87a35d6e0aff9f43785
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7070
Tested-by: jenkins
20 months agoopenocd: src/jtag: replace the GPL-2.0-or-later license tag 69/7069/2
Antonio Borneo [Sun, 26 Jun 2022 23:06:45 +0000 (01:06 +0200)]
openocd: src/jtag: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ie873d12bb0fb838d0d6252e6b9ca3c2118853e9a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7069
Tested-by: jenkins
20 months agoopenocd: src/helper: replace the GPL-2.0-or-later license tag 68/7068/3
Antonio Borneo [Sun, 26 Jun 2022 22:58:56 +0000 (00:58 +0200)]
openocd: src/helper: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I7851617e2682f97ccc3927e3941aadef2df63b54
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7068
Tested-by: jenkins
20 months agoopenocd: src/flash: replace the GPL-2.0-or-later license tag 67/7067/2
Antonio Borneo [Sun, 26 Jun 2022 22:53:35 +0000 (00:53 +0200)]
openocd: src/flash: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ic7db91fe37d1139d42c99e303b3243b6c8fe3ea2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7067
Tested-by: jenkins
20 months agoopenocd: src: fix incorrect SPDX tags 66/7066/2
Antonio Borneo [Sun, 26 Jun 2022 21:10:08 +0000 (23:10 +0200)]
openocd: src: fix incorrect SPDX tags

The SPDX tag is aimed at machine handling and it's thus expected
to be placed in the first line in specific format.

Move the SPDX tag to the first line and fix it where needed.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ie9a05f530009d482a4116eebd147fd7e1ee3d41e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7066
Tested-by: jenkins
20 months agoopenocd: src: fix incorrect GPL license tag 65/7065/2
Antonio Borneo [Sun, 26 Jun 2022 09:44:00 +0000 (11:44 +0200)]
openocd: src: fix incorrect GPL license tag

Use the standard SPDX tag, where it was incorrectly applied.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Iaec63abc6e0a38e5b0ae0ea7f5ecee7ca007bbbd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7065
Tested-by: jenkins
20 months agoopenocd: src: replace the GPL-2.0-only license tag 64/7064/2
Antonio Borneo [Sun, 26 Jun 2022 09:38:41 +0000 (11:38 +0200)]
openocd: src: replace the GPL-2.0-only license tag

Replace the FSF boilerplate with the SPDX tag.

Change-Id: I29f51caa5ae9854d05ce7e150d168a7002607cd1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7064
Tested-by: jenkins
20 months agoopenocd: src: replace the incomplete GPL-2.0-or-later license tag 63/7063/2
Antonio Borneo [Mon, 27 Jun 2022 08:04:43 +0000 (10:04 +0200)]
openocd: src: replace the incomplete GPL-2.0-or-later license tag

Few files have the FSF boilerplate without the latest statement on
where to get the GPL license.

Manually replace the FSF boilerplate with the SPDX tag.
While there, reorganize the copyright statement.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I0c908d01c010e24f9c7e94885e7fbed4ecf26a86
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7063
Tested-by: jenkins
20 months agoopenocd: src: replace the GPL and BSD-Source-Code license tags 62/7062/2
Antonio Borneo [Mon, 27 Jun 2022 13:01:17 +0000 (15:01 +0200)]
openocd: src: replace the GPL and BSD-Source-Code license tags

Add the new license text in the license pool.
Replace the GPL and BSD boilerplates with the SPDX tag.
Add the copyright owner of Atmel, as it was explicitly listed in
the BSD boilerplate text.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ibb117dbf8402269be3e5ba4f4c472162494d813f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7062
Tested-by: jenkins
20 months agoopenocd: src: replace the GPL with eCos exception 2.0 license tag 61/7061/2
Antonio Borneo [Mon, 27 Jun 2022 13:44:05 +0000 (15:44 +0200)]
openocd: src: replace the GPL with eCos exception 2.0 license tag

Add the license exception text in the license pool.
Add the exception chapter in license-rules.txt
Replace the boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ied513b7c9c0722ed2a9c11dbdff3fbf59f1b41ce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7061
Tested-by: jenkins
20 months agoopenocd: src: replace the BSD-2-Clause-Views license tag 60/7060/2
Antonio Borneo [Mon, 27 Jun 2022 08:31:09 +0000 (10:31 +0200)]
openocd: src: replace the BSD-2-Clause-Views license tag

Add the license text in the license pool.
Replace the BSD boilerplate with the SPDX tag.
Add the copyright owner of Jim Project, as it was explicitly
listed in the boilerplate text.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I6dd004b1945773c10539016ce733d1fbfe776a9d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7060
Tested-by: jenkins
20 months agoopenocd: src: replace the BSD-3-Clause license tag 59/7059/2
Antonio Borneo [Mon, 27 Jun 2022 08:32:34 +0000 (10:32 +0200)]
openocd: src: replace the BSD-3-Clause license tag

Replace the BSD boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I5a8cab2051eee7eb99adf67f9631b0827c1359de
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7059
Tested-by: jenkins
20 months agoopenocd: src: add GPL license tag on files that miss it 58/7058/2
Antonio Borneo [Sun, 26 Jun 2022 09:07:45 +0000 (11:07 +0200)]
openocd: src: add GPL license tag on files that miss it

Some file miss completely the license tag.

Add the SPDX tag, using the same GPL-2.0-or-later license of the
OpenOCD project.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I1fb51e722232d14f050458a820c3041de3dc9138
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7058
Tested-by: jenkins
20 months agoopenocd: src: remove duplicated GPL license tag 57/7057/2
Antonio Borneo [Sun, 26 Jun 2022 08:54:00 +0000 (10:54 +0200)]
openocd: src: remove duplicated GPL license tag

SPDX tag is replacing the FSF boilerplate.
For files that have both, remove the FSF boilerplate and keep only
the SPDX tag.

Change-Id: I04c4764d13d4ca92453f30ed16aeae53cd4c3fc8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7057
Tested-by: jenkins
20 months agoopenocd: build: add SPDX tag 51/7051/2
Antonio Borneo [Sat, 25 Jun 2022 16:19:46 +0000 (18:19 +0200)]
openocd: build: add SPDX tag

Add the SPDX tag to makefiles, configuration scripts and tcl files
present in the folders under src/

Change-Id: I1e4552aafe46ef4893d510da9d732c5f181784a4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7051
Tested-by: jenkins
21 months agosemihosting: fix return value of SYS_READ and SYS_WRITE 03/6803/4
Pavel Kirienko [Sun, 9 Jan 2022 19:05:01 +0000 (21:05 +0200)]
semihosting: fix return value of SYS_READ and SYS_WRITE

ARM/RISC-V semihosting calls SYS_READ/SYS_WRITE require
inversion of the result value as described in
"Semihosting for AArch32 and AArch64". Prior to
this patch, this was done correctly only if
(semihosting->is_fileio==false).

This patch has been tested with STM32F446.

Change-Id: I1b34c8d8393f7dfa66ee6539904a2eaf8f9154b0
Signed-off-by: Pavel Kirienko <pavel.kirienko@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/232/
Reviewed-on: https://review.openocd.org/c/openocd/+/6803
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotarget: esp_xtensa_smp: fix clang report 50/7050/3
Antonio Borneo [Sat, 25 Jun 2022 10:40:24 +0000 (12:40 +0200)]
target: esp_xtensa_smp: fix clang report

The variable 'smp_break' is only set and used in case of smp.
But clang cannot track if 'target->smp' get modified between the
set and the use of 'smp_break', so it consider possible to use
'smp_break' uninitialized.

Initialize 'smp_break' to silent clang.

Change-Id: Ifa25a84fe9ffa25b8b58d7920ec77994c3b7ebfe
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 77287b8d47b4 ("target: add Espressif ESP32 basic support")
Reviewed-on: https://review.openocd.org/c/openocd/+/7050
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
21 months agosemihosting: move semihosting_result_t from riscv.h to the semihosting_common.h 39/7039/4
Erhan Kurubas [Mon, 20 Jun 2022 13:34:10 +0000 (15:34 +0200)]
semihosting: move semihosting_result_t from riscv.h to the semihosting_common.h

These enum values are useful for the arch level semihosting call handlers.
Currently riscv uses them, we also need similar return codes for the xtensa.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I8f63749cc203c59b07862f33edf3c393cd7e33a9
Reviewed-on: https://review.openocd.org/c/openocd/+/7039
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotcl/esp32s3: check memory protection on gdb attach 37/7037/3
Erhan Kurubas [Sat, 18 Jun 2022 21:16:37 +0000 (23:16 +0200)]
tcl/esp32s3: check memory protection on gdb attach

Memory protection must be disabled to allow stub flasher
operate correctly.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I6f292ee672ae001cd6e4df5d24eb7bb862639093
Reviewed-on: https://review.openocd.org/c/openocd/+/7037
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotcl/esp32s2: check memory protection on gdb attach 36/7036/3
Erhan Kurubas [Sat, 18 Jun 2022 21:01:28 +0000 (23:01 +0200)]
tcl/esp32s2: check memory protection on gdb attach

Memory protection must be disabled to allow stub flasher
operate correctly.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I2f239d98fca6882c4361691af306a5652b58ee78
Reviewed-on: https://review.openocd.org/c/openocd/+/7036
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agojtag: add esp_usb_jtag driver 43/6943/19
Erhan Kurubas [Thu, 21 Apr 2022 19:48:28 +0000 (21:48 +0200)]
jtag: add esp_usb_jtag driver

This driver is used with the ESP32 chips which has builtin USB-JTAG
interface. e.g. with ESP32-C3, ESP32-S3

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: If966268cb8d26f76540dd5440245a17ed0b72c61
Reviewed-on: https://review.openocd.org/c/openocd/+/6943
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
21 months agoconfigure: provide advice if PKG_PROG_PKG_CONFIG unavailable 35/7035/3
R. Diez [Sat, 18 Jun 2022 14:23:00 +0000 (16:23 +0200)]
configure: provide advice if PKG_PROG_PKG_CONFIG unavailable

These are the misleading error messages that this change prevents:
configure.ac:13: error: possibly undefined macro: AC_MSG_WARN
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.
configure.ac:48: error: possibly undefined macro: AC_DEFINE
configure.ac:342: error: possibly undefined macro: AC_MSG_ERROR
configure.ac:608: error: possibly undefined macro: AC_MSG_NOTICE

Change-Id: I21bcc7715eeac0f3d0bcc60bba6801e6a895cdd0
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7035
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agohelper: fix build with mingw gcc 12.1.0 38/7038/2
Antonio Borneo [Sun, 19 Jun 2022 20:10:47 +0000 (22:10 +0200)]
helper: fix build with mingw gcc 12.1.0

New mingw compiler correctly complains for using a freed memory
area:

src/helper/configuration.c: In function 'get_home_dir':
src/helper/configuration.c:182:29: error: dangling pointer 'home'
to 'homepath' may be used [-Werror=dangling-pointer=]
182 | home_path = alloc_printf("%s/%s", home, append_path);
    |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In fact the variable 'homepath' is declared inside an 'if' branch
and is not available outside.

Move the declaration of 'homepath' to have it available in a wider
context.

Change-Id: I4a43a03c007c9f0d5c4cee962a9f7cc83ca49637
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Dietmar May <dietmar.may@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7038
Tested-by: jenkins
Reviewed-by: Dietmar May <dietmar.may@outlook.com>
21 months agotcl: add SPDX tag 30/7030/2
Antonio Borneo [Sun, 12 Jun 2022 21:51:51 +0000 (23:51 +0200)]
tcl: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl | while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: Ief3da306a6e1978de7dfb8f552f9ff23151f9944
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7030
Tested-by: jenkins
21 months agotcl/interface: add SPDX tag 29/7029/2
Antonio Borneo [Sun, 12 Jun 2022 21:50:59 +0000 (23:50 +0200)]
tcl/interface: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl/interface | while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: I7bd6a628e9e153fc477cddf9b97087a39ec48aa7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7029
Tested-by: jenkins
21 months agotcl/board: add SPDX tag 28/7028/2
Antonio Borneo [Sun, 12 Jun 2022 21:48:05 +0000 (23:48 +0200)]
tcl/board: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl/board | while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: Ibcf7da62e842aafd036a78db9ea2b9f11f79af16
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7028
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
21 months agotcl/target: add SPDX tag 27/7027/2
Antonio Borneo [Sun, 12 Jun 2022 21:42:27 +0000 (23:42 +0200)]
tcl/target: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl/ target| while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: I7b2610300b24cccd07bfa6fb5f1266970d5d3a1b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7027
Tested-by: jenkins
21 months agotcl: move SPDX tag as first line 26/7026/2
Antonio Borneo [Sun, 12 Jun 2022 20:59:55 +0000 (22:59 +0200)]
tcl: move SPDX tag as first line

The SPDX tag is aimed at machine handling and it's thus expected
to be placed in the first line.

Change-Id: I3992856eeb28b333c38d010ef286e22471ede263
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7026
Tested-by: jenkins
21 months agotcl: replace FSF boilerplate with SPDX tag 25/7025/2
Antonio Borneo [Sun, 12 Jun 2022 20:55:37 +0000 (22:55 +0200)]
tcl: replace FSF boilerplate with SPDX tag

OpenOCD project is switching to SPDX tags.
Replace the few FSF boilerplate in tcl folder.

Change-Id: I15b146eb77cc491ed7355178f684f3e76fc763b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7025
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
21 months agotcl/board/steval-idb012v1: fix SPDX tag 24/7024/2
Antonio Borneo [Sun, 12 Jun 2022 22:08:15 +0000 (00:08 +0200)]
tcl/board/steval-idb012v1: fix SPDX tag

Remove trailing '.'
While there, add newline to file's last line.

Change-Id: I3a727e406b572d051b28e17688c24627e55520c4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7024
Tested-by: jenkins
21 months agotcl/interface/vdebug: add newline to file's last line 23/7023/2
Antonio Borneo [Sun, 12 Jun 2022 22:09:41 +0000 (00:09 +0200)]
tcl/interface/vdebug: add newline to file's last line

Change-Id: I83d2477e8bc837aeac69bd5d08fdd923fd00a37c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7023
Tested-by: jenkins
21 months agosemihosting: remove comparison with NULL 31/7031/2
Antonio Borneo [Mon, 13 Jun 2022 13:41:22 +0000 (15:41 +0200)]
semihosting: remove comparison with NULL

Commit b9526f140127 ("semihosting: permit redirection of
semihosting I/O to TCP") introduces a new comparison with NULL.

Remove it.

Change-Id: Ice4333c50d16f7592f0ff86b1640217fa42e34f6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: b9526f140127 ("semihosting: permit redirection of semihosting I/O to TCP")
Reviewed-on: https://review.openocd.org/c/openocd/+/7031
Tested-by: jenkins
21 months agodrivers/linuxgpiod: simplify gpio release 33/7033/2
Antonio Borneo [Mon, 13 Jun 2022 13:56:14 +0000 (15:56 +0200)]
drivers/linuxgpiod: simplify gpio release

We already have a helper to release the gpio.
Extend it to also release its corresponding gpio chip.

As side effect, remove comparison with NULL.

Change-Id: I47cd446edfaead662d63c3330f25a791b747e882
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7033
Tested-by: jenkins
Reviewed-by: Steve Marple <stevemarple@googlemail.com>
21 months agodrivers/linuxgpiod: release gpio at exit 32/7032/2
Antonio Borneo [Mon, 13 Jun 2022 20:59:42 +0000 (22:59 +0200)]
drivers/linuxgpiod: release gpio at exit

Commit 20adf85f3484 ("linuxgpiod: add SWDIO buffer") introduces an
additional gpio for SWDIO direction, but does not release it at
driver's exit.

Release the gpio at exit.

Change-Id: If7ea31f79ffed04af585864e49bcf1f35e118bdd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7032
Tested-by: jenkins
Reviewed-by: Steve Marple <stevemarple@googlemail.com>
21 months agoaarch64: fix handling of 'reset halt' 34/7034/3
Antonio Borneo [Mon, 13 Jun 2022 14:41:11 +0000 (16:41 +0200)]
aarch64: fix handling of 'reset halt'

Commit 6c0151623cb0 ("aarch64: add support for "reset halt"")
introduces the register setting to halt at reset vector, but:
- does not consider the case 'srst_pulls_trst' that makes useless
  setting the registers as they will be erased by the pulled trst;
- does not clean sticky errors in case of 'srst_gates_jtag'.

Avoid any register initialization on 'srst_pulls_trst' and move
the cleaning of sticky errors in the common block.

Change-Id: I6f839f06f7b091e234ede31ec18096e51f017bcd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 6c0151623cb0 ("aarch64: add support for "reset halt"")
Reviewed-on: https://review.openocd.org/c/openocd/+/7034
Tested-by: jenkins
Reviewed-by: Christian Hoff <christian.hoff@advantest.com>
21 months agotcl/target/imx8m: use hwthread rtos 19/7019/5
Alvin Šipraga [Fri, 10 Jun 2022 22:01:01 +0000 (00:01 +0200)]
tcl/target/imx8m: use hwthread rtos

In order to facilitate debugging multiple cores, specify the coreid and
the hwthread rtos in the imx8m target configuration.

Change-Id: Ibd871517a160ceca15002fb10e27cb793f14d086
Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-on: https://review.openocd.org/c/openocd/+/7019
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agosemihosting: add custom user command handler 89/6889/6
Erhan Kurubas [Tue, 5 Apr 2022 11:26:08 +0000 (14:26 +0300)]
semihosting: add custom user command handler

Custom user syscalls can be handled with target events in the TCL scripts.
This patch gives another opportunity to handle custom syscalls in the c files.
Besides that some utility functions are also exported for the custom handlers.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ice13d527540a0de0b2a8abda912ae3dcff3834b7
Reviewed-on: https://review.openocd.org/c/openocd/+/6889
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agoesp32s2: convert counted timeout to timeval_ms 20/7020/2
Erhan Kurubas [Sat, 11 Jun 2022 23:04:08 +0000 (01:04 +0200)]
esp32s2: convert counted timeout to timeval_ms

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Id685408281478cec0e7e886dbedb3b8972c7b652
Reviewed-on: https://review.openocd.org/c/openocd/+/7020
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
21 months agotarget: add Espressif ESP32-S3 basic support 90/6990/9
Erhan Kurubas [Sun, 22 May 2022 21:17:48 +0000 (23:17 +0200)]
target: add Espressif ESP32-S3 basic support

ESP32-S3 is a dual core Xtensa SoC
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I44e17088030c96a9be9809f6579a4f16dbfc5794
Reviewed-on: https://review.openocd.org/c/openocd/+/6990
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotarget: add Espressif ESP32 basic support 89/6989/13
Erhan Kurubas [Sat, 21 May 2022 21:49:54 +0000 (23:49 +0200)]
target: add Espressif ESP32 basic support

ESP32 is a dual core Xtensa SoC
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I76fb184aa38ab9f4e30290c038b5ff8850060750
Reviewed-on: https://review.openocd.org/c/openocd/+/6989
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotarget/board: Add Ampere QS|MQ config files 91/5591/14
Daniel Goehring [Fri, 3 Apr 2020 23:28:03 +0000 (19:28 -0400)]
target/board: Add Ampere QS|MQ config files

Add Ampere Altra ("Quicksilver") and Ampere Altra Max ("Mystique")
target/board configuration files.

The target configuration file supports silicon and emulation.
The board configuration files support 1 and 2 socket platforms.

Tested on Ampere emulation and silicon

Change-Id: I036c798a50624e30ab51ccd2895b6f60c40be096
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5591
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
21 months agoarm_adi_v5: parse ROM tables behind SoC-600 APv1 adapter 27/6827/3
Antonio Borneo [Mon, 3 Jan 2022 09:08:35 +0000 (10:08 +0100)]
arm_adi_v5: parse ROM tables behind SoC-600 APv1 adapter

Arm "CoreSight System-on-Chip SoC-600" specification describes a
bridge "Access Port v1 adapter" aimed to "connect a legacy Access
Port (AP) ... into an CoreSight Architecture v3 system".

A ROM table can be located in the "legacy" part of the system,
on the legacy AP behind the APv1 adapter.

For the purpose of scanning the ROM tables, consider an ADIv6
SoC-600 APv1 adapter as an ADIv5 AP.

Change-Id: I97d42fb77013c1251fb68d0caa4274086bf38a70
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6827
Tested-by: jenkins
21 months agoadiv6: stay in same AP during dap_lookup_cs_component() 26/6826/3
Antonio Borneo [Sun, 23 Jan 2022 00:25:45 +0000 (01:25 +0100)]
adiv6: stay in same AP during dap_lookup_cs_component()

Configuration file can specify, as target's debug AP, an AP that
contains a ROM table that points, in turn, to other APs.
Current code in cortex_a and aarch64 is not able to handle a
return from dap_lookup_cs_component() that points to another AP.

While it could be interesting to specify 'root' as target's debug
AP, drop any found value if it's not in the starting AP.

Change-Id: Id206e4fa7a29e9402c8e2393026817b410bbb8bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6826
Tested-by: jenkins
21 months agoadiv6: add support for ROM tables in AP 67/6467/5
Antonio Borneo [Wed, 11 Aug 2021 13:29:45 +0000 (15:29 +0200)]
adiv6: add support for ROM tables in AP

ADIv6 adds AP that only contain a ROM table in the AP itself, that
can point to other AP containing either another AP level ROM table
or a MEM-AP to be parsed as usual.

Add support for parsing AP level ROM tables.

Change-Id: Ic25863b16463b8a6adc3b15e26db7fdca858d6df
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6467
Tested-by: jenkins
21 months agoadiv6: prepare for AP level ROM tables 66/6466/5
Antonio Borneo [Wed, 11 Aug 2021 09:03:49 +0000 (11:03 +0200)]
adiv6: prepare for AP level ROM tables

ADIv6 adds AP that only contain a ROM table in the AP itself, that
can point to other AP containing either another AP level ROM table
or a MEM-AP to be parsed as usual.

To handle recursive AP access, reorganize the code to:
- pass the depth==0 from the command 'dap info';
- print the AP number as first line, adding proper indentation on
  depth>0;
- align the following print with proper indentation.

Change-Id: I5b811810c807fc51b307bd60f67817d9de2aa095
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6466
Tested-by: jenkins
21 months agoarm_adi_v5: add option 'root' to 'dap info' command 62/6462/5
Antonio Borneo [Mon, 9 Aug 2021 13:31:10 +0000 (15:31 +0200)]
arm_adi_v5: add option 'root' to 'dap info' command

On ADIv6 the system root ROM table is found by reading the DAP DP
registers BASEPTR0 and BASEPTR1.

Add option 'root' to the commands 'dap info' to let it retrieve
the system root ROM table's AP from DAP DP, then use such AP for
following dump.

Change-Id: I1789457a005faa3870c5d14f763378d2f6a5f095
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6462
Tested-by: jenkins
21 months agoadiv6: use struct adiv5_ap->ap_num to contain the AP base address 61/6461/5
Antonio Borneo [Sat, 14 Aug 2021 21:56:12 +0000 (23:56 +0200)]
adiv6: use struct adiv5_ap->ap_num to contain the AP base address

ADIv5 DAP can only have 256 AP, while ADIv6 can provide till
2**40 (1,099,511,627,776) AP per DAP.

Reuse the field ap_num in struct adiv5_ap, currently used on ADIv5
to hold the ADIv5 AP number (apsel), to contain the ADIv6 AP base
address.

Convert struct adiv5_ap->ap_num to 64 bit and initialize it to
DP_APSEL_INVALID for unused AP.
Restrict dap_find_get_ap() to ADIv5 only. To be enhanced.
On ADIv6, let dap_get_ap() return an already allocated AP, or
allocate and return an unused AP.
Add function is_ap_num_valid() and use it.

Change-Id: Ib2fe8c7ec0d08393cd91c29fdac5d632dfc1e438
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6461
Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Tested-by: jenkins
21 months agoadiv6: add low level swd transport 97/6697/4
Antonio Borneo [Thu, 11 Nov 2021 22:49:23 +0000 (23:49 +0100)]
adiv6: add low level swd transport

During enter in SWD read DP_DPIDR without selecting the register
bank through DP_SELECT_DPBANK.
Handle the different format of DP_SELECT register.

Change-Id: Iea1b8eb6ec94177e16a430d5885595a38e833eeb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6697
Tested-by: jenkins
21 months agoadi_v5_jtag: extend memaccess_tck to every AP access 60/6460/5
Kevin Burke [Sat, 14 Aug 2021 16:55:28 +0000 (18:55 +0200)]
adi_v5_jtag: extend memaccess_tck to every AP access

ADIv5 reports:
Accessing AP registers or debug resources in connected
device through an AP can be subjected to other variable
response delays in the system. A debugger that can adapt
to these delays and avoid wasting WAIT scans operates more
efficiently and provides higher maximum data throughput.

The existing code in OpenOCD uses extra tck only for accessing
resources through an AP.

Extend the use of extra tck also for accessing an AP register.

Split from change https://review.openocd.org/6077/

Change-Id: I2082362e098d09f4ba0668e01f5196afc965c8f3
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6460
Tested-by: jenkins
21 months agoadiv6: add low level jtag transport 59/6459/5
Kevin Burke [Fri, 6 Aug 2021 09:56:13 +0000 (11:56 +0200)]
adiv6: add low level jtag transport

swd and dap-direct are not implemented yet

Split from change https://review.openocd.org/6077/

Change-Id: I6d73d8adf6a6090001c5d4771325fb1d63c45e3c
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6459
Tested-by: jenkins
21 months agoadi_v5_jtag: clear sticky overrun error 30/6430/6
Antonio Borneo [Fri, 6 Aug 2021 21:37:23 +0000 (23:37 +0200)]
adi_v5_jtag: clear sticky overrun error

By accessing invalid AP in JTAG mode, it's possible to trigger the
error:
JTAG-DP STICKY ERROR
After that the sticky error is never cleared and the whole DAP
gets not anymore accessible.

Clean-up the sticky error once detected.

Change-Id: I8b07263b30f9e46645f0c29084b8f1626e241f45
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6430
Tested-by: jenkins
21 months agoadiv6: read ROM Table address size 58/6458/5
Kevin Burke [Sat, 21 Aug 2021 21:59:38 +0000 (23:59 +0200)]
adiv6: read ROM Table address size

Required for parsing ADIv6 ROM tables.

Split from change https://review.openocd.org/6077/

Change-Id: I849543b7b4a4455b10bd9fc7da38a37849d71700
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6458
Tested-by: jenkins
21 months agoadiv6: re-organize mem_ap registers definition 57/6457/5
Kevin Burke [Sat, 21 Aug 2021 17:12:01 +0000 (19:12 +0200)]
adiv6: re-organize mem_ap registers definition

ADIv5 MEM-AP registers are a subset of ADIv6 MEM-AP registers and
are located at different offset.

To prepare for introducing ADIv6, add 'struct adiv5_dap *' as
argument to ADIv5 registers macro.
Check the ADI version and use the proper address.
Both adapter drivers rshim and stlink are ADIv5 only, so let them
use the ADIv5 macros only.

Split from change https://review.openocd.org/6077/

Change-Id: Ib861ddcdab74637b2082cc9f2612dea0007d77b1
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6457
Tested-by: jenkins
21 months agoadiv6: add dap flags -adiv5 and -adiv6 56/6456/5
Kevin Burke [Fri, 6 Aug 2021 13:01:34 +0000 (15:01 +0200)]
adiv6: add dap flags -adiv5 and -adiv6

Add flags to 'dap create' command and set the field adi_version
in struct adiv5_dap.

Actually only ADIv5 is functional. Other patches are needed to get
ADIv6 working.

Split from change https://review.openocd.org/6077/

Change-Id: I63d3902f99a7f139c15ee4e07c19eae9ed4534b9
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6456
Tested-by: jenkins

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)