openocd.git
2 years agoflash/stm32l4x: remove stm32l4_part_info.default_flash_regs 35/6435/4
Tarek BOCHKATI [Fri, 13 Aug 2021 23:09:29 +0000 (00:09 +0100)]
flash/stm32l4x: remove stm32l4_part_info.default_flash_regs

This struct element is replaced by the usage of F_HAS_L5_FLASH_REGS flag:
since over this driver stm32l4_flash_regs is the default register layout,
and the only exception is STM32L5 family,
so it's simpler to manage it using a flag.

Note: the same flag will be used with STM32U5 devices, as they have
the same registers layout, which explains the move of stm32l5_s_flash_regs
before the switch(device_id) in order to not re-write this for STM32U5.

Change-Id: I3b67a6f558d9350f609a22524012b6fceb7de7c2
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6435
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
2 years agoflash/stm32l4x: introduce flash programming without loader 73/6273/9
Tarek BOCHKATI [Tue, 25 May 2021 10:54:50 +0000 (11:54 +0100)]
flash/stm32l4x: introduce flash programming without loader

this capability permits to program the flash if we cannot reserve a workarea.

the introduction the command 'stm32l4x flashloader <bank_id> [enable|disable]'
helps to automatically skip using the flashloader if needed.

Change-Id: Id29213c85ee5c7c487cfee21554f5a7ea50db6c9
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6273
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
2 years agoflash/stm32l4x: STM32L5 support programming when TZEN=1 and RDP=0x55 35/6035/17
Tarek BOCHKATI [Fri, 22 Jan 2021 12:15:52 +0000 (13:15 +0100)]
flash/stm32l4x: STM32L5 support programming when TZEN=1 and RDP=0x55

when RDP level is 0.5 the provided work-area should reside in non-secure RAM
to ensure that:
 - add a hint in the driver level
 - reduce the usage of secure RAM only when TZEN=1 and RDP is not 0.5
   (check the target configuration file)

Change-Id: Idbf2325e609b84ef8480eefdb49a176fdf7e07c7
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6035
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
2 years agoflash/stm32l4x: STM32L5 support programming when TZEN=1 and RDP=0xAA 36/5936/19
Tarek BOCHKATI [Thu, 12 Nov 2020 16:19:40 +0000 (17:19 +0100)]
flash/stm32l4x: STM32L5 support programming when TZEN=1 and RDP=0xAA

STM32L5 flash memory is aliased to 0x0C000000, this address mapping
is used for secure applications. (0x08000000 for non-secure)

this change allows the programming of secure and non-secure flash
when trustzone is enabled and RDP level is 0

Change-Id: I89d1f1b5d493cf01a142ca4dbfef5a3731cab96e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5936
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2 years agoflash/stm32l4x: introduce auto-probe when OPTR is changed 35/5935/14
Tarek BOCHKATI [Tue, 10 Nov 2020 18:15:54 +0000 (19:15 +0100)]
flash/stm32l4x: introduce auto-probe when OPTR is changed

auto re-probing is ensured by having optr cache set in the
last probe operation.

this will help to detect if flash options have been modified by the
running application or by the user using direct register access.

Change-Id: I05cd7ab9e83a7fc26ac6cff175b3c11b0efa2eb5
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5935
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
2 years agoflash/stm32l4x: introduce 'stm32l4x trustzone [enable|disable]' command 42/5542/19
Tarek BOCHKATI [Wed, 25 Mar 2020 21:47:08 +0000 (22:47 +0100)]
flash/stm32l4x: introduce 'stm32l4x trustzone [enable|disable]' command

this command will help to enable/disable or display the TrustZone security,
using the TZEN option bit.

Note: This command works only with devices with TrustZone, eg. STM32L5.
Note: This command will perform an OBL_Launch after modifying the TZEN.

Change-Id: I4aef15bf57d09c1658d37858143d23b1d43de1f0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5542
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2 years agoflash/stm32l4x: do not report bank mode before probing [FIX] 11/6411/3
Tarek BOCHKATI [Thu, 29 Jul 2021 09:35:26 +0000 (10:35 +0100)]
flash/stm32l4x: do not report bank mode before probing [FIX]

in line 1391, get_stm32l4_bank_type_str(bank) will always output the same
value "Flash single" since the variable stm32l4_info->dual_bank_mode is false
by default, stm32l4_info->dual_bank_mode will be set correctly afterward
in the switch case at line 1467

thus the need to remove the usage of get_stm32l4_bank_type_str(bank) before
stm32l4_info->dual_bank_mode initialization.

Fixes: 64c2e03b23d9 ("flash/nor: improved API of flash_driver.info & fixed buffer overruns")
Change-Id: Ia8dc7e144e0ded6143682eb514c247f27859ff81
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6411
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agotcl: add lattice ECP5 family support 12/6112/6
Oleksij Rempel [Sun, 14 Mar 2021 17:19:06 +0000 (18:19 +0100)]
tcl: add lattice ECP5 family support

Add support for ECP5 FPGA targets and board based on this chips:
Radiona ULX3S and Lambdaconcept ECPIX-5

Change-Id: I932fc6e2458cda7d63ac21579acddea5b53410bc
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6112
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2 years agotarget/adi_v5_jtag: Add support for 8-bit IR JTAG-DP 85/6285/2
root [Thu, 3 Jun 2021 09:37:37 +0000 (11:37 +0200)]
target/adi_v5_jtag: Add support for 8-bit IR JTAG-DP

As per Arm Debug Interface Architecture Specification (ADIv5.0 to
ADIv5.2), B3.3.1, the JTAG-DP as an IR length of 4 or 8 bits
depending on the ARM implementation. The current code
only support 4-bit and this patch extends the support to 8-bit IR.
Not tested back yet on a 4-bit target.

Change-Id: Ie4f875dc336caf014c6cfced57574b54d0970623
Signed-off-by: Antoine C. <acalando@free.fr>
Reviewed-on: https://review.openocd.org/c/openocd/+/6285
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agocortex_a: use the ap number specified at target create 13/6413/2
Antonio Borneo [Wed, 4 Aug 2021 15:50:02 +0000 (17:50 +0200)]
cortex_a: use the ap number specified at target create

Current implementation ignores the flag '-ap-num' provided to
command 'target create' and searches for the first AP of APB type.

If specified, use the ap number.

Change-Id: If1ac12345220d14a4a60515efe46dc2a2eac079a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6413
Tested-by: jenkins
2 years agojep106: use packed jedec manufacturer code 18/6418/2
Antonio Borneo [Sun, 8 Aug 2021 11:51:33 +0000 (13:51 +0200)]
jep106: use packed jedec manufacturer code

JEP106 encodes JEDEC-assigned manufacture code as:
a) a sequence of zero or more escape codes 0x7f;
b) an odd-parity bit of the next 7 bits;
c) 7 bits.

The same code is often represented as a single value composed by
the logical OR between:
- the number of escape codes in a), shifted left by 7 positions;
- the 7 bits in c).
This is the preferred packed representation used by this change.

Currently there are only two uses of JEP106 in openocd to get the
manufacturer name:
- to decode the JTAG IDCODE of each TAP, where the JEP106 code is
  already packed as in the preferred representation above in bits
  IDCODE[11:1];
- to decode the ARM CoreSight PIDR register, where the JEP106 code
  is split in 3 parts:
  = PIDR3[3:0], corresponding to bits [10:7] of the packed code;
  = PIDR2[2:0], corresponding to bits [6:4] of the packed code;
  = PIDR1[7:4], corresponding to bits [3:0] of the packed code.

Wrap the existing JEP106 decode function in a simpler API using
the packed code.
Simplify the callers by skipping the bit unpacking.
Change the manufacturer code in CoreSight table dap_partnums[] to
match the packed representation, by removing the always-one bit 7
erroneously taken from PIDR bit JEDEC and included in the former
table.

Change-Id: I63eb4da9e6801fab25e330f1f6b792d2fd619493
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6418
Tested-by: jenkins
2 years agoarm_adi_v5: update coresight class names 31/6431/2
Antonio Borneo [Wed, 11 Aug 2021 15:03:18 +0000 (17:03 +0200)]
arm_adi_v5: update coresight class names

Update the list of ARM coresight classes wrt to latest ARM
documentation.
Use c99 array designator to easily track changes in future.
Add a comment for the entry "OptimoDE DESS". It was added in 2009
by David Brownell, but Google cannot find any reference other than
this line in openocd code its associated commit. It should not be
an issue keeping it as is.

Change-Id: Ia3b646131ee68ca5263095c3a0aeaf75c004b324
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6431
Tested-by: jenkins
2 years agocommand: log the command only when it is executed 36/6436/2
Antonio Borneo [Wed, 11 Aug 2021 22:14:29 +0000 (00:14 +0200)]
command: log the command only when it is executed

In case of multi-word commands, the command dispatcher is nested
called at each word during command name parsing.
The improper position of the call to script_debug() causes the
command line to be logged once at each parsed word.
In the example of command "cpu arm disassemble 0" the full command
is logged three times for "cpu", "arm" and "disassemble":

Debug: 656617 61843 command.c:201 script_debug(): command - cpu arm disassemble 0
Debug: 656618 61843 command.c:201 script_debug(): command - cpu arm disassemble 0
Debug: 656619 61843 command.c:201 script_debug(): command - cpu arm disassemble 0

Call script_debug() only when the parsing is terminated and the
command handler is going to be executed.

Change-Id: Ide4cb01b3b38912e2e24b073c94a9560f92d30bb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6436
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agocortex_m: fix command 'step address' 34/6434/2
Antonio Borneo [Fri, 13 Aug 2021 16:52:20 +0000 (18:52 +0200)]
cortex_m: fix command 'step address'

The command 'step' accepts an optional parameter 'address' to run
the step-by-step execution from an address different from current
program counter.
When OpenOCD sets the new program counter value in the register
cache, it doesn't flag it as dirty. The following call to function
armv7m_restore_context() does not propagate the new value of the
program counter to the target. This cause the target to continue
from the old program counter value, ignoring the user's request.

It is hard to notice the issue if the target is halted in an idle
loop! In fact the default mode to operate step-by-step is to set a
breakpoint to the following instruction and resume execution. In
the idle loop the CPU will pass through the breakpoint whatever
the resume address is. User will find the target halting at the
instruction following 'address' which is consistent with the
expected behaviour of command 'step address'.

To verify the issue on an STM32F4, use a dummy code in SRAM:
halt
mww 0x20000000 0xbf00bf00
mww 0x20000004 0xbf00bf00
mww 0x20000008 0xe7fcbf00
arm disassemble 0x20000000 6
        0x20000000  bf00    nop
        0x20000002  bf00    nop
        0x20000004  bf00    nop
   +--> 0x20000006  bf00    nop
   |    0x20000008  bf00    nop
   +-<- 0x2000000a  e7fc    b   #0x20000006
resume 0x20000006
halt
step 0x20000000
the target doesn't halt because it is in the loop from 0x20000006
to 0x2000000a. The 'step 0x20000000' did not changed the program
counter so the temporary breakpoint at 0x20000002 is never hit.
Then:
halt
step 0x20000008
target halted ...
... pc: 0x2000000a
gives the feeling that only the instruction at 0x20000008 has been
executed, but actually the whole loop has been executed from the
place 'halt' stopped the execution till the breakpoint at the
instruction following 0x20000008.

Flag the program counter cached value as 'valid' and 'dirty' to
force armv7m_restore_context() to update the target's register.

Change-Id: I49bd8bb95b2f5429ec38ed016f2ad706618ae68a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6434
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 years agostlink: fix SWIM mode on stlink-v3 43/6443/2
Antonio Borneo [Thu, 19 Aug 2021 14:07:21 +0000 (16:07 +0200)]
stlink: fix SWIM mode on stlink-v3

Commit 89f07325f2e7 ("stlink: Set speed before entering JTAG/SWD
mode") anticipates setting the adapter speed just before entering
in the JTAG/SWD mode. This to initiate the communication with the
speed selected by the user.
But SWIM doesn't allow setting the speed before entering in SWIM
mode. The resulting error causes OpenOCD to quit.
The problem only happens with stlink-v3, due to the different way
to set the adapter speed on different stlink versions.

Set the speed before entering in the mode only for JTAG and SWD
modes.

Change-Id: Iab42cd9d72ecfac14c7e17bae74e0dee2218b235
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 89f07325f2e7 ("stlink: Set speed before entering JTAG/SWD mode")
Reviewed-on: https://review.openocd.org/c/openocd/+/6443
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agortos/riot: fix out-of-bounds writes when target is corrupted 81/6381/5
Sebastiaan de Schaetzen [Tue, 27 Jul 2021 13:06:57 +0000 (15:06 +0200)]
rtos/riot: fix out-of-bounds writes when target is corrupted

This protects against out-of-bounds writes when the memory
of RIOT's scheduler is corrupted.
This memory can be corrupted because of:
 - Programming errors
 - The scheduler not yet having been initialised
 - An incorrect symbol file being used during debugging.

This error can result in OpenOCD segfaulting. Valgrind was
used to find the approximate location of the error.

Change-Id: I60e7d7c245b8c4e38f4c98cb0c0347a9b5ec3177
Signed-off-by: Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6381
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agortos/riot: fix out-of-bounds read of optional symbols array 28/6428/4
Sebastiaan de Schaetzen [Wed, 11 Aug 2021 12:51:29 +0000 (14:51 +0200)]
rtos/riot: fix out-of-bounds read of optional symbols array

This fixes an out-of-bounds read of the riot_optional_symbols array.

Change-Id: I172ae182dd0c7dd68edaa66ac030030d9bc65401
Signed-off-by: Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6428
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/atsame5: use COMMAND_PARSE_NUMBER in command handlers 23/6423/2
Tarek BOCHKATI [Thu, 29 Jul 2021 22:46:31 +0000 (23:46 +0100)]
flash/atsame5: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: Ia7fe9c4017108616f21676f115f151ac62924205
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6423
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agoflash/kinetis: use COMMAND_PARSE_NUMBER in command handlers 22/6422/2
Tarek BOCHKATI [Thu, 29 Jul 2021 22:46:09 +0000 (23:46 +0100)]
flash/kinetis: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: I972da1a75ba7c41c1b714c2429289c3d24594235
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6422
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agoflash/xmc4xxx: use COMMAND_PARSE_NUMBER in command handlers 21/6421/2
Tarek BOCHKATI [Thu, 29 Jul 2021 22:45:38 +0000 (23:45 +0100)]
flash/xmc4xxx: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: Ibfe95ce73f147f467de8de23e9573ef0179aed96
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6421
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agoflash/at91samd: use COMMAND_PARSE_NUMBER in command handlers 24/6424/3
Tarek BOCHKATI [Thu, 29 Jul 2021 22:47:07 +0000 (23:47 +0100)]
flash/at91samd: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: I14061cb48da6bac13f9d2896190136f5784b8c07
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6424
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agojtag/cmcis_dap: use COMMAND_PARSE_NUMBER in command handlers 20/6420/2
Tarek BOCHKATI [Thu, 29 Jul 2021 22:44:36 +0000 (23:44 +0100)]
jtag/cmcis_dap: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: Ife9342c6088a241a0a4b77f9bd21f12c9b9862a0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6420
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 years agoflash/stm32l4x: use COMMAND_PARSE_NUMBER in command handlers 19/6419/2
Tarek BOCHKATI [Thu, 29 Jul 2021 21:05:18 +0000 (22:05 +0100)]
flash/stm32l4x: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: I7e113b06b74f2d8d9cc4c0ce1957994a1c49c964
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6419
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
2 years agogithub/workflow: disable libusb static link for windows build 84/6384/3
Tarek BOCHKATI [Wed, 28 Jul 2021 09:48:59 +0000 (10:48 +0100)]
github/workflow: disable libusb static link for windows build

Current github build for windows is using dynamic libraries,
but libftdi is requiring libusb static libraries.

As a quick solution, just get rid of libftdi till it can be linked without
static libusb.

Change-Id: I9c7cb0b8853459ca48589674498403e255ade5cc
Reported-by: Xiaofan <xiaofanc@gmail.com>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6384
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
2 years agotcl/interface: add Ashling Opella-LD FTDI config files 79/6379/5
Ranjith Chandran [Fri, 23 Jul 2021 04:51:05 +0000 (10:21 +0530)]
tcl/interface: add Ashling Opella-LD FTDI config files

Adding Ashling's FTDI based Debug adapter Opella-LD's JTAG and SWD config files

Change-Id: Ie0e82e3b8326de37641901f5c825372cab31de58
Signed-off-by: ranjith.tc@ashling.com
Reviewed-on: http://openocd.zylin.com/6379
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/ft232r: Group adapter commands 09/6409/3
Marc Schink [Sun, 1 Aug 2021 12:20:22 +0000 (14:20 +0200)]
drivers/ft232r: Group adapter commands

Use a command group 'ft232r' with subcommands instead of individual
commands with 'ft232r_' prefix.

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

Change-Id: I0dbeb4716330c83f8ce89b0d054eb0286b887bdf
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6409
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl: Adapt config files to new usb_blaster command syntax 08/6408/3
Marc Schink [Sun, 1 Aug 2021 12:15:06 +0000 (14:15 +0200)]
tcl: Adapt config files to new usb_blaster command syntax

Change-Id: I4eb645f74ef31fc0b5882299b3487020aa142dd8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6408
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/usb_blaster: Group adapter commands 07/6407/3
Marc Schink [Sun, 1 Aug 2021 12:12:23 +0000 (14:12 +0200)]
drivers/usb_blaster: Group adapter commands

Use a command group 'usb_blaster' with subcommands instead of individual
commands with 'usb_blaster_' prefix.

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

Change-Id: I2ae3d96ba864c20d7db67c74677781a62bfc4eb5
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6407
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodoc/openocd: Fix buspirate example 06/6406/3
Marc Schink [Sun, 1 Aug 2021 12:06:59 +0000 (14:06 +0200)]
doc/openocd: Fix buspirate example

Change-Id: Idcbe73220d7630953cb49e643a58a7ab05c395fa
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6406
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface/buspirate: Adapt to new buspirate command syntax 05/6405/3
Marc Schink [Sun, 1 Aug 2021 12:05:19 +0000 (14:05 +0200)]
tcl/interface/buspirate: Adapt to new buspirate command syntax

Change-Id: I1a82608532f043054abd22eb5b50ab5c5f58cee4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6405
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/buspirate: Group adapter commands 04/6404/3
Marc Schink [Sun, 1 Aug 2021 12:04:49 +0000 (14:04 +0200)]
drivers/buspirate: Group adapter commands

Use a command group 'buspirate' with subcommands instead of individual
commands with 'buspirate_' prefix.

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

Change-Id: Id999d4ba276af576fb22b76052f3c0a1f3e1b876
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6404
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface: Adapt config files to new sysfsgpio command syntax 03/6403/3
Marc Schink [Sat, 31 Jul 2021 21:51:56 +0000 (23:51 +0200)]
tcl/interface: Adapt config files to new sysfsgpio command syntax

Change-Id: I8e8dee6e8869d2853a7a73c8d4dc8b4891fb0389
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6403
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/sysfsgpio: Group adapter commands 02/6402/3
Marc Schink [Sat, 31 Jul 2021 21:49:10 +0000 (23:49 +0200)]
drivers/sysfsgpio: Group adapter commands

Use a command group 'sysfsgpio' with subcommands instead of individual
commands with 'sysfsgpio_' prefix.

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

Change-Id: I103d8d9b0e3169a916d944a999579746f6f6a59c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6402
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface/dln-2-gpiod: Adapt to new linuxgpiod command syntax 01/6401/3
Marc Schink [Sat, 31 Jul 2021 21:45:31 +0000 (23:45 +0200)]
tcl/interface/dln-2-gpiod: Adapt to new linuxgpiod command syntax

Change-Id: Ife1e52fe5da0e0374a606072f1faf7c598cf0e2b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6401
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/linuxgpiod: Group adapter commands 00/6400/3
Marc Schink [Sat, 31 Jul 2021 21:44:24 +0000 (23:44 +0200)]
drivers/linuxgpiod: Group adapter commands

Use a command group 'linuxgpiod' with subcommands instead of individual
commands with 'linuxgpiod_' prefix.

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

Change-Id: Iad9b330363f81128ab1ec1cbc498df28ba2ca152
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6400
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface/jtag_vpi: Adapt to new jtag_vpi command syntax 99/6399/3
Marc Schink [Fri, 30 Jul 2021 16:40:03 +0000 (18:40 +0200)]
tcl/interface/jtag_vpi: Adapt to new jtag_vpi command syntax

Change-Id: I27eeab5e3dd554af00799104471ee8f30fbd0c51
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6399
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/jtag_vpi: Group adapter commands 98/6398/3
Marc Schink [Fri, 30 Jul 2021 16:39:27 +0000 (18:39 +0200)]
drivers/jtag_vpi: Group adapter commands

Use a command group 'jtag_vpi' with subcommands instead of individual
commands with 'jtag_vpi_' prefix.

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

Change-Id: Ie1fcc2cc138796d27f1e862692bb9ef8b11bc10d
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6398
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface: Adapt config files to new bcm2835gpio command syntax 97/6397/3
Marc Schink [Fri, 30 Jul 2021 16:31:07 +0000 (18:31 +0200)]
tcl/interface: Adapt config files to new bcm2835gpio command syntax

Change-Id: I2d649117aa8dbdf5484ace068785a1416efa3ecc
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6397
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/bcm2835gpio: Group adapter commands 96/6396/3
Marc Schink [Fri, 30 Jul 2021 16:29:01 +0000 (18:29 +0200)]
drivers/bcm2835gpio: Group adapter commands

Use a command group 'bcm2835gpio' with subcommands instead of individual
commands with 'bcm2835gpio_' prefix.

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

Change-Id: I8f7b14273b1b2813ac3c9704605d175fa2053008
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6396
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface/jtag_dpi: Adapt to new jtag_dpi command syntax 95/6395/3
Marc Schink [Fri, 30 Jul 2021 16:25:41 +0000 (18:25 +0200)]
tcl/interface/jtag_dpi: Adapt to new jtag_dpi command syntax

Change-Id: Icebf6f0a037f4ea9fb450581fcc599417bffc153
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6395
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/jtag_dpi: Group adapter commands 94/6394/3
Marc Schink [Fri, 30 Jul 2021 16:24:03 +0000 (18:24 +0200)]
drivers/jtag_dpi: Group adapter commands

Use a command group 'jtag_dpi' with subcommands instead of individual
commands with 'jtag_dpi_' prefix.

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

Change-Id: I19271546235a3c6737f975976a0bf0a2f66cbbe7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6394
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/vsllink: Group adapter commands 93/6393/4
Marc Schink [Fri, 30 Jul 2021 16:22:41 +0000 (18:22 +0200)]
drivers/vsllink: Group adapter commands

Use a command group 'vsllink' with subcommands instead of individual
commands with 'vsllink_' prefix.

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

Change-Id: I59273bd7cd08c9801e4a9b3de7beaa86ca854622
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6393
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/ulink: Group adapter commands 92/6392/4
Marc Schink [Fri, 30 Jul 2021 16:20:39 +0000 (18:20 +0200)]
drivers/ulink: Group adapter commands

Use a command group 'ulink' with subcommands instead of individual
commands with 'ulink_' prefix.

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

Change-Id: I600d65de2bbd5fb8107445f7fe93b6b24c572e3e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6392
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/xlnx-pcie-xvc: Group adapter commands 91/6391/3
Marc Schink [Fri, 30 Jul 2021 16:19:02 +0000 (18:19 +0200)]
drivers/xlnx-pcie-xvc: Group adapter commands

Use a command group 'xlnx_pcie_xvc' with subcommands instead of individual
commands with 'xlnx_pcie_xvc_' prefix.

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

Change-Id: I0deaaa14ed14f65bf356f3c248331bfab472f08d
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6391
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/presto: Group adapter commands 90/6390/3
Marc Schink [Fri, 30 Jul 2021 16:11:23 +0000 (18:11 +0200)]
drivers/presto: Group adapter commands

Use a command group 'presto' with subcommands instead of individual
commands with 'presto_' prefix.

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

Change-Id: I883d8d87fd457d29cee8d12cd80f2e6c405e8f42
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6390
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/remote_bitbang: Group adapter commands 89/6389/3
Marc Schink [Fri, 30 Jul 2021 16:01:09 +0000 (18:01 +0200)]
drivers/remote_bitbang: Group adapter commands

Use a command group 'remote_bitbang' with subcommands instead of individual
commands with 'remote_bitbang_' prefix.

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

Change-Id: I2692320f19c8a357112a365db6ca7e13cd6ad411
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6389
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface/openjtag: Adapt to new openjtag command syntax 88/6388/3
Marc Schink [Fri, 30 Jul 2021 15:51:04 +0000 (17:51 +0200)]
tcl/interface/openjtag: Adapt to new openjtag command syntax

Change-Id: I3a9d649dd38a913b1ce6d4a2d506bbf44743d529
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6388
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/openjtag: Group adapter commands 87/6387/3
Marc Schink [Fri, 30 Jul 2021 15:50:21 +0000 (17:50 +0200)]
drivers/openjtag: Group adapter commands

Use a command group 'openjtag' with subcommands instead of individual
commands with 'openjtag_' prefix.

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

Change-Id: Ie1b1bf0b7c03e7703cfb074e554288384bf7b1b9
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6387
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/interface: Adapt config files to new parport command syntax 86/6386/3
Marc Schink [Fri, 30 Jul 2021 15:43:58 +0000 (17:43 +0200)]
tcl/interface: Adapt config files to new parport command syntax

Change-Id: Iffe7a04c36c6ec680497081a99d55b8c69f8f079
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6386
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agodrivers/parport: Group adapter commands 85/6385/4
Marc Schink [Fri, 30 Jul 2021 15:39:11 +0000 (17:39 +0200)]
drivers/parport: Group adapter commands

Use a command group 'parport' with subcommands instead of individual
commands with 'parport_' prefix.

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

Change-Id: I4cb7096a8ba8d6cd7a6dc970862cd73c32b5c0a2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6385
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor: Do not update 'is_erased' 79/6279/3
Marc Schink [Fri, 7 May 2021 10:02:23 +0000 (12:02 +0200)]
flash/nor: Do not update 'is_erased'

Remove useless setting of the 'is_erased' flag after a flash
modification. Also, remove code that erroneously depends on
this flag.

Keep the flag for now since it is still used by the
erase_check() functionality.

See commit 07da3b3913dcb6b65564f4fe67c2f26032f180c0

Change-Id: Ia046905bc9e0cb2572145f19251c3e10c4e2d553
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6279
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agojtag/mpsse: fix SIGSEGV for use after free 17/6417/3
Antonio Borneo [Mon, 9 Aug 2021 13:03:37 +0000 (15:03 +0200)]
jtag/mpsse: fix SIGSEGV for use after free

By pressing CTRL-C on a running openocd with FTDI adapter, it's
possible to generate a segmentation fault that with valgrind is
dumped as a SIGABRT:

^CError: libusb_handle_events() failed with LIBUSB_ERROR_INTERRUPTED
==16594== Invalid read of size 8
==16594==    at 0x48B2472: libusb_submit_transfer
==16594==    by 0x48B4B0F: libusb_control_transfer
==16594==    by 0x1A6B9D: mpsse_purge (mpsse.c:428)
==16594==    by 0x1A7B96: mpsse_flush (mpsse.c:953)
==16594==    by 0x19BA5B: ftdi_execute_queue (ftdi.c:654)
...
==16594==  Address 0x6158568 is 72 bytes inside a block of size 216 free'd
==16594==    at 0x484118B: free (vg_replace_malloc.c:755)
==16594==    by 0x1A7B88: mpsse_flush (mpsse.c:950)
==16594==    by 0x19BA5B: ftdi_execute_queue (ftdi.c:654)
...
==16594==  Block was alloc'd at
==16594==    at 0x48435FF: calloc (vg_replace_malloc.c:1117)
==16594==    by 0x48B2259: libusb_alloc_transfer
==16594==    by 0x1A7A26: mpsse_flush (mpsse.c:880)
==16594==    by 0x19BA5B: ftdi_execute_queue (ftdi.c:654)
...
==16594== Process terminating with default action of signal 6 (SIGABRT):
dumping core
...
Aborted (core dumped)

The error is in mpsse_flush() that, following valgrind dump:
- allocates the buffer at line mpsse.c:880
  read_transfer = libusb_alloc_transfer(0);
- frees the buffer at line mpsse.c:950
  libusb_free_transfer(read_transfer);
- still pretends to use the freed buffer at line mpsse.c:953
  mpsse_purge(ctx);

Move the call to mpsse_purge() right before freeing the buffer.

Change-Id: I47c71ec8c283f4b037fdd7cd72ca2e877cd3a851
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6417
Tested-by: jenkins
2 years agoarm_adi_v5: use macro DP_APSEL_MAX in place of magic number 15/6415/2
Antonio Borneo [Wed, 4 Aug 2021 22:37:32 +0000 (00:37 +0200)]
arm_adi_v5: use macro DP_APSEL_MAX in place of magic number

Commit 11019a824d02 ("adi_v5: enforce check on AP number value")
introduces the macro DP_APSEL_MAX and use it in place of hardcoded
magic numbers for the upper limit of AP selection value.

Fix one more place where the macro should be used.

Change-Id: I6c57f72405c69bbb40924221309d95dfeb5f7540
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 11019a824d02 ("adi_v5: enforce check on AP number value")
Reviewed-on: http://openocd.zylin.com/6415
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agoopenocd: fix cleanup order: cti before dap 14/6414/2
Antonio Borneo [Wed, 4 Aug 2021 22:22:06 +0000 (00:22 +0200)]
openocd: fix cleanup order: cti before dap

cti access is based on dap.
During cleanup, drop cti before dropping dap to guarantee that cti
can still access its dap.

Change-Id: I40c7f67d4d4a32f53802c0ce7668a5321a05893c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6414
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agoarm_adi_v5: fix access to 64-bit MEM-AP 12/6412/2
Antonio Borneo [Thu, 5 Aug 2021 15:08:11 +0000 (17:08 +0200)]
arm_adi_v5: fix access to 64-bit MEM-AP

Commit ac22cdc57322 ("target/adiv5: Large Physical Address
Extension") reads the register MEM_AP_REG_CFG and keeps it in a
new field of struct adiv5_ap. The test on LE bit (Large Extension)
is used to identify if mem_ap addresses are 32 or 64 bits.
But the register MEM_AP_REG_CFG is only read during mem_ap_init(),
that is called only when the AP is used as a target debug AP or if
a target mem_ap is attached to that AP.

The openocd commands '<dapname> baseaddr', '<dapname> info' and
'dap info' can be executed on AP that has not been associated yet
to a target, thus executed without any knowledge of MEM_AP_REG_CFG
value. The initialization to ADI_BAD_CFG causes openocd to always
use 32 bit mode on un-associated APs.

Verify if MEM_AP_REG_CFG has not been read and eventually read it.
In case of 32 bits mode AP, MEM_AP_REG_BASE64 is defined as 'RES0'
(reserved, but readable); the code can queue both the read of
MEM_AP_REG_CFG and MEM_AP_REG_BASE64, before knowing if the former
is required. This speeds-up the operation.
Rename ADI_BAD_CFG as MEM_AP_REG_CFG_INVALID.

Change-Id: If3bbd792b56a483022c37ccc2ce82b5ba5c36caa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: ac22cdc57322 ("target/adiv5: Large Physical Address Extension")
Reviewed-on: http://openocd.zylin.com/6412
Tested-by: jenkins
Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2 years agoarm_adi_v5: fix signed offset in Class 0x1 ROM tables 10/6410/3
Antonio Borneo [Wed, 4 Aug 2021 10:25:18 +0000 (12:25 +0200)]
arm_adi_v5: fix signed offset in Class 0x1 ROM tables

In both arm ADIv5 and ADIv6 documentation, for both Class 0x1 and
Class 0x9 ROM tables, the offset field from ROM tables is supposed
to be a signed value: "Negative values of OFFSET are permitted,
using two’s complement."

The commit ac22cdc57322 ("target/adiv5: Large Physical Address
Extension") extends to 64 bits the addresses while managing the ROM
tables. The offset is read as unsigned and in the former 32 bits
implementation the wrap-around was hiding the need for converting
the offset to signed. The new implementation requires the proper
cast to the offset.

On a STM32F411, without this fix the ROM table dump is incorrectly
reporting addresses out of the 32 bit bus range:
MEM-AP BASE 0xe00ff003
Valid ROM table present
Component base address 0xe00ff000
Peripheral ID 0x00000a0411
Designer is 0x0a0, STMicroelectronics
Part is 0x411, Unrecognized
Component class is 0x1, ROM table
MEMTYPE system memory present on bus
ROMTABLE[0x0] = 0xfff0f003
Component base address 0x1e000e000
                       ^^^^^^^^^^^

Cast the offset before adding it to the base address of the ROM
table.

Change-Id: I8d31fd2b3d657286cb96f8e22fb00842baa728f7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: ac22cdc57322 ("target/adiv5: Large Physical Address Extension")
Reviewed-on: http://openocd.zylin.com/6410
Tested-by: jenkins
Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2 years agohelper/align.h: use it 75/6375/3
Antonio Borneo [Thu, 13 May 2021 22:48:31 +0000 (00:48 +0200)]
helper/align.h: use it

Use the new helper to make the code more readable.

Change-Id: I11b2a79dbc6f93f6cfde382bcc00dd7ff710d908
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6375
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agohelper: add align.h 74/6374/3
Antonio Borneo [Thu, 13 May 2021 17:07:50 +0000 (19:07 +0200)]
helper: add align.h

OpenOCD has to often align values or check for alignment.
Use a dedicated set of macros instead of reinventing the wheel
each time.

Change-Id: Ia58711608aae0801deeaccb5f33148f2073b0bbd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6374
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 years agortos: add debug prints for qSymbol lookup 87/6287/3
Jan Matyas [Thu, 3 Jun 2021 14:55:50 +0000 (16:55 +0200)]
rtos: add debug prints for qSymbol lookup

- Added two debug prints that allow to inspect the symbol
  lookup process (carried out via the qSymbol packets).

- Added a check for an edge situation when the debugger
  would send us different symbol than what we asked for
  (avoids NULL dereference).

Change-Id: I84ae1b2b66473eab76a7966c678d2777b6ef48d6
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6287
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoflash/nor/atsamv: fixed "maybe uninitialized" compiler warning 90/6290/2
Jan Matyas [Fri, 4 Jun 2021 08:19:29 +0000 (10:19 +0200)]
flash/nor/atsamv: fixed "maybe uninitialized" compiler warning

This warning about "maybe uninitialized" variable
used to pop up on certain versions of GCC.

Change-Id: I1cf43b9600885d507afc1dc042322a06751fe146
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6290
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoadd config for Microchip SAMA5D27 SOM1 Kit1 75/5275/5
Oleksij Rempel [Mon, 12 Aug 2019 10:33:50 +0000 (12:33 +0200)]
add config for Microchip SAMA5D27 SOM1 Kit1

... and related SAMA5D27 SoC.

Change-Id: Ic2584e3005ac691642dc2e5a8ee3fb8a4eacaa00
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/5275
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2 years agogithub/workflow: upgrade libraries in windows build to latest versions 83/6383/2
Tarek BOCHKATI [Wed, 28 Jul 2021 09:14:51 +0000 (10:14 +0100)]
github/workflow: upgrade libraries in windows build to latest versions

Change-Id: I11fb6eb948531f1a2e8c0c3926cac52cf92765b9
Reported-by: Xiaofan <xiaofanc@gmail.com>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6383
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years ago.github/workflows: Add missing 'apt-get update' to the snapshot workflow 78/6378/2
Jan Matyas [Fri, 23 Jul 2021 05:29:56 +0000 (07:29 +0200)]
.github/workflows: Add missing 'apt-get update' to the snapshot workflow

During the build of the OpenOCD snapshot via GitHub Actions, ensure that
the local package database is first updated, prior to installing any
packages via apt-get install. Otherwise the apt-get install could fail.

Change-Id: If3c29faeb1496d5e2be75350f6352575b1f3a42e
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6378
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agortos: zephyr: add zephyr_params for cortex r4 69/6369/2
Julien Massot [Tue, 13 Jul 2021 06:41:20 +0000 (08:41 +0200)]
rtos: zephyr: add zephyr_params for cortex r4

Implementation for Cortex-M does works for Cortex-R too,
it allows me to fetch thread list and their backtrace on
a Cortex-R platforms.

Change-Id: I23e6eb00879587ba36e0bfb560f7002a9653d39b
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Reviewed-on: http://openocd.zylin.com/6369
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/board: Add Raspberry Pi 4 model B board 67/6367/5
Jian-Hong Pan [Sun, 11 Jul 2021 04:54:39 +0000 (12:54 +0800)]
tcl/board: Add Raspberry Pi 4 model B board

OpenOCD cannot connect to BCM2711's JTAG interface on RPi 4B board until
the reset configuration mode is set as trst_only.

According to Table 94. GPIO Pins Alternative Function Assignment of
Broadcom's BCM2711 ARM Peripherals datasheet [1] and Raspberry Pi's GPIO
control in config.txt document [2], only Test Reset (TRST) pin (no
System Reset, SRST) is exposed.

[1] https://datasheets.raspberrypi.org/bcm2711/bcm2711-peripherals.pdf
[2] https://www.raspberrypi.org/documentation/configuration/config-txt/gpio.md

Change-Id: I806f0be9700fa0f0944b42c8a651a5731adc762b
Link: http://openocd.zylin.com/#/c/6364/1
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Reviewed-on: http://openocd.zylin.com/6367
Tested-by: jenkins
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agotcl/board: Add Raspberry Pi 3 board 66/6366/5
Jian-Hong Pan [Sun, 11 Jul 2021 04:04:06 +0000 (12:04 +0800)]
tcl/board: Add Raspberry Pi 3 board

OpenOCD cannot connect to BCM2837's JTAG interface on RPi 3 board until
the reset configuration mode is set as trst_only.

According to Table 6-31 GPIO Pins Alternative Function Assignment of
Broadcom's BCM2837 ARM Peripherials datasheet [1] and Raspberry Pi's
GPIO control in config.txt document [2], only Test Reset (TRST) pin (no
System Reset, SRST) is exposed.

[1] https://usermanual.wiki/Datasheet/BCM2837ARMPeripheralsBroadcom.1054296467/view
[2] https://www.raspberrypi.org/documentation/configuration/config-txt/gpio.md

Change-Id: I26ff3924039ff7943faf0a5b1ad0427c8dbb88f2
Link: http://openocd.zylin.com/#/c/6364/1
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Reviewed-on: http://openocd.zylin.com/6366
Tested-by: jenkins
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 years agoCall poll at a fixed interval. 63/6363/5
Tim Newsome [Fri, 9 Jul 2021 19:58:07 +0000 (12:58 -0700)]
Call poll at a fixed interval.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

For the remaining NULL comparisons, remove then manually.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

While there, apply minor style changes.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The patch was created automatically using the following
script:

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

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: I41b72175635f06c000536f583e3efa30fb57379e
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6292
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>

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)