openocd.git
4 years agotarget/imx8m: Cleanup defaults 36/5036/4
Leonard Crestez [Wed, 3 Apr 2019 16:07:56 +0000 (19:07 +0300)]
target/imx8m: Cleanup defaults

* Add mem_ap for direct access to axi bus (without halting cpu)
* Mark m4 core with -defer-examine because it's not used by default
* Make a53.0 default target since it's the boot core

Change-Id: Id031533c5d4af346eb08a9ac2532fa1bca602913
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5036
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotarget/imx6ul: Initial support 40/5040/3
Leonard Crestez [Thu, 4 Apr 2019 13:19:55 +0000 (16:19 +0300)]
target/imx6ul: Initial support

Unlike the rest of imx6 the 6UL 6ULL 6ULZ chips are based on Cortex-A7
which is at a different address so a custom script is required.

Tested on imx6ull-14x14-evk

Change-Id: I72822d2241045c318389fadbc66d7aaabaaf4cb5
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5040
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotarget/imx6sx: Initial support 41/5041/3
Leonard Crestez [Thu, 4 Apr 2019 19:25:49 +0000 (22:25 +0300)]
target/imx6sx: Initial support

Unlike the rest of imx6 a Cortex-M4 was added with a second CoreSight
DAP so a separate script is required.

Tested on imx6sx-sdb running linux

Change-Id: I1561910b233015f42508f341175822c0827655ec
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5041
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotarget/imx7ulp: Initial support 43/5043/3
Leonard Crestez [Thu, 4 Apr 2019 19:40:21 +0000 (22:40 +0300)]
target/imx7ulp: Initial support

Unlike imx7d/solo supported by imx7.cfg the M4 core is on a different AP
and is always running by default so no -defer-examine is required.

There is also only one Cortex-A7

Tested on imx7ulp-evk

Change-Id: Ifa923d1b9a372c788e6654bc2233fd4d9073a32d
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5043
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agodoc/openocd.texi: fix cross referencing 45/5045/2
Antonio Borneo [Sat, 6 Apr 2019 07:40:18 +0000 (09:40 +0200)]
doc/openocd.texi: fix cross referencing

Commit b04c7c2ca587feebd6506716cd84297212350608 adds the cross
reference target "adapter_usb_location", but references it with
the command @xref inside a text, where command @ref should be
used. This triggers a compile warning:
doc/openocd.texi:2517: warning: `.' or `,' must follow @xref, not c

Replace @xref with @ref and adapt both the text and the command
syntax.

Change-Id: I1520ffecb7d1d375f924492b1884d5b47f399007
Fixes: b04c7c2ca587 ("ftdi: use "adapter usb location" instead of
ftdi_location command")
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5045
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agoarmv7a: Improve parsing of MPIDR register to avoid error message for Cortex R5 08/5108/4
Tommy Vestermark [Thu, 11 Apr 2019 10:40:36 +0000 (20:40 +1000)]
armv7a: Improve parsing of MPIDR register to avoid error message for Cortex R5

References:
- ARM DDI0406C ARMv7 Architecture Reference Manual, section B4.1.106
- ARM DDI0460D Cortex-R5 Technical Reference Manual section 4.3.6
- ARM 100048_0002_0 Cortex-A73 Technical Reference Manual section 4.5.2

Tested on: TMS570LC4357

Change-Id: Ie0d45fb697697f78cc4ad4e7a0116be9772590ba
Signed-off-by: Tommy Vestermark <tov@vestermark.dk>
Reviewed-on: http://openocd.zylin.com/5108
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotcl/board: Add config for the Amazon Kindle 2 and DX 56/3956/4
Alexander Kurz [Tue, 24 Jan 2017 12:34:38 +0000 (13:34 +0100)]
tcl/board: Add config for the Amazon Kindle 2 and DX

Add a config to access the Amazon Kindle Model No. D00701 and D00801.
Both ebook readers are based on a Freescale i.MX31. A JTAG interface is
included in a 40 pin FFC connector marked "J9" on both variants.

Change-Id: I58bb1ded3d6706bc3798af488ca8bafb7dc45225
Signed-off-by: Alexander Kurz <akurz@blala.de>
Reviewed-on: http://openocd.zylin.com/3956
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotarget/cortex_a: use extensively cortex_a_wait_dscr_bits() 13/5113/2
Antonio Borneo [Mon, 15 Apr 2019 21:46:29 +0000 (23:46 +0200)]
target/cortex_a: use extensively cortex_a_wait_dscr_bits()

We have the function to wait for bits in dscr. Use it whenever
possible.

When the bit to test is DSCR_INSTR_COMP, use instead the wrapper
function cortex_a_wait_instrcmpl().

Change-Id: I5c54c239a00f489712af448eb97752210b4b38b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5113
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotarget/cortex_a: check dscr before timeout 12/5112/2
Antonio Borneo [Mon, 15 Apr 2019 20:32:32 +0000 (22:32 +0200)]
target/cortex_a: check dscr before timeout

In function cortex_a_wait_dscr_bits() the last read on dscr gets
ignored in case of timeout, even if it finally provides the value
that would trigger a successful return.

Check the returned value before testing the timeout.
Also, print a message on failure reading dscr.

Change-Id: I261ac1545113db39374833a55be911a4da71d893
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5112
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
4 years agotarget/cortex_a: fix waiting for target halted after step 11/5111/3
Antonio Borneo [Mon, 15 Apr 2019 21:47:50 +0000 (23:47 +0200)]
target/cortex_a: fix waiting for target halted after step

Depending on adapter speed, the function cortex_a_poll() can take
time to execute and can complete successfully when the timeout is
already expired. Checking the timeout at function return causes a
timeout error while that could be avoided.

Check the target status at cortex_a_poll() return, before checking
for the timeout.

Change-Id: I4c1581f6e718298c566df7b1359255e16e3955d5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5111
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget/cortex_m: Implement maskisr steponly option 73/4673/9
Christopher Head [Wed, 1 Aug 2018 17:21:15 +0000 (10:21 -0700)]
target/cortex_m: Implement maskisr steponly option

`maskisr steponly` disables interrupts during single-stepping but
enables them during normal execution. This can be used as a partial
workaround for 702596 erratum in Cortex-M7 r0p1. See "Cortex-M7 (AT610)
and Cortex-M7 with FPU (AT611) Software Developer Errata Notice" from
ARM for further details.

Change-Id: I797a14e4d43f6dcb3706528ee4ab452846ebf133
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4673
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
5 years agofix for sanitizer errors in left shifts 05/5005/4
Mete Balci [Sat, 30 Mar 2019 11:51:03 +0000 (12:51 +0100)]
fix for sanitizer errors in left shifts

The modified lines cause "runtime error: left shift of <X> by <Y>
places cannot be represented in type 'int'", because integer
literal is cast to int by default.

Change-Id: Ie38119b5eb46ee470e0d149959e523b48ac4d66d
Signed-off-by: Mete Balci <metebalci@gmail.com>
Reviewed-on: http://openocd.zylin.com/5005
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/riscv: Free registers to avoid memory leak 85/4885/3
Marc Schink [Mon, 1 Apr 2019 11:47:17 +0000 (13:47 +0200)]
target/riscv: Free registers to avoid memory leak

Tested with SiFive HiFive1 development board.

Change-Id: I96a9a528057fcf9fc54d3da46a672d2cd54c3d5f
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4885
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agoflash/stm32h7x: include IO_HSLV in user3_options 45/4745/3
Christopher Head [Tue, 30 Oct 2018 21:45:11 +0000 (14:45 -0700)]
flash/stm32h7x: include IO_HSLV in user3_options

Bit 29 of OPTSR is IO_HSLV. It ought to be read in stm32x_read_options
and written in stm32x_write_options. Adjust the bitmasks to do this.

Change-Id: I785a5291c991c98b774177f960dc58f2b5e045e2
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4745
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agohelper/command: log an error for commands without usage 26/5026/2
Antonio Borneo [Sat, 30 Mar 2019 07:47:38 +0000 (08:47 +0100)]
helper/command: log an error for commands without usage

Every command has been fixed with proper usage field.
Change LOG_DEBUG with LOG_ERROR so a developer will get a visible
alert for missing usage field when adds a new command.

Change-Id: I077c3745fd6265aded8e54b3f9d202d4d6516966
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5026
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/imx6: Update list of supported TAPIDs 34/5034/5
Leonard Crestez [Fri, 10 Aug 2018 16:54:43 +0000 (19:54 +0300)]
target/imx6: Update list of supported TAPIDs

Copy all SJC TAPIPs from imx6 reference manuals.

Some imx6 chips are based on Cortex-A7 or have an additional Cortex-M4
and need separate scripts.

Change-Id: I3b07d94058c2c5e6313cfc8bb43134a90682a62e
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5034
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget/imx6: Fix indentation in DAP_TAPID handling 39/5039/2
Leonard Crestez [Thu, 4 Apr 2019 13:17:49 +0000 (16:17 +0300)]
target/imx6: Fix indentation in DAP_TAPID handling

OpenOCD scripts are usually indented with 4 spaces but here there are 8.

Change-Id: Iaad53e3b377d246d99119bb7bb5fd75d4422f564
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5039
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget/imx6: Add -ignore-version 31/5031/5
Leonard Crestez [Fri, 10 Aug 2018 13:06:43 +0000 (16:06 +0300)]
target/imx6: Add -ignore-version

Looking through imx6 manuals all of them claim that "In follow-on
silicon revisions the ID value is subject to change by incrementing the
first nibble".

Handle this by passing -ignore-version to jtag newtap command.

Change-Id: I7fc4779f9757d527ea20a5174a8c90f919580013
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5031
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget/imx7: Add ahb mem_ap 32/5032/5
Leonard Crestez [Fri, 10 Aug 2018 13:05:16 +0000 (16:05 +0300)]
target/imx7: Add ahb mem_ap

This allows bus access even when CPU is off.

Change-Id: I2d5c5581cd0169aecb92ac7b610810988a8dcef4
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5032
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agojtag: tcl: Add cget -idcode 33/5033/4
Leonard Crestez [Fri, 10 Aug 2018 14:09:41 +0000 (17:09 +0300)]
jtag: tcl: Add cget -idcode

This can be used to dynamically distinguish between similar chips in tcl
code.

Change-Id: Ic4dfb61693e78616355173142dc7f9b9683a9f73
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5033
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoFix incorrect commas in URLs 28/5028/2
Christopher Head [Mon, 1 Apr 2019 23:02:09 +0000 (16:02 -0700)]
Fix incorrect commas in URLs

In Texinfo, a comma inside an @url separates parameters to the @url
function rather than being included as part of a parameter. Use @comma{}
instead to resolve this.

Change-Id: I8b38939462cf4452e5bc2582ee484220aaf83ae0
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5028
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoDocument the mem_ap target type 29/5029/2
Christopher Head [Mon, 1 Apr 2019 23:06:30 +0000 (16:06 -0700)]
Document the mem_ap target type

Change-Id: I56e971b38f20db8c4ad0cdee5cc42b42a25319ea
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5029
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget: fix copy&paste error in cget -coreid 35/5035/3
Tomas Vanek [Wed, 3 Apr 2019 05:41:54 +0000 (07:41 +0200)]
target: fix copy&paste error in cget -coreid

Command should return target->coreid, not target->working_area_size
Solution appeared as an off topic fix in http://openocd.zylin.com/4935

Change-Id: Ic9701ce2001c75060dbaa75fbd013ed475a352e5
Suggested-by: Graham Sanderson <graham.sanderson@gmail.com>
Reported-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5035
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotopic: Remapped Flash over ITCM region in STM32F7x script 97/5097/5
Rocco Marco Guglielmi [Sun, 7 Apr 2019 14:18:36 +0000 (16:18 +0200)]
topic: Remapped Flash over ITCM region in STM32F7x script

This patch remaps the Flash over ITCM region as virtual to ensure that
any breakpoint placed in this area will be automatically set as an
hardware breakpoint. This patch is a fix to a regression introduced with
changes #4429.

Change-Id: I03d46d8537ef06b33a3d4a2328274667c6481969
Signed-off-by: Rocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>
Reviewed-on: http://openocd.zylin.com/5097
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
5 years agohelper/command: handle empty "usage" with add_help_text/add_usage_text 25/5025/2
Antonio Borneo [Sat, 30 Mar 2019 10:19:47 +0000 (11:19 +0100)]
helper/command: handle empty "usage" with add_help_text/add_usage_text

By using the command "add_help_text" to add a help text to a TCL
procedure it implicitly creates a new command_registration struct
that has field .usage set to NULL. This triggers a debug message
BUG: command '%s' does not have the '.usage' field filled out

Use an empty string if usage field is NULL.

Plus, do not annoy the user with a LOG_INFO when the command
"add_usage_text" replaces an empty usage.

Change-Id: I4a72646e0fb704ba354f938d774055540cde3967
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5025
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agoSet empty usage field for commands that do not need parameters 24/5024/2
Antonio Borneo [Fri, 4 Jan 2019 17:16:00 +0000 (18:16 +0100)]
Set empty usage field for commands that do not need parameters

The missing field causes runtime debug message
BUG: command '%s' does not have the '.usage' field filled out

While there, fix some minor typo in the help messages:
s/deasert/deassert/
s/Deasert/Deassert/

Change-Id: If3dd18265cda103ca0d05609f67f4ca58e7cbb27
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5024
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/adi_v5_swd: add "usage" field to command "swd" 30/4830/3
Antonio Borneo [Tue, 4 Dec 2018 22:50:02 +0000 (23:50 +0100)]
target/adi_v5_swd: add "usage" field to command "swd"

The missing field causes runtime debug message
BUG: command 'swd' does not have the '.usage' field filled out

Change-Id: I5a36c0fc822c4d5d74ef2d1c75e369648c6f7d4d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4830
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agodrivers/at91rm9200: fix help and usage to command "at91rm9200_device" 23/5023/2
Antonio Borneo [Sat, 30 Mar 2019 07:43:19 +0000 (08:43 +0100)]
drivers/at91rm9200: fix help and usage to command "at91rm9200_device"

Add usage and fix the help text of the command

Change-Id: I0e157d76f5d87bcda80f82a110912994908c8e03
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5023
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agoflash/nor/str9xpec: fix help and usage for command "part_id" 22/5022/2
Antonio Borneo [Sat, 30 Mar 2019 07:39:26 +0000 (08:39 +0100)]
flash/nor/str9xpec: fix help and usage for command "part_id"

Remove the numeric parameter <bank> from help and add it to usage

Change-Id: I630ca5450955210299f54e16fe5c9e8e51b3b266
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5022
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agoflash/nor/at91samd: set usage for command "set-security" 21/5021/2
Antonio Borneo [Sat, 30 Mar 2019 07:36:38 +0000 (08:36 +0100)]
flash/nor/at91samd: set usage for command "set-security"

The only allowed parameter is the string "enable"

Change-Id: Iefdad38f1b4177e4194e58caf2be654357299ded
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5021
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agodrivers/vsllink: add help and usage to commands 20/5020/2
Antonio Borneo [Sat, 30 Mar 2019 07:42:36 +0000 (08:42 +0100)]
drivers/vsllink: add help and usage to commands

Change-Id: I4a8a68147011525191ca79e65fc3d7e760371ae1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5020
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agodrivers/bcm2835gpio: fix usage messages 19/5019/2
Antonio Borneo [Fri, 4 Jan 2019 20:18:37 +0000 (21:18 +0100)]
drivers/bcm2835gpio: fix usage messages

The notation "(tck tms tdi tdo)* " is incorrect, because it means the
quadruple of gpio can be repeated on the command-line.
The correct syntax of the command requires instead to provide either
all the four gpio numbers (in order to set the values) or to pass an
empty command-line (to dump the values previously set).

Change the .usage field to "[tck tms tdi tdo]".
Change similarly the corresponding .usage field for SWD command.
Add the .usage field for the commands that individually set each gpio
or gpio property.
Dump the previously set values when commands bcm2835gpio_speed_coeffs
or bcm2835gpio_peripheral_base are executed with empty command-line.

Change-Id: Ie45d8268c1de331aded0bb52d5e6b8f0e8766a5b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5019
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agodrivers/imx_gpio: fix usage messages 18/5018/2
Antonio Borneo [Fri, 4 Jan 2019 20:07:36 +0000 (21:07 +0100)]
drivers/imx_gpio: fix usage messages

The notation "(tck tms tdi tdo)* " is incorrect, because it means the
quadruple of gpio can be repeated on the command-line.
The correct syntax of the command requires instead to provide either
all the four gpio numbers (in order to set the values) or to pass an
empty command-line (to dump the values previously set).

Change the .usage field to "[tck tms tdi tdo]".
Change similarly the corresponding .usage field for SWD command.
Add the .usage field for the commands that individually set each gpio
or gpio property.
Dump the previously set values when commands imx_gpio_speed_coeffs or
imx_gpio_peripheral_base are executed with empty command-line.

Change-Id: Id56a68622817101bd0a46fed1fead6d2cd2b6ec6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5018
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agocommand_registration: add empty usage field to chained commands 17/5017/2
Antonio Borneo [Fri, 4 Jan 2019 14:13:53 +0000 (15:13 +0100)]
command_registration: add empty usage field to chained commands

Chained command require a subcommand as first argument. The usage
field for chained commands is not really important because the
"help" command will list all the subcommands with their respective
usage.

Add a empty usage field on all chained command.
The command "jlink config" can be either followed by a subcommand
or used alone, so use a dedicated usage string.

Change-Id: I43c3f8a766f96a9bdab4e709e3c90713be41fcef
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5017
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/armv7a: simplify help description of command "l2x" 16/5016/2
Antonio Borneo [Sat, 30 Mar 2019 09:48:30 +0000 (10:48 +0100)]
target/armv7a: simplify help description of command "l2x"

There is no need to split the string in two lines.

Change-Id: Ifc574904acd06c31fab589643334e86f4dd0a122
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5016
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agoflash/xmc4xxx: use coherent indentation in struct initialization 15/5015/2
Antonio Borneo [Fri, 4 Jan 2019 10:50:53 +0000 (11:50 +0100)]
flash/xmc4xxx: use coherent indentation in struct initialization

Keep using the same indentation rules while initializing struct
command_registration.

Change-Id: I900924600753ee7a72ca45da13db4112ab4b1522
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5015
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agoflash/kinetis: use coherent indentation in struct initialization 14/5014/2
Antonio Borneo [Fri, 4 Jan 2019 10:48:37 +0000 (11:48 +0100)]
flash/kinetis: use coherent indentation in struct initialization

Keep using the same indentation rules while initializing struct
command_registration.

Change-Id: Ie69d9d6a786e1ef0abbcfd3eef89a61206238ebe
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5014
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agotarget/riscv: use coherent syntax in struct initialization 13/5013/2
Antonio Borneo [Fri, 4 Jan 2019 10:37:21 +0000 (11:37 +0100)]
target/riscv: use coherent syntax in struct initialization

While initializing struct command_registration, the field's name "name"
is not specified, thus relying on the fact that it is the first field
declared in the struct and it's initialization value can be listed as
the first one.

Be coherent in the struct initialization and always use the field's
name.

Change-Id: Iefaeb15cc051db9f1e0f0140fe2f231b45f5bb12
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5013
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
5 years agotarget/openrisc: use coherent syntax in struct initialization 12/5012/2
Antonio Borneo [Fri, 4 Jan 2019 10:36:39 +0000 (11:36 +0100)]
target/openrisc: use coherent syntax in struct initialization

While initializing struct command_registration, the field's name "name"
is not specified, thus relying on the fact that it is the first field
declared in the struct and it's initialization value can be listed as
the first one.

Be coherent in the struct initialization and always use the field's
name.

Change-Id: I65d32870bf4d3df845db69682fe445c71642f976
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5012
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agotarget/armv4_5: use coherent syntax in struct initialization 11/5011/2
Antonio Borneo [Fri, 4 Jan 2019 10:35:46 +0000 (11:35 +0100)]
target/armv4_5: use coherent syntax in struct initialization

While initializing struct command_registration, the field's name "name"
is not specified, thus relying on the fact that it is the first field
declared in the struct and it's initialization value can be listed as
the first one.

Be coherent in the struct initialization and always use the field's
name.

Change-Id: I9ef7ac08e7cd5b82a6a7896c47017943d668925f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5011
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agotarget/arm7_9_common: use coherent syntax in struct initialization 10/5010/2
Antonio Borneo [Fri, 4 Jan 2019 10:25:53 +0000 (11:25 +0100)]
target/arm7_9_common: use coherent syntax in struct initialization

While initializing struct command_registration, the field's name "name"
is not specified, thus relying on the fact that it is the first field
declared in the struct and it's initialization value can be listed as
the first one.

Be coherent in the struct initialization and always use the field's
name.

Change-Id: I743457acf7757df4646c9bc4e5ea1a6f9c841516
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5010
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agolog: add const qualifier to commands struct 09/5009/2
Antonio Borneo [Fri, 4 Jan 2019 09:53:49 +0000 (10:53 +0100)]
log: add const qualifier to commands struct

The struct log_command_handlers[] is never modified.
Add const qualifier to it.

Change-Id: I5785aeb09ae9c23eaf7c34a05b88d0c7285f2d78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5009
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agocontrib: rpc_examples: python: fix memory retrieval 87/4487/2
Paul Fertser [Mon, 9 Apr 2018 20:00:10 +0000 (23:00 +0300)]
contrib: rpc_examples: python: fix memory retrieval

mem2array returns a Tcl (associative) array and so the order of elements
is not guaranteed. Treat it as such.

Change-Id: Ie4d1219faac1e60247ca13bc2eedf22041a9a9e9
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4487
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
5 years agotcl_server: fix minor typo in comment 63/4863/2
Peter Lawrence [Sun, 20 Jan 2019 21:12:22 +0000 (15:12 -0600)]
tcl_server: fix minor typo in comment

ctrl-z usage is incorrectly commented as ctrl-d

Change-Id: I54fe1775760ee984154bbae380baa38bcaffa04e
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/4863
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/arm_adi_v5: fix typo 01/5001/2
Mete Balci [Thu, 28 Mar 2019 09:35:30 +0000 (10:35 +0100)]
target/arm_adi_v5: fix typo

Fixed the small typo.

Change-Id: Ia8834b23302d25e92cb2fa0802bebb2a9416595b
Signed-off-by: Mete Balci <metebalci@gmail.com>
Reviewed-on: http://openocd.zylin.com/5001
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agoflash/nor/core.h: clarify comment flash_sector::is_erased 68/4768/2
Tomas Vanek [Thu, 15 Nov 2018 23:23:10 +0000 (00:23 +0100)]
flash/nor/core.h: clarify comment flash_sector::is_erased

Setting of flash_sector::is_erased in flash erase and mass erase
is popular folklore. Make clear it is useless.

Change-Id: Ide397eb6d24fc8fa38931e6c8a0693d39668a5d2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4768
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
5 years agohelper/startup.tcl: remove proc exit 86/4986/2
Antonio Borneo [Mon, 4 Mar 2019 16:27:32 +0000 (17:27 +0100)]
helper/startup.tcl: remove proc exit

The TCL command exit is already replaced by the OpenOCD command
exit in server/telnet_server.c, no need to redefine it in the
script.
Moreover, the implementation is broken because the proc ocd_throw
has been removed in mid 2008 with pre-git-era commit dfbb9f3e89ae
in svn rev 849.

Remove completely the unused proc exit.

Change-Id: I0365d740eccc47631eb459aab77b865b0877c1f7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4986
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agoarmv7a_mmu: Remove warning on va = pa 07/5007/2
Florian Fainelli [Sun, 31 Mar 2019 01:20:07 +0000 (18:20 -0700)]
armv7a_mmu: Remove warning on va = pa

Depending on how the MMU is configured it is possible to have a 1:1
mapping between virtual and physical addresses, thus making this warning
bogus. We already check that the MMU is enabled in the caller:
cortex_a_virt2phys().

Change-Id: I09f4c53ef933c8d1e268da5215a769449be014bc
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-on: http://openocd.zylin.com/5007
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget/cortex_m: remove target halted check when removing a breakpoint 87/4887/2
Tomas Vanek [Wed, 6 Feb 2019 18:07:15 +0000 (19:07 +0100)]
target/cortex_m: remove target halted check when removing a breakpoint

Remove the target halted check from cortex_m_remove_breakpoint()
as there is no such check in cortex_m_set_breakpoint() and bp can be
safely removed from the running target.

While on it return the error code from cortex_m_unset_breakpoint()
to higher level.

Change-Id: I2b358c3661feed84297913e9f589bdf1e4de7e64
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4887
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Jānis Skujenieks <janis.skujenieks@gmail.com>
Reviewed-by: Christopher Head <chead@zaber.com>
5 years agotarget/cortex_m: remove fp_code_available counting 70/4870/5
Tomas Vanek [Thu, 24 Jan 2019 12:36:39 +0000 (13:36 +0100)]
target/cortex_m: remove fp_code_available counting

fp_code_available looses sync with the real number of free comparators
as soon as cortex_m_set_breakpoint() returns an error. Remove the counter
and always go through the fp_comparator_list to find a free one.

Change-Id: I9f6e06c36d8a57ad11df5155e8a1a3aff6d833a5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4870
Tested-by: jenkins
Reviewed-by: Jānis Skujenieks <janis.skujenieks@gmail.com>
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget/cortex_m: simplify cortex_m_unset_breakpoint() 89/4889/2
Tomas Vanek [Thu, 7 Feb 2019 13:18:17 +0000 (14:18 +0100)]
target/cortex_m: simplify cortex_m_unset_breakpoint()

Cortex-M uses only 2 byte breakpoint instruction.
cortex_m_unset_breakpoint() does not need to check breakpoint->length,
use the length as the size argument in target_write_memory()

Change-Id: I20bb869f6abce2fc61f0469e34a638bc4dc6f7ce
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4889
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Jānis Skujenieks <janis.skujenieks@gmail.com>
Reviewed-by: Christopher Head <chead@zaber.com>
5 years agoConstify struct flash_driver instances 03/4803/3
Christopher Head [Thu, 13 Dec 2018 19:53:59 +0000 (11:53 -0800)]
Constify struct flash_driver instances

Instances of struct flash_driver are never written to at runtime. For a
small amount of memory saving and also robustness (fewer things for
stray pointer writes to hit), mark them const.

Change-Id: Iadbbbc2fac0976d892699200000c5f02856729f3
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4803
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agosmp: move sub-command "smp_gdb" in file smp.c 91/4991/3
Antonio Borneo [Thu, 7 Mar 2019 21:34:29 +0000 (22:34 +0100)]
smp: move sub-command "smp_gdb" in file smp.c

The code for this command is currently replicated in cortex_a and
in mips_m4k and is going to be added again for cortex_m.
Plus, it is going to be obsoleted by the HW thread pseudo RTOS.

Consolidate in smp.c a single instance of the command. This will
simplify both obsoleting it and adding it to cortex_m, whatever
change comes first.

Change-Id: I03cd857e21fa3f7202fdcee36bcbd5aae30a609d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4991
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agosmp: replace commands smp_on/smp_off with "smp [on|off]" 15/4615/3
Antonio Borneo [Thu, 19 Jul 2018 09:50:56 +0000 (11:50 +0200)]
smp: replace commands smp_on/smp_off with "smp [on|off]"

Seams over-engineered having two separate commands to turn SMP
on/off. Plus it is missing the possibility to dump the current
status of SMP and would be weird adding an additional command
for it. Moreover, such commands are replicated in few targets so
it would make sense centralizing them.

- Deprecate the commands "smp_on" and "smp_off".
- Add a new command "smp" that accepts optional parameters
  "[on|off]" and prints the SMP status when run without
  parameters. This replaces the two commands above.
- Put the deprecated and the new command handlers in smp.c
- Update the documentation, except for mips_m4k, since it is not
  available yet.
- Promote the macro foreach_smp_target to global context and use
  it where possible.

Change-Id: Ia72841c1a3bd6edd4db4cc809046322f498617e6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4615
Tested-by: jenkins
Reviewed-by: Graham Sanderson <graham.sanderson@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoimx8m: add an m4 target to the imx8m 01/4501/3
Angus Ainslie [Thu, 19 Apr 2018 19:21:55 +0000 (13:21 -0600)]
imx8m: add an m4 target to the imx8m

The imx8m also has a Cortex m4 so add a target for it.

Change-Id: I2abf62b6232c547fe9b12507f459835b11c63a6d
Signed-off-by: Angus Ainslie <angus@akkea.ca>
Reviewed-on: http://openocd.zylin.com/4501
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoflash/nor/core: adjust flash_iterate_address_range_inner() for 64-bit 85/4985/2
Tomas Vanek [Sat, 2 Mar 2019 08:51:23 +0000 (09:51 +0100)]
flash/nor/core: adjust flash_iterate_address_range_inner() for 64-bit

Use target_addr_t exclusively for comparison of sector boudaries and
address range.

Use the last addres for both address range end and sector end.
It avoids problems with a flash bank mapped at the very end of
target address space.

Change-Id: Idf97c837453d97cbc4cf8a1c76ad799f4142f19e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4985
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoLots of RISC-V improvements. 22/4922/3
Tim Newsome [Fri, 15 Feb 2019 20:08:51 +0000 (12:08 -0800)]
Lots of RISC-V improvements.

This represents months of continuing RISC-V work, with too many changes
to list individually. Some improvements:
* Fixed memory leaks.
* Better handling of dbus timeouts.
* Add `riscv expose_custom` command.
* Somewhat deal with cache coherency.
* Deal with more timeouts during block memory accesses.
* Basic debug compliance test.
* Tell gdb which watchpoint hit.
* SMP support for use with -rtos hwthread
* Add `riscv set_ir`

Change-Id: Ica507ee2a57eaf51b578ab1d9b7de71512fdf47f
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/4922
Tested-by: jenkins
Reviewed-by: Philipp Guehring <pg@futureware.at>
Reviewed-by: Liviu Ionescu <ilg@livius.net>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agostlink: Set speed before entering JTAG/SWD mode 18/4818/4
Frans-Willem Hardijzer [Sat, 22 Dec 2018 11:03:43 +0000 (12:03 +0100)]
stlink: Set speed before entering JTAG/SWD mode

Some boards require a slower clock speed because of passive components on the
JTAG/SWD lines. The previous implementation would first try to discover the
chips on the default speed, and only after discovery switch to the requested
adapter_khz speed.

This patch moves the speed change to just before entering the SWD/JTAG mode,
which should alleviate this problem.

Tested on an STLink V2 clone.

Change-Id: I9734452dcc8bb28d6629e64d9a7e32ef92868cf9
Signed-off-by: Frans-Willem Hardijzer <fw@hardijzer.nl>
Reviewed-on: http://openocd.zylin.com/4818
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agomips32: pracc: Fix indent 95/4995/2
Marek Vasut [Fri, 1 Mar 2019 12:58:19 +0000 (13:58 +0100)]
mips32: pracc: Fix indent

Fix indent of the macros in header file, no functional change.

Change-Id: I4d1dba5725155200148d1543c45bad919f6cd37e
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/4995
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
5 years agomips32: pracc: Fix UPPER/LOWER macros 94/4994/2
Marek Vasut [Fri, 1 Mar 2019 12:56:44 +0000 (13:56 +0100)]
mips32: pracc: Fix UPPER/LOWER macros

These macros are missing parenthesis around the argument, which can
lead to side effects, add them. Replace the argument name to avoid
conflict with uint32_t data type, since the macro can be applied to
other data types as well.

Change-Id: I32d2ffec6c062795d7c8bb23d1dfa3378bfc3a58
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/4994
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
5 years agotarget/mips: Use 'bool' data type 70/4970/3
Marc Schink [Tue, 26 Feb 2019 13:10:48 +0000 (14:10 +0100)]
target/mips: Use 'bool' data type

Change-Id: Ifb114bfc062ed7c0ff6e4f37a1a6d546f5415344
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4970
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/xscale: Use 'bool' data type 68/4968/3
Marc Schink [Tue, 26 Feb 2019 13:09:46 +0000 (14:09 +0100)]
target/xscale: Use 'bool' data type

Change-Id: I4e117f4e6c8c0850f565587f68f41d88da0d6b0b
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4968
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/dsp563xx: Use 'bool' data type 62/4962/3
Marc Schink [Tue, 26 Feb 2019 13:07:20 +0000 (14:07 +0100)]
target/dsp563xx: Use 'bool' data type

Change-Id: Ie7ee82bf04c76ef899ae8b19105158e71b69ae2c
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4962
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agoflash/stm32h7x: remove IWDG1_SW separate variable 44/4744/3
Christopher Head [Tue, 30 Oct 2018 21:37:22 +0000 (14:37 -0700)]
flash/stm32h7x: remove IWDG1_SW separate variable

Bit 4 in OPTSR is IWDG1_SW (the code originally called it IWDG1_HW, but
the reference manual refers to it as IWDG1_SW). This is broken out into
a separate variable, independent_watchdog_selection, in stm32x_options.
However, this is not necessary: bit 4 is included in the user_options
field, which includes all of bits 2 through 7, and
independent_watchdog_selection is not referenced anywhere else. Delete
the field and just rely on user_options to transport that bit, along
with all the other bits it contains, between stm32x_read_options and
stm32x_write_options.

Change-Id: I4da63df9272cf091267b956c412b95671ea1d3c9
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4744
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/adi_v5_swd: improve error check while updating DP_SELECT 80/4980/4
Antonio Borneo [Thu, 28 Feb 2019 11:29:49 +0000 (12:29 +0100)]
target/adi_v5_swd: improve error check while updating DP_SELECT

Write to register DP_SELECT can fail, but both functions
swd_queue_dp_bankselect() and swd_queue_ap_bankselect() return
void and do not propagate the error.

Change the return type of the two functions to int and check the
returned value.
Invalidate the cached value of DP_SELECT if the write fails.

Change-Id: Iba6ef8b0c2332e7f7efb66337d558fb7a4a0d39c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4980
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/adi_v5_swd: update cached value on write to DP_SELECT 79/4979/2
Antonio Borneo [Thu, 28 Feb 2019 10:31:11 +0000 (11:31 +0100)]
target/adi_v5_swd: update cached value on write to DP_SELECT

When the register DP_SELECT is written directly, e.g. with command
<dap> dpreg 8 <value>
the cached value in OpenOCD is not completely updated with the new
value, thus creating issues in the following AP and DP read/write
that rely on the cached value.

Update the cached value while writing to DP_SELECT.

Change-Id: I8221b10cd6fc1fbe73e6b834b68820b43480e1a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4979
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget/breakpoints: make internal functions static 88/4888/2
Tomas Vanek [Thu, 7 Feb 2019 13:17:03 +0000 (14:17 +0100)]
target/breakpoints: make internal functions static

While on it add two missing new lines.

Change-Id: I0d54740479bc462b734f91686f0931824796b598
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4888
Tested-by: jenkins
Reviewed-by: Marc Schink <openocd-dev@marcschink.de>
5 years agoflash/nor/tcl.c: use COMMAND_PARSE_ADDRESS 77/4977/2
Tomas Vanek [Wed, 27 Feb 2019 01:31:30 +0000 (02:31 +0100)]
flash/nor/tcl.c: use COMMAND_PARSE_ADDRESS

instead of conditional compilation #if BUILD_TARGET64

Change-Id: I005ae0b3a4ed127c0f59219b1c6b185a2c76c76e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4977
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
5 years agoflash/nor: use target_addr_t for flash bank base 19/4919/8
Tim Newsome [Fri, 15 Feb 2019 01:33:28 +0000 (17:33 -0800)]
flash/nor: use target_addr_t for flash bank base

This should allow users to configure flash at >32-bit addresses.

Change-Id: I7c9d3c5762579011a2d9708e5317e5765349845c
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/4919
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agogdb_server, target: Add target_address_bits() 47/4947/3
Tim Newsome [Mon, 25 Feb 2019 22:02:30 +0000 (14:02 -0800)]
gdb_server, target: Add target_address_bits()

Targets can use this to expose how many address bits there are.
gdb_server uses this to send gdb the appropriate upper limit in the
memory-map. (Before this change the upper limit would only be correct
for 32-bit targets.)

Change-Id: Idb0933255ed53951fcfb05e040674bcdf19441e1
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/4947
Tested-by: jenkins
Reviewed-by: Peter Mamonov <pmamonov@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agortos/hwthread: add hardware-thread pseudo rtos 99/3999/24
Matthias Welwarsky [Fri, 17 Feb 2017 15:16:51 +0000 (16:16 +0100)]
rtos/hwthread: add hardware-thread pseudo rtos

This patch adds "hwthread", a pseudo rtos that represents cpu cores
in an SMP system as threads to gdb. This allows to debug SMP
system kernels in a more sensible manner and removes the current
atrocities of switching gdb manually between CPU cores to update
the context.

Change-Id: Ib781c6c34097689d21d9e02011e4d74a4a742379
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/3999
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Graham Sanderson <graham.sanderson@gmail.com>
5 years agodrivers/stlink_usb: use command STLINK_DEBUG_APIV2_READ_IDCODES 26/4826/5
Antonio Borneo [Wed, 19 Dec 2018 23:01:58 +0000 (00:01 +0100)]
drivers/stlink_usb: use command STLINK_DEBUG_APIV2_READ_IDCODES

API v2 deprecates using command STLINK_DEBUG_READCOREID to read
the core ID.
Switch to STLINK_DEBUG_APIV2_READ_IDCODES on new stlink firmware
version.

Change-Id: Iabadfc116c57f2c31f08f2e77baefea0cf90bdc3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4826
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agodrivers/stlink_usb: check error code returned by st-link 25/4825/4
Antonio Borneo [Fri, 7 Dec 2018 11:37:20 +0000 (12:37 +0100)]
drivers/stlink_usb: check error code returned by st-link

Most of ST-Link commands return an error code, but this is almost
never checked.

Check for the error code for every command that returns it.

Change-Id: Ifc4e32f8c73196de23700ba0989bfdfe0f5b46e3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4825
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agodrivers/stlink_usb: fix stlink_usb_read_regs() for API v2 24/4824/3
Antonio Borneo [Fri, 7 Dec 2018 21:11:12 +0000 (22:11 +0100)]
drivers/stlink_usb: fix stlink_usb_read_regs() for API v2

API v2 implementation for command READALLREGS returns the status
in the first two bytes, followed by two bytes of padding.
This makes the reply 4 bytes longer and changes the offset of the
first register value to 4.

Fix it for the case API v2 and clean-up the management of the
return value.

Change-Id: I448c82bcc0baa72d66fdfe7f0c525b94f8a4468b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4824
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agostlink: handle error GET_IDCODE 82/4982/3
Antonio Borneo [Tue, 5 Feb 2019 10:25:19 +0000 (11:25 +0100)]
stlink: handle error GET_IDCODE

When the connection with target is lost on the physical JTAG/SWD
link (either wire disconnected or DAP/TAP in reset), STLINK fail
to connect and returns error STLINK_JTAG_GET_IDCODE_ERROR.

Add it in the list of known errors.

Change-Id: Iabd6e6892111726f614345497d9286554bfe4ac0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4982
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agostlink: handle error bad-AP 81/4981/3
Antonio Borneo [Sun, 3 Feb 2019 20:07:31 +0000 (21:07 +0100)]
stlink: handle error bad-AP

The new firmwares for ST-Link support handling multiple AP, but
are (actually) limited to the AP number in range [0..8].
Any tentative to operate on AP number higher than 8 returns an
error "bad AP".
Add the error code and the related message.

Change-Id: I78a98b2612d10e580d03fc43ed9f2b09619d39d8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4981
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 years agotarget/openrisc/x86_32_common: Use 'bool' data type 72/4972/2
Marc Schink [Tue, 26 Feb 2019 13:11:46 +0000 (14:11 +0100)]
target/openrisc/x86_32_common: Use 'bool' data type

Change-Id: I395a36ddd7ac7e85bc54f6bb073a93b0c6f24db0
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4972
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/openrisc/or1k: Use 'bool' data type 71/4971/2
Marc Schink [Tue, 26 Feb 2019 13:11:15 +0000 (14:11 +0100)]
target/openrisc/or1k: Use 'bool' data type

Change-Id: I6393bb8503d64947a1f2349e1d14c1552cabf927
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4971
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/lakemont: Use 'bool' data type 69/4969/2
Marc Schink [Tue, 26 Feb 2019 13:10:09 +0000 (14:10 +0100)]
target/lakemont: Use 'bool' data type

Change-Id: I9baaf617c2bfabd07ac3ca195e486893d7950398
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4969
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/feroceon: Use 'bool' data type 67/4967/2
Marc Schink [Tue, 26 Feb 2019 13:09:22 +0000 (14:09 +0100)]
target/feroceon: Use 'bool' data type

Change-Id: I30b8d07ee198e8f67cd98f83c4bec15bcfe8be08
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4967
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/etb: Use 'bool' data type 66/4966/2
Marc Schink [Tue, 26 Feb 2019 13:09:03 +0000 (14:09 +0100)]
target/etb: Use 'bool' data type

Change-Id: I536036b15af10bb1879dbbec84576134fd3dce35
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4966
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/arm_semihosting: Use 'bool' data type 65/4965/2
Marc Schink [Tue, 26 Feb 2019 13:08:42 +0000 (14:08 +0100)]
target/arm_semihosting: Use 'bool' data type

Change-Id: I05245b7dc9c37ea8e0e40672070fb3e87cb7683f
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4965
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/embeddedice: Use 'bool' data type 64/4964/2
Marc Schink [Tue, 26 Feb 2019 13:08:18 +0000 (14:08 +0100)]
target/embeddedice: Use 'bool' data type

Change-Id: I0f237e0769786aa560d1a472a71499d3856ab25c
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4964
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/cortex_a: Use 'bool' data type 63/4963/2
Marc Schink [Tue, 26 Feb 2019 13:08:00 +0000 (14:08 +0100)]
target/cortex_a: Use 'bool' data type

Change-Id: I055767f1c20af539159ee59e35de8dd20b399fa4
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4963
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/avr32_ap7k: Use 'bool' data type 61/4961/2
Marc Schink [Tue, 26 Feb 2019 13:06:44 +0000 (14:06 +0100)]
target/avr32_ap7k: Use 'bool' data type

Change-Id: I49f1a6c6ee6d175935eb40b49abf8ebdf56a0b6e
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4961
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/arm926ejs: Use 'bool' data type 60/4960/2
Marc Schink [Tue, 26 Feb 2019 13:06:06 +0000 (14:06 +0100)]
target/arm926ejs: Use 'bool' data type

Change-Id: I3016a8ba37942d674017c09e4540d9813c832872
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4960
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/arm920t: Use 'bool' data type 59/4959/2
Marc Schink [Tue, 26 Feb 2019 13:05:43 +0000 (14:05 +0100)]
target/arm920t: Use 'bool' data type

Change-Id: I5f2c95d9a4bdb14cc31d72eb026f58710fb07db5
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4959
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/arm720t: Use 'bool' data type 58/4958/2
Marc Schink [Tue, 26 Feb 2019 13:05:22 +0000 (14:05 +0100)]
target/arm720t: Use 'bool' data type

Change-Id: I9838d0d0ba472f029169ab37597ef367a6084fbf
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4958
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/aarch64: Use 'bool' data type 57/4957/2
Marc Schink [Tue, 26 Feb 2019 13:04:46 +0000 (14:04 +0100)]
target/aarch64: Use 'bool' data type

Change-Id: Ibfe4413b88ed0759a556a8777dac40f0c2c64922
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4957
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/armv8: Use 'bool' data type 56/4956/2
Marc Schink [Tue, 26 Feb 2019 13:03:49 +0000 (14:03 +0100)]
target/armv8: Use 'bool' data type

Change-Id: I65def33f24187ab336db5732ce35200ca5cd8f5f
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4956
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/armv7m: Use 'bool' data type 55/4955/2
Marc Schink [Tue, 26 Feb 2019 13:03:27 +0000 (14:03 +0100)]
target/armv7m: Use 'bool' data type

Change-Id: I9cfbba9d81601cc72e2b54ec410e21c7edc4f1c4
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4955
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/arm11: Use 'bool' data type 54/4954/2
Marc Schink [Tue, 26 Feb 2019 13:02:59 +0000 (14:02 +0100)]
target/arm11: Use 'bool' data type

Change-Id: Ia09adeab88eaf66c009f94be25ab82b0b8f88f61
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4954
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/armv7_9_common: Use 'bool' data type 53/4953/2
Marc Schink [Tue, 26 Feb 2019 13:02:33 +0000 (14:02 +0100)]
target/armv7_9_common: Use 'bool' data type

Change-Id: I5af27247f39cf47c925260784e21292f34665471
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4953
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/armv4_5: Use 'bool' data type 52/4952/2
Marc Schink [Tue, 26 Feb 2019 13:01:17 +0000 (14:01 +0100)]
target/armv4_5: Use 'bool' data type

Change-Id: I82e3963ea662844bb96943aee849dab35ea96bb3
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4952
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/register: Use 'bool' data type 51/4951/2
Marc Schink [Tue, 26 Feb 2019 13:00:30 +0000 (14:00 +0100)]
target/register: Use 'bool' data type

Change-Id: I3633ced9cb2bfe6afb0ef49aa42fd1b54f155a66
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4951
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget/cortex_m: Use 'bool' instead of 'int' 50/4950/2
Marc Schink [Tue, 26 Feb 2019 12:40:23 +0000 (13:40 +0100)]
target/cortex_m: Use 'bool' instead of 'int'

Change-Id: I273d24997e2c844015e144a15981f8f0af522261
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4950
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agotarget: Remove unused variable 'has_percent' 49/4949/2
Marc Schink [Tue, 26 Feb 2019 12:27:23 +0000 (13:27 +0100)]
target: Remove unused variable 'has_percent'

Change-Id: Ib080fc33e8a0305990ee334019547e7643c446ac
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4949
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agohelper/command: return proper JIM error code 73/4973/2
Antonio Borneo [Tue, 26 Feb 2019 08:32:04 +0000 (09:32 +0100)]
helper/command: return proper JIM error code

The function command_unknown() is expected to return a value
recognized as JIM error code, as it is correctly done in the
other cases it returns.

Fix the only case in which command_unknown() does not return
a JIM error code, by s/ERROR_FAIL/JIM_ERR/

Change-Id: Ib98b75755ae36870bd68c17f8839ddbfa06c6312
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4973
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agostlink: remove unused assignment 45/4945/2
Antonio Borneo [Sun, 24 Feb 2019 17:19:44 +0000 (18:19 +0100)]
stlink: remove unused assignment

Fix a warning identified by clang 7.0.1:
stlink_usb.c:1092:3: warning: Value stored to 'p' is never read
p += sprintf(p, "S%d", swim);
^    ~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: Ic9da57e19ceecb0e3d65d3ea3412a05e1c2c779a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4945
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agogdb_server: fix 'null' pointer passed as 'nonnull' parameter 46/4946/2
Antonio Borneo [Fri, 15 Feb 2019 23:23:25 +0000 (00:23 +0100)]
gdb_server: fix 'null' pointer passed as 'nonnull' parameter

The null pointer used as second parameter to gdb_put_packet() is
passed as second parameter to the memcpy() in line 408 of
gdb_put_packet_inner(). In this case memcpy() does not segfault
because also the parameter length is zero. Nevertheless, the
prototype of memcpy() requires a nonnull pointer.

Fixed by passing an empty string in place of the null pointer.

Issue highlighted by clang 7.0.0 with warning message:
"Null pointer passed as an argument to a 'nonnull' parameter"

Change-Id: Ib3dde95d76fcc5fb245ee2d6669e5535d0e0b127
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4946
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>

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)