openocd.git
14 months agortos/nuttx: move stacking info to the new nuttx stackings file 50/7250/5
Erhan Kurubas [Wed, 5 Oct 2022 15:59:54 +0000 (17:59 +0200)]
rtos/nuttx: move stacking info to the new nuttx stackings file

Other OSes have separate files to keep stack register offsets.
Adding them for NuttX as well will provide a clearer way to expand.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I1428fefefa199a95431f2073c0279dd7028ad8da
Reviewed-on: https://review.openocd.org/c/openocd/+/7250
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agodoc:usb_adapters: add lsusb dump of esp_usb_jtag 40/7440/3
Erhan Kurubas [Fri, 20 Jan 2023 17:33:43 +0000 (18:33 +0100)]
doc:usb_adapters: add lsusb dump of esp_usb_jtag

Also, esp_usb_jtag added to the supported driver list of
"adapter serial" command.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie65cbf9b44f5de6d7995102d1a281161468f6103
Reviewed-on: https://review.openocd.org/c/openocd/+/7440
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agodoc: fix broken link to IgnoreHardwareSerialNumber in README.Windows 39/7439/3
N S [Thu, 19 Jan 2023 05:58:43 +0000 (21:58 -0800)]
doc: fix broken link to IgnoreHardwareSerialNumber in README.Windows

   URL for Microsoft documentation on IgnoreHardwareSerialNumber
   redirects to generic USB driver landing page instead of specific
   article. Update link to go to correct page.

Signed-off-by: N S <nlshipp@yahoo.com>
Change-Id: Ifac6c730a1438242cdfe0a0a2867e043e03ceec7
Reviewed-on: https://review.openocd.org/c/openocd/+/7439
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agostm32f3x: Allow overriding the flash bank size 38/7438/2
Andreas Fritiofson [Wed, 18 Jan 2023 08:23:32 +0000 (09:23 +0100)]
stm32f3x: Allow overriding the flash bank size

Same mechanism as in stm32f1x.cfg reused here.

Change-Id: I81f02feb2b655e8259341b22180f3a8b82e28d05
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7438
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agohelper: Add generic little endian CRC32 function 15/7415/3
Marian Buschsieweke [Thu, 22 Dec 2022 12:20:07 +0000 (13:20 +0100)]
helper: Add generic little endian CRC32 function

This generalizes the little endian CRC32 function used in the OR1K
target and moves it to a common helper, so that other places do not need
to reinvent the wheel. It is directly used in the OR1K target.

Change-Id: I0e55340281a5bfd80669bb1994f3a96fecc1248a
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7415
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/psoc4: drop jtag_poll_mask() from flash write 62/7162/2
Tomas Vanek [Sun, 4 Sep 2022 12:18:26 +0000 (14:18 +0200)]
flash/nor/psoc4: drop jtag_poll_mask() from flash write

Polling the target makes no harm during PSoC 4 flash write in the current
OpenOCD code. Don't mask it.

Change-Id: I6625ded0162ee3a96b92188844d0d2d6c30101c2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7162
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag: hla: use generic helper for commands 'jtag newtap' 'swd newdap' 28/7428/2
Antonio Borneo [Sun, 1 Jan 2023 18:17:18 +0000 (19:17 +0100)]
jtag: hla: use generic helper for commands 'jtag newtap' 'swd newdap'

The commands 'jtag newtap' and 'swd newdap' have to work either on
HLA transport and on standard JTAG/SWD. Having a dedicated
implementation for HLA is a non-sense.

Reuse the generic code jim_jtag_newtap() and drop the files
hla_tcl.[ch] as they are now empty.

Change-Id: I9dabbdc2a6f338f23b2fd3ed1a4dc3da0200c080
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7428
Tested-by: jenkins
15 months agojtag: parse command options in 'swd newdap' 27/7427/2
Antonio Borneo [Sun, 1 Jan 2023 17:26:53 +0000 (18:26 +0100)]
jtag: parse command options in 'swd newdap'

The same code is currently used for commands 'jtag newtap' and
'swd newdap' (plus dapdirect versions), but for SWD case the code
skips the parsing of the command line as not every flag is used.
This has the drawback that syntax errors get unchecked.

Move the check about the transport so the command line get always
parsed even when the corresponding flags are not useful.

Change-Id: I596c3beb04e9e8a9ebe6ee68a61395b679d43b3e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7427
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
15 months ago.gitignore: Add .cache and compile_commands.json 14/7414/2
Marian Buschsieweke [Wed, 21 Dec 2022 10:00:53 +0000 (11:00 +0100)]
.gitignore: Add .cache and compile_commands.json

Enhancing the editor / IDE experience with the use of the language
server protocol (lsp) is getting more and more common. The most widely
used lsp implementation for C/C++ outside of Redmond is clangd.

Clangd uses compile_commands.json, that contains the compiler invocation
for each compilation unit, to get the required $CFLAGS to successfully
located header files etc. This is best automatically generated from with
bear on Makefile based build systems. Hence, there is little value in
adding it to the git repo.

In addition, clangd generates cache files in the .cache folder. Again,
there is no reason in tracking it with git.

Change-Id: Ic5165d10aca3a1cc9e9398af9dd2fbf0977608b3
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7414
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/stm32l4x: Add revision 'X' and 'C' for STM32U575/585 devices 90/7390/2
Marc Schink [Wed, 7 Dec 2022 12:13:04 +0000 (13:13 +0100)]
flash/nor/stm32l4x: Add revision 'X' and 'C' for STM32U575/585 devices

Change-Id: I4d950dc0a1421036418f2e5c1f0ed8eca86efc1a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7390
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotcl/target: enable -rtos hwthread 84/7384/2
Antonio Borneo [Mon, 28 Nov 2022 23:34:44 +0000 (00:34 +0100)]
tcl/target: enable -rtos hwthread

The rtos hwthread has been merged in 2019 with commit 85ba2dc4c6ab
("rtos/hwthread: add hardware-thread pseudo rtos").
During review in patchset 19 the name of the rtos has been changed
from 'hawt' to 'hwthread'.

Some target config file was already merged ready for hwthread, but
keeping the relevant lines commented and still reporting the old
name.

Enable rtos hwtread to the target that were supposed to use it.
Fix the name of the rtos.

Change-Id: I877862dcdba39f26462bb542bac06d1a5f5f222d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7384
Tested-by: jenkins
15 months agojtag/drivers/cmsis_dap: prevent conn/discon workaround before line reset 81/7381/2
Tomas Vanek [Thu, 24 Nov 2022 13:21:59 +0000 (14:21 +0100)]
jtag/drivers/cmsis_dap: prevent conn/discon workaround before line reset

The line reset SWD sequence is used quite often in SWD multidrop mode.
Prevent the ugly connect/disconnect adapter firmware bug workaround
to be called before each line reset.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Id85bff075dba9077e4e501e2cdcfd64d5d9d0531
Reviewed-on: https://review.openocd.org/c/openocd/+/7381
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: speed up long transfers using DAP_TransferBlock 72/7372/4
Tomas Vanek [Tue, 22 Nov 2022 11:29:52 +0000 (12:29 +0100)]
jtag/drivers/cmsis_dap: speed up long transfers using DAP_TransferBlock

DAP_TransferBlock command saves n - 3 bytes in comparison to DAP_Transfer,
where n is number of transfers.

Use DAP_TransferBlock optionaly to save some USB bandwidth.

The change increases the speed of the write transfer
from 40 KiB/s to 42 KiB/s @ USB FS, adapter speed 1000.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ifde0159cfd44481d2b81b90daa088e731c03e26d
Reviewed-on: https://review.openocd.org/c/openocd/+/7372
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: improve USB packets filling 64/7364/4
Tomas Vanek [Sat, 19 Nov 2022 06:21:10 +0000 (07:21 +0100)]
jtag/drivers/cmsis_dap: improve USB packets filling

DAP write transaction occupies 5 bytes of a command packet.
DAP read transaction needs just one byte in a command packet
and expect 4 bytes in a response.

The fixed maximal number of transactions in a packet caused
packet filling less than optimal.

Compute both command and expected response sizes based on
read or write direction of each transaction.
Run the queue if one of sizes does not fit into a packet.

The change increases the speed of the mostly read transfer
from 36 KiB/s to almost 40 KiB/s @ USB FS, adapter speed 1000
due to reduction of adapter inserted RDBUFF reads.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib70812600eaae0403b8ee8673b6f897348496569
Reviewed-on: https://review.openocd.org/c/openocd/+/7364
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: introduce packet_usable_size 63/7363/4
Tomas Vanek [Sat, 19 Nov 2022 06:16:30 +0000 (07:16 +0100)]
jtag/drivers/cmsis_dap: introduce packet_usable_size

USB bulk backend needs to avoid zero sized USB packets
sent after each full sized packed for performance reasons.

HID backend uses fixed size HID reports so the full size
of the report can be utilized.

Introduce packet_usable_size to reflect it.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I34094c9edac5730624480711cbd6aa65883c47c7
Reviewed-on: https://review.openocd.org/c/openocd/+/7363
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: use unsigned types 62/7362/4
Tomas Vanek [Sat, 19 Nov 2022 06:08:32 +0000 (07:08 +0100)]
jtag/drivers/cmsis_dap: use unsigned types

Not all variables converted, JTAG part is left as is.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ie9cc890769a2f53cb3a07fd457030e1b98910d44
Reviewed-on: https://review.openocd.org/c/openocd/+/7362
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: use dap parameter instead of cmsis_dap_handle 61/7361/3
Tomas Vanek [Sat, 19 Nov 2022 06:08:32 +0000 (07:08 +0100)]
jtag/drivers/cmsis_dap: use dap parameter instead of cmsis_dap_handle

Replace the direct dereference of cmsis_dap_handle by dereference
of the dap function parameter wherever possible.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I32601dbe0270267642720a8524706aa76d187c3b
Reviewed-on: https://review.openocd.org/c/openocd/+/7361
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: move pending request FIFO 60/7360/3
Tomas Vanek [Sat, 19 Nov 2022 05:57:56 +0000 (06:57 +0100)]
jtag/drivers/cmsis_dap: move pending request FIFO

Move all pending request FIFO related variables to
the struct cmsis_dap

Pure refactoring, no functional changes.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I2cea9c1e265ac102ec0f314767b8b9afdcda9ee9
Reviewed-on: https://review.openocd.org/c/openocd/+/7360
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotools: add disassembler helper for files .inc 47/7347/3
Antonio Borneo [Sun, 13 Nov 2022 14:46:19 +0000 (15:46 +0100)]
tools: add disassembler helper for files .inc

We are moving the binary helpers in files .inc in contrib/loaders/
but we have no support to disassemble them for checking their
content, nor documentation to give any hint.

Add a simple script that uses objdump to directly disassemble a
file .inc
Use Cortex-M settings as default, but provide the flexibility to
reuse the script for any other target CPU.

Change-Id: I12e79580f2936b1622fb7231d9a2484a763ba72a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7347
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
15 months agodoc: usb_adapters: add other adapters 98/7298/3
Antonio Borneo [Sat, 22 Oct 2022 15:58:28 +0000 (17:58 +0200)]
doc: usb_adapters: add other adapters

Mainly get from web or from OpenOCD users

Change-Id: Id4d6354bc9b6972622adfacf3549c7c3e0549bc2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7298
Tested-by: jenkins
15 months agodoc: usb_adapters: add lsusb dump of few adapters 97/7297/3
Antonio Borneo [Sat, 22 Oct 2022 16:16:59 +0000 (18:16 +0200)]
doc: usb_adapters: add lsusb dump of few adapters

Real dumps from adapters I have access to.
Serial numbers have been manually edited but are still consistent.

Change-Id: Iee2d16e09615746e29588f91fdfb77eb9fad4daa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7297
Tested-by: jenkins
15 months agodoc: usb_adapters: add container for lsusb dump of adapters 96/7296/3
Antonio Borneo [Sat, 22 Oct 2022 16:12:16 +0000 (18:12 +0200)]
doc: usb_adapters: add container for lsusb dump of adapters

When extending an existing adapter driver, developer has to
carefully avoid to break backward compatibility.
But not all developers have access to many adapters for testing.

Prepare a folder aimed at containing 'lsusb -v' dumps of adapters
to be used as reference.
Add documentation and a simple dump script.

Change-Id: Ia3a9132d65ec8869734721f9605cebcebcf33608
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7296
Tested-by: jenkins
15 months agoflash/nor, contrib/loaders: move numicro M0 write assembly to contrib/loaders 46/7346/3
Jian-Hong Pan [Sun, 13 Nov 2022 04:43:14 +0000 (12:43 +0800)]
flash/nor, contrib/loaders: move numicro M0 write assembly to contrib/loaders

Simply move numicro M0 flash write assembly to contrib/loaders. Also,
modify corresponding Makefile and generated numicro_m0.inc.

To make the path more general, this patch rename the path
"contrib/loaders/flash/numicro_m4" to "contrib/loaders/flash/numicro" as
well.

Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I9adea24c2b3c97319a9b015cf50257f3d131dc26
Reviewed-on: https://review.openocd.org/c/openocd/+/7346
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor, contrib/loaders: move numicro M4 write assembly to contrib/loaders 43/7343/3
Jian-Hong Pan [Wed, 9 Nov 2022 16:14:10 +0000 (00:14 +0800)]
flash/nor, contrib/loaders: move numicro M4 write assembly to contrib/loaders

Simply move numicro M4 flash write assembly to contrib/loaders. Also,
add corresponding Makefile and generated numicro_m4.inc.

Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I22b8be0a245857335b11bd0b538db415fc34748d
Reviewed-on: https://review.openocd.org/c/openocd/+/7343
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotcl: add a configuration file for Nuvoton M541 & NUC442/472 series 30/7330/7
Zale Yu [Fri, 4 Nov 2022 15:07:29 +0000 (23:07 +0800)]
tcl: add a configuration file for Nuvoton M541 & NUC442/472 series

This patch is picked from the tcl part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
to support the communication with Nuvoton's Cortex-M4 chips: M541 &
NUC442/472 series.

This patch has been tested with Nuvoton's NuTiny-SDK-NUC472 development
board [2].

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705
[2]: https://www.nuvoton.com/export/resource-files/UM_NuTiny-SDK-
     NUC472_EN_Rev1.02.pdf

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I27ac58dd1c98a76e791a4f1117c31060cf5522e8
Reviewed-on: https://review.openocd.org/c/openocd/+/7330
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash: support Nuvoton M541 & NUC442/472 series 29/7329/7
Zale Yu [Sun, 6 Nov 2022 15:32:22 +0000 (23:32 +0800)]
flash: support Nuvoton M541 & NUC442/472 series

This patch is picked from the flash part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
to support flashing Nuvoton's Cortex-M4 chips: M541 & NUC442/472 series.

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I9dc69eccb851df14c1b0ce2f619d7b3da0aa92aa
Reviewed-on: https://review.openocd.org/c/openocd/+/7329
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/numicro: reorder the parts list 39/7339/3
Zale Yu [Sun, 6 Nov 2022 14:54:37 +0000 (22:54 +0800)]
flash/nor/numicro: reorder the parts list

This patch is picked from the flash part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
It reorders Nuvoton MCU part list and spreads out the way to define the
banks' base address & size of the parts.

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I1f21f54dfdf53e5b8ea04d803347d1dbc8c321a0
Reviewed-on: https://review.openocd.org/c/openocd/+/7339
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/armv7m: Rename xPSR to xpsr 92/7292/2
Boris-Chengbiao Zhou [Wed, 26 Oct 2022 01:10:17 +0000 (03:10 +0200)]
target/armv7m: Rename xPSR to xpsr

The org.gnu.gdb.arm.m-system GDB feature defines the name in lowercase
letters.[1] Not adhering to the definition can cause issues with tools
interacting with the GDB which expect the correct casing.

[1]: https://sourceware.org/gdb/onlinedocs/gdb/ARM-Features.html

Change-Id: I0b6584a78f86b053947d79686baad5dac3ec4a00
Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7292
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/stm32l4x: avoid multiple assignments 82/7282/2
Tarek BOCHKATI [Thu, 20 Oct 2022 19:48:48 +0000 (20:48 +0100)]
flash/stm32l4x: avoid multiple assignments

Change-Id: I6d8e0fbfa7e05f26295fc22733c65c11f7460b51
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7282
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
15 months agoadapter: Improve three adapter-related prints 69/7269/3
Jan Matyas [Mon, 17 Oct 2022 06:24:05 +0000 (08:24 +0200)]
adapter: Improve three adapter-related prints

- Do not warn the user about adapter speed not being set
  if the selected adapter does not support configurable speed.
  This would be confusing to users.

- Minor reword in the "adapter speed is not selected" warning.

- Print the adapter name in the "adapter doesn't support
  configurable speed" log entry

- Another minor reword: autoselect --> autoselecting

Signed-off-by: Jan Matyas <matyas@codasip.com>
Change-Id: I4c198b547544fd8199921f092153562c5f159134
Reviewed-on: https://review.openocd.org/c/openocd/+/7269
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoriscv: drop deprecated command 'riscv test_sba_config_reg' 72/7272/2
Antonio Borneo [Mon, 17 Oct 2022 10:34:23 +0000 (12:34 +0200)]
riscv: drop deprecated command 'riscv test_sba_config_reg'

Change-Id: I51c1b1cb3de8cb86ee38280fa3f035f6f7a63dbc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7272
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
Tested-by: jenkins
15 months agoriscv: drop deprecated command 'riscv set_prefer_sba' 71/7271/2
Antonio Borneo [Mon, 17 Oct 2022 10:28:57 +0000 (12:28 +0200)]
riscv: drop deprecated command 'riscv set_prefer_sba'

Change-Id: I546efe4e1a6b673b26cfb4a74b5c3809fecda49c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7271
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
15 months agotcl/target: remove rp2040-core0.cfg 26/7326/2
Tomas Vanek [Thu, 3 Nov 2022 09:32:36 +0000 (10:32 +0100)]
tcl/target: remove rp2040-core0.cfg

rp2040-core0.cfg configuration file was intended for a special adapter
which selects a SWD multidrop target on its own. This means
that rp2040-core0.cfg is totally unusable with a standard SWD
adapter. The file was marked as deprecated in 0.12 release.

The reworked rp2040.cfg can be restricted to use just one core:
  openocd ... -c 'set USE_CORE 0' -f target/rp2040.cfg

Remove the obsoleted config.

Change-Id: Id886471622bb4a8cb83f5c4c3660657407aaaf74
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7326
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotcl/target: add SMP mode to rp2040.cfg 42/7242/6
Tomas Vanek [Sun, 2 Oct 2022 12:46:11 +0000 (14:46 +0200)]
tcl/target: add SMP mode to rp2040.cfg

Add the variable selected configuration for SMP debug with rtos hwthread.

Use SMP by default.

Change-Id: I1c37d91688a3ab58d65c15686737892965711adc
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7242
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/rp2040: make SPI flash ID detection optional 41/7241/6
Tomas Vanek [Sun, 2 Oct 2022 09:21:42 +0000 (11:21 +0200)]
flash/nor/rp2040: make SPI flash ID detection optional

Do not read ID from SPI flash and suppress autodetection
if non-zero flash bank size is configured.

Change-Id: Idcf9ee6ca17f9fa89964a60da7bf11e47b4af5e7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7241
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/cortex_m: add SMP support for Cortex-M 39/7239/5
Tomas Vanek [Sat, 1 Oct 2022 15:10:31 +0000 (17:10 +0200)]
target/cortex_m: add SMP support for Cortex-M

Cortex-M support for SMP multicore targets.

This SMP implementation unlike older ones does not act
on the first halted target found. It polls targets
until a SMP group is finished and stores eventual
'halted' events instead of emitting them. As soon as polling
of a group is done, poll proceeds with SMP related tasks.
This approach improves detection of a reason why debug
stopped - a correct reason is detected for all targets,
not only for the first found.
Drawback: SMP target group should be defined in the same
order as the targets were defined.

Obsolete gdb 'J' packet/smp_gdb command core switching is not implemented,
use with rtos hwthread.

Only one core is resumed if debug_execution is requested.

Some ideas taken from Graham Sanderson's [4936]
and src/target/aarch64.c

Added error checking of armv7m_restore_context().

Change-Id: I60f5b79e74b624dc2b5835ff10e38ac2ccb23792
Link: [4936]: target/cortex_m: Add smp support for Cortex M | https://review.openocd.org/c/openocd/+/4936
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7239
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/armv7m: check error in armv7m_restore_context() 38/7238/4
Tomas Vanek [Sat, 1 Oct 2022 15:00:51 +0000 (17:00 +0200)]
target/armv7m: check error in armv7m_restore_context()

Return error if arm.write_core_reg() fails.

Change-Id: Ide8f5aa5958532b202dc9f5e13d3250a706d832d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7238
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoarmv8: Add support of pointer authentication 48/7248/4
Koudai Iwahori [Tue, 4 Oct 2022 11:21:35 +0000 (04:21 -0700)]
armv8: Add support of pointer authentication

When pointer authentication is enabled, some upper bits of the link
register (LR[63:VA_SIZE]) are used to store a signature. Therefore, GDB
need to remove the signature to get backtraces.
GDB has support of pointer authentication. When pointer authenticaion is
enabled, GDB requests 8-bytes mask to the target to remove the
signature. mask[63:VA_SIZE] should be all set and mask[VA_SIZE-1:0]
should be all cleared. GDB removes the signature by addr&~mask or
addr|mask.
I added a feature to provide the mask for pointer authentication.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: I56fbbf9cc23619b6536ecd326f350c8bf137f322
Reviewed-on: https://review.openocd.org/c/openocd/+/7248
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agosrc/rtos/eCos : Support per-build configuration specific structure layouts 75/6275/13
James G. Smith [Wed, 26 May 2021 09:08:26 +0000 (10:08 +0100)]
src/rtos/eCos : Support per-build configuration specific structure layouts

Extended feature. This is a large patch, but is self-contained to the
eCos support and does not affect any other openocd functionality. It
does NOT affect existing eCos RTOS plugin users where their
applications do not provide the extended symbolic helper
information. If the helper symbols are not available the rtos support
code will behave as before. This "dynamic" functionality is *required*
because eCos does NOT have a fixed/hardwired, known, layout for the
thread descriptor structure. The per-application build eCos
configuration can affect the shape of the thread descriptor structure
(field presence, and hence offsets of subsequent fields) such that
constant values cannot be used to consistently interpret all possible
eCos application configurations. For historical reasons, there is not
yet a consistent namespace for the helper symbols across eCos HALs
hence the support is currently limited to specific architectures
(Cortex-M and ARM/Cortex-A). No new Clang analyser warnings are raised
by this changeset.

Change-Id: Ib3a36877326eeb56595cbca55e21b9e59a59c98a
Signed-off-by: James G. Smith <jsmith@rallysmith.co.uk>
Reviewed-on: https://review.openocd.org/c/openocd/+/6275
Reviewed-by: Alex Schuilenburg <alex.schuilenburg@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
15 months agoflash/nor/spi: Add issi is25lq040b to device list 35/7135/9
Fawaz Tirmizi [Fri, 19 Aug 2022 21:22:06 +0000 (14:22 -0700)]
flash/nor/spi: Add issi is25lq040b to device list

The HiFive Inventor uses this flash chip, so adding it will allow for
openocd to be used to program it. These values were taken from the
chip's documentation.

Signed-off-by: Fawaz Tirmizi <fawaz@rivosinc.com>
Change-Id: I15c9d35f99d4500f73134cdc2d1b9ab6279b491c
Reviewed-on: https://review.openocd.org/c/openocd/+/7135
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/xtensa: remove needless target_was_examined check 31/7231/2
Erhan Kurubas [Wed, 28 Sep 2022 22:22:00 +0000 (00:22 +0200)]
target/xtensa: remove needless target_was_examined check

In any case flag will be set as examined.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I5177ee656f726a807269e2f4725223f50e49e855
Reviewed-on: https://review.openocd.org/c/openocd/+/7231
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/avrf: add ATmega32U4 support 81/7081/2
Kyle Schwarz [Sun, 10 Jul 2022 19:58:14 +0000 (15:58 -0400)]
flash/nor/avrf: add ATmega32U4 support

Add new chip info and tcl target

Change-Id: Ib9d33d1b145a8659857b7a6cc9c5acba047f41d1
Signed-off-by: Kyle Schwarz <zeranoe@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7081
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoopenocd: revert workarounds for 'expr' syntax change 05/7405/2
Antonio Borneo [Sun, 18 Dec 2022 18:15:57 +0000 (19:15 +0100)]
openocd: revert workarounds for 'expr' syntax change

With OpenOCD v0.12.0 released, drop the workarounds for 'expr'
syntax change by reverting:
- commit 320043c054dc ("openocd: fix for polling during "expr"
  computation");
- commit c7eaaf620488 ("openocd: prepare for jimtcl 0.81 'expr'
  syntax change").

Replace the call to target_call_timer_callbacks_now() with call
to target_call_timer_callbacks().

Change-Id: Iae5afc50e3f688e11176a52648efc9a6577a9a11
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7405
Tested-by: jenkins
15 months agonds32: drop it, together with aice adapter driver 82/7382/2
Antonio Borneo [Mon, 19 Sep 2022 21:14:41 +0000 (23:14 +0200)]
nds32: drop it, together with aice adapter driver

The target nds32 and its companion adapter aice have not received
any real improvement since 2013.
It has been hard to keep them aligned during the evolution of
OpenOCD code, with no way for maintainers to really check if they
are still working.
No real documentation is present for them in OpenOCD.
The nds32 code triggers ~50 errors/warnings with scan-build.

The arch nds32 has been dropped from Linux kernel v5.18-rc1.

For all the reasons above, this code has been deprecated with
commit 2e5df83de7f2 ("nds32: deprecate it, together with aice
adapter driver") and tagged to be dropped before v0.13.0.

Let it r.i.p. in OpenOCD git history.

While there, drop from checkpatch list the camelcase symbols that
where only used in this code.

Change-Id: Ide52a217f2228e9da2f1cc5036c48f3536f26952
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7382
Tested-by: jenkins
15 months agoDeprecate libjaylink Git submodule 29/7129/2
Marc Schink [Sun, 22 May 2022 14:15:00 +0000 (16:15 +0200)]
Deprecate libjaylink Git submodule

libjaylink was integrated into OpenOCD as a Git submodule, because at
that time there was no official release and no packages for it.
Today there are libjaylink packages for most popular distributions [1].

Removing libjaylink from OpenOCD reduces build complexity in both
projects and makes them more flexible with respect to the build system,
for example.

Disable the libjaylink submodule by default and announce it as
deprecated feature that will be removed in the future. This gives
package maintainers time to package libjaylink if not already done.

[1] https://repology.org/project/libjaylink/versions

Change-Id: I6166ba4757aee5c89a0506de867072f58fa5ec4b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7129
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoRestore normal development cycle
Paul Fertser [Sat, 14 Jan 2023 23:33:06 +0000 (02:33 +0300)]
Restore normal development cycle

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
15 months agoThe openocd-0.12.0 release v0.12.0
Paul Fertser [Sat, 14 Jan 2023 20:14:31 +0000 (23:14 +0300)]
The openocd-0.12.0 release

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
15 months agoconfigure.ac: fix check for jimtcl submodule 37/7437/2
Antonio Borneo [Sat, 14 Jan 2023 14:18:02 +0000 (15:18 +0100)]
configure.ac: fix check for jimtcl submodule

The file configure.ac checks if jimtcl submodule is present by
looking for the file jimtcl/configure.ac .
But jimtcl has switched to its own build system in 2011 and thus
dropped configure.ac . This cause a build issue on OpenOCD that
was incorrectly fixed by adding a dummy configure.ac in jimtcl.

Fix OpenOCD configure.ac to look for the correct file
jimtcl/configure .
After this fix, another fix would be proposed to jimtcl to drop
its useless dummy file configure.ac .

Change-Id: I705f72d83e374c8dd700baaa0c0bbe041f153605
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7437
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
15 months agojtag: esp_usb_jtag: remove macro __packed 35/7435/2
Antonio Borneo [Fri, 6 Jan 2023 11:40:01 +0000 (12:40 +0100)]
jtag: esp_usb_jtag: remove macro __packed

In FreeBSB 13.0 the build fails due to redefined macro __packed.

src/jtag/drivers/esp_usb_jtag.c:19:9: error: '__packed' macro
    redefined [-Werror,-Wmacro-redefined]
#define __packed __attribute__((packed))
        ^
/usr/include/sys/cdefs.h:223:9: note: previous definition is here
#define __packed        __attribute__((__packed__))
        ^
1 error generated.

Drop the macro and align the code with the other files in OpenOCD
project, where the attribute is directly applied without using a
macro.

Change-Id: I89ae943e77036206d40d4d54172cd4a73e76e5c5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Wojciech Puchar <wojtek@puchar.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/7435
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
15 months agortt: fix corner-cases of finding control block 29/7429/2
Marcin Niestroj [Mon, 2 Jan 2023 07:04:06 +0000 (08:04 +0100)]
rtt: fix corner-cases of finding control block

This patch fixes two corner-cases of finding RTT control block.

The first one is when there was a partial match (even single byte) at
the end of loaded buffer (uint8_t buf[1024]), but this was not part of
full match. In that case `cb_offset` was not updated correctly and the
returned `*address` was lower by the legth of the partial match. In case
of searched 'SEGGER RTT' (the default control block ID) string, it was
enough to match `buf[1023] == 'S'`, which is quite likely to happen, and
the `*address` was offset by 1 (e.g. it was 0x20000fff instead of
0x20010000).

Updating (or even maintaining) `cb_offset` is not needed, as start
address of control block can be calculated based on memory address that
was loaded into `uint8_t buf[1024]`, the offset within this buffer and
the length of expected string.

The second issue is when control block is prepended with a byte that
matches first ID character, e.g. there is `SEGGER RTT` control block ID
is prepended by another `S`, making memory contents be `SSEGGER RTT`. In
that case there was no match found.

Fix that issue by making sure that tested byte is always compared with
first byte of expected control block ID.

While at it, change names of local variables to better describe their
meaning.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Change-Id: I12aa6e202bf12bedcbb888ab595751a2a2518a24
Reviewed-on: https://review.openocd.org/c/openocd/+/7429
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agoRestore +dev suffix
Paul Fertser [Tue, 20 Dec 2022 12:49:44 +0000 (15:49 +0300)]
Restore +dev suffix

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
16 months agoThe openocd-0.12.0-rc3 release candidate 51/7351/2 v0.12.0-rc3
Antonio Borneo [Tue, 15 Nov 2022 21:46:27 +0000 (22:46 +0100)]
The openocd-0.12.0-rc3 release candidate

Change-Id: Id7ddf232593e1aa7cb36f2b30fe832ebf79c1535
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agocortex_m: handle armv8m cores without security extension 02/7402/2
Antonio Borneo [Wed, 14 Dec 2022 14:54:53 +0000 (15:54 +0100)]
cortex_m: handle armv8m cores without security extension

Cores armv8m, e.g. Cortex-M33, can be instantiated without the
optional Security Extension.
In this case, the secure registers are not present and when GDB
try accessing them it triggers a set of errors.

For armv8m cores without security extension, don't provide to GDB
the description of the secure registers.

Change-Id: I254478a4cf883e85b786df3f62c726b2f40d88d9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7402
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
16 months agojtag: fix build with configure --enable-verbose 03/7403/2
Antonio Borneo [Sat, 17 Dec 2022 22:05:23 +0000 (23:05 +0100)]
jtag: fix build with configure --enable-verbose

With flag --enable-verbose, configure enables compiling some
conditional code that with new gcc triggers an error:
error: '%04x' directive output may be truncated writing
between 4 and 8 bytes into a region of size 5
[-Werror=format-truncation=]

Extend the buffer to contain the full 8 bytes of %04x on a 'int'
and change the limit in snprintf.
Skip the intermediate buffer 's[4]'.
Align the code to the coding style.

Change-Id: Ifc8a6e4686555578a7355a1f6049471fd5e31913
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Karl Hammar <karl@aspodata.se>
Reported-by: Tommy Murphy <tommy_murphy@hotmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/376/
Reviewed-on: https://review.openocd.org/c/openocd/+/7403
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
16 months agoat91samd: wait for nvm ready 91/7391/4
Dan Stahlke [Mon, 5 Dec 2022 02:12:16 +0000 (18:12 -0800)]
at91samd: wait for nvm ready

Flashing a SAMD21J17D was failing during NVM erase.  The samd21
datasheet specifies that one cause of error conditions is executing an
NVM command while the previous command is still running.  The solution
is to wait for INTFLAG.READY after a command is issued.

SAMD21J17A was not exhibiting this problem.  Perhaps the later silicon
revision has slower NVM erase times.

Signed-off-by: Dan Stahlke <dan@stahlke.org>
Change-Id: I19745dae4d3fc6e3a7611dcac628e067cb41e0f0
Reviewed-on: https://review.openocd.org/c/openocd/+/7391
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
16 months agodriver: vdebug: fix mode of cmd 'vdebug mem_path' 95/7395/2
Antonio Borneo [Sun, 11 Dec 2022 10:08:32 +0000 (11:08 +0100)]
driver: vdebug: fix mode of cmd 'vdebug mem_path'

The command 'vdebug mem_path' is reported in the documentation as
'{Config Command}', but the code sets mode = COMMAND_ANY.
The code of the commands sets some value that is only used during
the init phase, so the documentation is correct.

Change mode of command 'vdebug mem_path' to COMMAND_CONFIG.

Change-Id: Icb940fe382cbc75015273b35dcc8a88fc2a7d0ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7395
Tested-by: jenkins
Reviewed-by: Jacek Wuwer <jacekmw8@gmail.com>
16 months agotarget: fix assert in 'monitor profile' on constant PC 00/7400/3
Antonio Borneo [Wed, 14 Dec 2022 14:21:43 +0000 (15:21 +0100)]
target: fix assert in 'monitor profile' on constant PC

When target is stopped in WFI/WFE or is in an infinite loop, the
sampled PC will always return the same value.
Command 'profile' requires that distance between min and max PC
should be at least 2, which is not the case for constant PC, and
incorrectly enforces the check through as assert().

Move the code that reads the optional parameters 'start' and 'end'
and check the gap 'end - start' before running the profile.
For self-computed min and max, increase max (or decrease min) to
match the required constraint.
Drop the assert().

Change-Id: I2be8df8568ce8c889923888c492e4f7ce354b16b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/370/
Reviewed-on: https://review.openocd.org/c/openocd/+/7400
Tested-by: jenkins
16 months agotarget: fix unsigned computation in 'monitor profile' 94/7394/2
Antonio Borneo [Sun, 11 Dec 2022 09:11:58 +0000 (10:11 +0100)]
target: fix unsigned computation in 'monitor profile'

The implementation of command 'monitor profile' has few
issues:
- the address_space is a signed int, so cannot wrap-around on
  space over INT_MAX;
- max address is incremented without check for overflow;
- assert() used on errors instead of returning error codes;
- only handles 32 bits PC;
- output file created and left empty on error.

This patch fixes the first two issues, as a wider fix would be too
invasive and should be postponed in a following series.

Change-Id: Id8ead3f6db0fd5730682a0d1638f11836d06a632
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/370/
Reviewed-on: https://review.openocd.org/c/openocd/+/7394
Tested-by: jenkins
16 months agotarget: cortex_a: fix clang error core.CallAndMessage 93/7393/2
Antonio Borneo [Sat, 10 Dec 2022 21:15:44 +0000 (22:15 +0100)]
target: cortex_a: fix clang error core.CallAndMessage

Clang complains about the variable 'orig_dfsr' that can be used
uninitialized both in cortex_a_read_cpu_memory() and in
cortex_a_write_cpu_memory().

The issue is caused by an incorrect error path that used to jump
through 'goto out'. The code after the label 'out' is specific to
handle the case of an error during memory R/W; it is incorrect to
jump there to handle an error during the initialization that
precedes the memory R/W.

Replace the 'goto out' with 'return retval'.
Remove the label 'out' that is now unused.

Change-Id: Ib4b140221d1c1b63419de109579bde8b63fc2e8c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7393
Tested-by: jenkins
16 months agoarm_adi_v5: fix SIGSEGV due to failing re-examine 92/7392/2
Antonio Borneo [Sat, 10 Dec 2022 17:19:54 +0000 (18:19 +0100)]
arm_adi_v5: fix SIGSEGV due to failing re-examine

Commit 35a503b08d14 ("arm_adi_v5: add ap refcount and add get/put
around ap use") modifies the examine functions of mem_ap, cortex_m,
cortex_a and aarch64 by calling dap_put_ap() and then looking again
for the mem-ap and calling dap_get_ap().
This causes an issue if the system is irresponsive and the examine
fails and left the AP pointer to NULL. If the system was already
examined the NULL pointer will cause a SIGSEGV.

Commit b6dad912b85d ("target/cortex_m: prevent segmentation fault
in cortex_m_poll()") proposes a fix for one specific case and only
on cortex_m.

Modify all the examine functions by skipping look-up for the AP if
it was already set in a previous examine; the target's AP is not
supposed to change during runtime.

Remove the partial fix for cortex_m as it is not needed anymore.

Change-Id: I806ec3b1b02fcc76e141c8dd3a65044febbf0a8c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 35a503b08d14 ("arm_adi_v5: add ap refcount and add get/put around ap use")
Reviewed-on: https://review.openocd.org/c/openocd/+/7392
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
16 months agosrc/target/mips_m4k.c: set missing flag in set_watchpoint 89/7389/3
Nima Palizban [Thu, 1 Dec 2022 17:41:30 +0000 (12:41 -0500)]
src/target/mips_m4k.c: set missing flag in set_watchpoint

Without the fix, will see "Can not find free FP Comparator" error log

Change-Id: Id0d91cc02b7055e44d27507f9c05ccd48ff49838
Signed-off-by: Nima Palizban <n.palizban@gmail.com>
Fixes: fb43f1ff4e2f (target: Rework 'set' variable of break-/watchpoints)
Reviewed-on: https://review.openocd.org/c/openocd/+/7389
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agodoc: describe tcl port consistently. 85/7385/2
Karl Palsson [Tue, 29 Nov 2022 13:12:14 +0000 (13:12 +0000)]
doc: describe tcl port consistently.

One place described the tcl port as 5555, which was changed in 163bd86071a
Reported on IRC.

Change-Id: If740a29443793d6a4d4f8c9db54f0fc8344a6c1c
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Reviewed-on: https://review.openocd.org/c/openocd/+/7385
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agoFix jim_target_smp for smp rtos target 44/7244/9
Evgeniy Naydanov [Fri, 16 Sep 2022 13:01:46 +0000 (16:01 +0300)]
Fix jim_target_smp for smp rtos target

If multiple targets are specified as -rtos <rtos_type>, the
rtos_update_threads was called only if the last target was specified as
rtos, which is inconsistent with other checks of whether or not smp target
is an rtos one.

Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Change-Id: Ie52bc6b6c8f841d31b9590fcbc44e985d3cba0eb
Reviewed-on: https://review.openocd.org/c/openocd/+/7244
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agohwthread: Restore current_threadid in hwthread_update_threads 58/7358/5
Koudai Iwahori [Fri, 18 Nov 2022 14:18:17 +0000 (06:18 -0800)]
hwthread: Restore current_threadid in hwthread_update_threads

When OpenOCD receives a step-execution command from GDB and the target
is configured as rtos=hwthread, OpenOCD reconstructs the thread-info.
However, OpenOCD does not restore the thread id which is currently
selected by GDB. Due to this issue, OpenOCD sends the information of
wrong thread to GDB after the step execution.
This commit fixes the above issue by adding a code to save/restore the
thread id selected by GDB.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: I761a1141c04d48f1290e4f09baa7c7024f86f36a
Reviewed-on: https://review.openocd.org/c/openocd/+/7358
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agohwthread: Add register validity check in get_thread_reg_list 57/7357/2
Koudai Iwahori [Fri, 18 Nov 2022 09:23:43 +0000 (01:23 -0800)]
hwthread: Add register validity check in get_thread_reg_list

When OpenOCD receives 'g' packet (read general registers) from GDB and
target is configured as rtos=hwthread, hwthread_get_thread_reg_list is
called. However, it does not check if the register valid or not. Due to
this issue, OpenOCD returns invalid register values to GDB.
This commit adds a validity check to hwthread_get_thread_reg_list. If
the register is not valid, it tries to read the register from the
target.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: Iad6424b62124271ec411b1dfc044b57dfc460280
Reviewed-on: https://review.openocd.org/c/openocd/+/7357
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agojtag: xds110: fix clang error core.StackAddressEscape 80/7380/2
Antonio Borneo [Wed, 16 Nov 2022 22:06:12 +0000 (23:06 +0100)]
jtag: xds110: fix clang error core.StackAddressEscape

Clang ignores that xds110_swd_write_reg() is always called with
bit SWD_CMD_RNW in 'cmd' set to zero.
It then complains that the local variable 'value' gets passed by
address to xds110_swd_queue_cmd() and in case of 'read request'
such stack address get stored for later use:
src/jtag/drivers/xds110.c:1363:1: warning: Address of
 stack memory associated with local variable 'value' is
 still referred to by the global variable 'xds110' upon
 returning to the caller. This will be a dangling
 reference [core.StackAddressEscape]

To both xds110_swd_write_reg() and xds110_swd_read_reg(), add an
assert() to inform Clang about the state of bit SWD_CMD_RNW.

Change-Id: I7687c055ec71424b642e152f478723a930966e3a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7380
Tested-by: jenkins
16 months agoflash: lpc2900: fix clang error 'dead assignment' 79/7379/2
Antonio Borneo [Wed, 16 Nov 2022 00:02:02 +0000 (01:02 +0100)]
flash: lpc2900: fix clang error 'dead assignment'

The variable retval is assigned a value that is never used.
Scan-build reports:
Although the value stored to 'retval' is used in the
enclosing expression, the value is never actually read
from 'retval'.

Drop the dead assignment.

Change-Id: I11588dee748a55d52aa7f35bc1967b7df55af7fc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7379
Tested-by: jenkins
16 months agoflash/nor/stm32lx: Add revision '1, X' for Cat.2 devices 78/7378/2
Marc Schink [Thu, 24 Nov 2022 11:54:57 +0000 (12:54 +0100)]
flash/nor/stm32lx: Add revision '1, X' for Cat.2 devices

Change-Id: I0ff1e2102175ee952b066b325c9acbcb598b3af7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7378
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agotcl: max326xx: fix target scripts for latest version of OpenOCD 73/7373/3
Rocco Marco Guglielmi [Wed, 23 Nov 2022 08:54:30 +0000 (09:54 +0100)]
tcl: max326xx: fix target scripts for latest version of OpenOCD

Change-Id: Iec5aba3a082f2e25f21d7ca173ed710894b370a4

Signed-off-by: Rocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>
Change-Id: Ia83850e326661c8acb0712a280fdf961258322a4
Reviewed-on: https://review.openocd.org/c/openocd/+/7373
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
16 months agojtag/drivers/cmsis_dap.c: Fix Length of SWO Baudrate Command 70/7370/2
Nick Kraus [Mon, 21 Nov 2022 14:55:11 +0000 (09:55 -0500)]
jtag/drivers/cmsis_dap.c: Fix Length of SWO Baudrate Command

The command should now send the full 5 byte command length, which
includes the command tag (0x19) and the 4-byte baudrate word, instead
of only the last 3 bytes of the baudrate.

Signed-off-by: Nick Kraus <nick@nckraus.com>
Change-Id: Idd6e084efd7492489aa900cdbf08f540944041cb
Reviewed-on: https://review.openocd.org/c/openocd/+/7370
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agotarget/armv7m: fix feature name of ARMv8M security extension regs 65/7265/3
Tomas Vanek [Sun, 16 Oct 2022 09:34:57 +0000 (11:34 +0200)]
target/armv7m: fix feature name of ARMv8M security extension regs

gdb requires this feature to enable stack unwinding of secure/nonsecure
interstate calls and exceptions on an ARMv8M target with
the security extension.

Tested on STM32L5 (Cortex-M33).

Change-Id: Ib09780c011afbc095b352074068597559ad14fcd
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae7e2f45aa4798be449f282bbf75ad41e73f055e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7265
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agortos/ThreadX: added check for NULL-named tasks 28/7328/4
Giulio Fieramosca [Thu, 3 Nov 2022 19:38:20 +0000 (20:38 +0100)]
rtos/ThreadX: added check for NULL-named tasks

Thread name loading was not correctly handled if a ThreadX task has a NULL
name.

Signed-off-by: Giulio Fieramosca <giulio@glgprograms.it>
Change-Id: I03071930182bc2585b61ce5d8c67491710883dd6
Reviewed-on: https://review.openocd.org/c/openocd/+/7328
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agoFix for segfault and some clang reported problems in stmqspi 45/7345/2
Andreas Bolsch [Sat, 12 Nov 2022 15:29:18 +0000 (16:29 +0100)]
Fix for segfault and some clang reported problems in stmqspi

Change-Id: Id003adb574085cdd603cc13aeb6f2efec73593f1
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7345
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agojep106: update to revision JEP106BF.01 Oct 2022 41/7341/2
Antonio Borneo [Tue, 8 Nov 2022 10:25:27 +0000 (11:25 +0100)]
jep106: update to revision JEP106BF.01 Oct 2022

Change-Id: Ia1f19dcce48da997c036ccffa65e76e179de2eb9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7341
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
17 months agoflash/nor/stm32f1x: adjust size of the flash loader buffer 42/7342/2
Simon Smiganovski [Wed, 9 Nov 2022 15:32:26 +0000 (16:32 +0100)]
flash/nor/stm32f1x: adjust size of the flash loader buffer

target_run_flash_async_algorithm expects the source_buffer to have
at least 2 words reserved for read and write pointers in addition to the
FIFO buffer. If the size of the data to be flashed is <= 8 bytes then
the flash function will fail with "corrupted fifo read pointer" error.

Ensure the allocated buffer is big enough to hold both FIFO buffer and
read/write pointers.

Change-Id: I09c22eaac517b8cfea8e0b463f5deb6b98afd267
Signed-off-by: Simon Smiganovski <simon.smiganovski@fruitcore.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7342
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agotarget/armv7m: prevent saving and restoring non existent regs 76/7276/3
Tomas Vanek [Tue, 18 Oct 2022 20:00:18 +0000 (22:00 +0200)]
target/armv7m: prevent saving and restoring non existent regs

armv7m_start_algorithm() saves register values to arch_info->context.
armv7m_wait_algorithm() restores register values from arch_info->context.
Exclude registers with flag exist = false from both loops.

While on it refactor the register restore: introduce 'struct reg' pointer
and dereference it instead of numerous accesses by a full path
from armv7m pointer.

Change-Id: I1600084db84809ee13bcf8e7828b79f8c9ff9077
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7276
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agotcl/interface: fix raspberrypi2-native.cfg speed coefficient 05/7305/2
Tomas Vanek [Thu, 3 Nov 2022 07:48:53 +0000 (08:48 +0100)]
tcl/interface: fix raspberrypi2-native.cfg speed coefficient

The speed coefficient for Raspberry Pi 2 was probably calibrated
for a scaled down clock frequency.

To prevent JTAG/SWD overclocking, use the value corresponding
to the 'official' maximum CPU clock.

Change-Id: Iaff58b092198dce6d6552c9d31d6a3ba4aaaa2d5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7305
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
17 months agotcl/cpld/xilinx-xcu: fix typo 33/7333/2
George Voicu [Sat, 5 Nov 2022 09:59:43 +0000 (10:59 +0100)]
tcl/cpld/xilinx-xcu: fix typo

Fix typo in comments

Signed-off-by: George Voicu <razvanvg@hotmail.com>
Change-Id: Icc2d770e73f896e20dd347de324328030544bdb9
Reviewed-on: https://review.openocd.org/c/openocd/+/7333
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agopld/virtex2: small doc extension 03/7303/2
Daniel Anselmi [Wed, 2 Nov 2022 16:21:18 +0000 (17:21 +0100)]
pld/virtex2: small doc extension

Change-Id: I174cd702388be04268b38178fbfacb90db452f72
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7303
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agortos: hwthread: fix clang error core.NullDereference 37/7337/2
Antonio Borneo [Thu, 3 Nov 2022 23:32:20 +0000 (00:32 +0100)]
rtos: hwthread: fix clang error core.NullDereference

Clang spots a potential NULL pointer dereferencing that is instead
an incorrect use of an array of pointers:

src/rtos/hwthread.c:254:32: warning: Dereference of null pointer
  [core.NullDereference]
(*rtos_reg_list)[j].number = (*reg_list)[i].number;
                             ^~~~~~~~~~~~~~~~~~~~~
The error has not been spotted before because:
- this function is not called for the first core of the SMP node,
- for the other cores on Cortex-A it still returns valid register
  value for the first 12 ARM registers, then it diverges.

Also Valgrind does not spot any issue at runtime.

Address the array correctly.

While there, use DIV_ROUND_UP() macro for the computation.

Change-Id: Ib87e60e0edfd9671091f5dcfa9aedaf1aed800d1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7337
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
17 months agoRevert "Remove duplicate of a counter in hwthread_update_threads" 07/7307/5
Tomas Vanek [Sun, 30 Oct 2022 08:22:37 +0000 (08:22 +0000)]
Revert "Remove duplicate of a counter in hwthread_update_threads"

Commit 0cedf10f8fd6 ("Remove duplicate of a counter in
hwthread_update_threads") introduced a code bug.

In the second foreach_smp_target() loop, variable "threads_found"
gets passed to routine hwthread_fill_thread(). By removing the
counting of threads_found from the second loop, the
incorrect thread counter value gets passed to hwthread_fill_thread().

Change-Id: Ie89e53ccd28bb72b6838ef2f12106a1fe8d00994
Suggested-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7307
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agojtag/drivers/cmsis_dap: prevent CDC missdetect as CMSIS-DAP bulk 79/7279/2
Tomas Vanek [Thu, 20 Oct 2022 09:43:10 +0000 (11:43 +0200)]
jtag/drivers/cmsis_dap: prevent CDC missdetect as CMSIS-DAP bulk

The autodetection of CMSIS-DAP v2 bulk interface is tricky
as not all adapters conform CMSIS-DAP specs.

If an interface has a string descriptor containing CMSIS-DAP,
then OpenOCD did not insisted on the correct interface class
LIBUSB_CLASS_VENDOR_SPEC.

However the relaxed test caused false autodetection of v2 bulk
interface on some CMSIS-DAP v1 adapters with an additional serial
interface with the string descriptor stupidly containing
CMSIS-DAP text.

Make the test less relaxed, refuse autodetection of the interfaces
with the class number of well known functions including CDC and MSC.

Link: https://sourceforge.net/p/openocd/tickets/368/
Change-Id: I917cb257eb42aab93560cc39c61ec35a60ce52e3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7279
Tested-by: jenkins
Reviewed-by: SilverFox <yyjdelete@126.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
17 months agoflash: stmqspi: fix clang error 'dead assignment' 04/7304/2
Antonio Borneo [Wed, 2 Nov 2022 22:11:19 +0000 (23:11 +0100)]
flash: stmqspi: fix clang error 'dead assignment'

The variable retval is assigned a value that is never used, as it
is reassigned few lines below.

Drop the dead assignment.

Change-Id: Id4e9134408fab3e04936d36e95724bf8d3ab55aa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7304
Tested-by: jenkins
17 months agodsp5680xx: fix clang error core.UndefinedBinaryOperatorResult 02/7302/2
Antonio Borneo [Wed, 2 Nov 2022 00:13:49 +0000 (01:13 +0100)]
dsp5680xx: fix clang error core.UndefinedBinaryOperatorResult

Clang get confused by initializing the array uint16_t lock_word[],
casting it to (uint8_t *), then accessing the second element of
the uint8_t pointer.

  src/target/dsp5680xx.c:2046:41: warning: The left operand of '<<'
    is a garbage value [core.UndefinedBinaryOperatorResult]
        uint16_t tmp = (buffer[0] | (buffer[1] << 8));
                                     ~~~~~~~~~ ^
Fix it by replacing the array with a single uint16_t.

The code is still depending on host endianness; no fix for this is
proposed.

Change-Id: I16dfd60cab117dd145aeecf10d9593574ff233a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7302
Tested-by: jenkins
17 months agoesirisc_jtag: fix clang error core.VLASize 01/7301/2
Antonio Borneo [Tue, 1 Nov 2022 23:57:17 +0000 (00:57 +0100)]
esirisc_jtag: fix clang error core.VLASize

The function esirisc_jtag_recv() can be called with argument
num_in_fields = 0, for example as consequence of calling
esirisc_jtag_continue().
In this case, num_in_bytes is zero and the allocation of the
variable-length array 'r' requires size zero.

  src/target/esirisc_jtag.c:133:2: warning: Declared variable-length
    array (VLA) has zero size [core.VLASize]
        uint8_t r[num_in_bytes * 2];
        ^~~~~~~~~ ~~~~~~~~~~~~~~~~

Fix it by forcing size one when num_in_bytes is zero.

Change-Id: Id764c7b5ec4f5b3c18c7da650bbff39fc98ed049
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7301
Tested-by: jenkins
17 months agoopenrisc: fix clang error core.CallAndMessage 00/7300/2
Antonio Borneo [Tue, 1 Nov 2022 23:33:16 +0000 (00:33 +0100)]
openrisc: fix clang error core.CallAndMessage

Clang assumes that size could assume a value that is not 1 nor 2
nor 4. In such condition the buffer in t is allocated (size != 1)
and not initialized. This triggers an error:
  src/target/openrisc/or1k_du_adv.c:655:14: warning: 2nd function
    call argument is an uninitialized value [core.CallAndMessage]
                crc_calc = adbg_compute_crc(crc_calc, data[i], 8);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add the default case to cover other values of size.

After this fix, clang still complains on the same line, this time
misunderstanding the limits of the loop and considering that
buf_bswap16() only swaps the first 16 bits, thus passing not
initialized value data[2] to adbg_compute_crc()

Replace malloc() with calloc() to silent it.

Change-Id: I358d7fb2ebefd69255670641bd435b770762a301
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7300
Tested-by: jenkins
17 months agohelper/types: use unsigned type for all h_u64_to_le() and similar 99/7299/2
Antonio Borneo [Tue, 1 Nov 2022 18:21:35 +0000 (19:21 +0100)]
helper/types: use unsigned type for all h_u64_to_le() and similar

All the converters functions:
h_u64_to_le()
h_u64_to_be()
h_u32_to_le()
h_u32_to_be()
h_u24_to_le()
h_u24_to_be()
h_u16_to_le()
h_u16_to_be()
have signed type in their prototype, while the function name and
all the current use cases pass an unsigned value.

Change the prototypes to use unsigned types.

Change-Id: I76dcfdd7912b81f60902184712b2907eae9843f7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7299
Tested-by: jenkins
17 months agoThreadX: set current_thread for kernel execution 80/7280/2
Ben McMorran [Thu, 20 Oct 2022 22:39:24 +0000 (15:39 -0700)]
ThreadX: set current_thread for kernel execution

If we just invented thread 1 to represent the current execution, we
need to make sure the RTOS object also claims it's the current thread
so that threadx_get_thread_reg_list() doesn't attempt to read a
thread control block at 0x00000001.

Signed-off-by: Ben McMorran <bemcmorr@microsoft.com>
Change-Id: I7f71e730d047858898297e4cb31db8e47e0c371c
Reviewed-on: https://review.openocd.org/c/openocd/+/7280
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
18 months agoRestore +dev suffix
Paul Fertser [Wed, 26 Oct 2022 13:43:49 +0000 (16:43 +0300)]
Restore +dev suffix

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
18 months agoThe openocd-0.12.0-rc2 release candidate v0.12.0-rc2
Paul Fertser [Wed, 26 Oct 2022 10:45:09 +0000 (13:45 +0300)]
The openocd-0.12.0-rc2 release candidate

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
18 months agotcl/target: add basic RP2040 target config 75/7275/2
Tomas Vanek [Tue, 18 Oct 2022 19:19:20 +0000 (21:19 +0200)]
tcl/target: add basic RP2040 target config

The existing rp2040-core0.cfg configuration file was intended
for a special adapter which selects a SWD multidrop target on its own.
This means that rp2040-core0.cfg is totally unusable with a standard SWD
adapter.

To fix the problem, mark rp2040-core0.cfg as deprecated and
add rp2040.cfg, a basic config file with multidrop target selection.

Change-Id: I5194e42f529a2d9645481424b7c66ab61efa44ee
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7275
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
18 months agodoc: fix semihosting_redirect command documentation 78/7278/2
Tarek BOCHKATI [Wed, 19 Oct 2022 13:26:28 +0000 (14:26 +0100)]
doc: fix semihosting_redirect command documentation

Change-Id: I78c82a21e4160851a5c0b58394ac7897479808ff
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7278
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
18 months agotcl/stm32l5x|u5x: support HLA adapters in non-secure mode only 46/6546/9
Tarek BOCHKATI [Fri, 24 Sep 2021 12:47:14 +0000 (13:47 +0100)]
tcl/stm32l5x|u5x: support HLA adapters in non-secure mode only

instrument "target/stm32x5x_common.cfg" used by both STM32L5x/U5x
to support HLA adapters like "interface/stlink.cfg" in non-secure mode

if the device switches to secure mode, the debug session will be
stopped immediately (with an explanatory message).

Change-Id: I645fdd55e3448ef82d0ddcc396f42fd7b2f39ac3
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reported-by: Patrik Bachan <diggit@users.sourceforge.net>
Fixes: https://sourceforge.net/p/openocd/tickets/317/
Reviewed-on: https://review.openocd.org/c/openocd/+/6546
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
18 months agotarget/xtensa: remove redundant call for `TARGET_EVENT_HALTED` 74/7274/2
Erhan Kurubas [Tue, 18 Oct 2022 15:23:15 +0000 (17:23 +0200)]
target/xtensa: remove redundant call for `TARGET_EVENT_HALTED`

`xtensa_do_step` is invoked from `xtensa_prepare_resume` to silently
step over BP/WP before resuming.
For example; in the case of WPs (DEBUGCAUSE_DB), in the current
implementation `xtensa_do_step` will generate one more
`TARGET_EVENT_HALTED` after the original one caused by WP itself.

This patch moves the halted event cb call after
the step is done successfully.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I9048e14fb316dc124847a42cfaefb1f76b5ce53e
Reviewed-on: https://review.openocd.org/c/openocd/+/7274
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
18 months agodoc: fix riscv commands 68/7268/5
Antonio Borneo [Sun, 16 Oct 2022 21:56:23 +0000 (23:56 +0200)]
doc: fix riscv commands

- Fix the declaration of riscv command 'set_mem_access'.
- Remove non existing riscv command 'set_scratch_ram'.
- Add riscv commands 'info', 'reset_delays'; copy the description
  from the 'help' text.
- Don't add riscv commands 'set_prefer_sba' and 'test_sba_config_reg'
  as they are marked as deprecated.
- Ensure that 'test_sba_config_reg' prints a deprecation warning
  when used.

Change-Id: I39dc3aec4e7f13b69ac19685f1b593790acdde83
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7268
Reviewed-by: Tim Newsome <tim@sifive.com>
Tested-by: jenkins
18 months agodoc: remove unreferenced anchors 70/7270/2
Antonio Borneo [Mon, 17 Oct 2022 10:19:18 +0000 (12:19 +0200)]
doc: remove unreferenced anchors

Remove the @anchor{} tags that are not referenced in the
documentation.

Change-Id: Ia8e9f75afb08e08ef99d0c8fd82115d689e4a267
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7270
Tested-by: jenkins
18 months agodoc: fix espusbjtag commands type 67/7267/2
Antonio Borneo [Sun, 16 Oct 2022 22:08:52 +0000 (00:08 +0200)]
doc: fix espusbjtag commands type

Exec commands should be reported as {Command}.

Change-Id: Iacb50d77b354617ecd24b0f1c2ec24e240179698
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7267
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
18 months agodoc: fix xtensa commands type 66/7266/2
Antonio Borneo [Sun, 16 Oct 2022 21:36:15 +0000 (23:36 +0200)]
doc: fix xtensa commands type

Config commands should be reported as {Config Command}

Change-Id: Ic778df31bb1dc9aefdbe3d8006b06bb370d25e6f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7266
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
18 months agojtag/drivers: bcm2835gpio: implement memory barriers when bitbashing 58/7258/4
Jonathan Bell [Thu, 13 Oct 2022 09:38:53 +0000 (10:38 +0100)]
jtag/drivers: bcm2835gpio: implement memory barriers when bitbashing

This GPIO driver is common to SoCs that have in-order ARM cores
(BCM2835) as well as superscalar (BCM2836-7) and speculative
out-of-order cores (BCM2711).

For BCM2837 and BCM2711, the processor can dual-issue stores and
is free to merge writes to peripheral memory for pages mapped
MT_NORMAL_NC, which is the default provided by /dev/[gpio]mem.

This can cause glitches (or missing edges) on GPIO pins when
toggled with no delay, as pipelined writes to the same address
can get arbitrarily squelched.

To prevent this happening, make sure the preceding write ops are
flushed outside the shareable domain by using a memory barrier.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Change-Id: I8805cc0911667bcb9b7f4ca340d7f4f1cb25d096
Reviewed-on: https://review.openocd.org/c/openocd/+/7258
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
18 months agoREADME: update build dependency list 56/7256/4
Antonio Borneo [Sun, 9 Oct 2022 15:22:37 +0000 (17:22 +0200)]
README: update build dependency list

Add info on what is optional,

Change-Id: Iedfa969243d95736aaf1b236caa2c2b33f563fe7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7256
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)