openocd.git
10 months agopld: give devices a name for referencing in scripts 28/7728/8
Daniel Anselmi [Sat, 3 Jun 2023 18:16:19 +0000 (20:16 +0200)]
pld: give devices a name for referencing in scripts

Change-Id: I05e8596ffacdb6cd8da4dd8a40bb460183f4930a
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7728
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
10 months agotcl/board/bemicro: source cycloneiii.cfg from correct path 51/7751/2
Daniel Anselmi [Mon, 19 Jun 2023 21:37:08 +0000 (23:37 +0200)]
tcl/board/bemicro: source cycloneiii.cfg from correct path

Change-Id: Ib1d1be1067107633949a202a05f7fd06831ba84b
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7751
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
10 months agosemihosting: fix handling of errno 30/7730/5
Marek Vrbka [Thu, 1 Jun 2023 10:42:03 +0000 (12:42 +0200)]
semihosting: fix handling of errno

This patch fixes the handling of errno by setting the sys_errn
only if error has actually occurred during the semihosting call.
It also fixes few issues where error was not set in the first place.

Change-Id: I2fbe562f3ec5e6220b800de04cd33aa1f409c7a0
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7730
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
10 months agosemihosting: improve semihosting opcode debug messages 26/7726/3
Marek Vrbka [Tue, 30 May 2023 13:36:12 +0000 (15:36 +0200)]
semihosting: improve semihosting opcode debug messages

This patch introduces function semihosting_opcode_to_str() which
converts semihosting opcodes to strings. This function is then
used in debug messages to improve log analysis and troubleshooting.

Change-Id: Iffea49dae13d6a626ae0db40d379cba3c9ea5bd3
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7726
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
10 months agoriscv/semihosting: Fix ebreak skip on fileio mode 29/7729/3
Marek Vrbka [Mon, 5 Jun 2023 06:35:09 +0000 (08:35 +0200)]
riscv/semihosting: Fix ebreak skip on fileio mode

This patch fixes skipping the semihosting sequence if
the fileio mode is enabled on riscv. This change was
tested by me and is in the riscv-openocd fork for a year now.

Original merge request:
https://github.com/riscv/riscv-openocd/pull/699

Original author: Wu Zhigang
zhigang.wu@starfivetech.com
https://github.com/wzgpeter

Change-Id: Iadaa0a48d1f82d3a7ca168f8a6b656ff6ab78e03
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7729
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
11 months agotarget/ti-cjtag: make switching to JTAG more reliable 19/7419/3
Lorenz Brun [Sat, 24 Dec 2022 02:56:22 +0000 (03:56 +0100)]
target/ti-cjtag: make switching to JTAG more reliable

The current cJTAG to JTAG switching commands for TI chips are not
particularly reliable, especially on chips with accurate timing.
On a Raspberry Pi the existing sequence has (depending on cabling and
chip) a ~50% chance of working, on a much better-behaved FT2232H
it doesn't manage to enable full JTAG at all.

This change runs a bunch of test-idle cycles before actually attempting
to switch to full JTAG. This makes the switch reliable even at high
clock speeds (>100kHz) and from precise sources like the FT2232H.

Change-Id: I9293e884bf3e9606d529756ae4483b844d3c39db
Reported-by: Phil Wiggum <p1mail2015@mail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/375/
Signed-off-by: Lorenz Brun <lorenz@brun.one>
Reviewed-on: https://review.openocd.org/c/openocd/+/7419
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agojep106: update to revision JEP106BG May 2023 27/7727/2
Antonio Borneo [Thu, 1 Jun 2023 08:50:50 +0000 (10:50 +0200)]
jep106: update to revision JEP106BG May 2023

The original document from Jedec does not report the entry for
"21  NXP (Philips)", replaced by "c". It's clearly a typo.

Keep the line from JEP106BF.01 for "NXP (Philips)".

Change-Id: I30215c4ff08d5f112305cde6ab7a3176cdcef948
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7727
Tested-by: jenkins
11 months agosemihosting: fix non-zero value on Windows isatty() 25/7725/2
Marek Vrbka [Tue, 30 May 2023 12:16:38 +0000 (14:16 +0200)]
semihosting: fix non-zero value on Windows isatty()

On Windows, isatty() can return any non-zero value if it's an interactive
device. Which diverges from the ARM semihosting specification. This patch
introduces a fix to make the SYS_ISTTY operation conform to spec.

Change-Id: I9bc4f3cb82370812825d52419851910b3e3f35cc
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7725
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
11 months agogdb_server: refactor and unify function gdb_get_char_inner 24/7724/3
Marek Vrbka [Tue, 30 May 2023 08:07:18 +0000 (10:07 +0200)]
gdb_server: refactor and unify function gdb_get_char_inner

The old implementation of gdb socket error handling
in the gdb_get_char_inner() differs between Windows and *nix
platforms. This patch simplifies it by using an existing
function log_socket_error() which handles most of the platform
specific things. It also provides better error messages.

Change-Id: Iec871c4965b116dc7cfb03c3565bab66c8b41958
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7724
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agogdb_server: add debug signal reason prints 20/7720/4
Marek Vrbka [Mon, 29 May 2023 12:41:34 +0000 (14:41 +0200)]
gdb_server: add debug signal reason prints

Added debug prints to show what is the target debug reason. Also added
debug print for Ctrl-C response. This is useful for troubleshooting and
log analysis.

Change-Id: I055936257d989efe7255656198a8d73a367fcd15
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7720
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
11 months agoflash/nor: add support for NXP QN908x 84/5584/11
iosabi [Thu, 9 Apr 2020 22:00:58 +0000 (22:00 +0000)]
flash/nor: add support for NXP QN908x

This patch adds support for the NXP QN908x family of Bluetooth
microcontrollers, such as the QN9080. This chip features a Cortex-M4F
with 512 KiB of flash on all the available versions, although the
documentation suggests that there might be 256 kB versions as well.

The initial support allows to read, erase and write the whole user flash
area. Three new sub-commands under the new "qn908x" command are added
in this patch as well: disable_wdog to disabled the watchdog,
mass_erase to perform a mass erase and allow_brick to allow programming
images that disable the SWD interface.

Disabling the watchdog is required after a "reset halt" in order to run
the CRC algorithm from RAM when verifying the chip. However, this is not
done automatically on probing or other initialization since disabling
the watchdog might interfere with debugging real applications.

The "mass_erase" command allows to erase the whole flash without
probing it, since in some scenarios the chip can be locked such that no
flash or ram can be accessed from the SWD interface, allowing only to
run a mass_erase to be able to flash the program.

The flashing process allows to compute a checksum, similar to the
lpc2000 driver "calc_checksum" but done over a different region of the
memory. This checksum is required to be present for the QN908x
bootloader ROM to boot, and otherwise is useless. As with the lpc2000
design, verification when using "calc_checksum" is expected to fail if
the checksum was not valid in the image being verified.

This was manually tested on a QN9080, including the scan-view,
AddressSanitizer/UBSan and test coverage configurations.

Change-Id: Ibd6d8f3608654294795085fcaaffb448b77cc58b
Co-developed-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Signed-off-by: iosabi <iosabi@protonmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5584
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
11 months agojtag/vdebug: adding xtensa config 23/7723/2
Jacek Wuwer [Mon, 29 May 2023 17:00:27 +0000 (19:00 +0200)]
jtag/vdebug: adding xtensa config

This change adds the extensa sample target and board configurations.
it removes the obsoleted vd_xtensa_jtag.cfg from targets.

Change-Id: I9d4d25abde46c0b15e5211a973012447872cb405
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7723
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
11 months agojtag/vdebug: using tap_state 22/7722/2
Jacek Wuwer [Mon, 29 May 2023 16:38:44 +0000 (18:38 +0200)]
jtag/vdebug: using tap_state

This change implements the predefined type tap_state instead of generic
uint8_t in the driver

Change-Id: I3478e8d7b40b961f3ba77711179016cdcc35cd32
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7722
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
11 months agojtag/vdebug: fix endianness support 21/7721/2
Jacek Wuwer [Mon, 29 May 2023 15:46:08 +0000 (17:46 +0200)]
jtag/vdebug: fix endianness support

This change fixes endianness support in the driver.

Change-Id: Ida360bb58e988cea0a66fdc79e1610b528846fc4
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7721
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agotarget/espressif: fix clang scan-build warning 19/7719/3
Erhan Kurubas [Sun, 28 May 2023 11:56:56 +0000 (14:56 +0300)]
target/espressif: fix clang scan-build warning

Clang reports that 3rd function call argument is an uninitialized value
file esp32_apptrace.c line:1270

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I73e254d4eb0c6b3152229717d8827d334784ab92
Reviewed-on: https://review.openocd.org/c/openocd/+/7719
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
11 months agotcl/board/calao-usb-a9g20-c01: add proper initialization 78/7578/4
Wolfram Sang [Tue, 28 Mar 2023 19:28:35 +0000 (21:28 +0200)]
tcl/board/calao-usb-a9g20-c01: add proper initialization

Initialize clocks to max speed and setup SDRAM. NAND support is still
incomplete. Originally found at:

elinux.org/index.php?title=Calao_Atmel_AT91_development_board&oldid=73933

Updated the code from 2011 and improved it a bit.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Change-Id: I83474e07c8de8cc3b5d058029551935549693ef9
Reviewed-on: https://review.openocd.org/c/openocd/+/7578
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agoAdd/Correct STM8L15xx2/3/4/6/8 devices 90/7690/5
Dominik Wernberger [Thu, 18 May 2023 14:51:55 +0000 (16:51 +0200)]
Add/Correct STM8L15xx2/3/4/6/8 devices

Change-Id: I83fe1e50821ec15e1853aca96ebb32fe1ff5328f
Signed-off-by: Dominik Wernberger <dominik.wernberger@gmx.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7690
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agoflash: jtagspi: fix clang build warning 18/7718/2
Antonio Borneo [Sat, 27 May 2023 15:01:58 +0000 (17:01 +0200)]
flash: jtagspi: fix clang build warning

Clang is unable to fully track the content of the array
write_buffer[] and incorrectly complains that it could contain
some uninitialized value.

To help clang to track the execution flow, rewrite the handling of
the buffer by using simpler indexing and by moving away cmd_byte
from the first buffer's element to the variable cmd_byte.

While there:
- fix the error codes returned while parsing the command line and
- use directly command_print_sameline() instead of passing through
  intermediate buffers.

Change-Id: I1969e896887ea3a4abebee057cc04c03005fa57c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7718
Tested-by: jenkins
11 months agoflash: psoc4: fix clang error 17/7717/2
Antonio Borneo [Sat, 27 May 2023 13:56:44 +0000 (15:56 +0200)]
flash: psoc4: fix clang error

Clang 15.0.7 complains about snprintf output truncation due to
output between 13 and 22 bytes into a destination of size 20.

Increase the size of the buffer.

Change-Id: I0369255ca1bc02a0cf494f765e91a608c960a0d6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7717
Tested-by: jenkins
11 months agocortex_m: fix reading of DCB_DSCSR register 93/7693/3
Bohdan Tymkiv [Tue, 23 May 2023 11:40:11 +0000 (14:40 +0300)]
cortex_m: fix reading of DCB_DSCSR register

Value in the 'dscsr' variable is garbage until the DAP queue is run.
Postpone evaluation of the 'secure_state' variable. Reading the
core registers in between will execute the DAP queue.

Change-Id: I44959e882dbafb1b9779e813c3d13f3b3dbcd47f
Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7693
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
11 months agotarget: armv8: fix support of pointer authentication 12/7712/2
Antonio Borneo [Thu, 25 May 2023 08:49:20 +0000 (10:49 +0200)]
target: armv8: fix support of pointer authentication

The registers pauth_dmask and pauth_cmask are not accessible in
AARCH32 mode. Tagging them as 'hidden' is not enough and triggers
error:
Failed to read pauth_dmask register
while halting the core.

Tag the pauth registers as not existing, unless required by user.

Note: for non existing registers there should be no need to
      allocate their register cache. Let's keep this for a further
      improvement.

Change-Id: Iaa0d006a3d8ee611ee93333ed49a8615a6c94276
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: d0436b0cdabb ("armv8: Add support of pointer authentication")
Reviewed-on: https://review.openocd.org/c/openocd/+/7712
Tested-by: jenkins
Reviewed-by: Koudai Iwahori <koudai@google.com>
11 months agoflash/jtagspi: sending command and setting parameters without probing. 32/7432/5
Daniel Anselmi [Tue, 21 Mar 2023 22:23:12 +0000 (23:23 +0100)]
flash/jtagspi: sending command and setting parameters without probing.

Change-Id: I6b9d90265ca5112b9ab2aae97bb4c6cf3ebc4112
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7432
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
11 months agotarget/xtensa: add file-IO support 50/7550/5
Ian Thompson [Fri, 24 Mar 2023 00:30:53 +0000 (17:30 -0700)]
target/xtensa: add file-IO support

- Manual integration of File-IO support from xt0.2 release
- Verified with applications linked using gdbio LSP
- No new clang static analysis warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: Iedc5f885b2548097ef4f11ae1a675b5944f5fdf0
Reviewed-on: https://review.openocd.org/c/openocd/+/7550
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agojtag/adapter: Removed unused include of strings.h 87/7687/3
Jan Matyas [Mon, 15 May 2023 08:27:59 +0000 (10:27 +0200)]
jtag/adapter: Removed unused include of strings.h

Removed an unused include from src/jtag/adapter.c.

Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Change-Id: Ia5ea0acdfa1c011d7c88decd0f63e8032aafd699
Reviewed-on: https://review.openocd.org/c/openocd/+/7687
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agojtag: rewrite jim_jtag_tap_enabler() as COMMAND_HANDLER 54/7554/3
Antonio Borneo [Mon, 2 Jan 2023 16:12:04 +0000 (17:12 +0100)]
jtag: rewrite jim_jtag_tap_enabler() as COMMAND_HANDLER

The function is used for commands:
- jtag tapisenabled
- jtag tapenable
- jtag tapdisable

While there, add the missing .help and .usage fields and fix the
incorrect check in jtag_tap_enable() and jtag_tap_disable().

Change-Id: I0e1c9f0b8d9fbad19d09610a97498bec8003c27e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7554
Tested-by: jenkins
11 months agojtag: rewrite commands 'jtag newtap' and 'swd newdap' as COMMAND_HANDLER 31/7431/4
Antonio Borneo [Mon, 2 Jan 2023 00:11:44 +0000 (01:11 +0100)]
jtag: rewrite commands 'jtag newtap' and 'swd newdap' as COMMAND_HANDLER

While there:
- fix memory leak in case of error on values tap->chip,
  tap->tapname, tap->expected_ids;
- check for out of memory error;
- fix minor coding style issue;
- add the missing .usage field;
- remove functions not in use anymore.

Change-Id: I1c8c3ffeb324e9eacb919c7e0d94fd72122c9a81
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7431
Tested-by: jenkins
11 months agotarget: use unsigned int for timeout_ms 62/7562/3
Antonio Borneo [Mon, 27 Mar 2023 11:01:20 +0000 (13:01 +0200)]
target: use unsigned int for timeout_ms

Change the prototype of functions:
- target_run_algorithm()
- target_wait_algorithm()
- target_wait_state()
- struct target_type::run_algorithm()
- struct target_type::wait_algorithm()
to use unsigned int for timeout_ms instead of int.
Change accordingly the variables passed as parameter.

Change-Id: I0b8d6e691bb3c749eeb2911dc5a86c38cc0cb65d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7562
Tested-by: jenkins
11 months agotarget: rewrite command 'arp_waitstate' as COMMAND_HANDLER 61/7561/3
Antonio Borneo [Mon, 27 Mar 2023 10:03:13 +0000 (12:03 +0200)]
target: rewrite command 'arp_waitstate' as COMMAND_HANDLER

While there, add the missing .usage field and remove the now
unused function jim_target_tap_disabled().

Change-Id: I79afcc5097643fc264354c6c3957786a55f40498
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7561
Tested-by: jenkins
11 months agotarget: rewrite command 'arp_examine' as COMMAND_HANDLER 60/7560/3
Antonio Borneo [Mon, 27 Mar 2023 09:38:35 +0000 (11:38 +0200)]
target: rewrite command 'arp_examine' as COMMAND_HANDLER

Change-Id: I8f227b219ca39f198e1e39847ddd36bb9880a328
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7560
Tested-by: jenkins
11 months agotarget: espressif: apptrace: declare a local function as static 76/7676/3
Antonio Borneo [Sat, 6 May 2023 20:26:06 +0000 (22:26 +0200)]
target: espressif: apptrace: declare a local function as static

The function esp32_cmd_apptrace_generic() is not used outside the
file.

Declare it as static.
Detected through 'sparse' tool.

Change-Id: I08c6b92fb01594320bc3ae6b16067ac4eb51ca12
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7676
Tested-by: jenkins
11 months agotarget/espressif: add system level tracing feature 06/7606/6
Erhan Kurubas [Thu, 13 Apr 2023 22:07:18 +0000 (00:07 +0200)]
target/espressif: add system level tracing feature

Produces traces compatible with SEGGER SystemView tool.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: If1057309edbb91ed2cf1ebf9137c378d3deb9b88
Reviewed-on: https://review.openocd.org/c/openocd/+/7606
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agoRevert "target/image: zero-initialize ELF segments up to p_memsz" 58/7658/2
Antonio Borneo [Sat, 6 May 2023 09:44:53 +0000 (11:44 +0200)]
Revert "target/image: zero-initialize ELF segments up to p_memsz"

This reverts commit 047b1a8fc237af480e3bab66a9827a358afd7547.

Commit 047b1a8fc237 ("target/image: zero-initialize ELF segments
up to p_memsz") breaks the backward compatibility introducing some
problem:
- an empty bss segment with paddr in SRAM gets zero filled at load
  but does not survive after a reset, causing verify to fail;
- an empty bss segment with paddr in FLASH causes excessive flash
  usage, which can exceed flash size (causing error) and makes
  flash aging faster.

Revert it while looking for a better implementation.

Change-Id: Iaaf926dafce46a220a5bbe20c8576eb449996d76
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7658
Reviewed-by: Bohdan Tymkiv <bohdan200@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Peter Collingbourne <pcc@google.com>
Tested-by: jenkins
11 months agoflash/nor/stm32f2x: Show error message when unprotecting OTP 15/7615/2
Matthijs Kooijman [Thu, 27 Apr 2023 16:34:44 +0000 (18:34 +0200)]
flash/nor/stm32f2x: Show error message when unprotecting OTP

Trying to disable OTP write protection by running e.g. `flash protect
1 0 1 off` would already be rejected with an error code, but that would
result in a generic "failed setting protection for blocks 0 to 1"
message. Now a more specific error message is also printed, telling the
user why it failed.

Change-Id: I6d4974eb0bcd23a0a6cf68ff955d9e59b8b1b06a
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Reviewed-on: https://review.openocd.org/c/openocd/+/7615
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
11 months agoflash/nor/stm32f2x: Fix typos in log messages 14/7614/3
Matthijs Kooijman [Thu, 27 Apr 2023 14:05:02 +0000 (16:05 +0200)]
flash/nor/stm32f2x: Fix typos in log messages

Change-Id: I0f27e1c64972a58ac146c391761008cdca610afe
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Reviewed-on: https://review.openocd.org/c/openocd/+/7614
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
11 months agotarget/riscv-013: clear sticky error when DMI operation fails 88/7688/2
Amaury Pouly [Wed, 17 May 2023 11:09:32 +0000 (12:09 +0100)]
target/riscv-013: clear sticky error when DMI operation fails

When a DMI operation does not succeed (either because of a timeout
or an error), the specification says that the error in the `op`
field is sticky and needs to cleared by writing `dmireset` in `dtmcs`.
This is already done for timeouts in increase_dmi_busy_delay
but not for errors.

Change-Id: I7c5f27a5cf145511a1a8b64a45a586521e1cbe41
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
Reviewed-on: https://review.openocd.org/c/openocd/+/7688
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
11 months agoflash/stm32l4x: support STM32C0x devices 74/6874/6
Tarek BOCHKATI [Fri, 3 Dec 2021 11:58:33 +0000 (12:58 +0100)]
flash/stm32l4x: support STM32C0x devices

this new STM32 series family introduces 2 devices:
STM32C011xx (0x443) and STM32C031xx (0x453)

both devices have 32 Kbytes single flash bank.

Change-Id: I4e890789e44e3b174c0e9c0e1068383ecdbb865f
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6874
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
11 months agojtag/drivers/bcm2835gpio: add peripheral_mem_dev config command 50/7350/5
Tomas Vanek [Sat, 13 May 2023 04:39:48 +0000 (06:39 +0200)]
jtag/drivers/bcm2835gpio: add peripheral_mem_dev config command

The bcm2835gpio driver preferred /dev/gpiomem for access to
memory mapped GPIO control and used /dev/mem as a fallback
only if it couldn't open /dev/gpiomem.

/dev/mem usually requires elevated rights or specific capabilities
of the opening process, so the fallback failed anyway.

Although /dev/gpiomem is the strongly preferred option with respect
to security, there could be also use cases which require /dev/mem
even if /dev/gpiomem is available (e.g. changing the GPIO pad
settings is necessary or testing/debugging OpenOCD).
It was difficult to handle such cases because they required
to block globally the system device /dev/gpiomem
(remove, rename or chmod).

Drop the fallback feature and select the memory device
by 'bcm2835gpio peripheral_mem_dev' configuration command.
Use /dev/gpiomem as a default.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I60e427bda795d7a13d55d61443590dd31d694832
Reviewed-on: https://review.openocd.org/c/openocd/+/7350
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
11 months agojtag/drivers/bcm2835gpio: extend peripheral_base to off_t 85/7685/2
Tomas Vanek [Fri, 12 May 2023 10:04:22 +0000 (12:04 +0200)]
jtag/drivers/bcm2835gpio: extend peripheral_base to off_t

Raspberry Pi 4 with 64-bit kernel and arm_peri_high=1 config.txt
parameter needs peripheral_base 0x47e000000, uint32_t is not enough.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Icedd084e2916657fa4478d452a5eb1e84a45c281
Reviewed-on: https://review.openocd.org/c/openocd/+/7685
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agojtag/drivers/bcm2835gpio: don't touch pad setting on /dev/gpiomem 84/7684/2
Tomas Vanek [Tue, 15 Nov 2022 08:47:43 +0000 (09:47 +0100)]
jtag/drivers/bcm2835gpio: don't touch pad setting on /dev/gpiomem

The pads were configured at a wrong memory address
if /dev/gpiomem was mapped.

The pad setting registers are not accessible in mapped /dev/gpiomem,
disable the pads setting if the driver doesn't open /dev/mem.

While on it, do not fail the driver initialization if pad mapping fails
- just emit a warning and work with unchanged pad setting.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I0bce76cade8f7efd75efd9087a7d9ba6511a6239
Reviewed-on: https://review.openocd.org/c/openocd/+/7684
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agotcl/target: Add support for TMS570LC43xx 82/7682/5
Phil Kirkpatrick [Tue, 9 May 2023 09:04:24 +0000 (11:04 +0200)]
tcl/target: Add support for TMS570LC43xx

Added support for TMS570LC43xx series parts.  This uses the pre-existing
ti_tms570.cfg parent config.  In ti_tms570.cfg, dbgbase was changed.
Note 1: Based on the following TI E2E post, the previous dbgbase was wrong
and the new value isn't due to a difference in parts.
Link: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1106954/tms570ls3137-debugging-with-openocd
Note 2: Both the previous dbgbase and the one suggested in the TI E2E post
have the 2 LSB set. In the current version of OpenOCD, this will cause
cortex_a_read_cpu_memory_fast and cortex_a_write_cpu_memory_fast to fail
due to an alignment checks in
mem_ap_<read/write>_buf_noincr()->mem_ap_<read/write>().
In all other uses of dbgbase for arm cortex parts, the 2 LSB are masked
and ignored.

Change-Id: Ic936722e5a4cfc7161b0df1fe3325ee12fd901c6
Signed-off-by: Phil Kirkpatrick <p.kirkpatrick@reflexaerospace.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7682
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
11 months agoflash/jtagspi: handle error return values where needed 22/7422/7
Daniel Anselmi [Thu, 29 Dec 2022 19:02:39 +0000 (20:02 +0100)]
flash/jtagspi: handle error return values where needed

Change-Id: Id46c2799f954fb1d4353f652ba3115796c88936d
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7422
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
11 months agopld/virtex2: check error propagated by virtex2_read_stat() 57/7657/2
Antonio Borneo [Sat, 6 May 2023 08:34:13 +0000 (10:34 +0200)]
pld/virtex2: check error propagated by virtex2_read_stat()

Commit dd9137dc0e0c ("pld/virtex2: add missing error checks") adds
checks on the return value of several functions, allowing also
virtex2_read_stat() to propagate such returned values.
This triggers an error with clang, as it is now able to identify a
possible execution path that makes uninitialized the variable
status.

Check for the returned value of virtex2_read_stat() before using
the variable status and propagate the returned value.
While there, drop a useless empty string.

Change-Id: I7a23d3f904d4e07cdb6f6dfdf1179889b6b8afb8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7657
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
11 months agoHACKING: add info on usage of sparse 79/7679/2
Antonio Borneo [Sun, 7 May 2023 14:15:46 +0000 (16:15 +0200)]
HACKING: add info on usage of sparse

Add short example on how to run the static analyser 'sparse' on
OpenOCD code.

Change-Id: Ieba8ae926d0e02ca9e6ac619b13b0832136f82cb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7679
Tested-by: jenkins
11 months agortos: uCOS-III: split struct ucos_iii_params 78/7678/2
Antonio Borneo [Sun, 7 May 2023 13:50:26 +0000 (15:50 +0200)]
rtos: uCOS-III: split struct ucos_iii_params

The static analyser 'sparse' complains about using sizeof() on a
struct that has variable size:
src/rtos/uCOS-III.c:267:32: warning: using sizeof on a flexible structure
src/rtos/uCOS-III.c:269:41: warning: using sizeof on a flexible structure
src/rtos/uCOS-III.c:275:66: warning: using sizeof on a flexible structure
The struct ucos_iii_params contains either constants values for
different target type and variable fields. The last field is an
variable size array, always allocated to UCOS_III_MAX_THREADS
items. It's not practical to fix this size because we would get
too huge initialization in data segment.

Split away from struct ucos_iii_params all the variable fields and
put them in struct ucos_iii_private. Add in the new struct a
pointer to the selected element of ucos_iii_params_list[] and fix
the size of array threads[] to its maximum value; this would be
allocated at run-time, avoiding impacts to data segment.

Change-Id: I569011a257783d35a8795adbda06e942b4157f2a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7678
Tested-by: jenkins
11 months agortos: move prototype of rtos_thread_packet() in rtos.h 77/7677/2
Antonio Borneo [Sun, 7 May 2023 12:35:51 +0000 (14:35 +0200)]
rtos: move prototype of rtos_thread_packet() in rtos.h

The function rtos_thread_packet() is used across rtos and declared
locally as extern.

Move the prototype of the function in common include rtos.h

Change-Id: I50d311b583148a2de628de0997ef1afc9103a70e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7677
Tested-by: jenkins
11 months agotarget: arm_adi_v5: move in include file the declaration of dap_ops 75/7675/2
Antonio Borneo [Sat, 6 May 2023 20:17:36 +0000 (22:17 +0200)]
target: arm_adi_v5: move in include file the declaration of dap_ops

The struct containing SWD and JTAG operations are declared as
extern in the C file.

Mode them in include file arm_adi_v5.h to silent 'sparse' error
for global variable definition without declaration in an include
file.

Change-Id: I59088512c052d5a120c38404a882ed512a68ca02
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7675
Tested-by: jenkins
11 months agoflash: nand: move in include file the declaration of 'nand_devices' 74/7674/2
Antonio Borneo [Sat, 6 May 2023 20:09:06 +0000 (22:09 +0200)]
flash: nand: move in include file the declaration of 'nand_devices'

The pointer nand_devices is used in two file.

Move the extern prototype in code.h

Detected through 'sparse' tool.

Change-Id: I7237359fd1a008770a624725cd0b3d8632b4166e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7674
Tested-by: jenkins
11 months agoserver: gdb: export gdb_actual_connections through a function 73/7673/2
Antonio Borneo [Sat, 6 May 2023 19:59:31 +0000 (21:59 +0200)]
server: gdb: export gdb_actual_connections through a function

The internal variable 'gdb_actual_connections' is used by log and
by semihosting to determine if there are active GDB connections.

Keep the variable local in server's code and only export its value
through a dedicated function.

This solves the issue detected by 'parse' of the variable defined
as global but not declared in any include file.

Change-Id: I6e14f4cb1097787404094636f8a2a291340222dd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7673
Tested-by: jenkins
11 months agojtag: move declaration outside function 72/7672/2
Antonio Borneo [Sat, 6 May 2023 19:28:51 +0000 (21:28 +0200)]
jtag: move declaration outside function

The function jtag_debug_state_machine_() is only used by a static
inline function and declared inside it as private.
The static analyser 'sparse' complains that the function is
defined as global but not cross checked against a prototype in an
include file.

Move the declaration outside the inline function so it get visible
by interface.c, which already includes interface.h
While there, change the argument type from 'unsigned' to 'unsigned
int' to pass checkpatch check.

Change-Id: Ia5dfb92dc4bc6d52ead4f0cb8c68319c83ff85b0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7672
Tested-by: jenkins
11 months agohello: include hello.h 71/7671/2
Antonio Borneo [Sat, 6 May 2023 16:49:46 +0000 (18:49 +0200)]
hello: include hello.h

Let source file to include its file .h to validate the exported
prototypes.

Detected through 'sparse' tool.

Change-Id: I6197f21c857833dafc3d6e3b750c764bf4610abd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7671
Tested-by: jenkins
11 months agohelper: types: rework h_u32_to_le() and similar for sparse 70/7670/2
Antonio Borneo [Sat, 6 May 2023 14:35:57 +0000 (16:35 +0200)]
helper: types: rework h_u32_to_le() and similar for sparse

The static analyser 'sparse' complains about values bigger that
255 that gets cast-ed and/or stored in an 8 bit variable.

Rework the functions:
- h_u32_to_le()
- h_u32_to_be()
- h_u24_to_le()
- h_u24_to_be()
- h_u16_to_le()
- h_u16_to_be()
to avoid all the related warnings, without adding any functional
change. Any modern compiler should not be impacted by this.

Change-Id: I0b84043600a41c72d0e4ddb3dd195d69e3b2896b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7670
Tested-by: jenkins
11 months agotarget: arm_dpm: with pointers, use NULL instead of 0 69/7669/2
Antonio Borneo [Sat, 6 May 2023 14:24:04 +0000 (16:24 +0200)]
target: arm_dpm: with pointers, use NULL instead of 0

Don't assign pointer to 0, use NULL.

Detected through 'sparse' tool.

Change-Id: I34551112ddab9dedf8537c8111d32356c170e7d5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7669
Tested-by: jenkins
11 months agopld: fix new warnings from sparse 68/7668/2
Antonio Borneo [Sat, 6 May 2023 14:19:55 +0000 (16:19 +0200)]
pld: fix new warnings from sparse

The new committed files add some warning from the static analyser
'sparse':
- Don't assign pointer to 0, use NULL.
- switch with no cases.

Fix them.

Change-Id: I2c02d629bd80b71c8e42553be5d9388bb9b6bcd0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7668
Tested-by: jenkins
11 months agohelper: replacements: rework including replacements.h 67/7667/2
Antonio Borneo [Sat, 6 May 2023 14:14:15 +0000 (16:14 +0200)]
helper: replacements: rework including replacements.h

The static analyser 'sparse' complains that the functions
clear_malloc() and fill_malloc() are defined global but not cross
checked against a prototype in an include file.

Rework replacements.h and replacements.c to let the former be
included by the latter.

Change-Id: I536393a9c3718dcd7e144cde8f02e169f64c88e0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7667
Tested-by: jenkins
11 months agonand: declare exported function in core.h 66/7666/2
Antonio Borneo [Sun, 30 Apr 2023 22:55:15 +0000 (00:55 +0200)]
nand: declare exported function in core.h

Don't use 'extern' in a C file, but declare the exported function
in a H file.
This helps validating the function prototype across declaration
and use.

Detected through 'sparse' tool.

Change-Id: I2c22b084fb513f4b3b1b1db96dfbc8fa4bfe7238
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7666
Tested-by: jenkins
11 months agojtag: move in interface.h the adapter_driver's declaration 65/7665/2
Antonio Borneo [Sun, 30 Apr 2023 22:40:18 +0000 (00:40 +0200)]
jtag: move in interface.h the adapter_driver's declaration

The static analyser 'sparse' complains, while compiling a jtag
driver, that the struct adapter_driver is declared in the file as
non static, but it is not exposed through an include file.
The message is:
warning: symbol 'XXX' was not declared. Should it be static?

Move the list of adapter_driver's declaration in interface.h
Drop the preprocessor #ifdef/#endif around the declaration, as it
has no effect when the declaration is not used and/or the symbol
does not exist.

Change-Id: I5b8f5fe48a89ff0ffce38d547c551cd196379fbf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7665
Tested-by: jenkins
11 months agopld: validate exported functions by including its own .h 64/7664/2
Antonio Borneo [Sun, 30 Apr 2023 22:29:11 +0000 (00:29 +0200)]
pld: validate exported functions by including its own .h

Let source files to include its file .h to validate the exported
prototypes.

Detected through 'sparse' tool.

Change-Id: I217c2903fdb19e1a2cce39d2536a903c3d72f3f7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7664
Tested-by: jenkins
11 months agopld: move in pld.h the pld_driver's declaration 63/7663/2
Antonio Borneo [Sun, 30 Apr 2023 22:24:37 +0000 (00:24 +0200)]
pld: move in pld.h the pld_driver's declaration

The static analyser 'sparse' complains, while compiling a pld
driver, that the struct pld_driver is declared in the file as
non static, but it is not exposed through an include file.
The message is:
warning: symbol 'XXX' was not declared. Should it be static?

Move the list of pld_driver's declaration in pld.h

Change-Id: I0f917aecc7534c1b51af0afa9b32ccfd33db3511
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7663
Tested-by: jenkins
11 months agonor: move in driver.h the flash_driver's declaration 62/7662/2
Antonio Borneo [Sun, 30 Apr 2023 22:17:23 +0000 (00:17 +0200)]
nor: move in driver.h the flash_driver's declaration

The static analyser 'sparse' complains, while compiling a nor
driver, that the struct flash_driver is declared in the file as
non static, but it is not exposed through an include file.
The message is:
warning: symbol 'XXX' was not declared. Should it be static?

Move the list of flash_driver's declaration in driver.h
Fix some incorrect non-const declaration and remove redundant
forward declarations.

Change-Id: I5e41d094307aac4a57dfa9a70496ff3cf180bd92
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7662
Tested-by: jenkins
11 months agonand: move in driver.h the nand_flash_controller's declaration 61/7661/2
Antonio Borneo [Sun, 30 Apr 2023 22:08:32 +0000 (00:08 +0200)]
nand: move in driver.h the nand_flash_controller's declaration

The static analyser 'sparse' complains, while compiling a nand
driver, that the struct nand_flash_controller is declared in the
file as non static, but it is not exposed through an include file.
The message is:
warning: symbol 'XXX' was not declared. Should it be static?

Move the list of nand_flash_controller's declaration in driver.h
While there, drop the unused/commented boundary scan controller.

Change-Id: I7dc32cef55be13ba537abe0f4c47b135d837126c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7661
Tested-by: jenkins
11 months agortos: move in rtos.h the rtos_type's declaration 60/7660/2
Antonio Borneo [Sun, 30 Apr 2023 21:54:44 +0000 (23:54 +0200)]
rtos: move in rtos.h the rtos_type's declaration

The static analyser 'sparse' complains, while compiling a rtos'
file, that the struct rtos_type is declared in the file as non
static, but it is not exposed through an include file.
The message is:
warning: symbol 'XXX' was not declared. Should it be static?

Move the list of rtos_type's declaration in rtos.h

Change-Id: Ia96dff077407a6653b11920519c1724e4c1167a3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7660
Tested-by: jenkins
11 months agotarget: move in target_type.h the target_type's declaration 59/7659/2
Antonio Borneo [Sun, 30 Apr 2023 22:00:47 +0000 (00:00 +0200)]
target: move in target_type.h the target_type's declaration

The static analyser 'sparse' complains, while compiling a target's
file, that the struct target_type is declared in the file as non
static, but it is not exposed through an include file.
The message is:
warning: symbol 'XXX' was not declared. Should it be static?

Move the list of target_type's declaration in target_type.h
While there, fix a name clash in stm8.c

Change-Id: Ia9c681e0825cfd04d509616dbc04a0cf4944f379
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7659
Tested-by: jenkins
12 months agojtag: tcl: show error message when attempting manual "drscan" on a bypassed tap 54/7654/3
Paul Fertser [Tue, 2 May 2023 12:15:21 +0000 (15:15 +0300)]
jtag: tcl: show error message when attempting manual "drscan" on a bypassed tap

To perform any meaningful manipulations with DR the corresponding IR should
be set to a relevant instruction, not BYPASS, so warn the user accordingly.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: I42580ecd75ae824a4145f6f17f0df9bcf825b50f
Reviewed-on: https://review.openocd.org/c/openocd/+/7654
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
12 months agojtag: tcl: change drscan usage to show at least one value is required 53/7653/3
Paul Fertser [Tue, 2 May 2023 12:10:11 +0000 (15:10 +0300)]
jtag: tcl: change drscan usage to show at least one value is required

It's customary to use [] brackets to mean the argument is optional, but
drscan requires at least one pair of "num_bits value" so change it to ().
In common regular expressions * means 0 or more, and + means 1 or more,
so change that too.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: Ib15d833bda2aa398ad1345a042f97d91c98dbf66
Reviewed-on: https://review.openocd.org/c/openocd/+/7653
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agotarget: rewrite command 'arp_reset' as COMMAND_HANDLER 59/7559/2
Antonio Borneo [Mon, 27 Mar 2023 09:11:46 +0000 (11:11 +0200)]
target: rewrite command 'arp_reset' as COMMAND_HANDLER

While there, add the missing .usage field and move in target.c the
enum nvp_assert.

Change-Id: Ia4f2f962887b5a35faeaa4eae128fa2865569b24
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7559
Tested-by: jenkins
12 months agotarget: rewrite command 'arp_halt' as COMMAND_HANDLER 58/7558/2
Antonio Borneo [Mon, 27 Mar 2023 08:43:30 +0000 (10:43 +0200)]
target: rewrite command 'arp_halt' as COMMAND_HANDLER

While there, add the missing .usage field.

Change-Id: I748382cafe08443c458ff1d4e47819610cfbf85c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7558
Tested-by: jenkins
12 months agotarget: rewrite command 'arp_poll' as COMMAND_HANDLER 57/7557/2
Antonio Borneo [Mon, 27 Mar 2023 08:34:14 +0000 (10:34 +0200)]
target: rewrite command 'arp_poll' as COMMAND_HANDLER

While there, add the missing .usage field.

Change-Id: I16e0aeacdaaada09fa77ad29552fa4025eff0c45
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7557
Tested-by: jenkins
12 months agojtag: rewrite command 'pathmove' as COMMAND_HANDLER 56/7556/2
Antonio Borneo [Mon, 2 Jan 2023 21:32:53 +0000 (22:32 +0100)]
jtag: rewrite command 'pathmove' as COMMAND_HANDLER

Change-Id: I1f8c6722021f392b1f065484b63a19964db69ad5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7556
Tested-by: jenkins
12 months agojtag: rewrite command 'drscan' as COMMAND_HANDLER 55/7555/2
Antonio Borneo [Mon, 2 Jan 2023 21:16:46 +0000 (22:16 +0100)]
jtag: rewrite command 'drscan' as COMMAND_HANDLER

Reorganize the code to parse the command line only once.
Add check for successful memory allocation.

Change-Id: Ibf6068e177c09e93150d11aecfcf079348c47c21
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7555
Tested-by: jenkins
12 months agoopenocd: trivial replace of jim-nvp with new nvp 53/7553/2
Antonio Borneo [Mon, 26 Dec 2022 21:46:19 +0000 (22:46 +0100)]
openocd: trivial replace of jim-nvp with new nvp

For some trivial case only, replace calls to jim-nvp with calls
to the new OpenOCD nvp.

Change-Id: Ifd9aff32b67748af8ab808e6a6b6e64f5271b888
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7553
Tested-by: jenkins
12 months agoxtensa: fix build with gcc 13.1.1 81/7681/2
Antonio Borneo [Mon, 8 May 2023 08:45:25 +0000 (10:45 +0200)]
xtensa: fix build with gcc 13.1.1

New gcc does not understand that the variable 'restore_ms' is set
to 'true' only when the variable 'ms' is assigned in
static int xtensa_write_dirty_registers(...)
{
xtensa_reg_val_t ms;
bool restore_ms = false;
...
if (...) {
ms = regval;
restore_ms = true;
...
}
...
if (restore_ms) {
USE(ms);
}
...
}
and complains about possible use of uninitialized variable 'ms'.

Sadly initialize 'ms' to zero to hide this false positive.

Change-Id: I1fb3949070c8abbf4aa45a740f0ca2fdb753d4fa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7681
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Tested-by: jenkins
12 months agotarget: etm: fix check trace status 99/7599/2
Antonio Borneo [Sat, 8 Apr 2023 23:00:15 +0000 (01:00 +0200)]
target: etm: fix check trace status

Current code tests a function pointer against a numeric value that
is the same enum type as returned by the pointed function.
Clearly the author was willing to call the function and check its
returned value.

Fix the check by calling the function.

Detected through 'sparse' tool.

Change-Id: I27d18d26c2c797160a397daa32835c199014b70b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Checkpatch-ignore: GIT_COMMIT_ID
Fixes: 237e894805dd ("reworked etm/etb into a generic etm part with trace capture")
Reviewed-on: https://review.openocd.org/c/openocd/+/7599
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agojtag: xds110: fix check on malloc() returned pointer 56/7656/2
Antonio Borneo [Sat, 6 May 2023 08:16:08 +0000 (10:16 +0200)]
jtag: xds110: fix check on malloc() returned pointer

Commit 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL
instead of 0") incorrectly inverts the check, making the driver's
pathmove operation not functional and triggering two clang errors.

Fix the check on malloc() returned pointer.

Change-Id: If1f220aca67452adbcd3a1c9cf691fc984b16b27
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL instead of 0")
Reviewed-on: https://review.openocd.org/c/openocd/+/7656
Tested-by: jenkins
12 months agopld/virtex2: add missing error checks 33/7633/2
Daniel Anselmi [Wed, 12 Apr 2023 23:55:10 +0000 (01:55 +0200)]
pld/virtex2: add missing error checks

Add error checks after allocating memory.
Add error checks for calls to jtag_execute_queue().

Change-Id: I3b63b3d836170244ad3b0566d5bd9d9aabb8e238
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7633
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agopld: gatemate: fix memory leak 32/7632/2
Antonio Borneo [Sun, 30 Apr 2023 20:57:59 +0000 (22:57 +0200)]
pld: gatemate: fix memory leak

When gatemate_set_instr() fails, the array pointed by
bit_file.raw_file.data is not freed.
Issue identified by OpenOCD Jenkins clang build.

Free the array while propagating the error.

Change-Id: I2f7fadee903f9c65cdc9ab9b52ccb5803b48a59d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 682f927f8e4e ("pld: add support for cologne chip gatemate fpgas")
Reviewed-on: https://review.openocd.org/c/openocd/+/7632
Tested-by: jenkins
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
12 months agotarget: with pointers, use NULL instead of 0 04/7604/2
Antonio Borneo [Sat, 8 Apr 2023 23:40:51 +0000 (01:40 +0200)]
target: with pointers, use NULL instead of 0

Don't assign pointer to 0, use NULL.
Don't pass 0 ad pointer argument, pass NULL.

Detected through 'sparse' tool.

Change-Id: I806031d2ae505fa5f0accc6be1936d48cd365ca4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7604
Tested-by: jenkins
12 months agotarget: rtt: include rtt.h 02/7602/2
Antonio Borneo [Sat, 8 Apr 2023 23:37:11 +0000 (01:37 +0200)]
target: rtt: include rtt.h

Let source file to include its file .h to validate the exported
prototypes.

Detected through 'sparse' tool.

Change-Id: I8ae2f8f1fdaea5683e157247463533b17237e464
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7602
Tested-by: jenkins
12 months agotarget: use 'ULL' suffix for long constants 01/7601/2
Antonio Borneo [Sat, 8 Apr 2023 23:36:04 +0000 (01:36 +0200)]
target: use 'ULL' suffix for long constants

On 32 bit hosts, gcc should consider constants without suffix as
32 bits values.

Use the suffix 'ULL' to guarantee it is a 64 bit.

Detected through 'sparse' tool.

Change-Id: I205ca986968fef9a536f87492d1f6c80e41829f3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7601
Tested-by: jenkins
12 months agortos: with pointers, use NULL instead of 0 98/7598/2
Antonio Borneo [Sat, 8 Apr 2023 22:33:38 +0000 (00:33 +0200)]
rtos: with pointers, use NULL instead of 0

Don't compare pointers with 0, use NULL when needed.
Don't assign pointer to 0, use NULL.

Detected through 'sparse' tool.

Change-Id: Ifa81ba961c0d490cc74880b4a46b620e6358f779
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7598
Tested-by: jenkins
12 months agohelper: with pointers, use NULL instead of 0 97/7597/2
Antonio Borneo [Sat, 8 Apr 2023 22:16:28 +0000 (00:16 +0200)]
helper: with pointers, use NULL instead of 0

Don't compare pointers with 0, use NULL when needed.
Don't assign pointer to 0, use NULL.
Don't pass 0 ad pointer argument, pass NULL.

Detected through 'sparse' tool.

Change-Id: I3f867cb9c0903f6e396311e7b3970ee5fb3a4231
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7597
Tested-by: jenkins
12 months agohelper: util: include util.h 96/7596/2
Antonio Borneo [Sat, 8 Apr 2023 22:14:45 +0000 (00:14 +0200)]
helper: util: include util.h

Let source file to include its file .h to validate the exported
prototypes.

Detected through 'sparse' tool.

Change-Id: I5de107b4f8a468f0e37f06171f5f0c3c0546db1a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7596
Tested-by: jenkins
12 months agoflash: with pointers, use NULL instead of 0 95/7595/3
Antonio Borneo [Sat, 8 Apr 2023 22:00:37 +0000 (00:00 +0200)]
flash: with pointers, use NULL instead of 0

Don't compare pointers with 0, use NULL when needed.
Don't pass 0 ad pointer argument, pass NULL.

Detected through 'sparse' tool.

Change-Id: I118554fffde41c94cea9e1201ea941ff3c1ee762
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7595
Tested-by: jenkins
12 months agoflash: nor: add static to local symbols 94/7594/2
Antonio Borneo [Sat, 8 Apr 2023 21:59:42 +0000 (23:59 +0200)]
flash: nor: add static to local symbols

Add static type to symbols that are not used elsewhere.

Detected through 'sparse' tool.

Change-Id: I2bdac5d2b06a6dbed5c27bfdb1cf36eee90ad823
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7594
Tested-by: jenkins
12 months agoflash: nor: use 'ULL' suffix for long constants 93/7593/2
Antonio Borneo [Sat, 8 Apr 2023 21:50:00 +0000 (23:50 +0200)]
flash: nor: use 'ULL' suffix for long constants

On 32 bit hosts, gcc should consider constants without suffix as
32 bits values. Adding a cast to convert it to 64 bits should not
be enough.

Use the suffix 'ULL' to guarantee it is a 64 bit.

Detected through 'sparse' tool.

Change-Id: If6be35bd3cbbc7c3a83e0da1407e611f07ff6e06
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7593
Tested-by: jenkins
12 months agojtag: drivers: with pointers, use NULL instead of 0 92/7592/3
Antonio Borneo [Sat, 8 Apr 2023 21:21:33 +0000 (23:21 +0200)]
jtag: drivers: with pointers, use NULL instead of 0

Don't compare pointers with 0, use NULL when needed.
Don't assign pointer to 0, use NULL.
Don't pass 0 ad pointer argument, pass NULL.

While there, check for return value from malloc(), replace an
assert() with a LOG_ERROR(), drop a useless cast.

Detected through 'sparse' tool.

Change-Id: Ia7cf52221b12198aba1a07ebdfaf57ce341d5699
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7592
Tested-by: jenkins
12 months agojtag: drivers: add static to local symbols 91/7591/2
Antonio Borneo [Sat, 8 Apr 2023 21:19:50 +0000 (23:19 +0200)]
jtag: drivers: add static to local symbols

Add static type to symbols that are not used elsewhere.

Detected through 'sparse' tool.

Change-Id: I00e151d2466868a5dce028444d326defb80d4826
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7591
Tested-by: jenkins
12 months agopld: add support for cologne chip gatemate fpgas 65/7565/10
Daniel Anselmi [Fri, 24 Feb 2023 14:57:30 +0000 (15:57 +0100)]
pld: add support for cologne chip gatemate fpgas

Change-Id: I0bf5a52ee6a7f0287524619114eba0cfccf6ac81
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7565
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agopld: add support for gowin devices 68/7368/19
Daniel Anselmi [Mon, 12 Dec 2022 08:49:51 +0000 (09:49 +0100)]
pld: add support for gowin devices

Change-Id: Idd1a09514bbbbe0a7b54d69010f6c2f91215fd1d
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7368
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agopld: add support for altera/intel devices 55/7355/18
Daniel Anselmi [Mon, 12 Dec 2022 08:49:51 +0000 (09:49 +0100)]
pld: add support for altera/intel devices

Change-Id: I7977d39c9037ae71139f78c8d381f5f925dc3489
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7355
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agopld: add support for efinix devices 88/7288/28
Daniel Anselmi [Mon, 12 Dec 2022 08:49:51 +0000 (09:49 +0100)]
pld: add support for efinix devices

Change-Id: Ie520e761c255ba1335d5aab9c6825f160a6151d9
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7288
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
12 months agopld: add support for lattice certus devices 98/7398/16
Daniel Anselmi [Mon, 12 Dec 2022 08:49:51 +0000 (09:49 +0100)]
pld: add support for lattice certus devices

Change-Id: Ic50a724e5793000fca11f35ba848c2d317c3cbab
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7398
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agopld: add support for lattice ecp5 devices 97/7397/16
Daniel Anselmi [Mon, 12 Dec 2022 08:49:51 +0000 (09:49 +0100)]
pld: add support for lattice ecp5 devices

Change-Id: Ib2f0933da3abe7429abca86d6aaa50ad85ce72c7
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7397
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
12 months agopld: add support for lattice ecp2 and ecp3 devices 96/7396/14
Daniel Anselmi [Mon, 12 Dec 2022 08:49:51 +0000 (09:49 +0100)]
pld: add support for lattice ecp2 and ecp3 devices

Change-Id: I29c227c37be464f7ecc97a30d9cf3da1442e2b7f
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7396
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
12 months agotarget/espressif: fix clang report on list use 08/7608/2
Antonio Borneo [Fri, 14 Apr 2023 22:25:54 +0000 (00:25 +0200)]
target/espressif: fix clang report on list use

It looks like a false positive.
Scan-build considers as possible to:
- have list_empty() return false;
- list_for_each_safe() to not execute any loop, thus not assigning
  a non-NULL value to 'block';
- the NULL pointer 'block' is passed to list_del().
This is not possible because with list_empty(), the loop runs at
least once.

Rewrite the function to simplify the code and making it easier for
scan-build to check it.

This also drops an incorrect use of list_for_each_safe(), where
the 'safe' version was not required.

Change-Id: Ia8b1d221cf9df73db1196e3f51986023dcaf78eb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 8d1dcf293a0c ("target/espressif: add application tracing functionality over JTAG")
Reviewed-on: https://review.openocd.org/c/openocd/+/7608
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
12 months agotarget/espressif: fix clang report on use of garbage value 07/7607/2
Antonio Borneo [Fri, 14 Apr 2023 22:21:42 +0000 (00:21 +0200)]
target/espressif: fix clang report on use of garbage value

When the function xtensa_queue_dbg_reg_read() returns error, the
array 'tmp' remains not initialized and scan-build complains while
computing buf_get_u32() that:
Result of operation is garbage or undefined

Check the returned value of xtensa_queue_dbg_reg_read() and
propagate it.

Change-Id: If0aaad068b97ef0a76560e262d16429afd469585
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 8d1dcf293a0c ("target/espressif: add application tracing functionality over JTAG")
Reviewed-on: https://review.openocd.org/c/openocd/+/7607
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
12 months agosrc: fix clang15 compiler warnings 69/7569/3
Erhan Kurubas [Sat, 1 Apr 2023 22:26:51 +0000 (00:26 +0200)]
src: fix clang15 compiler warnings

Below warnings are fixed.

1- A function declaration without a prototype is deprecated in all
versions of C [-Werror,-Wstrict-prototypes]

2- error: variable set but not used [-Werror,-Wunused-but-set-variable]

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I1cf14b8e5e3e732ebc9cacc4b1cb9009276a8ea9
Reviewed-on: https://review.openocd.org/c/openocd/+/7569
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
12 months agoserver/ipdbg: add error checks after allocating memory 05/7605/2
Daniel Anselmi [Tue, 11 Apr 2023 08:18:33 +0000 (10:18 +0200)]
server/ipdbg: add error checks after allocating memory

Change-Id: Icf18a855eb66d2b09789a9ee27f5fbc4cd9afc89
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7605
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agotcl/target: renesas gen3 Set target to armv8r for Cortex-R52 05/6805/4
Julien Massot [Wed, 12 Jan 2022 08:53:06 +0000 (09:53 +0100)]
tcl/target: renesas gen3 Set target to armv8r for Cortex-R52

Cortex-R52 is an ARMv8-R processor supporting only
AArch32 Profile.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change-Id: I663ae4bf1d3026d7c9e4c5950a79e7ddf1bd6564
Reviewed-on: https://review.openocd.org/c/openocd/+/6805
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agoaarch64: Add support for ARMv8-R 43/6843/2
Julien Massot [Tue, 1 Feb 2022 12:44:05 +0000 (13:44 +0100)]
aarch64: Add support for ARMv8-R

ARMv8-R platforms are similar to ARMv8-A regarding
JTAG and most cpu registers. ARMv8-R doesn't has MMU
but has MPU instead.

ARMv8-R platforms can be AArch32 only such as Cortex-R52,
or AArch64 capable like Cortex-R82.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change-Id: Ib086f71685d1e3704b396d478ae9399dd8a391e1
Reviewed-on: https://review.openocd.org/c/openocd/+/6843
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agotarget:armv8: aarch32 do not try to restore same EL 07/6807/3
Julien Massot [Wed, 12 Jan 2022 13:10:36 +0000 (14:10 +0100)]
target:armv8: aarch32 do not try to restore same EL

While debugging a Cortex-R52 OpenOCD fail to restore context
on line
retval = dpm->instr_write_data_r0(dpm,
ARMV8_MSR_GP_xPSR_T1(1, 0, 15), cpsr);

which trigger this exception:

aarch64.c:1206 aarch64_restore_context(): r8a779a0.r52
armv8_dpm.c:560 armv8_dpm_modeswitch(): restoring mode, cpsr = 0x0000011f
1262753 armv8_dpm.c:598 armv8_dpm_modeswitch(): target_el = 1, last_el = 1
armv8_dpm.c:611 armv8_dpm_modeswitch(): SPSR = 0x0000011f
armv8_dpm.c:260 dpmv8_exec_opcode(): Opcode 0x8f00f390, DSCR.ERR=1, DSCR.EL=1

and finally OpenOCD doesn't succeed to restore the processor.

This check 'dpm->last_el != target_el' exist for aarch64,
so might be correct for aarch32 too.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change-Id: I41d1006233251dcaf6d69bda580488b204b7eb63
Reviewed-on: https://review.openocd.org/c/openocd/+/6807
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>

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)