openocd.git
10 months agoHACKING: add info on usage of sparse 79/7679/2
Antonio Borneo [Sun, 7 May 2023 14:15:46 +0000 (16:15 +0200)]
HACKING: add info on usage of sparse

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

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

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

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

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

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

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

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

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

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

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

The pointer nand_devices is used in two file.

Move the extern prototype in code.h

Detected through 'sparse' tool.

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

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

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

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

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

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

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

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

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

Detected through 'sparse' tool.

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

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

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

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

Don't assign pointer to 0, use NULL.

Detected through 'sparse' tool.

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

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

Fix them.

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

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

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

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

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

Detected through 'sparse' tool.

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

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

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

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

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

Detected through 'sparse' tool.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

While there, add the missing .usage field.

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

While there, add the missing .usage field.

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

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

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

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

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

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

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

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

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

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

Fix the check by calling the function.

Detected through 'sparse' tool.

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

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

Fix the check on malloc() returned pointer.

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

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

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

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

Free the array while propagating the error.

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

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

Detected through 'sparse' tool.

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

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

Detected through 'sparse' tool.

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

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

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

Detected through 'sparse' tool.

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

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

Detected through 'sparse' tool.

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

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

Detected through 'sparse' tool.

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

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

Detected through 'sparse' tool.

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

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

Detected through 'sparse' tool.

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

Add static type to symbols that are not used elsewhere.

Detected through 'sparse' tool.

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

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

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

Detected through 'sparse' tool.

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

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

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

Detected through 'sparse' tool.

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

Add static type to symbols that are not used elsewhere.

Detected through 'sparse' tool.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Below warnings are fixed.

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

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

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

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

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

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

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

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

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

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

which trigger this exception:

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

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

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

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change-Id: I41d1006233251dcaf6d69bda580488b204b7eb63
Reviewed-on: https://review.openocd.org/c/openocd/+/6807
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agopld: move file sanity checks to pld.c 88/7388/8
Daniel Anselmi [Wed, 14 Dec 2022 08:27:38 +0000 (09:27 +0100)]
pld: move file sanity checks to pld.c

Change-Id: Id64b1165b25a03634949ac22b8af16eb0e24c1fa
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7388
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agoflash/rsl10: fix typo 84/7584/2
Mark Zhuang [Mon, 10 Apr 2023 02:57:55 +0000 (10:57 +0800)]
flash/rsl10: fix typo

Change-Id: I11af37309fe4684fcb340a00fcc7b2096b8dad76
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7584
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agortos/linux.c: Fix Linux user space border check 70/7570/3
panciyan [Sun, 2 Apr 2023 05:17:17 +0000 (05:17 +0000)]
rtos/linux.c: Fix Linux user space border check

Linux kernel and user space border is 0xc0000000 not 0xc000000

Signed-off-by: panciyan <panciyan@eswincomputing.com>
Change-Id: I6b487cce62ac31737deca97d5f5f7bbc081280f4
Reviewed-on: https://review.openocd.org/c/openocd/+/7570
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agosrc/server: Fix memory leak of reg_list 66/7566/3
panciyan [Fri, 31 Mar 2023 15:12:08 +0000 (15:12 +0000)]
src/server: Fix memory leak of reg_list

memory leak of reg_list when local_list realloc fail.

Signed-off-by: panciyan <panciyan@eswincomputing.com>
Change-Id: I6b09137ecd132ab326205f5a575a38bcc82e8469
Reviewed-on: https://review.openocd.org/c/openocd/+/7566
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agotarget/espressif: add application tracing functionality over JTAG 63/7163/20
Erhan Kurubas [Thu, 25 Aug 2022 12:38:34 +0000 (15:38 +0300)]
target/espressif: add application tracing functionality over JTAG

This feature allows to transfer arbitrary data between host and
ESP32 via JTAG.

The main use cases:

1- Collecting application specific data
2- Lightweight logging to the host
3- System behaviour analysis with SEGGER SystemView
4- Source code coverage

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I95dee00ac22891fa326915a3fcac3c088cbb2afc
Reviewed-on: https://review.openocd.org/c/openocd/+/7163
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agodoc: drop "resume will wait 5 seconds" 79/7579/3
Tomas Vanek [Tue, 4 Apr 2023 11:03:59 +0000 (13:03 +0200)]
doc: drop "resume will wait 5 seconds"

Checkpatch-ignore: GIT_COMMIT_ID

Waiting for running state was removed from handle_resume_command()
in commit a92d27afb073 ("very long and bad structured commit msg
without anything relevant to resume") around year 2008.
Update the doc accordingly.

Silent checkpatch or we have to copy 10 or more lines
of the old commit msg.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I3296cb2c29cf80aeed63eddd8fbf352edec778c1
Reviewed-on: https://review.openocd.org/c/openocd/+/7579
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agotcl: cpld/xilinx-xc7: remove virtex-7 devices with ir-length > 6 87/7387/5
Daniel Anselmi [Wed, 30 Nov 2022 03:05:44 +0000 (04:05 +0100)]
tcl: cpld/xilinx-xc7: remove virtex-7 devices with ir-length > 6

They have an ir length of 22, 24 or 38 bit and different command codes.

Change-Id: I488e8613f1c4d017e1590111f60b2725ec62964b
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7387
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agotcl: zynq_7000: add missing id codes 86/7386/6
Daniel Anselmi [Wed, 30 Nov 2022 02:42:18 +0000 (03:42 +0100)]
tcl: zynq_7000: add missing id codes

Add missing ID codes and ignore the version in the ID.

Change-Id: Idd2d3a5eddb6995f3af1c45afd2adf76ce3442bf
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7386
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agohelper/compiler fix build with gcc on MacOS 71/7571/2
Antonio Borneo [Sun, 2 Apr 2023 12:24:23 +0000 (14:24 +0200)]
helper/compiler fix build with gcc on MacOS

On MacOS libc includes files from MacOSX.sdk that define the macro
#define __nonnull
without arguments, causing compile error.

Extend the existing check for clang on MacOS and undefine the
macro for gcc too.

Change-Id: Ic99de78348c6aa86561212a3aded9342e5d32e02
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7571
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
12 months agoipdbg: whitespaces 99/7399/3
Daniel Anselmi [Wed, 14 Dec 2022 11:51:48 +0000 (12:51 +0100)]
ipdbg: whitespaces

Change-Id: I9294c551cf2e795ad5e3e92dc3926c564424e067
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7399
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agohelper/list: re-align with Linux kernel 6.3-rc1 68/7568/2
Antonio Borneo [Tue, 14 Mar 2023 14:20:14 +0000 (15:20 +0100)]
helper/list: re-align with Linux kernel 6.3-rc1

Minor changes due to kernel switch to 100 char/line.
Added four new functions.

Silent checkpatch; we don't want to diverge from Linux reference
code.
Checkpatch-ignore: MACRO_ARG_REUSE, UNNECESSARY_PARENTHESES
Checkpatch-ignore: MACRO_ARG_PRECEDENCE

Change-Id: I1d2ff25bf3bab8cd0f5c9be55c7501795490ea75
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7568
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agohelper/list: remove unused hlist_* 67/7567/2
Antonio Borneo [Tue, 14 Mar 2023 14:01:18 +0000 (15:01 +0100)]
helper/list: remove unused hlist_*

The file list.h is taken from Linux and includes two similar
implementation of double linked lists:
- with single linked list's head (hlist_*), and
- with double linked list's head (list_*).
While the former offers a minor memory footprint improvement,
keeping two implementations makes harder for newbie developers
to approach them.

So far only the latter implementation has been used and no new
patches in gerrit is going to change that.

Drop the support for lists with single linked head.
It can be easily taken back from git history, if needed.

Change-Id: I420e5de38ab755fdfbeb2115538c61818308ec2b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7567
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agosrc/target/mips_m4k : add fast read method 64/7564/9
François LEGAL [Wed, 29 Mar 2023 15:46:38 +0000 (17:46 +0200)]
src/target/mips_m4k : add fast read method

Add the fast read method to speed up flash verification
after programming. Works the same as fast write already
implemented.

Signed-off-by: François LEGAL <devel@thom.fr.eu.org>
Change-Id: I74611a3542a88212f0483ec8ee368aba3d1f03c7
Reviewed-on: https://review.openocd.org/c/openocd/+/7564
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agosrc/target/mips_m4k : fix condition on overlapping workspace data area 63/7563/2
François LEGAL [Wed, 29 Mar 2023 12:19:48 +0000 (14:19 +0200)]
src/target/mips_m4k : fix condition on overlapping workspace data area

The condition to check if the workspace area (used by actual MIPS code
executed on target) and data area (sandbox to put data to be read/written
to/from flash) is wrong, thus preventing the use of FAST_* commands to
program/verify FLASH.

Signed-off-by: François LEGAL <devel@thom.fr.eu.org>
Change-Id: Ic68424b7f42d44e550433a120093db5e7980fd56
Reviewed-on: https://review.openocd.org/c/openocd/+/7563
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agortos/FreeRTOS: some optimization of freertos_update_threads() 49/7549/3
Chao Du [Wed, 22 Mar 2023 06:51:51 +0000 (06:51 +0000)]
rtos/FreeRTOS: some optimization of freertos_update_threads()

1.
update the rtos->thread_count in time, to make sure the allocated
thread_name_str and extra_info_str could be freed by
rtos_free_threadlist(). Otherwise the abnormal return may cause a
memory leak.
2.
remove a redundant assignment to threadid.

Signed-off-by: Chao Du <duchao@eswincomputing.com>
Change-Id: Ifabc59d501c925b3d6aec8b04b2856d2c31cc4e2
Reviewed-on: https://review.openocd.org/c/openocd/+/7549
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agogithub/workflow: build libjaylink from source 52/7552/3
Erhan Kurubas [Sat, 25 Mar 2023 00:00:51 +0000 (03:00 +0300)]
github/workflow: build libjaylink from source

Libjaylink submodule disabled by default at
https://review.openocd.org/c/openocd/+/7129

--enable-internal-libjaylink config option will be deprecated soon.

So, building the source is a permanent solution.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Id06654d806a3a49f35e3ba41e9e4cc58c1a0d388
Reviewed-on: https://review.openocd.org/c/openocd/+/7552
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agogithub/workflow: increase delete-tag-and-release version 51/7551/6
Erhan Kurubas [Fri, 24 Mar 2023 23:56:19 +0000 (02:56 +0300)]
github/workflow: increase delete-tag-and-release version

During setup job in the GH actions, GH tries to resolve
all actions before starting to run the scripts.
It can not find 0.2.0 version inside
'dev-drprasad/delete-tag-and-release 'repo and action fails.

This patch fixes that error.
Also, switched to the latest ubuntu image
Hidapi version updated to 0.13.1

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I02af41f6189d5a28f874c9b008073d74de46b4ca
Reviewed-on: https://review.openocd.org/c/openocd/+/7551
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
12 months agoflash/nor: missing fileio_close. 46/7546/4
panciyan [Mon, 20 Mar 2023 02:26:58 +0000 (02:26 +0000)]
flash/nor: missing fileio_close.

If the file read abnormally, need to close it which was opened before.

Signed-off-by: panciyan <panciyan@eswincomputing.com>
Change-Id: I6142f154741dcd38088b7add2793219ee4dd2ae9
Reviewed-on: https://review.openocd.org/c/openocd/+/7546
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agotcl/board: add Calao USB-A9G20 24/7524/7
Wolfram Sang [Sun, 5 Mar 2023 07:38:14 +0000 (08:38 +0100)]
tcl/board: add Calao USB-A9G20

Add a basic config.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Change-Id: Ie68e5fbb26b1c2f3028e561af0255fa71ec61828
Reviewed-on: https://review.openocd.org/c/openocd/+/7524
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agotcl/board/calao-usb-a9260: fix and refactor broken support 22/7522/5
Wolfram Sang [Fri, 3 Mar 2023 11:26:46 +0000 (12:26 +0100)]
tcl/board/calao-usb-a9260: fix and refactor broken support

The old configuration files did not work because of a missing
'at91sam9260minimal.cfg' file. Also, the config files were placed
wrongly. Update them, put them to the proper location, merge the two
supported boards into one, remove now superfluous include, remove
defunct web page, etc.. Tested with a Calao USB-A9G20 and a hacked
'device_desc' to match. Native support for it will come next.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Change-Id: Iec578c8777c5a6134e132dbac17c2988c7634742
Reviewed-on: https://review.openocd.org/c/openocd/+/7522
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
12 months agotarget: rewrite command 'target smp' as COMMAND_HANDLER 11/7511/2
Antonio Borneo [Mon, 19 Dec 2022 23:11:41 +0000 (00:11 +0100)]
target: rewrite command 'target smp' as COMMAND_HANDLER

This also fixes an incorrect return ERROR_xx from a jim command,
propagated from return value of rtos_smp_init().

Change-Id: Icf4893c00aabd8fadd60077c5e8a2e926f687518
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7511
Tested-by: jenkins
12 months agotarget: rewrite command 'target names' as COMMAND_HANDLER 10/7510/2
Antonio Borneo [Mon, 19 Dec 2022 22:58:01 +0000 (23:58 +0100)]
target: rewrite command 'target names' as COMMAND_HANDLER

Print one entry per line.
While there add the mandatory 'usage' field.

Change-Id: Ia832684817f3bdbfa4cb943cd97e3f9fb2605902
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7510
Tested-by: jenkins
12 months agotarget: rewrite command 'target types' as COMMAND_HANDLER 09/7509/2
Antonio Borneo [Mon, 19 Dec 2022 22:54:10 +0000 (23:54 +0100)]
target: rewrite command 'target types' as COMMAND_HANDLER

Print one entry per line.
While there add the mandatory 'usage' field.

Change-Id: I135556e12154e33fdbd0f71d89f6fe37c69813b7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7509
Tested-by: jenkins
12 months agotarget: rewrite command 'target current' as COMMAND_HANDLER 08/7508/2
Antonio Borneo [Mon, 19 Dec 2022 22:50:23 +0000 (23:50 +0100)]
target: rewrite command 'target current' as COMMAND_HANDLER

While there add the mandatory 'usage' field.

Change-Id: I3e5b826ca58f7ade30a443ada0cb4a9cd9ea35c2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7508
Tested-by: jenkins
12 months agotarget: rewrite command 'arp_halt_gdb' as COMMAND_HANDLER 07/7507/2
Antonio Borneo [Mon, 19 Dec 2022 22:44:04 +0000 (23:44 +0100)]
target: rewrite command 'arp_halt_gdb' as COMMAND_HANDLER

While there add the mandatory 'usage' field.

Change-Id: I5389881dac25877dc32930ec36ee546e48ecc14d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7507
Tested-by: jenkins
12 months agotarget: rewrite command 'examine_deferred' as COMMAND_HANDLER 06/7506/2
Antonio Borneo [Mon, 19 Dec 2022 22:41:22 +0000 (23:41 +0100)]
target: rewrite command 'examine_deferred' as COMMAND_HANDLER

Check for empty command line, add the mandatory 'usage' field.

Change-Id: I9c3606242ec3dda9026fe19222162a110e618bff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7506
Tested-by: jenkins
12 months agotarget: rewrite command 'was_examined' as COMMAND_HANDLER 05/7505/2
Antonio Borneo [Mon, 19 Dec 2022 22:37:07 +0000 (23:37 +0100)]
target: rewrite command 'was_examined' as COMMAND_HANDLER

Check for empty command line, add the mandatory 'usage' field.

Change-Id: I3f59448458fe01268bf5f4293aea5adcbd6d8279
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7505
Tested-by: jenkins
12 months agotarget: rewrite command 'target curstate' as COMMAND_HANDLER 04/7504/2
Antonio Borneo [Mon, 19 Dec 2022 22:25:21 +0000 (23:25 +0100)]
target: rewrite command 'target curstate' as COMMAND_HANDLER

While there, add the mandatory 'usage' field.

Change-Id: Ibfda6f56a1450e2eb9ad3092d756de0778f4a092
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7504
Tested-by: jenkins
12 months agotarget: rewrite command 'read_memory' as COMMAND_HANDLER 03/7503/2
Antonio Borneo [Mon, 19 Dec 2022 22:15:54 +0000 (23:15 +0100)]
target: rewrite command 'read_memory' as COMMAND_HANDLER

While there, fix typo on 'exceeds'.
In a following patch, the output could be formatted and split in N
values per line to make it easier to read by humans.

Change-Id: I295111a80934393011e46311f6cf6c13f2bdc0a3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7503
Tested-by: jenkins
12 months agotarget: arm_tpiu_swo: rewrite command 'tpiu init' as COMMAND_HANDLER 02/7502/2
Antonio Borneo [Mon, 19 Dec 2022 20:00:42 +0000 (21:00 +0100)]
target: arm_tpiu_swo: rewrite command 'tpiu init' as COMMAND_HANDLER

Change-Id: Iaaccfc62dd85267066a152c434f254d1b9a0c4f1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7502
Tested-by: jenkins
12 months agotarget: arm_tpiu_swo: rewrite command 'tpiu names' as COMMAND_HANDLER 01/7501/2
Antonio Borneo [Mon, 19 Dec 2022 19:56:40 +0000 (20:56 +0100)]
target: arm_tpiu_swo: rewrite command 'tpiu names' as COMMAND_HANDLER

While there, format in a human readable way the output list by
using one line per tpiu name.

Change-Id: I937c92b6c1e92509cf8aa96be1517a51bc363600
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7501
Tested-by: jenkins
12 months agotarget: arm_tpiu_swo: rewrite command 'tpiu enable' as COMMAND_HANDLER 00/7500/2
Antonio Borneo [Mon, 19 Dec 2022 19:52:51 +0000 (20:52 +0100)]
target: arm_tpiu_swo: rewrite command 'tpiu enable' as COMMAND_HANDLER

Change-Id: Ia600948b99a229ef0490b7f576df62f880db8546
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7500
Tested-by: jenkins
12 months agotarget: arm_tpiu_swo: rewrite command 'tpiu disable' as COMMAND_HANDLER 99/7499/2
Antonio Borneo [Mon, 19 Dec 2022 19:28:56 +0000 (20:28 +0100)]
target: arm_tpiu_swo: rewrite command 'tpiu disable' as COMMAND_HANDLER

Change-Id: I689482f898bde2afa2881b2f311676a6b98abb9a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7499
Tested-by: jenkins
12 months agotarget: arm_dap: rewrite command 'dap names' as COMMAND_HANDLER 98/7498/2
Antonio Borneo [Mon, 19 Dec 2022 17:35:23 +0000 (18:35 +0100)]
target: arm_dap: rewrite command 'dap names' as COMMAND_HANDLER

While there, format in a human readable way the output list by
using one line per dap name.

Change-Id: I24a47350105b90db15808c61790f05d807120739
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7498
Tested-by: jenkins
12 months agojtag: rewrite command 'flush_count' as COMMAND_HANDLER 97/7497/2
Antonio Borneo [Mon, 19 Dec 2022 17:29:08 +0000 (18:29 +0100)]
jtag: rewrite command 'flush_count' as COMMAND_HANDLER

While there:
- check the number of command parameters;
- add the mandatory 'usage' field.

Change-Id: I7cd16f049753caedf19f313f7dc84be98efdba42
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7497
Tested-by: jenkins
12 months agojtag: rewrite command 'jtag arp_init-reset' as COMMAND_HANDLER 96/7496/2
Antonio Borneo [Mon, 19 Dec 2022 17:23:11 +0000 (18:23 +0100)]
jtag: rewrite command 'jtag arp_init-reset' as COMMAND_HANDLER

While there add the mandatory 'usage' field.

Change-Id: I316fb31e24e94985dcc724e428b0384be7ef5bdd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7496
Tested-by: jenkins
12 months agojtag: rewrite command 'jtag arp_init' as COMMAND_HANDLER 95/7495/2
Antonio Borneo [Mon, 19 Dec 2022 17:18:48 +0000 (18:18 +0100)]
jtag: rewrite command 'jtag arp_init' as COMMAND_HANDLER

While there add the mandatory 'usage' field.

Change-Id: I3491ed79d11c5a3e81cc9afd2423da14b8df72ff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7495
Tested-by: jenkins
12 months agojtag: rewrite command 'jtag names' as COMMAND_HANDLER 94/7494/2
Antonio Borneo [Mon, 19 Dec 2022 17:08:03 +0000 (18:08 +0100)]
jtag: rewrite command 'jtag names' as COMMAND_HANDLER

While there:
- format in a human readable way the output list by using one line
  per tap name;
- add the mandatory 'usage' field.

Change-Id: I295449220c78fac8973478b265413342ea832f61
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7494
Tested-by: jenkins
12 months agojtag: rewrite command 'adapter name' as COMMAND_HANDLER 93/7493/2
Antonio Borneo [Sun, 18 Dec 2022 21:11:14 +0000 (22:11 +0100)]
jtag: rewrite command 'adapter name' as COMMAND_HANDLER

Trivial change.
Add the mandatory 'usage' field.

Change-Id: Id92af5cd873fb86f5de79f785f156d1ef734b005
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7493
Tested-by: jenkins
12 months agotarget: cti: rewrite command 'cti names' as COMMAND_HANDLER 92/7492/2
Antonio Borneo [Mon, 19 Dec 2022 16:55:13 +0000 (17:55 +0100)]
target: cti: rewrite command 'cti names' as COMMAND_HANDLER

While there, format in a human readable way the output list by
using one line per cti name.

Change-Id: I6d4870ee512fe7e6935d73355c2377ad805ccc3b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7492
Tested-by: jenkins
12 months agotarget: armv4_5: rewrite commands 'arm mcr/mrc' as COMMAND_HANDLER 91/7491/2
Antonio Borneo [Mon, 19 Dec 2022 12:02:59 +0000 (13:02 +0100)]
target: armv4_5: rewrite commands 'arm mcr/mrc' as COMMAND_HANDLER

While there, add a check for target halted and check the number of
parameters accordingly to the command name.

Change-Id: I9e8bb109c35039561997d14782fac682267aee65
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7491
Tested-by: jenkins
12 months agotarget: aarch64: rewrite commands 'aarch64 mcr/mrc' as COMMAND_HANDLER 90/7490/2
Antonio Borneo [Mon, 19 Dec 2022 11:49:20 +0000 (12:49 +0100)]
target: aarch64: rewrite commands 'aarch64 mcr/mrc' as COMMAND_HANDLER

This also fixes an incorrect return ERROR_TARGET_NOT_HALTED from a
jim command.

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