openocd.git
3 years agohelper/command: register full-name commands in jim 71/5671/9
Antonio Borneo [Tue, 12 May 2020 23:59:59 +0000 (01:59 +0200)]
helper/command: register full-name commands in jim

While still keeping the tree of struct command, stop registering
commands in jim by the root "word" only.

Register the full-name of the command and pass as private data the
struct command of the command itself.

Still use the tree of struct command to un-register the commands.

Some "native" commands (.jim_handler) share the same handler, then
the handler checks the command name to run the right code.
Now argv[0] returns the full-name of the command, so check the
name by looking in the struct command passed as private data.

Change-Id: I5623c61cceee8a75f5d5a551ef3fbf5a303af6be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5671
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agohelp: re-implement 'help' independent from tree of struct command 70/5670/7
Antonio Borneo [Sat, 27 Mar 2021 15:12:11 +0000 (16:12 +0100)]
help: re-implement 'help' independent from tree of struct command

The current implementation of "help" related commands is tightly
connected to the tree of struct command.
The TCL commands 'add_usage_text' and 'add_help_text' have to add
fake commands in the tree of struct command to handle the help of
TCL procs.

Move all the help texts in a list accessible from the struct
command_context and register the commands through their full name.
Keep the list sorted alphabetically by the command name, so the
result of commands 'help' and 'usage' will be sorted too.

Remove the associated help and usage during commands un-register,
but call help_del_all_commands() for the text added through TCL
commands 'add_usage_text' and 'add_help_text'.

The resulting help and usage output is not changed by this patch
(tested on all the help and usage strings in current master
branch).

Change-Id: Ifd37bb5bd374cba1a22cd7aac208505b4ae1e6fc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5670
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agocommand mode: return "any" for tcl proc 69/5669/6
Antonio Borneo [Sat, 9 May 2020 00:00:45 +0000 (02:00 +0200)]
command mode: return "any" for tcl proc

A tcl proc can be executed anytime, in any command mode.

Let the command "command mode" to detect a tcl proc and return the
string "any".

Change-Id: I0559076c3063632ee0ea9a57a25f91060209b77f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5669
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agohelper/command: pass command prefix to command registration 68/5668/3
Antonio Borneo [Sun, 10 May 2020 17:35:56 +0000 (19:35 +0200)]
helper/command: pass command prefix to command registration

Replace the "struct command *parent" parameter with a string that
contains the command prefix.
This abstracts the openocd code from the knowledge of the tree of
struct command.
This also makes unused the function command_find_in_context(), so
remove it.

Change-Id: I598d60719cfdc1811ee6f6edfff8a116f82c7ed6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5668
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agohelper/command: override target only on target prefixed cmds 67/5667/3
Antonio Borneo [Tue, 12 May 2020 09:52:56 +0000 (11:52 +0200)]
helper/command: override target only on target prefixed cmds

In current code the current target is overridden whenever
jim_handler_data is not NULL. This happens not only with target
prefixed commands, but also with cti, dap and swo/tpiu prefixed
commands.
While this is not causing any run-time issue, by now, the
behaviour is tricky and makes the code cryptic.

Add a specific field to struct command for the target override so
the content of jim_handler_data can be restricted to command
specific data only (today only cti, dap and swo/tpiu).

Extend the API register_commands() to specify the presence of
either the command data or the override target.

The new API makes obsolete calling command_set_handler_data() to
set jim_handler_data, so remove it.

Change-Id: Icc323faf754b0546a72208f90abd9e68ff2ef52f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5667
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agohelper/command: get current target from dedicated API 66/5666/3
Antonio Borneo [Tue, 12 May 2020 00:36:56 +0000 (02:36 +0200)]
helper/command: get current target from dedicated API

Now that target override is uniformly implemented for all types of
commands, there is no need for target-prefixed "native" commands
(.jim_handler) to sneakily extract the overridden target from the
struct command.

Modify the commands to use the standard API get_current_target().

Change-Id: I732a09c3261e56524edd5217634fa409eb97a8c6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5666
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agohelper/command: use one single handler for all the commands 65/5665/3
Antonio Borneo [Mon, 11 May 2020 23:59:06 +0000 (01:59 +0200)]
helper/command: use one single handler for all the commands

Today openocd registers the commands to jim with three methods:
1) "native" commands (.jim_handler) at root level are registered
   directly as jim commands;
2) "simple" commands (.handler) at root level are registered
   through the handler script_command();
3) all other commands not at root level are registered through the
   handler command_unknown().

Apart from using different handler, other inconsistencies are
present:
a) command in 1) are not checked for their "mode", so are run with
   no check about current mode (COMMAND_CONFIG or COMMAND_EXEC);
b) target_call_timer_callbacks_now() is called only for "simple"
   commands and not for "native" commands;
c) target override is performed only for "simple" commands and not
   for "native" commands.

Drop script_command() and extend command_unknown() to uniformly
handle all the cases above, fixing all the inconsistencies already
mentioned.
The handler's name command_unknown() is probably not anymore
appropriate, but will be renamed in a separate change.

Note: today all the commands in a) have mode CONFIG_ANY, apart for
"mem2array" and "array2mem" that have mode COMMAND_EXEC. But the
latter commands are registered during target init, so do not exist
during COMMAND_CONFIG and no issue is present.

Change-Id: I67bd6e47eb2c575107251b9192c676c27d4aabae
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5665
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agohelper/command: always pass struct command as jim private data 64/5664/3
Antonio Borneo [Mon, 11 May 2020 22:22:13 +0000 (00:22 +0200)]
helper/command: always pass struct command as jim private data

While registering a new command, jim accepts a pointer to command's
private data that will be accessible during the command execution.

Today openocd is not consistent and passes different private data
depending on the command, and then even overwrites it:
- "simple" commands (.handler) are registered with their own
  struct command pointer as command private data;
- "native" commands (.jim_handler) at root level are registered
  with NULL command private data;
- "native" commands (.jim_handler) not at root level are
  registered with the struct command pointer of their root command
  as command private data but, when executed, the command private
  data is overwritten by the value in field jim_handler_data taken
  from their struct command.

Uniform the usage of command private data by always set it to the
struct command pointer while registering the new commands.
Note: for multi-word commands only the root command is registered,
so command private data will be set to the struct command of the
root command. This will change later in this series when the full-
name of the command will be registered.

Don't overwrite the command private data, but let the commands that
needs jim_handler_data to get it directly through struct command.

For sake of uniformity, let function command_set_handler_data() to
set the field jim_handler_data also for "group" commands, even if
such value will not be used.

Now Jim_CmdPrivData() always returns a struct command pointer, so
wrap it in the inline function jim_to_command() to gain compile
time check on the returned type.
While there, uniform the code to use the macro Jim_CmdPrivData()
to access the command's private data pointer.

Change-Id: Idba16242ba1f6769341b4030a49cdf35a5278695
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5664
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 years agoAarch64:Switch to EL1 from EL0 before manipulate MMU 51/6051/5
Cheng-Shiun Tsai [Sat, 6 Feb 2021 23:04:14 +0000 (23:04 +0000)]
Aarch64:Switch to EL1 from EL0 before manipulate MMU

If current core is in EL0, it cannot use 'msr sctlr_el1, x0'

Change-Id: I04e60e39e4c84f9d9de7cc87a8e438f5d2737dc3
Signed-off-by: Cheng-Shiun Tsai <cheng.shiun.tsai@gmail.com>
Reviewed-on: http://openocd.zylin.com/6051
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
3 years agodoc: [3/3] uniform the texinfo syntax for commands definition 52/6152/2
Antonio Borneo [Tue, 6 Apr 2021 21:44:37 +0000 (23:44 +0200)]
doc: [3/3] uniform the texinfo syntax for commands definition

To avoid errors in the documentation, like the one fixed by change
http://openocd.zylin.com/6134/ , use a uniform notation across the
file so simple copy-paste will work.

Enclose every command within curly-brackets '{...}', even single
word commands.
Patch generated through:
sed -i 's/^\(@deffn {[^{]*} \)\([^{][^ ]*\)/\1{\2}/' doc/openocd.texi
sed -i 's/^\(@deffnx {[^{]*} \)\([^{][^ ]*\)/\1{\2}/' doc/openocd.texi

Change-Id: I41a8447d487ec8f6f32c2babcbc73ac21c769344
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6152
Tested-by: jenkins
3 years agodoc: [2/3] uniform the texinfo syntax for commands definition 51/6151/2
Antonio Borneo [Tue, 6 Apr 2021 21:31:32 +0000 (23:31 +0200)]
doc: [2/3] uniform the texinfo syntax for commands definition

To avoid errors in the documentation, like the one fixed by change
http://openocd.zylin.com/6134/ , use a uniform notation across the
file so simple copy-paste will work.

Enclose every Command within curly-brackets '{...}', even single
word commands.
Patch generated through:
sed -i 's/^\(@deffn {Command} \)\([^{][^ ]*\)/\1{\2}/' doc/openocd.texi
sed -i 's/^\(@deffnx {Command} \)\([^{][^ ]*\)/\1{\2}/' doc/openocd.texi

Change-Id: I797e8d9f5ab0aa1936f350b340d3bdd52373f5aa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6151
Tested-by: jenkins
3 years agodoc: [1/3] uniform the texinfo syntax for commands definition 50/6150/2
Antonio Borneo [Tue, 6 Apr 2021 21:24:49 +0000 (23:24 +0200)]
doc: [1/3] uniform the texinfo syntax for commands definition

To avoid errors in the documentation, like the one fixed by change
http://openocd.zylin.com/6134/ , use a uniform notation across the
file so simple copy-paste will work.

Both 'Command' and '{Command}' are in use, with the following
statistics:
  0 @deffnx {Command}
 45 @deffn {Command}
 31 @deffnx Command
382 @deffn Command

While 'Command' is the most popular, prefer the version within
curly-brackets that has to be used for multi-word definition like
'{NAND Driver}', '{Config Command}', '{FPGA Driver}', ...

Patch generated through:
sed -i 's/^\(@deffn \)\(Command\)/\1{\2}/' doc/openocd.texi
sed -i 's/^\(@deffnx \)\(Command\)/\1{\2}/' doc/openocd.texi

Change-Id: If692bbf7e546c5287f466a6aa6940d42b3d4655d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6150
Reviewed-by: Yasushi SHOJI <yashi@spacecubics.com>
Tested-by: jenkins
3 years agodoc: Group adapter sub-commands 34/6134/2
Yasushi SHOJI [Tue, 6 Apr 2021 09:51:57 +0000 (18:51 +0900)]
doc: Group adapter sub-commands

The commit 5280eb618a8cab46 fixed all `adapter_khz` and
`adapter_nsrst_*` commands in the doc but missed grouping them.  This
let the commands `adapter speed`, `adapter srst pulse_width`, and
`adapter srst delay` not indexed.

Tell texinfo about adapter sub-commands by grouping them in one.

Change-Id: Ida53c4f5cfe28827320c145c8d501d53e831623c
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: http://openocd.zylin.com/6134
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agomem_ap: allow GDB connections 34/6034/7
Antonio Borneo [Sun, 20 Dec 2020 20:13:58 +0000 (21:13 +0100)]
mem_ap: allow GDB connections

The target mem_ap is a convenient way to access buses, memory and
peripherals behind an ARM AP.
The current implementation provides only access through OpenOCD
commands, because GDB remote protocol has to interact with a CPU
and has to operate on CPU states and registers.
Using GDB to access the memory is welcome, because GDB can resolve
the symbol's address from an ELF file and can nicely display the
content of complex struct and data types.

Extend mem_ap target with the bare minimal support for a remote
GDB connection, by emulating a fake basic ARM core. It means that
only a GDB that has support for ARM can be used (either 'aarch64',
'arm' or 'multiarch' GDB). This is not seen as a big limitation,
because the mem_ap target is mainly used on ARM based devices.

Add a minimalist register description for the fake CPU.
Fill the field 'debug_reason' as expected by GDB server.
Call the target halted event to reply to GDB halt requests.

For backward compatibility, don't open the GDB port by default. If
needed, it has to be specified at 'target create' or 'configure'
with the flag '-gdb-port'.

Change-Id: I5a1b7adb749746516f5d4ffc6193c47b70132364
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6034
Tested-by: jenkins
3 years agotarget/aarch64: Add watchpoint support 61/4761/8
Liming Sun [Fri, 9 Nov 2018 21:17:25 +0000 (16:17 -0500)]
target/aarch64: Add watchpoint support

There are some breakpoint/watchpoint related code in armv8_dpm.c,
but seems not working for aarch64. Target aarch64 has its own
breakpoint implementation in aarch64.c. This commit follows the
same logic to add watchpoint support for target aarch64.

This commit also increases the size of stop_reason[] in function
gdb_signal_reply() since the old size is too small to fit in a
64-bit address, such as ffff8000115e6980.

Change-Id: I907dc0e648130e36b434220f570c37d0e8eb5ce1
Signed-off-by: Liming Sun <lsun@mellanox.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: http://openocd.zylin.com/4761
Tested-by: jenkins
Reviewed-by: Liming Sun <limings@nvidia.com>
Reviewed-by: Kevin Burke <kevinb@os.amperecomputing.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc/manual/style: Fix comments 33/6133/2
Marc Schink [Mon, 5 Apr 2021 13:40:35 +0000 (15:40 +0200)]
doc/manual/style: Fix comments

The comments currently used are not rendered.

Change-Id: I3fcfb6aee4dea9c4f9186a7aec70d382a1abd634
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6133
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc/manual/style: Do not use 'Yoda conditions' 32/6132/2
Marc Schink [Fri, 2 Apr 2021 09:17:00 +0000 (11:17 +0200)]
doc/manual/style: Do not use 'Yoda conditions'

For more details, see:
https://en.wikipedia.org/wiki/Yoda_conditions
https://sektorvanskijlen.wordpress.com/2019/05/16/conditional-inversion-very-harmful-myth/

Change-Id: If1a8a5f1d0fd345b7cc0c7b5dee6d0d47f9d7fc2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6132
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoLICENSES: add 'license-rules.txt' 73/5973/4
Antonio Borneo [Sat, 12 Dec 2020 10:50:56 +0000 (11:50 +0100)]
LICENSES: add 'license-rules.txt'

Add a file to the LICENSES directory to describe how file licenses
should be described in all the OpenOCD files, using the SPDX
identifier, as well as where all licenses should be in the source
tree for people to refer to (LICENSES/).

This file is mainly copied from the Linux kernel file in
Documentation/process/license-rules.rst
originally written by Thomas Gleixner <tglx@linutronix.de>, with
specific adaptations for OpenOCD.

Change-Id: I7a98fc756df90dc86dbc6e0c47c009a610a0318d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5973
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
3 years agoLICENSES: add the BSD 1-clause license 72/5972/4
Antonio Borneo [Thu, 10 Dec 2020 22:59:01 +0000 (23:59 +0100)]
LICENSES: add the BSD 1-clause license

Add the full text of the BSD 1-clause license.
It was copied directly from:

https://spdx.org/licenses/BSD-1-Clause.html#licenseText

Add the required tags for reference and tooling.

Change-Id: I71444e6a45d0e77fc57220cf1d579c010a27fdf3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5972
Tested-by: jenkins
3 years agoLICENSES: add the BSD 3-clause "New" or "Revised" License 71/5971/4
Thomas Gleixner [Thu, 28 Dec 2017 15:27:16 +0000 (16:27 +0100)]
LICENSES: add the BSD 3-clause "New" or "Revised" License

Add the full text of the BSD 3-clause "New" or "Revised" License to
OpenOCD tree. It was copied directly from:

  https://spdx.org/licenses/BSD-3-Clause.html#licenseText

Add the required tags for reference and tooling.

Change-Id: I0e7977ed92af9d58a4a72152dd792045b237f2f0
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5971
Tested-by: jenkins
3 years agoLICENSES: add the BSD 2-clause "Simplified" license 70/5970/4
Thomas Gleixner [Thu, 28 Dec 2017 15:27:15 +0000 (16:27 +0100)]
LICENSES: add the BSD 2-clause "Simplified" license

Add the full text of the BSD 2-clause "Simplified" license to OpenOCD
tree. It was copied directly from:

   https://spdx.org/licenses/BSD-2-Clause.html#licenseText

Add the required tags for reference and tooling.

Change-Id: I1c2fb8ad7510ddd0d745308c0a9acc2764c31f4e
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5970
Tested-by: jenkins
3 years agoLICENSES: add the GFDL-1.2 license 69/5969/4
Antonio Borneo [Mon, 7 Dec 2020 14:28:16 +0000 (15:28 +0100)]
LICENSES: add the GFDL-1.2 license

The documentation of OpenOCD is released under the GNU Free
Documentation License, version 1.2, with embedded some part of
OpenOCD code released under the GNU GPL-2.0-or-later.

Update doc/fdl.texi with latest minor fixes as in
https://www.gnu.org/licenses/old-licenses/fdl-1.2.texi
Update doc/openocd.texi and move here the license chapter title
Add license file LICENSES/preferred/GFDL-1.2 from
https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt
and add the required tags for reference and tooling, coping
mostly from the Linux kernel license file in the 'deprecated'
folder.
Add a readme file to link to the existing texinfo copy of the
license.

Change-Id: Ief96e0686257be7a70d4eeec442848bd6494763d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5969
Tested-by: jenkins
3 years agoLICENSES: add the GPL-3.0 license for stand-alone code 68/5968/4
Antonio Borneo [Mon, 7 Dec 2020 22:25:39 +0000 (23:25 +0100)]
LICENSES: add the GPL-3.0 license for stand-alone code

The stand-alone application "contrib/itmdump.c" is released as
GPL-3.0-or-later.

Add GPL-3.0 license in the licenses list.
Copy in subfolder stand-alone the GPL-3.0 from
https://www.gnu.org/licenses/gpl-3.0.txt
adding the header required by spdxcheck.py.

Change-Id: I238efc411e07ed6bc1eba23edbc91b3825c3d2c7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5968
Tested-by: jenkins
3 years agoLICENSES: move the GPL-2.0 license as required by checkpatch 67/5967/4
Antonio Borneo [Sat, 25 Apr 2020 15:19:28 +0000 (17:19 +0200)]
LICENSES: move the GPL-2.0 license as required by checkpatch

The script spdxcheck.py (used by checkpatch.pl) searches for the
license files in a dedicated folder, split in the subfolders:
"preferred", "dual", "deprecated", "exceptions".

Move the GPL-2.0 license from COPYING to the subfolder preferred,
adding the header required by spdxcheck.py.
The header is copied from equivalent file in the Linux kernel,
made by Thomas Gleixner <tglx@linutronix.de>.
Note: the license in COPYING matches exactly
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

Add a minimalist COPYING in the top directory, as required by
automake, pointing to the files in LICENSES.

Change-Id: I1fd0abc57b554d74f0b00fabd6c8c822b2c4acb5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5967
Tested-by: jenkins
3 years agodrivers/cmsis-dap: tidy up buffer access 20/6120/3
Tomas Vanek [Tue, 23 Mar 2021 08:12:26 +0000 (09:12 +0100)]
drivers/cmsis-dap: tidy up buffer access

Each one of CMSIS-DAP command handlers was responsible for setting
HID report number, which in case of USB bulk transport was not used
at all. The command had to be filled with 1 byte offset whereas
the response was read without an offset.

Introduce 'command' and 'response' pointers into struct cmsis_dap.
Use them for filling the command and read the response respectively.
CMSIS-DAP command parameter are now at positions as documented in
https://arm-software.github.io/CMSIS_5/DAP/html/group__DAP__Commands__gr.html
Adjust buffer allocation for HID and USB bulk transports.

While on it, use h_u32_to_le() and h_u16_to_le() instead of per-byte
writes.

Change-Id: Ib0808d6826ba0e254c1007ace8b743405536332a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/6120
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agocmsis-dap: don't update the packet size across backends. 20/5920/11
Adrian Negreanu [Fri, 6 Nov 2020 09:57:04 +0000 (11:57 +0200)]
cmsis-dap: don't update the packet size across backends.

The hidapi cmsis-dap backend is using a packet_size of
64+1: 64 is the bMaxPacketSize0 and 1 is the hid Report-Id.

In hidapi::hid_write(), the packet_size is decremented by 1 and
stored for the next transfer.
The packet_size is now valid bMaxPacketSize0=64,
so when hid_read() is called, libusb_bulk_transfer() finishes w/o timeout.

For the libusb bulk backend, the same packet_size of 64+1 is used,
but there's no hid_write() to decrement and store it for the next read.

So the next time a read is done, it will try to read 64+1 bytes.

Fix this by putting the packet logic within each backend.
Use calloc() to allocate the struct cmsis_dap to be on safer side.

Change-Id: I0c450adbc7674d5fcd8208dd23062d5cdd209efd
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/5920
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoopenocd: drop dependency from libusb0 93/5993/9
Antonio Borneo [Tue, 29 Dec 2020 21:07:41 +0000 (22:07 +0100)]
openocd: drop dependency from libusb0

Now that the old drivers have been converted to libusb1, there is
no need to keep the build dependency from libusb0.

Drop libusb0 from configure and makefiles, remove the libusb0
helper and remove libusb0 and libusb-compat from the README files.

Change-Id: Icc05be74ae5971ba6cbb67d39107c709a4d826e6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5993
Tested-by: jenkins
3 years agodrivers/arm-jtag-ew: switch to libusb1 90/5990/7
Antonio Borneo [Mon, 28 Dec 2020 22:51:32 +0000 (23:51 +0100)]
drivers/arm-jtag-ew: switch to libusb1

Convert the driver from libusb0 to libusb1.

Change-Id: Idef0b6cf10fab583bc8d13b3b4fadd5cc368c090
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5990
Tested-by: jenkins
3 years agodrivers/usbprog: switch to libusb1 92/5992/8
Antonio Borneo [Tue, 29 Dec 2020 20:52:56 +0000 (21:52 +0100)]
drivers/usbprog: switch to libusb1

Convert the driver from libusb0 to libusb1.

Change-Id: I3f334f2d02515d612097955e714910a587169990
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5992
Tested-by: jenkins
3 years agoudev rules: add missing Altera USB Blaster devices 02/6102/4
Antonio Borneo [Sun, 7 Mar 2021 22:49:30 +0000 (23:49 +0100)]
udev rules: add missing Altera USB Blaster devices

All Altera USB Blaster devices require a dedicated line in the
udev rules, but some USB VID/PID present in interface and board
config file is missing in udev rules.

Add the missing Altera USB Blaster devices in udev rules.
While there, fix an incorrect pair VID/PID that are reported
swapped inside a comment.

Change-Id: I2d67e90b10db99ef2638405585859c1393456f65
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6102
Tested-by: jenkins
3 years agoudev rules: add missing ftdi USB VID/PID 01/6101/4
Antonio Borneo [Sun, 7 Mar 2021 22:19:07 +0000 (23:19 +0100)]
udev rules: add missing ftdi USB VID/PID

All ftdi devices require a dedicated line in the udev rules, but
some USB VID/PID present in interface and board config file is
missing in udev rules.

Add the missing ftdi devices in udev rules.

Change-Id: I850a4a95a2d4bb63b3fd09be803be8c23c4d6b49
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6101
Tested-by: jenkins
3 years agojimtcl: add temporary workaround for memory leak in jimtcl 0.80 30/6130/4
Antonio Borneo [Fri, 26 Mar 2021 12:10:07 +0000 (13:10 +0100)]
jimtcl: add temporary workaround for memory leak in jimtcl 0.80

The API Jim_CreateCommand() in latest version of jimtcl leaks the
memory allocated internally by jimtcl when it converts the string
command-name to a Jim_Obj.
The fix is already merged upstream and would be available in next
jimtcl 0.81, expected in ~6 months, hopefully before the next tag
for OpenOCD v0.12.0.
OpenOCD v0.11.0 is distributed with jimtcl 0.79.
Debian distributes jimtcl as a separate library package and today
it's still on 0.79.

It make sense to keep using jimtcl 0.80 in current development
cycle to test it further. But having this background memory leak
noise hides the eventual new memory leaks that could come from the
development activity.

This patch uses the internal jimtcl API Jim_CreateCommandObj() and
correctly free the internal object, avoiding the memory leak.
Being an internal API, it is not accessible if OpenOCD is linked
with an external jimtcl library. Nevertheless, building jimtcl as
a submodule of OpenOCD makes the trick effective.

The scope of this patch is thus limited at developers that build
OpenOCD with jimtcl submodule and need to control and debug memory
leaks.
This patch is supposed to be removed as soon as jimtcl 0.81 gets
available.

The added code is located, on purpose, in an area of the file that
hopefully will not conflict other patches pending in gerrit.

Change-Id: I4d300ad21bdb6c616c3f0f14b429b4fdf360900d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6130
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 years agobuild: Fix out-of-tree with --disable-dependency-tracking configure flag 06/6106/3
Raúl Sánchez Siles [Mon, 15 Mar 2021 12:53:17 +0000 (13:53 +0100)]
build: Fix out-of-tree with --disable-dependency-tracking configure flag

After bootstrapping build, if we want to do an out-of-tree build (ie: in the
OOT-build dir) we have a build failure because build system relies on
the OOT-build/src directory exists

```sh
./bootstrap
mkdir OOT-build
cd OOT-build
../configure --disable-dependency-tracking --<flag1> --<flag2> ...
make
$ LANG=C make
cat ../src/helper/startup.tcl ../src/jtag/startup.tcl ../src/target/startup.tcl ../src/server/startup.tcl ../src/flash/startup.tcl | ../src/helper/bin2char.sh > src/startup_tcl.inc || { rm -f src/startup_tcl.inc; false; }
/bin/bash: line 1: src/startup_tcl.inc: No such file or directory
make: *** [Makefile:6603: src/startup_tcl.inc] Error 1
```

These kind of errors are fixed indicating relevant directory creation in
Makefile.am before actually relying on it.

Change-Id: I8185fd41ef942184597dc4c0092796034572cbe1
Signed-off-by: Raúl Sánchez Siles <rasasi78@gmail.com>
Reviewed-on: http://openocd.zylin.com/6106
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoflash/stm32l4x: probe tzen and rdp values 41/5541/11
Tarek BOCHKATI [Tue, 3 Nov 2020 00:22:53 +0000 (01:22 +0100)]
flash/stm32l4x: probe tzen and rdp values

introduction of 'enum stm32l4_rdp' enumerating possible RDP levels for
devices with and without TrustZone.

also in 'stm32l4_flash_bank' structure we added and rdp and tzen members
to store read values by the helper 'stm32l4_sync_rdp_tzen'

these new members are used to display security and protection status
while probing the flash.

Change-Id: Icf883189715278a3323fe210d295047678b16592
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5541
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/stm32l4x: introduce stm32l4_part_info.flags for devices features 40/5540/11
Tarek BOCHKATI [Tue, 3 Nov 2020 00:07:00 +0000 (01:07 +0100)]
flash/stm32l4x: introduce stm32l4_part_info.flags for devices features

instead of adding a new member into stm32l4_part_info for every relevant
feature, .flags serves as container for the devices' features.

identified features: F_HAS_DUAL_BANK, F_USE_ALL_WRPXX, F_HAS_TZ

Change-Id: I3093e54c6509dec33043ebe6f87675198bf1967a
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5540
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/stm32l4x: enhance protect handler to use efficiently all WRP areas 07/6107/5
Tarek BOCHKATI [Mon, 2 Nov 2020 23:50:24 +0000 (00:50 +0100)]
flash/stm32l4x: enhance protect handler to use efficiently all WRP areas

stm32l4_protect: was using one WRP area per bank, without checking
if it is already protecting some sectors.
protection algo is more complicated than that, before using a WRP area
we should check if it is already used, then either reuse it for extension
(or reduction) or use a free area.

introduce a new command: stm32l4x wrp_info bank_num ['bank1'|'bank2']
this command lists the protected areas using WRP.

Note: for some devices like STM32L4R/S in single bank mode, all 4 WRP areas
are usable for that bank, to manage this case an attribute 'use_all_wrpxx'
was introduced into stm32l4_part_info and used later in protection handlers

example usage:
$ telnet localhost 4444
> flash probe 0
  device idcode = 0x10036470 (STM32L4R/L4Sxx - Rev: Y)
  flash size = 2048kbytes
  flash mode : dual-bank
  flash 'stm32l4x' found at 0x08000000
> stm32l4x wrp_info 0
  no protected areas
> flash protect 0 0 4 on
  set protection for sectors 0 through 4 on flash bank 0
> flash protect 0 8 9 on
  set protection for sectors 8 through 9 on flash bank 0
> stm32l4x wrp_info 0
  protected areas: [0,4][8,9]
> flash protect 0 6 6 on
  the device WRPxy are not enough to set the requested protection
  failed setting protection for blocks 6 to 6
> flash protect 0 3 5 on
  set protection for sectors 3 through 5 on flash bank 0
> stm32l4x wrp_info 0
  protected areas: [0,5][8,9]
> flash protect 0 6 7 on
  set protection for sectors 6 through 7 on flash bank 0
> stm32l4x wrp_info 0
  protected areas: [0,9]
> flash protect 0 5 6 off
  cleared protection for sectors 5 through 6 on flash bank 0
> stm32l4x wrp_info 0
  protected areas: [0,4][7,9]

Change-Id: I42bd84fa66edd93406e18c6d89310faa5267ffa7
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6107
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agostm32l4x: add OTP support for STM32 G0/G4/L4/L4+/L5/WB/WL devices 37/5537/10
Tarek BOCHKATI [Sun, 22 Mar 2020 19:39:44 +0000 (20:39 +0100)]
stm32l4x: add OTP support for STM32 G0/G4/L4/L4+/L5/WB/WL devices

this is a rework of #5320 started by Andreas then abandoned.

same syntax as in stm32f2x driver:

  enable OTP for writing
  > stm32l4x otp 1 enable

  write to OTP
  > flash write_bank 1 foo.bin 0
  > flash filld 0x1FFF7000 0xDeadBeafBaadF00d 1

  read OTP
  > mdw 0x1FFF7000 4

  disable OTP
  > stm32l4x otp 1 disable

Change-Id: Id7d7c163b35d7a3f406dc200d7e2fc293b0675c2
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5537
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/nor/atsame5: add SAME51G18A and SAME51G19A devices 84/5984/3
Tomas Vanek [Tue, 22 Dec 2020 08:24:59 +0000 (09:24 +0100)]
flash/nor/atsame5: add SAME51G18A and SAME51G19A devices

Change-Id: Icbb49c76594152e9c5da1c7465675de26c86540e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reported-by: mikewolak@users.sourceforge.net
Fixes: https://sourceforge.net/p/openocd/tickets/288/
Reviewed-on: http://openocd.zylin.com/5984
Tested-by: jenkins
3 years agoflash/nor/cfi: fix uninitialized write-mem pointer 70/6070/6
Mischa Studer [Wed, 24 Feb 2021 12:24:51 +0000 (13:24 +0100)]
flash/nor/cfi: fix uninitialized write-mem pointer

In flash/nor/cfi.c:835 struct cfi_info is allocated by malloc(). As
write-mem was uninitialized the pointer pointed to an out of range
address, which led to a segmentation fault and crashed openocd.
This happened during flash-command of an external flash-bank, using
cfi.
Use calloc() instead.
While on it check for NULL return and remove unnecessary initialzation.

Change-Id: I0e2ffb90559afe7f090837023428dcc06b2e29f6
Signed-off-by: Mischa Studer <mischa.studer@csa.ch>
Reviewed-on: http://openocd.zylin.com/6070
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotcl/interface/ftdi: Add PLS SPC5 debugger config 81/6081/4
Andrew Wesie [Sun, 7 Mar 2021 08:48:27 +0000 (17:48 +0900)]
tcl/interface/ftdi: Add PLS SPC5 debugger config

Change-Id: I694201db0811beebc94e87822c87fbfc6aecc4c4
Signed-off-by: Andrew Wesie <awesie@gmail.com>
Reviewed-on: http://openocd.zylin.com/6081
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoREADME: update requested autoconf version 2.69 14/6114/2
Antonio Borneo [Thu, 18 Mar 2021 15:14:04 +0000 (16:14 +0100)]
README: update requested autoconf version 2.69

Commit 4c00f96fc2e3 ("configure.ac: switch to autoconf 2.69")
changes the required minor version of autoconf.

Update the README file accordingly.

Change-Id: I98b32b888ff531300f03c4ef9ebcbf8110509e52
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6114
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 years agodrivers: USB Blaster II: close file and release USB device if firmware handling failed 15/6115/2
Oleksij Rempel [Thu, 18 Mar 2021 17:47:35 +0000 (18:47 +0100)]
drivers: USB Blaster II: close file and release USB device if firmware handling failed

In case of some error, the USB device and firmware file are still
claimed. Make sure refcounting is properly accounted for both cases.

Change-Id: I933114f68e59280e58372c0941a0062fe96ab340
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/6115
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodrivers: USB Blaster II: claim interface before using it 89/4589/11
Oleksij Rempel [Tue, 12 Feb 2019 12:51:54 +0000 (13:51 +0100)]
drivers: USB Blaster II: claim interface before using it

If not, multiple instances of OOCD can concurrently use it.

Change-Id: I48cc9d90521d1dcc7720c6e8bec74f45972d16f7
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/4589
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget/arc: refactor ARC register numbers defines 05/6105/3
Evgeniy Didin [Mon, 15 Mar 2021 13:30:13 +0000 (16:30 +0300)]
target/arc: refactor ARC register numbers defines

For Zephyr rtos support it is necessary to define general register
numbers for architecture. There were some already in arc.h file.
Let's define ARC registers numbers as a set instead of separate defines.

Change-Id: I63742b8608f9556c2ec9bd2661a0fd9cf88e9b74
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/6105
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agobuild: remove warnings with gcc 11 04/6104/2
Rene Kita [Fri, 12 Mar 2021 17:38:02 +0000 (18:38 +0100)]
build: remove warnings with gcc 11

This removes some warnings which prevent a successful build with -Werror
which is enabled by default. I'm using gcc 11, so maybe others are not
getting this warnings yet.

In src/flash/nor/numicro.c the debug messages were misleadingly indented.
In src/target/arm920t.c the array size where smaller than expected from
the receiving function.

Change-Id: I66f5c6a63beb9f9416e73b726299297476c884d8
Signed-off-by: Rene Kita <git@rkta.de>
Reviewed-on: http://openocd.zylin.com/6104
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoaarch64: handle semihosting in aarch32 state 60/5860/5
Tarek BOCHKATI [Wed, 14 Oct 2020 17:07:14 +0000 (18:07 +0100)]
aarch64: handle semihosting in aarch32 state

Change-Id: I0e868d617db126a2b258e27b11979b75b5bb72f5
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5860
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/interface/ftdi: Add miniWiggler debugger config 11/6111/2
Andrew Wesie [Wed, 17 Mar 2021 15:23:16 +0000 (10:23 -0500)]
tcl/interface/ftdi: Add miniWiggler debugger config

Change-Id: I91f73a377cd9525008d09fda7a7c58d498014b74
Signed-off-by: Andrew Wesie <awesie@gmail.com>
Reviewed-on: http://openocd.zylin.com/6111
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotelnet: support end and home keys 94/6094/5
Tarek BOCHKATI [Wed, 10 Mar 2021 23:36:17 +0000 (00:36 +0100)]
telnet: support end and home keys

this will help navigate to the line start and end easily

Change-Id: I3f42eb5267df64c59a85ece67de5fce39a8843ec
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6094
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agoImplement CRC32 algorithm for RISC-V. 76/6076/4
Tim Newsome [Wed, 3 Mar 2021 20:41:03 +0000 (12:41 -0800)]
Implement CRC32 algorithm for RISC-V.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: Id437f78e74e3d837ff203f84c4eeb996bfad9a01
Reviewed-on: http://openocd.zylin.com/6076
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agoaarch64: add support for "reset halt" 47/5947/4
Christian Hoff [Mon, 23 Nov 2020 13:34:56 +0000 (14:34 +0100)]
aarch64: add support for "reset halt"

Support halting the CPU directly after a reset. If halt is
requested, the CPU stops directly at the reset vector, before
any code is executed.

This functionality was implemented using the Reset Catch
debug event.

Change-Id: If90d54c088442340376f0b588ba10267ea8e7327
Signed-off-by: Christian Hoff <christian.hoff@advantest.com>
Reviewed-on: http://openocd.zylin.com/5947
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agojtag: remove minidriver code and minidriver-dummy 91/6091/4
Antonio Borneo [Tue, 3 Nov 2020 15:50:49 +0000 (16:50 +0100)]
jtag: remove minidriver code and minidriver-dummy

With zy1000 removed, there is no other implementation that uses
the minidriver, apart from the test/example minidriver-dummy.
While the idea of the minidriver is probably still valid (that is
to intercept jtag primitives before serialization), there is no
current use case, no guarantee it is really working, and the way
it was implemented (by macros and #if conditionals) is really hard
to maintain and test.

Let's let it rip in git history, from where it could eventually be
taken back in a more modern implementation.
The entry points of minidriver API are still in the code with the
original names.

Change-Id: I882e32cb26cf5842f9cba14e3badaf8948e3760d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6091
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agozy1000: drop the code, deprecated in v0.10.0 90/6090/4
Antonio Borneo [Sun, 1 Nov 2020 11:30:27 +0000 (12:30 +0100)]
zy1000: drop the code, deprecated in v0.10.0

The code for zy1000 has been marked as deprecated in release
v0.10.0, 4 years ago.

Time to drop it!

Change-Id: I08fca2a2bf8f616f031e15fd37dac3197a40ba50
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6090
Tested-by: jenkins
3 years agoioutil: drop the code, deprecated in v0.10.0 89/6089/4
Antonio Borneo [Sun, 1 Nov 2020 09:51:36 +0000 (10:51 +0100)]
ioutil: drop the code, deprecated in v0.10.0

The code for ioutil has been marked as deprecated in release
v0.10.0, 4 years ago.

Time to drop it!

Change-Id: I36dce1669ebe9acada5f9e752835c53e5214e3be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6089
Tested-by: jenkins
3 years agooocd_trace: drop the code, deprecated in v0.10.0 88/6088/4
Antonio Borneo [Sun, 1 Nov 2020 09:41:47 +0000 (10:41 +0100)]
oocd_trace: drop the code, deprecated in v0.10.0

The code for oocd_trace has been marked as deprecated in release
v0.10.0, 4 years ago.

Time to drop it!

Change-Id: I989f8345dee4ff2369bcf5e2e2ace86bbd5aa6a5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6088
Tested-by: jenkins
3 years agotarget: remove handling of target's deprecated_name 87/6087/3
Antonio Borneo [Sat, 31 Oct 2020 23:14:52 +0000 (00:14 +0100)]
target: remove handling of target's deprecated_name

We do not have anymore any deprecated target name.
Drop the code to handle deprecated target names and the placehold
in struct target_type.

This patch is separated from the patch that drops the remaining
deprecated target names to be ready to revert this if there is any
need in the future.

Change-Id: I96fca7ffa39d8292f81e79f115ea45c4a30035d7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6087
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget: remove target names already deprecated in v0.8.0 86/6086/3
Antonio Borneo [Sat, 31 Oct 2020 23:10:55 +0000 (00:10 +0100)]
target: remove target names already deprecated in v0.8.0

Some target name were marked as deprecated in release v0.7.0 and
v0.8.0, almost 7 years ago, and replaced with more 'actual' names.
We can reasonably expect that in these 7 years any user of OpenOCD
has already migrated to v0.8.0 or to some newer release, thus has
already updated any local/personal script to get rid of the
deprecated message.

Drop the target names already deprecated in v0.8.0.

Change-Id: I7c7491496db1b302b4eb1e9fc6090b58d4acf05a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6086
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agostartup.tcl: remove commands already deprecated in v0.7.0 85/6085/3
Antonio Borneo [Sat, 31 Oct 2020 22:58:33 +0000 (23:58 +0100)]
startup.tcl: remove commands already deprecated in v0.7.0

Some command were already marked as deprecated in release v0.7.0,
more then 7 years ago, and for some of them the depredation date
is even earlier.
We can reasonably expect that in these 7 years any user of OpenOCD
has already migrated to v0.7.0 or to some following intermediate
build, thus has already updated any local/personal script to get
rid of the deprecated message.

Drop the commands already deprecated in v0.7.0.

Change-Id: I81cdc415ab855ebf30980ef5199f9780c5d7f932
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6085
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoopenocd: remove command line flag -p/--pipe deprecated in v0.5.0 84/6084/3
Antonio Borneo [Sat, 31 Oct 2020 23:22:49 +0000 (00:22 +0100)]
openocd: remove command line flag -p/--pipe deprecated in v0.5.0

The OpenOCD command line flag -p/--pipe was marked as deprecated
in release v0.5.0, more than 9 years ago.
We can reasonably expect that in these 9 years any user of OpenOCD
has already migrated to v0.5.0 or to some newer release, thus has
already updated any local/personal script to get rid of the
deprecated message.

Drop the command line flag already deprecated in v0.5.0.

Change-Id: I2faeb592ed2c2f67c2d3227f118093e39fcf4a8c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6084
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget/arm920t: remove command 'arm920t cp15i' deprecated in v0.4.0 83/6083/3
Antonio Borneo [Sat, 31 Oct 2020 23:45:05 +0000 (00:45 +0100)]
target/arm920t: remove command 'arm920t cp15i' deprecated in v0.4.0

The command 'arm920t cp15i' was marked as deprecated in release
v0.4.0, almost 11 years ago.
We can reasonably expect that in these years any user of OpenOCD
has already migrated to v0.4.0 or to some newer release, thus has
already updated any local/personal script.
There is no run-time warning about the deprecation, but it is
reported in the help and in the documentation.

Drop the command already deprecated in v0.4.0.

Change-Id: I755c4283e13e125558fcd73b15fe20498eae95ca
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6083
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget/arm720t: remove command 'arm720t cp15' deprecated in v0.4.0 82/6082/3
Antonio Borneo [Sat, 31 Oct 2020 23:38:13 +0000 (00:38 +0100)]
target/arm720t: remove command 'arm720t cp15' deprecated in v0.4.0

The command 'arm720t cp15' was marked as deprecated in release
v0.4.0, almost 11 years ago.
We can reasonably expect that in these years any user of OpenOCD
has already migrated to v0.4.0 or to some newer release, thus has
already updated any local/personal script.
There is no run-time warning about the deprecation, but it is
reported in the help and in the documentation.

Drop the command already deprecated in v0.4.0.

Change-Id: I2b325d0312d96ca5e5f0f1bad13bb162b3b75c52
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6082
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/stm32l4x: zero init stm32l4_flash_bank struct on flash bank initialization 03/6103/2
Raúl Sanchez Siles [Sat, 13 Mar 2021 00:09:01 +0000 (01:09 +0100)]
flash/stm32l4x: zero init stm32l4_flash_bank struct on flash bank initialization

This is specially needed when, in the probe routine, device is not
found among the stm32l4_parts. In this case, the stm32l4_flash_bank->part_info
is undefined and inadvertentanly used afterwards:
part_info = stm32l4_info->part_info;

If the stm32l4_flash_bank is zero init, the probe routine checks for
the validity of the part_info field in the previous struct and correctly
detects the unsupported (or not found) condition, raising an error
rather than a SIGSEGV

Change-Id: I7d9d669fb3fa7f8f0903acd60046966b4acb0031
Signed-off-by: Raúl Sánchez Siles <rasasi78@gmail.com>
Reviewed-on: http://openocd.zylin.com/6103
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoconfigure.ac: switch to autoconf 2.69 08/6008/4
Antonio Borneo [Fri, 8 Jan 2021 12:15:14 +0000 (13:15 +0100)]
configure.ac: switch to autoconf 2.69

OpenOCD file configure.ac requires autoconf equal or newer then
2.64, which is quite old.
These are the release dates so far:
- autoconf-2.64 2009-07-26
- autoconf-2.65 2009-11-21
- autoconf-2.66 2010-07-02
- autoconf-2.67 2010-08-02
- autoconf-2.68 2010-09-22
- autoconf-2.69 2012-04-24
- autoconf-2.70 2020-12-08

Switch to autoconf 2.69, which is old enough to be the standard in
current systems.
This should reduce the effort on configure.ac compatibility.

Change-Id: Ia7c78d2fa34c50ed5ccf4fb66ad3484369cf3b4a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6008
Tested-by: jenkins
3 years agojimtcl: update to version 0.80 (2020-10-29) 49/5949/3
Antonio Borneo [Sun, 29 Nov 2020 21:25:37 +0000 (22:25 +0100)]
jimtcl: update to version 0.80 (2020-10-29)

Update jimtcl to version 0.80.
Add a workaround in Makefile.am to allow 'make distcheck' with the
new jimtcl. A fix is already merged upstream but will be part of
the future release 0.81 of jimtcl.

Change-Id: I1cebfb9c17179114960dc771e0b31836b4b9b058
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5949
Tested-by: jenkins
3 years agotcl/target: add BCM2711 configuration file 66/6066/5
Tarek BOCHKATI [Wed, 17 Feb 2021 23:35:48 +0000 (00:35 +0100)]
tcl/target: add BCM2711 configuration file

The Broadcom BCM2711 used in Raspberry Pi 4
No documentation was found on Broadcom website
Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/

Change-Id: I3db6c9af520af8ab4c21ad35ff0f2db28efc0325
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6066
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add BCM2837 configuration file 69/6069/3
Tarek BOCHKATI [Sat, 20 Feb 2021 22:40:56 +0000 (23:40 +0100)]
tcl/target: add BCM2837 configuration file

This is the Broadcom chip used in the Raspberry Pi 3,
and in later models of the Raspberry Pi 2.

Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837b0

Change-Id: I1188a7866304c59f670a543809aca3927174786e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6069
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add BCM2836 configuration file 68/6068/3
Tarek BOCHKATI [Sat, 20 Feb 2021 22:21:53 +0000 (23:21 +0100)]
tcl/target: add BCM2836 configuration file

The Broadcom chip used in the Raspberry Pi 2 Model B

Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836

Change-Id: I50b040db213c5b72f63d5f5534c552426c7376f9
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6068
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add BCM2835 configuration file 67/6067/5
Tarek BOCHKATI [Fri, 19 Feb 2021 14:23:34 +0000 (15:23 +0100)]
tcl/target: add BCM2835 configuration file

This is the Broadcom chip used in the Raspberry Pi Model A, B, B+,
the Compute Module, and the Raspberry Pi Zero.

Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835

Change-Id: Ifeb012952473d624327e8c010ac5c886d9473aa0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6067
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoflash/nor/stmqspi: Replace macros with static inline functions 46/6046/6
Marc Schink [Mon, 1 Feb 2021 20:23:35 +0000 (21:23 +0100)]
flash/nor/stmqspi: Replace macros with static inline functions

There is no good reason to use macros instead of static inline functions. The
current code is hard maintain. For example, it changes variables outside of the
macro scope. Also, it is conflicting with the C coding style.

Change-Id: I5ac9d2ae076ef73c176d4e32b2e7e0a99fa875ab
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6046
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agostlink: swo: use completely the available buffer 61/6061/2
Antonio Borneo [Sat, 13 Feb 2021 22:28:16 +0000 (23:28 +0100)]
stlink: swo: use completely the available buffer

The buffer passed to stlink_usb_trace_read() is allocated of size
*size and does not need to be zero-terminated. There is no reason
to not fill its last byte.

When checking the bytes available on swo, limit the retrieved byte
length to *size.

Change-Id: Iade0f8963118695931f13a8a3f1ab204911236b6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/6061
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agojtag/nulink: add a space after PRIx32 60/6060/2
Antonio Borneo [Sat, 13 Feb 2021 13:40:18 +0000 (14:40 +0100)]
jtag/nulink: add a space after PRIx32

Missing the space cause the hex value to be printed together with
the following field.

Add a space after PRIx32.

Change-Id: I95824a9a8b8c0ad911d6c31f732d926cb3e0c068
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6060
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 years agocortex_m: avoid reading and writing non-existent registers 59/6059/5
Tarek BOCHKATI [Fri, 12 Feb 2021 20:12:43 +0000 (21:12 +0100)]
cortex_m: avoid reading and writing non-existent registers

Change-Id: Iedc24352c8d3444372da06d00fcec9603540f950
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6059
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoAdd configuration file for Olimex H405 49/6049/5
Felipe Balbi [Thu, 4 Feb 2021 12:50:15 +0000 (14:50 +0200)]
Add configuration file for Olimex H405

Change-Id: I34a030f65ebe041408655ea9792346b146bd1092
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Reviewed-on: http://openocd.zylin.com/6049
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoserver: revert commit 7e6556b3cad8 31/6031/2
Antonio Borneo [Fri, 13 Nov 2020 22:39:26 +0000 (23:39 +0100)]
server: revert commit 7e6556b3cad8

With the removal of old tpiu code, commit 7e6556b3cad8 ("server:
permit the add_service function to return the created service")
http://openocd.zylin.com/5717/ can be reverted.

Fix also the new calls to add_service().

Change-Id: Ib7f2dfc6a9e829239e20313e0f121911085fdc00
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6031
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agoarmv7m_trace: get rid of the old tpiu code 30/6030/2
Antonio Borneo [Fri, 13 Nov 2020 22:36:24 +0000 (23:36 +0100)]
armv7m_trace: get rid of the old tpiu code

Remove all the old tpiu code and replace it with a wrapper that
uses the new commands, prints-out the new commands and informs
about the deprecation.

All the code that handles the deprecated tpiu commands is enclosed
between the comments
/* START_DEPRECATED_TPIU */
and
/* END_DEPRECATED_TPIU */
so will be easy to remove it in the future.

Change-Id: I70b0486770128203b923346382d9a90b8ec08439
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6030
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agotcl/target: start using the new TPIU/SWO support 59/5859/8
Antonio Borneo [Sun, 11 Oct 2020 22:12:05 +0000 (00:12 +0200)]
tcl/target: start using the new TPIU/SWO support

Create the TPIU and SWO device in target config file.
Replace the target event 'trace-config' with the TPIU/SWO event
'post-enable'.
Extend the existing code in the event handler to properly set the
gpio mode and speed to permit synchronous trace.

This patch is not exhaustive of all the targets that have SWO, but
has to be considered as an initial example.

Change-Id: If4bbf364c0d2aef3ae49951e76507a3b1cfd58e7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5859
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agoarm_tpiu_swo: add support for independent TPIU and SWO 58/5858/10
Antonio Borneo [Sun, 11 Oct 2020 22:11:46 +0000 (00:11 +0200)]
arm_tpiu_swo: add support for independent TPIU and SWO

This is supposed to replace big part of armv7m_trace.[ch], since
TPIU is not only the one implemented in Cortex-M3 and M4.

Change-Id: I7588d16cbefe9cdb371c52fb0aa5cdfb48518804
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5858
Tested-by: jenkins
3 years agoitm: rework itm commands before 'init' 29/6029/3
Antonio Borneo [Fri, 13 Nov 2020 18:41:41 +0000 (19:41 +0100)]
itm: rework itm commands before 'init'

If the command 'itm port[s]' is issued before 'init', the ITM can
not be programmed because OpenOCD cannot access the target yet.
The configuration is recorded and applied after target examine.
The current test to trigger the ITM delayed-programming is based
on the TPIU configuration. This is allowed because the only use of
ITM it so send data through TPIU.
In case of system TPIU, not belonging anymore to the target, there
is no more association between target ITM and system TPIU.

Add a flag to record the pending ITM configuration requested
before 'init' and test the flag to trigger the delayed-programming
of the ITM.

Change-Id: I101eb97a116d7925cd2ff068f3e8813fc008b08e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6029
Tested-by: jenkins
3 years agostlink: fix execution order in stlink_config_trace() 34/5934/3
Antonio Borneo [Thu, 12 Nov 2020 14:27:01 +0000 (15:27 +0100)]
stlink: fix execution order in stlink_config_trace()

The change [1] guarantees that the value pointed by 'prescaler'
gets always set, even when the adapter does not support the
specific mode requested (e.g. sync), or during trace disabling.
This works fine with the code in armv7m_trace_tpiu_config(), but
requires all the parameters to be valid also to disable the trace
(with 'enable==false'), otherwise returns error on incorrect
parameters or even causes segmentation fault if pointers
'trace_freq' or 'prescaler' are NULL.

Another problem in stlink_config_trace(), not linked with [1], is
caused by a tentative to change the settings on an already enabled
trace; the trace is disabled before the new parameters are fully
validated and in case of invalid parameters the trace is not
re-enabled.
It would be more logical to first check all the parameters, then
disable the trace, change the settings and re-enable the trace.

Practically revert [1] by checking 'enable==false' at function
entry, then disable trace and exit without any further check on
the other parameters.
For the case 'enable==true', validate all the function parameters
then disable the trace, update the trace settings and re-enable
the trace.
Modify the caller armv7m_trace_tpiu_config() to initialize the
variable 'prescaler' to a safe value to avoid the issue targeted
by [1].

[1] commit 38277fa75280 ("jtag/drivers/stlink_usb: fix SWO prescaler")

Change-Id: Ia6530682162ca2c9f5ac64301f2456f70cc07ed2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5934
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agodrivers/rlink: switch to libusb1 91/5991/5
Antonio Borneo [Tue, 29 Dec 2020 00:26:15 +0000 (01:26 +0100)]
drivers/rlink: switch to libusb1

Convert the driver from libusb0 to libusb1.

Change-Id: I17d14522db18b4050d462d23151ec97d3a315a7f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5991
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 years agoarmv7m_trace_itm_config: wait for ITMBusy to be cleared 43/6043/4
Adrian Negreanu [Fri, 20 Nov 2020 16:53:51 +0000 (18:53 +0200)]
armv7m_trace_itm_config: wait for ITMBusy to be cleared

pg315 of CoreSight Components:

It is recommended that the ITMEn bit is cleared and waits for the
ITMBusy bit to be cleared, before changing any fields in the
Control Register, otherwise the behavior can be unpredictable.

Change-Id: Ie9a2b842825c98ee5edc9a35776320c668047769
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/6043
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agocmsis_dap: remove DAP_MAX_CLOCK 64/5964/3
Adrian Negreanu [Mon, 7 Dec 2020 12:54:05 +0000 (14:54 +0200)]
cmsis_dap: remove DAP_MAX_CLOCK

Discussed here:

    https://sourceforge.net/p/openocd/mailman/message/35466010/

Change-Id: Ic4d38a872f4b13b794ad0a8a2abdbe5bb21eced3
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/5964
Tested-by: jenkins
Reviewed-by: Bohdan Tymkiv <bhdt@cypress.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotarget: Remove redundant initialization of endianness 39/6039/2
Yasushi SHOJI [Thu, 28 Jan 2021 14:25:26 +0000 (23:25 +0900)]
target: Remove redundant initialization of endianness

target->endianness is initialized to TARGET_ENDIAN_UNKNOWN at 34 lines
below, before calling target_configure.  This initialization is
redundant and not needed.

Change-Id: Iea2d5e17a13c1a8b0b209ba7c20043736b520ef6
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: http://openocd.zylin.com/6039
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotarget/mips: Remove typedef'd struct 33/6033/2
Marc Schink [Tue, 26 Jan 2021 08:15:47 +0000 (09:15 +0100)]
target/mips: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: I449590251056c478c05105cdc18014ab4eb77ed8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6033
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoflash/nand/lpc32xx: Remove typedef'd struct 32/6032/2
Marc Schink [Tue, 26 Jan 2021 08:04:57 +0000 (09:04 +0100)]
flash/nand/lpc32xx: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: I983dd52307136d1b5adb58d8c44c0c14422d31e2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6032
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agortos: Remove typedef'd struct 28/6028/2
Marc Schink [Mon, 25 Jan 2021 10:28:59 +0000 (11:28 +0100)]
rtos: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: Ia7c8218fb61ff0c74b6dd0d10fb51a77cf059c14
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6028
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add Rockchip RK3399 target 94/5994/4
Jiri Kastner [Fri, 1 Jan 2021 22:27:11 +0000 (23:27 +0100)]
tcl/target: add Rockchip RK3399 target

Change-Id: I28f404b1e53fc9dbb04b3f939294ae248bbde183
Signed-off-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-on: http://openocd.zylin.com/5994
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agostlink: support of ST-LINK TCP server using stlink-dap and hla 33/5633/23
Tarek BOCHKATI [Tue, 12 Jan 2021 22:58:53 +0000 (23:58 +0100)]
stlink: support of ST-LINK TCP server using stlink-dap and hla

Quote: The ST-LINK TCP server is an application to share the debug
interface of a single ST-LINK board among several host applications,
typically a debugging tool and a monitoring tool.

Note: ST-Link TCP server does not support the SWIM transport.

ST-LINK TCP server allows several applications to connect to the same
ST-Link through sockets (TCP).

To use ST-LINK TCP server:
 - using stlink-dap : use 'st-link backend tcp [port]'
 - using hla : use 'hla_stlink_backend tcp [port]'

the default port value is 7184

Change-Id: I9b79f65267f04b1e978709934892160e65bd2d6d
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5633
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agostlink: separate stlink core from USB functions 32/5632/14
Tarek BOCHKATI [Sun, 24 May 2020 16:55:44 +0000 (17:55 +0100)]
stlink: separate stlink core from USB functions

the introduced stlink_backend_s struct provides an API to separate USB
internals from stlink core.

this separation aims to ease:
 - stlink-server integration [1]
 - stlink driver split into modules:
   - stlink_core
   - stlink_usb
   - stlink_tcp [1]

[1] refer to http://openocd.zylin.com/#/c/5633/

Change-Id: Iff6790942612ce1769ec4c75990914534e5e9e24
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5632
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoeMAG: Add Ampere eMAG config files 69/5569/5
Anthony Ferranti [Wed, 1 Apr 2020 19:46:30 +0000 (15:46 -0400)]
eMAG: Add Ampere eMAG config files

Add board and target configuration files for
Ampere eMAG8180 board and Ampere eMAG processor.

Tested on an Ampere eMAG8180 development platform.

Change-Id: I222653f0fc12d25202a7e469db3594076cbc38ed
Signed-off-by: Anthony Ferranti <ferranti@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: http://openocd.zylin.com/5569
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/board: Add AM642 EVM basic support 52/5952/13
Nishanth Menon [Mon, 30 Nov 2020 14:18:32 +0000 (08:18 -0600)]
tcl/board: Add AM642 EVM basic support

Add basic connection details with AM642 EVM

Change-Id: I95dcf6afadb61bfd8456b79274eae863b834167d
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5952
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Vignesh Raghavendra
Tested-by: jenkins
3 years agotcl/board: Add J7200 EVM basic support 51/5951/13
Nishanth Menon [Mon, 30 Nov 2020 03:01:24 +0000 (21:01 -0600)]
tcl/board: Add J7200 EVM basic support

Add basic connection details with J7200 EVM

Change-Id: Ia8fa5033a693ac09849d33693c81b8cb206f17c1
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5951
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotcl/board: Add J721E EVM basic support 85/5185/17
Nishanth Menon [Sat, 11 May 2019 08:15:39 +0000 (03:15 -0500)]
tcl/board: Add J721E EVM basic support

Add basic connection details with J721E EVM

Change-Id: I0c2d25252432914d8e371e81761a59c05924bd8e
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5185
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotcl/board: Add AM654 EVM basic support 83/5183/17
Nishanth Menon [Fri, 8 Jun 2018 21:48:27 +0000 (16:48 -0500)]
tcl/board: Add AM654 EVM basic support

Add basic connection details with AM654 evm

Change-Id: Iea2240860e50ae42cf6f1617a10e24f63c6dd988
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5183
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotcl/target: Add K3 basic support 82/5182/15
Nishanth Menon [Fri, 8 Jun 2018 21:48:27 +0000 (16:48 -0500)]
tcl/target: Add K3 basic support

Add basic connection details for AM654 and J721E SoCs from TI.

See AM65x Technical Reference Manual (SPRUID7, April 2018)
for further details: https://www.ti.com/lit/pdf/spruid7

See J721E Technical Reference Manual (SPRUIL1, May 2019)
for further details: https://www.ti.com/lit/pdf/spruil1

See J7200 Technical Reference Manual (SPRUIU1, June 2020)
for further details: https://www.ti.com/lit/pdf/spruiu1

See AM64X Technical Reference Manual (SPRUIM2, Nov 2020)
for further details: https://www.ti.com/lit/pdf/spruim2

Change-Id: Ie5108c6ad6f1304a6bf5b9f81aa9ebd33b8a559d
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5182
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agoRestore normal development cycle
Paul Fertser [Sun, 7 Mar 2021 12:44:45 +0000 (15:44 +0300)]
Restore normal development cycle

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agoThe openocd-0.11.0 release v0.11.0
Paul Fertser [Sun, 7 Mar 2021 10:36:49 +0000 (13:36 +0300)]
The openocd-0.11.0 release

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agotcl/target/eos_s3: fix variable's expansion typo 79/6079/3
Antonio Borneo [Wed, 3 Mar 2021 20:57:33 +0000 (21:57 +0100)]
tcl/target/eos_s3: fix variable's expansion typo

TCL expands the variables only if preceded by a dollar sign.

Add the missing dollar before the variable's name '_CPUTAPID'.

Change-Id: Icc5d0dddf24f75d12ee63fee69e1b265e842ca43
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Wes Cilldhaire <wes@sol1.com.au>
Fixes: c3166b43e415 ("tcl/target: Add QuickLogic EOS S3 MCU configuration")
Reviewed-on: http://openocd.zylin.com/6079
Tested-by: jenkins
Reviewed-by: TM <tommy_murphy@hotmail.com>
3 years agotarget: avoid polling during 'resumed' event handler 74/6074/4
Antonio Borneo [Fri, 26 Feb 2021 21:35:39 +0000 (22:35 +0100)]
target: avoid polling during 'resumed' event handler

OpenOCD is based on a single main loop that schedules all the
activities.
At the execution of a TCL command, the timestamp is checked to
eventually trigger the polling of the targets. This means that by
executing a TCL command the polling can be triggered and detect a
change of target's state.

When openocd 'resumes' a target, the target can halt again by
hitting a breakpoint.
The 'resumed' event handler is started just after the target has
been resumed, but it triggers a polling before the execution of
its very first instruction.
If the polling finds the target halted, it will run the 'halted'
event handler, that will then be executed 'before' the pending
'resumed' handler.

In case of gdb, a 'continue' command will restart the target but,
polling (and halt detection) executed before the end of the resume
process will hide the halt. As a consequence, the gdb will not be
informed of the halt and will remains waiting as if the target is
still running without showing the prompt.

This can be verified by running on the target a firmware with a
loop, run openocd with a dummy 'resumed' event, and let gdb to set
a breakpoint in the loop. A 'continue' command will cause the
target to halt again by hitting the breakpoint at the next loop
iteration, but gdb will loose it and will not return the prompt.

openocd -f board/st_nucleo_f4.cfg -c \
'stm32f4x.cpu configure -event resumed {echo hello}'
arm-none-eabi-gdb -ex 'target remote :3333' -ex 'b *$pc' -ex c

Disable the polling while executing target's resume().
Document it and provide hints to developers to cope with future
implementation.

Change-Id: I3be830a8e7c2ef6278617cb4547a4d676b0ddeb5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Габитов Александр Фаритович <gabitov@planarchel.ru>
Reviewed-on: http://openocd.zylin.com/6074
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
3 years agoautotools: generate list of NEWS-xx file during configure 54/6054/2
Antonio Borneo [Thu, 11 Feb 2021 18:47:46 +0000 (19:47 +0100)]
autotools: generate list of NEWS-xx file during configure

Commit 4fc0f3530c51 ("Makefile.am: fix non-POSIX warning from
automake") uses the BSD make extension '!=' to generate the list
of files NEWS-xx, but it's not POSIX (yet), it's not backward
compatible with GNU make 3.82 (used in CentOS 7, EOL scheduled for
2024) and depending on automake evolution it could trigger again
the warning 'apparently' just fixed.

Move in configure the generation of the file list.
The only drawback is that when a developer adds a new NEWS-xx
file, he/she has to run configure again before 'make distcheck',
otherwise will get failure.

Change-Id: Ia97e7f4e612655a97702f95e8451040539659b85
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Jan Matyáš <jmatyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6054
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agotarget: use proper macro for parsing watchpoint address 58/6058/2
Peter Mamonov [Mon, 12 Oct 2020 12:02:44 +0000 (15:02 +0300)]
target: use proper macro for parsing watchpoint address

Currently wp/rwp commands fail on 64-bit targets:

> wp 0xffffffff80001400 4
addr option value ('0xffffffff80001400') is not valid

Change-Id: I94d4af906b02b7bd463c8d79a6235a3646dfc434
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Reviewed-on: http://openocd.zylin.com/6058
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.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)