openocd.git
2 years agocontrib/udev: Add missing J-Link USB PID 78/6778/2
Marc Schink [Thu, 16 Dec 2021 09:12:42 +0000 (10:12 +0100)]
contrib/udev: Add missing J-Link USB PID

See libjaylink/contrib/99-libjaylink.rules

Change-Id: I36733e18eb4bc11828c5fa563c687d28be9e34bd
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6778
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/riscv: calloc() memory per register. 75/6775/2
Tim Newsome [Tue, 2 Nov 2021 16:55:07 +0000 (09:55 -0700)]
target/riscv: calloc() memory per register.

This replaces a static array with 8 bytes per register. When there are
vector registers larger than 8 bytes, they would end up clobbering each
other's values. I can't believe I didn't catch this earlier.

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

Change-Id: I9df4eaf05617a2c8df3140fff9fe53f61ab2b261
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6775
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agosemihosting: use macro COMMAND_HANDLER 86/6786/2
Antonio Borneo [Thu, 16 Dec 2021 23:53:11 +0000 (00:53 +0100)]
semihosting: use macro COMMAND_HANDLER

We have the macro
#define COMMAND_HANDLER(name) \
static __COMMAND_HANDLER(name)
Use it!

Change-Id: I0e5385cb54197c743348f0d2ce215c93b8e396a4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6786
Tested-by: jenkins
2 years agogdb_server: fix a comment in gdb_new_connection() 69/6769/3
Antonio Borneo [Sat, 4 Dec 2021 17:38:56 +0000 (18:38 +0100)]
gdb_server: fix a comment in gdb_new_connection()

On 2008-03-05, before git's age, commit 6d9501467441 adds a
comment about unobserved ACK supposedly sent by GDB at connection.

The ACK is sent since GDB 3.95 (1999-05-04), but a bug introduced
in GDB 6.5 (2006-06-21) and fixed in GDB 7.0 (2009-10-06) makes
GDB sending the query for "supported packets" before sending the
ACK. Due to the bug, the author of the commit failed to see the
ACK.

Change-Id: I574a8013e7d159d1c71087af83b7c2ce92be86bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6769
Tested-by: jenkins
2 years agoopenocd: add keep_alive during command sleep 70/6770/3
Antonio Borneo [Thu, 9 Dec 2021 16:55:46 +0000 (17:55 +0100)]
openocd: add keep_alive during command sleep

The command sleep holds the host CPU until it completes.
Send keep_alive to GDB, so it will not timeout.

Change-Id: I92e9c5fc871b4e6a7695cdc449ca9fb3c1f1d9ec
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6770
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
2 years agotarget/cortex_m: minor refactoring in cortex_m_store_core_reg_u32() 67/6767/2
Tomas Vanek [Wed, 8 Dec 2021 21:11:32 +0000 (22:11 +0100)]
target/cortex_m: minor refactoring in cortex_m_store_core_reg_u32()

Unlike cortex_m_load_core_reg_u32() storing core register uses
the same code pattern around DHCSR read as offered by the convenience
helper cortex_m_read_dhcsr_atomic_sticky().

Use the helper.

Change-Id: Ia947204944a8b549f3c2be7fb2f717aad18970c4
SeeAlso: 65d762918328 (cortex_m: poll S_REGRDY on register r/w)
SeeAlso: 0dcf95c7171b (target/cortex_m: cumulate DHCSR sticky bits)
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6767
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agojtag/drivers/vsllink: fix memory leak 66/6766/2
Tomas Vanek [Wed, 8 Dec 2021 16:46:34 +0000 (17:46 +0100)]
jtag/drivers/vsllink: fix memory leak

Close libusb context in vsllink_quit()

Change-Id: I85da8d7228b1b2b033a32b2f9ae9ed0726546b55
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6766
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor/spi: add micron MT25QU01G 64/6764/3
Jaehoon Park [Tue, 23 Jun 2020 19:39:27 +0000 (04:39 +0900)]
flash/nor/spi: add micron MT25QU01G

1Gbit SPI flash on VCU118 Rev. 2.0

Contributed to riscv-openocd in https://github.com/riscv/riscv-openocd/pull/487

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I93447dd970d9901a671567fe8ab9e407432f8db9
Reviewed-on: https://review.openocd.org/c/openocd/+/6764
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agotarget/arm_jtag.h: fix wrong comparison in arm_jtag_set_instr 62/6762/3
Bohdan Tymkiv [Thu, 2 Dec 2021 08:08:33 +0000 (10:08 +0200)]
target/arm_jtag.h: fix wrong comparison in arm_jtag_set_instr

Change [1] introduced a regression that results in comparison
in arm_jtag_set_instr() to be always true if the length of the
IR register is not 8 bit. The value on the left side
of the != operator contains only tap->ir_length number of
bits while value on the right is full 8-bit instruction code.

This forces OpenOCD to update the JTAG IR register on each
transaction even if the instruction in the JTAG IR register
is correct. This causes noticeable performance degradation,
especially with slow JTAG adapters.

[1] https://review.openocd.org/c/openocd/+/6285

time ./src/openocd -s tcl/ -f interface/cmsis-dap.cfg \
  -c "transport select jtag" -f target/psoc6.cfg \
  -c "init; load_image data.bin 0x08000000; exit"

Without this change:
real    0m4,863s
user    0m0,074s
sys     0m0,128s

With this change:
real    0m3,083s
user    0m0,038s
sys     0m0,098s

Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com>
Change-Id: Iaded83a04ecc7e65f18256afae582267ccc1fc59
Reviewed-on: https://review.openocd.org/c/openocd/+/6762
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agolinuxgpiod: Allow using multiple GPIO chips. 42/6742/5
Laszlo Sitzer [Thu, 18 Nov 2021 12:10:39 +0000 (13:10 +0100)]
linuxgpiod: Allow using multiple GPIO chips.

Allow passing optional gpiochip number before gpio number.
If no optional chip number is passed, the one from the 'gpiochip'
configuration directive is used.

Change-Id: I16933d81581d9af4d1600c5f9fdbc832ef3fda94
Signed-off-by: Laszlo Sitzer <dlsitzer@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6742
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoAdd Microchip SAME51 Curiosity Nano board 47/6747/2
Joerg Wunsch [Tue, 23 Nov 2021 19:49:30 +0000 (20:49 +0100)]
Add Microchip SAME51 Curiosity Nano board

This board is (software wise) similar to the existing SAME54 Xplained
Pro board, with just a slightly different MCU. (Hardware wise, it
features a vastly different form factor.)

Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Change-Id: I5e5435d49d333fb74471994ee84de59ed983153c
Reviewed-on: https://review.openocd.org/c/openocd/+/6747
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Axel W.
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodoc: Updated RISC-V memory-related cmds in documentation 43/6743/5
Jan Matyas [Mon, 22 Nov 2021 13:50:30 +0000 (14:50 +0100)]
doc: Updated RISC-V memory-related cmds in documentation

- "riscv set_prefer_sba" - removed from the doc, superseded
  by the latter
- "riscv set_mem_access" - new command, new entry added
  into the doc

This change only addresses the documentation. The corresponding
implementation of the RISC-V commands is already merged.

Change-Id: I3c07672cde94324407cf667504dba5402f63a543
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6743
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agodoc: Update doc for commands "riscv expose_csrs" and "riscv expose_custom" 38/6738/3
Jan Matyas [Mon, 22 Nov 2021 09:16:27 +0000 (10:16 +0100)]
doc: Update doc for commands "riscv expose_csrs" and "riscv expose_custom"

These commands were extended/improved in the last drop
of RISC-V target updates. Update also the documentation
to properly describe how the commands should be used now.

Change-Id: I9e2ba6adbe1a4c032b96f5f8ff2d4791fa4c2527
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6738
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
2 years agodoc/openocd.texi: Document find and ocd_find command 37/6737/3
Yasushi SHOJI [Sun, 21 Nov 2021 23:48:26 +0000 (08:48 +0900)]
doc/openocd.texi: Document find and ocd_find command

Document both find and ocd_find command under Config File Guidelines
-> Interface Config Files.  find command is used in the previous
section as well but the previous section is more about using OpenOCD.

The section added is "aimed at any user who needs to write a config
file".

Change-Id: I698207fe58d564c615a15b50756aa5547a5f40b7
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6737
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc/openocd.texi: Document command mode command 36/6736/3
Yasushi SHOJI [Sun, 21 Nov 2021 23:23:32 +0000 (08:23 +0900)]
doc/openocd.texi: Document command mode command

Document "command mode" command Server Configuration -> Configuration
Stage.  The text is taken from command's help string.

In addition to the help string, this commit explain the words
mismatch, the doc uses "stage" but the command and source code uses
"mode" to describe the same thing.

Change-Id: I1d5fc8c64a3a0b07ea8430bf016bcbd54e52da1c
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6736
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/target: Check checksum_memory before call 58/6758/2
Yasushi SHOJI [Mon, 29 Nov 2021 13:33:27 +0000 (22:33 +0900)]
target/target: Check checksum_memory before call

Make sure checksum_memory is present.  Otherwise it'll segfault.

Change-Id: If31123323bd8a03282da43505c9604fde735ad0e
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6758
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: document noinit command 61/6761/2
Tomas Vanek [Wed, 1 Dec 2021 11:58:19 +0000 (12:58 +0100)]
doc: document noinit command

Change-Id: I915c7d3231935fd44407b5fa65d86d4cb93e8db5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6761
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: list internal commands called by init 60/6760/2
Tomas Vanek [Wed, 1 Dec 2021 09:41:08 +0000 (10:41 +0100)]
doc: list internal commands called by init

Change-Id: I5534c94a983906533a1b38c30ec3eb982e62dee7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6760
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoadi_v5_swd: add jtag-to-swd through dormant 95/6695/4
Antonio Borneo [Thu, 11 Nov 2021 22:28:33 +0000 (23:28 +0100)]
adi_v5_swd: add jtag-to-swd through dormant

ARM IHI 0031A does not support SWJ-DP, so no switch between JTAG
and SWD is considered.
ARM IHI 0031B is not publicly available and it's reported as
"Confidential Beta" in the history list in following doc versions.
From ARM IHI 0031C the direct switch between JTAG and SWD is
already deprecated in favor of passing through dormant mode. With
no access to IHI 0031B we haven't info if any device strictly
requires the direct switch.

OpenOCD implements only the deprecated direct switch, so changing
it could cause regression on devices that do not implement dormant
mode.
Plus, not all the adapters support dormant mode.

Nevertheless there are already target devices that only allow
entering in SWD by passing through dormant.

Let the code try both method, alternating one tentative with the
deprecated legacy direct switch, then another tentative passing
through dormant, and repeat till timeout.
This would work on any device that don't support dormant, on new
devices that require switch through dormant and will work with
adapters that don't support dormant.

Change-Id: Ib8619635277d497872079a33fa4e38be9beb84a0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6695
Tested-by: jenkins
2 years agocortex_m: remove last references to debugport_init() 94/6694/4
Antonio Borneo [Thu, 11 Nov 2021 22:11:03 +0000 (23:11 +0100)]
cortex_m: remove last references to debugport_init()

The function debugport_init() has never existed in OpenOCD code,
but few comments erroneously references it in place of the
existing function ahbap_debugport_init().

Commit 00dbc185ee56 ("arm_adi_v5: Split ahbap_debugport_init")
splits the function ahbap_debugport_init() in dap_dp_init() and
mem_ap_init(), but did not removed all the incorrect comments
about debugport_init(). Few of such comments has been removed in
later patches.

Remove the last comment that references debugport_init().

Change-Id: Ibd1f125475386e5653340fedf706903a0ee15897
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6694
Tested-by: jenkins
2 years agogdb_server: added and improved several debug prints 88/6288/4
Jan Matyas [Thu, 3 Jun 2021 15:13:41 +0000 (17:13 +0200)]
gdb_server: added and improved several debug prints

Added and improved several prints related to the GDB connection
and various error states that may occur in relation to this
connection.

Change-Id: I233246190b613cc925b783561cfa3aa5267360fd
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6288
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agotarget,flash: allow target_free_working_area on NULL area pointer 12/6712/4
Tomas Vanek [Thu, 18 Nov 2021 08:37:23 +0000 (09:37 +0100)]
target,flash: allow target_free_working_area on NULL area pointer

Standard C library free() allows NULL pointer as a parameter.

Change target_free_working_area() to conform this convention.

Remove NULL pointer tests before target_free_working_area() calls.

While on it add missing setting pointer to NULL after target_free_working_area().

Change-Id: I7c692ab04a9933398ba5bc614723ad0bdecb87b3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6712
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor/fespi: algorithm, large address, errors 79/6679/3
Tim Newsome [Mon, 8 Nov 2021 17:26:51 +0000 (09:26 -0800)]
flash/nor/fespi: algorithm, large address, errors

* Move more smarts into the target algorithm code, and rewrite that in C
  so it's easier to understand/maintain.
* Support >24-bit addresses.
* Check for errors.

Change-Id: I3b1a143589fe6defafb8f95820aa682acc9646e7
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6679
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodoc/openocd.texi: Document usage command 35/6735/3
Yasushi SHOJI [Sun, 21 Nov 2021 23:21:50 +0000 (08:21 +0900)]
doc/openocd.texi: Document usage command

Document usage command under General Commands -> Server Commands. The
text is taken from the command's help string.

Change-Id: I957cb46cca98181c3c5e676228c5c103e47bb655
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6735
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc/openocd.texi: Document add_help_text and add_usage_text 34/6734/3
Yasushi SHOJI [Sun, 21 Nov 2021 23:18:22 +0000 (08:18 +0900)]
doc/openocd.texi: Document add_help_text and add_usage_text

Document add_help_text and add_usage_text under Genral Commands ->
Misc Commands.  The text are taken from command's help strings.

Change-Id: I2bbbee8e5faa8d9654227c304e0528f5144275e8
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6734
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: document 'cmsis-dap cmd' command 32/6732/2
Tomas Vanek [Sat, 20 Nov 2021 16:53:03 +0000 (17:53 +0100)]
doc: document 'cmsis-dap cmd' command

Change-Id: I90b7f020ee2bf078fdf22e3d21423f333ae061ac
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6732
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: fix list of supported nRF52 devices 31/6731/2
Tomas Vanek [Sat, 20 Nov 2021 16:07:31 +0000 (17:07 +0100)]
doc: fix list of supported nRF52 devices

Change-Id: I64d6d851dd9333689556b7062b1ff38d41b5ad32
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6731
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor/at91samd: remove 'at91samd info' command 30/6730/2
Tomas Vanek [Sat, 20 Nov 2021 13:27:45 +0000 (14:27 +0100)]
flash/nor/at91samd: remove 'at91samd info' command

The command is a stub only, does nothing.

Change-Id: Ib3b8c2122a9f6f2e179bee34ac56d0adf367bfcc
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6730
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: document 'atsamv gpnvm' command 29/6729/2
Tomas Vanek [Sat, 20 Nov 2021 12:36:00 +0000 (13:36 +0100)]
doc: document 'atsamv gpnvm' command

Change-Id: I922c75e2d074447558f85bfda5421aa24a850be1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6729
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor/kinetis_ke: remove 'kinetis mdm test_securing' cmd 28/6728/3
Tomas Vanek [Sat, 20 Nov 2021 10:44:55 +0000 (11:44 +0100)]
flash/nor/kinetis_ke: remove 'kinetis mdm test_securing' cmd

The command might be a leftover from development of the driver.
There is no documentation what it does.

Change-Id: Iaa5aa1ac51638bd6acce172a5dd03846a165dc27
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6728
Tested-by: jenkins
Reviewed-by: Ivan-Artekit <ivan@artekit.eu>
2 years agoflash/nor/kinetis_ke: add .help fields for tcl commands 27/6727/2
Tomas Vanek [Sat, 20 Nov 2021 10:50:48 +0000 (11:50 +0100)]
flash/nor/kinetis_ke: add .help fields for tcl commands

Add help texts from similar driver kinetis.c

While on it fix one existing help: the flash is obviously not NAND

Change-Id: Ibd295105586b008aaabf2fb4e4a75bf551266e38
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6727
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: mention SWD multidrop 44/6744/2
Tomas Vanek [Tue, 23 Nov 2021 12:17:47 +0000 (13:17 +0100)]
doc: mention SWD multidrop

Change-Id: I361dc351c407b67613eadef4d29e27ed0e00bd05
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6744
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agotcl: stm32mp13x: add target and board config files 75/6675/3
Antonio Borneo [Mon, 23 Aug 2021 14:41:43 +0000 (16:41 +0200)]
tcl: stm32mp13x: add target and board config files

The stm32mp13x has one core Cortex-A7.

The board Discovery Kit includes an on-board STLink-V3 with SWD
connection.
The webpage of the board is not active yet.

Change-Id: I8836b26612a160ead79766955ebefaf3d21a329c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6675
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojimtcl: update to version 0.81 (2021-11-28) 57/6757/2
Antonio Borneo [Sun, 28 Nov 2021 10:36:58 +0000 (11:36 +0100)]
jimtcl: update to version 0.81 (2021-11-28)

Change-Id: I374348047331b88e35b6584a5c65d8a73240b8a1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6757
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoflash/nor/efm32: fixed BG1x identification 66/6666/2
Doug Brunner [Mon, 25 Oct 2021 19:21:34 +0000 (12:21 -0700)]
flash/nor/efm32: fixed BG1x identification

The EFM32 flash driver misidentifies the EFR32BG1B on my board as EFR32MG1B.
Looks like this was caused by a copy-paste error, fixed.

Signed-off-by: Doug Brunner <doug.a.brunner@gmail.com>
Change-Id: I3067f7ba132c2562487da8c2371f63a4843230c1
Reviewed-on: https://review.openocd.org/c/openocd/+/6666
Tested-by: jenkins
Reviewed-by: Fredrik Hederstierna <fredrik.hederstierna@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodrivers: call adapter_get_required_serial() in jtag_libusb_open() 63/6663/4
Antonio Borneo [Tue, 19 Oct 2021 11:09:25 +0000 (13:09 +0200)]
drivers: call adapter_get_required_serial() in jtag_libusb_open()

Now that adapter serial is handled independently from the adapter
drivers, move inside jtag_libusb_open() the call to
adapter_get_required_serial(), so every adapter that uses libusb
will automagically get USB serial support.

Extend the documentation to list the adapters involved.

Change-Id: I75b3482d38f8ed3418329f3106c5e8b689fd460b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6663
Tested-by: jenkins
2 years agojtag/hla, jtag/stlink: switch to command 'adapter serial' 57/6657/4
Antonio Borneo [Fri, 8 Oct 2021 10:37:19 +0000 (12:37 +0200)]
jtag/hla, jtag/stlink: switch to command 'adapter serial'

The driver hla defines the command 'hla_serial' to specify the
serial string of the adapter.
The driver st-link defines the command 'st-link serial' to specify
the serial string of the adapter.

Remove and deprecate the driver commands and use 'adapter serial'.

Change-Id: I9505c398a77125b1ebf4ba71da7baf4d663b75be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6657
Tested-by: jenkins
2 years agojtag/jlink: switch to command 'adapter serial' 56/6656/4
Antonio Borneo [Fri, 8 Oct 2021 09:53:56 +0000 (11:53 +0200)]
jtag/jlink: switch to command 'adapter serial'

The driver jlink defines the command 'jlink serial' to specify the
serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Note: in former code the commands 'jlink serial' and 'jlink usb'
were mutually exclusive; running one of them would invalidate the
effect of a previous execution of the other. The new code gives
priority to 'adapter serial', even if executed before 'jlink usb'.

Change-Id: I920b0c136716f459b6fd6f7da8a01a7fa1ed389f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6656
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2 years agojtag/xds110: switch to command 'adapter serial' 55/6655/3
Antonio Borneo [Thu, 7 Oct 2021 21:03:23 +0000 (23:03 +0200)]
jtag/xds110: switch to command 'adapter serial'

The driver xds110 defines the command 'xds110 serial' to specify
the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Note: the original command 'xds110 serial' used a complex and
undocumented conversion of the serial number through multibyte
string, wide-character string and C cast. The XDS110 I can access
and the lsusb dumps available through Google don't show any
exotic USB serial that require such conversion. The original
developer doesn't remember any constraint that mandates such
conversion (see comments in https://review.openocd.org/4322/).
The conversion is removed by this patch.

Change-Id: I38909918079b2c1797ad85ebec2fea1b33743606
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6655
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agojtag/vsllink: switch to command 'adapter serial' 54/6654/3
Antonio Borneo [Thu, 7 Oct 2021 20:39:45 +0000 (22:39 +0200)]
jtag/vsllink: switch to command 'adapter serial'

The driver vsllink defines the command 'vsllink usb_serial' to
specify the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: Iadcc018b8aa8974ccd7156915b84e58270fad29d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6654
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agojtag/presto: switch to command 'adapter serial' 53/6653/3
Antonio Borneo [Thu, 7 Oct 2021 20:35:12 +0000 (22:35 +0200)]
jtag/presto: switch to command 'adapter serial'

The driver presto defines the command 'presto serial' to specify
the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: I1a69acce7d4910082d2029d5941ae84f9424314c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6653
Tested-by: jenkins
2 years agojtag/kitprog: switch to command 'adapter serial' 52/6652/3
Antonio Borneo [Thu, 7 Oct 2021 20:31:27 +0000 (22:31 +0200)]
jtag/kitprog: switch to command 'adapter serial'

The driver kitprog defines the command 'kitprog_serial' to specify
the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: I844cb815af01137392b6d12e1b5972fc77ac092d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6652
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agojtag/ftdi: switch to command 'adapter serial' 51/6651/3
Antonio Borneo [Thu, 7 Oct 2021 20:28:30 +0000 (22:28 +0200)]
jtag/ftdi: switch to command 'adapter serial'

The driver ftdi defines the command 'ftdi serial' to specify the
serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: Ia5b1f325b9fab8f58b5ea70f8b807e50b148b939
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6651
Tested-by: jenkins
2 years agojtag/ft232r: switch to command 'adapter serial' 50/6650/3
Antonio Borneo [Thu, 7 Oct 2021 20:25:27 +0000 (22:25 +0200)]
jtag/ft232r: switch to command 'adapter serial'

The driver ft232r defines the command 'ft232r serial_desc' to
specify the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: I0bd909923a668420604fed3c9f6a260716b044c7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6650
Tested-by: jenkins
2 years agojtag/cmsis_dap: switch to command 'adapter serial' 49/6649/3
Antonio Borneo [Thu, 7 Oct 2021 17:42:54 +0000 (19:42 +0200)]
jtag/cmsis_dap: switch to command 'adapter serial'

The driver cmsis_dap defines the command 'cmsis_dap_serial' to
specify the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: I88e2d4de360a6c6f23529bb18494962a267250df
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6649
Tested-by: jenkins
2 years agojtag/aice: switch to command 'adapter serial' 48/6648/3
Antonio Borneo [Thu, 7 Oct 2021 17:34:27 +0000 (19:34 +0200)]
jtag/aice: switch to command 'adapter serial'

The driver aice defines the command 'aice serial' to specify the
serial string of the adapter, but actually does not use this value
in the code.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: I892e0a4e1b41a7a87adf54a5736abf7419f32979
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6648
Tested-by: jenkins
2 years agojtag/adapter: add command 'adapter serial' 47/6647/3
Antonio Borneo [Thu, 7 Oct 2021 17:27:31 +0000 (19:27 +0200)]
jtag/adapter: add command 'adapter serial'

Several adapter define their own command to specify the USB serial
number or serial string to be used during USB search.

Define a general command 'adapter serial' to be proposed as
replacement of the driver specific ones.
No driver is changed so far to use it.

Change-Id: I7631687a4163ccc63a9bdf3ad1fcb300fc483d3a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6647
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agotarget/hla_target: set cortex_m->common_magic 41/6741/3
Tomas Vanek [Mon, 22 Nov 2021 12:50:01 +0000 (13:50 +0100)]
target/hla_target: set cortex_m->common_magic

hla_target uses the same struct cortex_m_common as the standard cortex_m
target. Unlike the cortex_m target hla missed setting of common_magic.

Set commont_magic to help pointer verification.

Add convenience tests is_cortex_m_or_hla() and
is_cortex_m_with_dap_access()

Use proper test in cortex_m_verify_pointer() - this code relied on
unset common_magic on hla target before the change.

Change-Id: I4dae79f056c3d73adf524e26aa8ef2d3a57b471e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6741
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc: fix typos in commands definition 25/6725/2
Antonio Borneo [Thu, 18 Nov 2021 11:29:49 +0000 (12:29 +0100)]
doc: fix typos in commands definition

Change-Id: Ie07260f229c6bd227bae0bf3dd97d29bf84c72ec
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6725
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodoc: remove non-existing command readgroup 23/6723/2
Antonio Borneo [Thu, 18 Nov 2021 10:45:15 +0000 (11:45 +0100)]
doc: remove non-existing command readgroup

The documentation included it in commit 4e79b48e2c7e ("Add new
target type: OpenRISC"), but the command was never added.

Remove it!

Change-Id: Ice5fa1ee4086b5f5ceb942c3ce68bc9bbd75d19b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 4e79b48e2c7e ("Add new target type: OpenRISC")
Reviewed-on: https://review.openocd.org/c/openocd/+/6723
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodoc: remove non-existing command swd wcr 22/6722/2
Antonio Borneo [Thu, 18 Nov 2021 10:30:08 +0000 (11:30 +0100)]
doc: remove non-existing command swd wcr

The commands has been dropped in commit 150b7d26f213 ("arm_adi_v5:
Update DP (Debug Port) registers defined in ADIv5.2.") but the
documentation still keeps it.

Remove it!

Change-Id: I4e88f481d943f064d919f8065562052244122bf0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 150b7d26f213 ("arm_adi_v5: Update DP (Debug Port) registers defined in ADIv5.2.")
Reviewed-on: https://review.openocd.org/c/openocd/+/6722
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodoc: remove non-existing command riscv set_scratch_ram 21/6721/2
Antonio Borneo [Thu, 18 Nov 2021 10:15:42 +0000 (11:15 +0100)]
doc: remove non-existing command riscv set_scratch_ram

The command was proposed in http://review.openocd.org/#/c/4578/2
and dropped in favor on existing work area commands.
Nevertheless the command landed in documentation.

Remove it!

Change-Id: I6e18124256f29be15d8593c07d96f61d19e983f8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: a51ab8ddf63a ("Add RISC-V support.")
Reviewed-on: https://review.openocd.org/c/openocd/+/6721
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
2 years agoflash/psoc6: initialize usage field 20/6720/2
Antonio Borneo [Wed, 17 Nov 2021 23:27:47 +0000 (00:27 +0100)]
flash/psoc6: initialize usage field

The missing initialization triggers a run-time error message:
Error: BUG: command 'psoc6 reset_halt' does not have the '.usage'
field filled out

Change-Id: I975e4ba99bd939aa924a9d62b1ab76b2ab5bf193
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6720
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoflash/rp2040: don't initialize to NULL fields in struct 19/6719/2
Antonio Borneo [Wed, 17 Nov 2021 23:25:37 +0000 (00:25 +0100)]
flash/rp2040: don't initialize to NULL fields in struct

When a struct is initialized, missing fields are already filled
with zero or NULL.
This change simplifies scripts to compare documentation and
registered commands.

Change-Id: I96fbdfa98bbb1f2b5e2a9532faf5a15cb5bc28dd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6719
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoopenocd: declare struct command_registration in a single line 18/6718/2
Antonio Borneo [Wed, 17 Nov 2021 21:44:21 +0000 (22:44 +0100)]
openocd: declare struct command_registration in a single line

To simplify scripts to compare documentation and registered
commands.

Change-Id: I3bed5ba80ea8be1fd615697e80d66b42d7b45fd1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6718
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoopenocd: use unique name for struct command_registration 17/6717/3
Antonio Borneo [Wed, 17 Nov 2021 21:15:20 +0000 (22:15 +0100)]
openocd: use unique name for struct command_registration

Just to avoid name clash when comparing documentation with
registered commands through scripts.

Change-Id: I8832545d8d9236ea5dabe6e73732f51e5246caff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6717
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agoopenocd: use single line for register_commands*() 16/6716/2
Antonio Borneo [Mon, 8 Nov 2021 23:04:52 +0000 (00:04 +0100)]
openocd: use single line for register_commands*()

Do not split in multiple lines the calls to register_commands*().
No change in code behaviour, just make it easy to grep in the code
and identify the commands that can be registered.
This would help detecting undocumented commands.

Change-Id: Id654e107cdabf7ee31fc3d227c1d2a59acc5669e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6716
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agotarget/arm_dap: check SWD DAP configuration 42/6142/7
Tomas Vanek [Tue, 6 Apr 2021 20:30:52 +0000 (22:30 +0200)]
target/arm_dap: check SWD DAP configuration

Raise error if

* more than one plain SWD DAPs are defined

* plain and multidrop DAPs are mixed

* two multidrop DAPs have the same TARGETSEL value

Inspired by Graham Sanderson's http://review.openocd.org/4935

Change-Id: I7279744464f5cc6477e50695c596be9c5e5507bf
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6142
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/adi_v5_swd: add support for SWD multidrop 41/6141/6
Tomas Vanek [Tue, 6 Apr 2021 13:04:31 +0000 (15:04 +0200)]
target/adi_v5_swd: add support for SWD multidrop

Based on Graham Sanderson's http://review.openocd.org/4935

Unlike Graham Sanderson's version this patch does not add
any multidrop specific queuing.

Multidrop SWD is handled mostly by the same code as single SWD,
just a selection sequence is prepended to a SWD operation
as needed.

This is a minimal working implementation without checking for
configuration errors (mixing multidrop and non multidrop DPs,
multiple use of the same selection id etc...).

Multidrop switching likely demands changes in the adapter code.

Change-Id: I99a5742c209b49c0483e800f6105cb5e59a897d9
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6141
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/arm_adi_v5,arm_dap: introduce multidrop_targetsel and its configuration 40/6140/5
Tomas Vanek [Tue, 6 Apr 2021 11:59:14 +0000 (13:59 +0200)]
target/arm_adi_v5,arm_dap: introduce multidrop_targetsel and its configuration

Add multidrop_targetsel to struct adiv5_dap.
Add option -dp-id and -instance-id to dap create command.
Add convenience function dap_is_multidrop()

Change-Id: Ibb93abb5f50b3665c320a10c1497421035762134
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6140
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget/arm_dap: clean up dap_configure code 02/6702/2
Tomas Vanek [Mon, 15 Nov 2021 14:32:39 +0000 (15:32 +0100)]
target/arm_dap: clean up dap_configure code

dap_configure() contained first time init related tasks, as the call to
dap_init_instance() and the check for configured tap.

Move all first time init related stuff to dap_create() to make dap_configure()
usable in eventual stand-alone 'dap configure' command.

Change-Id: Ia86eadb4e960ce54e8581630d01af75720d2318d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6702
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2 years agotarget/adi_v5_swd: introduce swd_queue_dp_read/write_inner() 39/6139/4
Tomas Vanek [Mon, 5 Apr 2021 03:57:46 +0000 (05:57 +0200)]
target/adi_v5_swd: introduce swd_queue_dp_read/write_inner()

This is a preparatory change for swd multidrop, mostly refactoring.

Split swd_queue_dp_read/write() to inner and outer parts.
Use the inner parts in swd_queue_dp_bankselect(), swd_connect()
they do not need to check reconnect.
Use the outer parts exclusively in swd_dap_ops.

Rearrange the code to reduce forward declarations.

Change-Id: I47b7f0cb037e0032a267463f06ba02123ba96fe7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6139
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agodrivers/bitbang: add support for SWD multidrop 00/6700/4
Tomas Vanek [Fri, 12 Nov 2021 14:28:30 +0000 (15:28 +0100)]
drivers/bitbang: add support for SWD multidrop

Ignore ack received after DP_TARGETSEL write to prevent false error.

This change also fixes a bug:
Received ACK FAULT or JUNK value were incorrectly stored to queued_retval
and later used as bitbang_swd_run_queue() error return.

Use LOG_ERROR for parity mismatch.

Change-Id: I5ff1f658f221af78d8bbec8416a7a0fc64ba2550
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6700
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/ftdi: add support for SWD multidrop 98/6698/4
Tomas Vanek [Fri, 12 Nov 2021 13:14:32 +0000 (14:14 +0100)]
drivers/ftdi: add support for SWD multidrop

Ignore ack received after DP_TARGETSEL write to prevent false error.

Inspired by Graham Sanderson's http://review.openocd.org/4935

Change-Id: I04fd77cde3244de250743d8c8bfb93ed26379385
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6698
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/swd: add support for SWD multidrop 99/6699/3
Tomas Vanek [Fri, 12 Nov 2021 08:49:01 +0000 (09:49 +0100)]
drivers/swd: add support for SWD multidrop

According to ARM IHI0031C+ chapter 2.3.11 "TARGETSEL, Target Selection register"
multidrop capable DPv2 must not drive SWDIO line during the response phase
of a write to TARGETSEL register.

Introduce helper functions swd_cmd_returns_ack() and swd_ack_to_error_code()
to centralize these tests from all drivers to one place.

Introduce distinct error codes for SWD protocol.

Partly inspired by Graham Sanderson's http://review.openocd.org/4935

Change-Id: Ie5f9edb22e066a933a534bf2b29e7e1d3087dad1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6699
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agotarget/arm_dap: fix memory leak in error path of dap_create() 85/6685/4
Tomas Vanek [Wed, 10 Nov 2021 11:46:42 +0000 (12:46 +0100)]
target/arm_dap: fix memory leak in error path of dap_create()

Change-Id: I91fa5910670161b62a76fc834b6394c5a6c05395
Suggested-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6685
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agojtag/hla_layout: add #include <target/arm_tpiu_swo.h> 87/6687/2
Tarek BOCHKATI [Thu, 11 Nov 2021 22:55:39 +0000 (23:55 +0100)]
jtag/hla_layout: add #include <target/arm_tpiu_swo.h>

hla_layout.h uses explicitly tpiu_pin_protocol enum defined in
arm_tpiu_swo.h.
To make this header file consistent, add the missing include.

Change-Id: Ibecc279da8d6859ced2b8377e812554c747d81bb
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6687
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/jtag_vpi: Added "jtag_vpi:" prefixes to log messages 86/6686/2
Jan Matyas [Thu, 11 Nov 2021 15:35:18 +0000 (16:35 +0100)]
drivers/jtag_vpi: Added "jtag_vpi:" prefixes to log messages

Added "jtag_vpi:" prefixes to log messages from the jtag_vpi
driver. The intention is to make it clear what the messages
relate to. Without the prefix, many of the log messages
won't make much sense to the user.

This change does not alter any functionality, just
the printed text.

Example:

Before:
Error: Can't connect to 127.0.0.1 : 5555

After:
Error: jtag_vpi: Can't connect to 127.0.0.1 : 5555

Change-Id: I779c379f52722b094b200d08b25ab0f7280d2845
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6686
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotarget: Use target_addr_t for algorithm addresses. 62/6662/3
Tim Newsome [Tue, 12 Oct 2021 18:06:44 +0000 (11:06 -0700)]
target: Use target_addr_t for algorithm addresses.

Otherwise 64-bit addresses can't work.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: Id9f92ff8a1602153cc06810bcf515a9d0a89c81b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6662
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoriscv: Clear type 6 triggers on connecting. 84/6684/3
Tim Newsome [Tue, 5 Oct 2021 17:03:19 +0000 (10:03 -0700)]
riscv: Clear type 6 triggers on connecting.

I missed this when I first add mcontrol6 support.

https://github.com/riscv/riscv-openocd/pull/648

Change-Id: I1a2706c7ea3a6757ed5083091cd2c764a8b0267c
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6684
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoriscv: Regenerated debug_defines.h and encoding.h 82/6682/4
Jan Matyas [Thu, 4 Nov 2021 16:48:23 +0000 (17:48 +0100)]
riscv: Regenerated debug_defines.h and encoding.h

The main intention is to get access to some of the CSRs
that were so far unknown to OpenOCD (tinfo, mcountinhibit, ...).

https://github.com/riscv/riscv-openocd/pull/659

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I824fdb558d5c1f73432b0f56f3b0b4d865eceeba
Reviewed-on: https://review.openocd.org/c/openocd/+/6682
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agojimtcl: update to master branch 20211108 74/6674/2
Antonio Borneo [Mon, 8 Nov 2021 08:42:41 +0000 (09:42 +0100)]
jimtcl: update to master branch 20211108

Today's version of jimtcl includes a fix for autoconf >= 2.70 and
a minor fix for warnings with GCC 11.
To prepare for next jimtcl 0.81, let's merge and test the updated
master branch.

Change-Id: I455cc708f7d4786461978e38b6ac71816e2c9825
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6674
Tested-by: jenkins
2 years agoadi_v5_swd: add comment to describe debug flag 'do_sync' 96/6696/2
Antonio Borneo [Thu, 11 Nov 2021 22:48:10 +0000 (23:48 +0100)]
adi_v5_swd: add comment to describe debug flag 'do_sync'

Change-Id: I1f7f0eed7a6e3626f5fde841ec7fa1d29906db29
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6696
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoftdi: add support to switch to/from dormant state 93/6693/3
Antonio Borneo [Thu, 11 Nov 2021 21:29:32 +0000 (22:29 +0100)]
ftdi: add support to switch to/from dormant state

Partially extracted from https://review.openocd.org/4935

Change-Id: Ia3f197b257434a1a7979fdbc08936c7c541db1e2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: graham sanderson <graham.sanderson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6693
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2 years agojlink: add support to switch to/from dormant state 92/6692/3
Antonio Borneo [Thu, 11 Nov 2021 21:13:55 +0000 (22:13 +0100)]
jlink: add support to switch to/from dormant state

Change-Id: Ifeda21ab7a40926166045f211b9e772aedff715d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6692
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agodrivers/bitbang: add support to switch to/from dormant state 91/6691/3
Antonio Borneo [Thu, 11 Nov 2021 15:44:27 +0000 (16:44 +0100)]
drivers/bitbang: add support to switch to/from dormant state

While there, replace the SWD_CMD_PARK macro to the magic number.

Change-Id: Id9094dcb2b010b9e894a5ed9e4a99d2287e5969c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6691
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agocmsis_dap: add support for dormant-to-jtag 90/6690/3
Antonio Borneo [Thu, 11 Nov 2021 15:42:51 +0000 (16:42 +0100)]
cmsis_dap: add support for dormant-to-jtag

Change-Id: I4a51f3772cd94d7dda5a66a1d13acd24d0d0c63c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6690
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agoarm_adi_v5: add missing enum DORMANT_TO_JTAG 89/6689/2
Antonio Borneo [Thu, 11 Nov 2021 15:39:39 +0000 (16:39 +0100)]
arm_adi_v5: add missing enum DORMANT_TO_JTAG

Add the value DORMANT_TO_JTAG in the enum listing the SWJ-DP
switching sequences.
The corresponding bit-sequence is already available.

Change-Id: I6f1ffd29a8f5729ec70ce0303248bc251409d37d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6689
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agocortex_m: Restore fast register reads if no polling is needed 78/6678/2
Andreas Fritiofson [Mon, 8 Nov 2021 17:09:56 +0000 (18:09 +0100)]
cortex_m: Restore fast register reads if no polling is needed

If the target is in a state where S_REGRDY polling is necessary (slow
clock, low power state...?), OpenOCD will continue to use the slow
path even if the condition is temporary and the target at a later
point would be capable of fast reads again.

Revert to fast reads if a full register dump can be made without need
for polling any of the registers; presumably it will succeed the next
time too.

Change-Id: I557f0d90b7ce6f9d81aa409b6400fc9c83d16008
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6678
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agotarget/cortex_m: faster reading of all CPU registers 21/5321/7
Tomas Vanek [Tue, 5 Feb 2019 08:39:11 +0000 (09:39 +0100)]
target/cortex_m: faster reading of all CPU registers

Without the change cortex_m_debug_entry() reads all registers
calling cortex_m_load_core_reg_u32() for each register with
a poor usage of JTAG/SWD queue.
It is time consuming, especially on an USB FS based adapter.
Moreover if target_request debugmsgs are enabled, DCB_DCRDR
is saved and restored on each register read.

This change introduces cortex_m_fast_read_all_regs()
which queues all register reads and a single dap_run() transaction
does all work.

cortex_m_fast_read_all_regs() reads all registers unconditionally
regardless register cache is valid or not. This is a difference
from the original cortex_m_debug_entry() code.

cortex_m_debug_entry times from -d3 log, Cortex-M4F and CMSIS-DAP
(Kinetis K28F-FRDM kit)

target_request |                time [ms]
debugmsgs      | without the change | with the change
---------------+--------------------+-----------------
disable        |        186         |       27
enable         |        232         |       29

Added checking of DHCSR.S_REGRDY flag. If "not ready" is seen,
cortex_m->slow_register_read is set and fallback to the old
register read method cortex_m_slow_read_all_regs() is used
instead of cortex_m_fast_read_all_regs().

Change-Id: I0665d94b97ede217394640871dc451ec93410254
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/5321
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agocortex_m: poll S_REGRDY on register r/w 19/5319/7
Antonio Borneo [Mon, 14 Oct 2019 17:03:48 +0000 (19:03 +0200)]
cortex_m: poll S_REGRDY on register r/w

Accordingly to arm documentation [1], chapter C1.6.4, the
operation to read/write from/to core registers can require time,
and the specific flag DHCSR.S_REGRDY has to be polled to verify
that the operation has been completed.
The lack of check on S_REGRDY causes OpenOCD to fail handling
correctly the core registers on a Cortex-M4 emulated in a slow
FPGA, and it could also fail on devices clocked at very low speed
while using a fast adapter.

Poll S_REGRDY as specified in [1] while either reading or writing
the core registers.
A timeout of 0.5s is added. This could still be too small in some
extremely slow cases, but at least now we log the timeout event,
which can help tracking down such odd issue.
During register read include in the polling loop the read of DCRSR
and to flush the JTAG queue only once.
During register write, relax the write in DCRSR by removing the
atomicity that is now useless since followed by the atomic read to
S_REGRDY.
During register read include the read of DCRSR inside the polling
loop to relax the read of S_REGRDY since followed by the atomic
read to DCRSR.

This change has the drawback of adding other transfers to the
adapter while reading/writing the registers, so it is expected to
introduce some speed degradation during step-by-step.

[1] DDI0403E - "ARMv7-M Architecture Reference Manual"

Change-Id: I61f454248f11a3bec6dcf4c58a50c5c996d7ef81
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/5319
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agotarget/cortex_m: cumulate DHCSR sticky bits 80/6180/6
Tomas Vanek [Thu, 22 Apr 2021 08:41:50 +0000 (10:41 +0200)]
target/cortex_m: cumulate DHCSR sticky bits

DCB DHCSR register contains S_RETIRE_ST and S_RESET_ST bits cleared
on a read.

The change introduces a helper function cortex_m_cumulate_dhcsr_sticky().
Call this function each time DHCSR is read to preserve S_RESET_ST state
in the case of a reset event was detected.

Introduce cortex_m_read_dhcsr_atomic_sticky() convenience helper to
read DHCSR, store it to cortex_m->dcb_dhcsr and cumulate sticky bits.

The cumulated state of S_RESET_ST is read and cleared in cortex_m_poll()

Change-Id: Ib679599f850fd219fb9418c6ff32eed7cf5740da
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6180
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agotarget/cortex_m: use cortex_m->dcb_dhcsr in cortex_m_soft_reset_halt() 77/6677/2
Tomas Vanek [Mon, 8 Nov 2021 14:40:24 +0000 (15:40 +0100)]
target/cortex_m: use cortex_m->dcb_dhcsr in cortex_m_soft_reset_halt()

cortex_m->dcb_dhcsr caches status of DHCSR register.
Use it instead of local variable in cortex_m_soft_reset_halt()
like in other code.

Extracted from [1].

[1] Antonio Borneo: 6207: cortex_m: rework handling of dcb_dhcsr

Link: https://review.openocd.org/c/openocd/+/6207
Change-Id: I9a0aeba0b6b0b4969f05f4a32fc2fc8d244f56ca
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6677
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agocortex_m: use cortex_m_write_debug_halt_mask() in cortex_m_single_step_core() 76/6676/2
Tomas Vanek [Mon, 8 Nov 2021 13:24:33 +0000 (14:24 +0100)]
cortex_m: use cortex_m_write_debug_halt_mask() in cortex_m_single_step_core()

cortex_m_single_step_core() used mem_ap_write_atomic_u32() to manipulate
dhcsr bits unlike the rest of code, where a specialized function
cortex_m_write_debug_halt_mask() takes place.

Unify setting of dhcsr bits and use cortex_m_write_debug_halt_mask() here as well.

Extracted from [1].

[1] Antonio Borneo: 6207: cortex_m: rework handling of dcb_dhcsr

Link: https://review.openocd.org/c/openocd/+/6207
Change-Id: I9ef05ce88a9dce42e1d3d5404a4fe87ec86b5fe8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6676
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agoflash/nor/at91samd: Add SAMR35J18B support 64/6664/3
Janco Kock [Fri, 22 Oct 2021 14:06:22 +0000 (16:06 +0200)]
flash/nor/at91samd: Add SAMR35J18B support

Add support for the mcu SAMR35J18B

Signed-off-by: Janco <janco@factorylab.nl>
Change-Id: I45d801485ad1c16d1b3086516a2b6d71d13f3fc7
Reviewed-on: https://review.openocd.org/c/openocd/+/6664
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agoflash/nor/stm32f1x: Add support for GD32E23x 27/6527/6
asier70 [Wed, 1 Sep 2021 20:00:51 +0000 (22:00 +0200)]
flash/nor/stm32f1x: Add support for GD32E23x

GD32E23x from GigaDevice is cortex-M23 microcontroller and it can work with the stm32f1x driver.
Modifications are similar to this done for GD32F1x0 in #6164 (https://review.openocd.org/c/openocd/+/6164).
Configuration file is added because its cortex-M23 CPU ID is different.
I think that GigaDevice microcontrollers should be handled in an independent unit to separate them from STM32,
but nowadays quick solution is welcome.

Signed-off-by: asier70Andrzej Sierżęga <asier70@gmail.com>
Change-Id: I91f31f5f66808bc50a8f607ac2c107e6b7c5e2b8
Reviewed-on: https://review.openocd.org/c/openocd/+/6527
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agojtagspi: fix build on MacOS 01/6701/2
Antonio Borneo [Sat, 13 Nov 2021 13:38:21 +0000 (14:38 +0100)]
jtagspi: fix build on MacOS

Commit be57b0ab847e ("Update jtagspi driver for 1-, 2- and 4-byte
addresses") introduces two incorrect format string for uint32_t
data types.
This cause build failure on MacOS:

src/flash/nor/jtagspi.c:474:35: error: format specifies type 'unsigned char'
but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
        LOG_DEBUG("status=0x%02" PRIx8, *status);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

src/flash/nor/jtagspi.c:513:65: error: format specifies type 'unsigned char'
but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
        LOG_ERROR("Cannot enable write to flash. Status=0x%02" PRIx8, status);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~

Fix the format string.

Change-Id: I209053317c8b26c35c6f11be0553ccccc698c551
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: be57b0ab847e ("Update jtagspi driver for 1-, 2- and 4-byte addresses")
Reviewed-on: https://review.openocd.org/c/openocd/+/6701
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2 years agoflash/stm32h7x: don't read flash size using the H74/H75x CPU2 70/6670/2
Tarek BOCHKATI [Wed, 20 Oct 2021 11:13:01 +0000 (12:13 +0100)]
flash/stm32h7x: don't read flash size using the H74/H75x CPU2

CPU2 (Cortex-M4) cannot read flash size register.
assume the maximum flash size without triggering an error message

Change-Id: I5c3328b7cc42e3aa57165075021227d7936f3d26
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6670
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/stm32h7x: avoid using magic numbers for device ids 69/6669/2
Tarek BOCHKATI [Wed, 20 Oct 2021 11:10:44 +0000 (12:10 +0100)]
flash/stm32h7x: avoid using magic numbers for device ids

Change-Id: I4d682ee828404974abd9a42f98b840d77835cfe0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6669
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agostlink (tcp): manage scattered stlink-server responses 71/6671/3
Tarek BOCHKATI [Wed, 3 Nov 2021 15:22:22 +0000 (16:22 +0100)]
stlink (tcp): manage scattered stlink-server responses

detected in ubuntu 20.04
sometimes, the stlink-server response could be segmented on multiple
packets.

this causes stlink_tcp_send_cmd to fail with the following msg:
Error: failed to receive USB CMD response
because the received_size < expected size

to fix the issue, do recv in a loop till all data is received
or timeout is reached.

Change-Id: I46cc60c231b4cc52f150ead268f843bc60c41149
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6671
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agohelper/log: Add macros for target-related errors/warnings/... 67/6667/3
Jan Matyas [Mon, 1 Nov 2021 14:28:28 +0000 (15:28 +0100)]
helper/log: Add macros for target-related errors/warnings/...

This commit introduces macros for target related log entries
(error, warning, ...) which is a very common operation in OpenOCD:

* LOG_TARGET_ERROR
* LOG_TARGET_WARNING
* LOG_TARGET_INFO
* LOG_TARGET_DEBUG
* LOG_TARGET_DEBUG_IO

The goal is to have one macro for this common operation and to
make such log entries look the same way - to make it more readable
for humans as well easier for parsing via scripts.

Change-Id: I6166565fc9040b03d3fca5c3aa44a1ccbcf96ad2
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6667
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agojtag/adapter: fix memory leak on usb location 46/6646/2
Antonio Borneo [Thu, 7 Oct 2021 16:13:21 +0000 (18:13 +0200)]
jtag/adapter: fix memory leak on usb location

At exit, free the memory allocated to hold the USB location.

Change-Id: I050701f4dc8be14fd40e8add9d0b047461fa0d1c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6646
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag: remove file driver.h 45/6645/2
Antonio Borneo [Thu, 7 Oct 2021 13:07:57 +0000 (15:07 +0200)]
jtag: remove file driver.h

The only purpose of include file driver.h was to expose the API
to register the adapter's commands.

Move the prototype in adapter.h, already used by openocd.c.

Change-Id: Ie1090c60ef9e5bac5ea187c87bed6e7b08d9671c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6645
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag: align adapter speed code to new structure 44/6644/2
Antonio Borneo [Thu, 7 Oct 2021 12:59:29 +0000 (14:59 +0200)]
jtag: align adapter speed code to new structure

Rename the jtag_XXX functions as adapter_XXX.
Rename internal variables.
Adapt log messages and comments text.

Change-Id: I67f209c67074899cd58bad495055def03f0d1bcf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6644
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag: move prototype of adapter init/quit and speed to adapter.h 43/6643/2
Antonio Borneo [Thu, 7 Oct 2021 12:30:43 +0000 (14:30 +0200)]
jtag: move prototype of adapter init/quit and speed to adapter.h

After moved the code, align the include files.

Change-Id: I514a3020648816810d69f76c2ec4f6e52a1c57ab
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6643
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag/adapter: move config vars in struct adapter_config 42/6642/2
Antonio Borneo [Thu, 7 Oct 2021 10:21:18 +0000 (12:21 +0200)]
jtag/adapter: move config vars in struct adapter_config

Move the static variables used to configure the adapter in
the struct adapter_config.

Change-Id: I1639e2bd39d0cbb12c71dfa347025558879d8b1d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6642
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag: move adapter init/quit and speed to adapter.c 41/6641/2
Antonio Borneo [Thu, 7 Oct 2021 10:13:28 +0000 (12:13 +0200)]
jtag: move adapter init/quit and speed to adapter.c

The configuration code for adapter parameters is spread around.

Move in adapter.c the code that handles the configuration of
adapter speed.
For convenience, move also the functions adapter_init() and
adapter_quit(), that anyway have no reason to be in file core.c

To simplify the review, the code moved is not modified. It will be
cleaned and adapted in the following changes.

Change-Id: I2b38975a0cd2e74d3d2de6c56ea17818ff225fd8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6641
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag/adapter: move 'usb location' code in adapter.c 40/6640/2
Antonio Borneo [Wed, 6 Oct 2021 21:17:30 +0000 (23:17 +0200)]
jtag/adapter: move 'usb location' code in adapter.c

The configuration code for adapter parameters is spread around.

Add a struct in adapter.c aimed at containing all the adapter's
configuration data.
Move in adapter.c the code related to configuring 'usb location'
and the copyright tag.
Add adapter.h to export the functions.
While there:
- rework the copyright and the SPDX tag;
- rename the 'usb location' functions;
- remove the JTAG_SRC variable in Makefile.am.

Change-Id: I4fe0d32991a8a30e315807180688035ae9ee01ce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6640
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agojtag/core: get rid of variable 'jtag' 39/6639/2
Antonio Borneo [Thu, 7 Oct 2021 08:37:06 +0000 (10:37 +0200)]
jtag/core: get rid of variable 'jtag'

The variable 'jtag' is set to 'adapter_driver' during adapter
initialization and is used:
- to check if adapter has been initialized;
- as local copy of adapter_driver.

Introduce a static flag to check if the adapter has been already
initialized and a convenience test function.
Use the test function and the original value of adapter_driver in
the code and drop the variable 'jtag'.

Change-Id: I1b1c54d3b36d7b60390985d787c8449432788141
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6639
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agoUpdate jtagspi driver for 1-, 2- and 4-byte addresses 76/4876/14
Andreas Bolsch [Mon, 28 Jan 2019 09:37:53 +0000 (10:37 +0100)]
Update jtagspi driver for 1-, 2- and 4-byte addresses

jtagspi driver always used 3-byte addresses regardless of actual
device capcity. Now select 1- to 4-byte addresses depending on
device capacity.
Some devices need a special command to activate the 4-byte address
mode, a special command to accomplish this, and a further command
for setting device properties are added.
Additionally, restriction (start of range had to be page aligned)
removed.
Tested with XCS6SLX16 board and W25Q256FV in 3- and 4-byte address
modes.

Change-Id: I88b2877517a18dac460253ae6d97f3dded054e6c
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/4876
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: zapb <dev@zapb.de>
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)