openocd.git
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>
5 years agosrc/jtag/drivers/ftdi: fix swd pin comment and links 08/4908/3
Diego Herranz [Wed, 13 Feb 2019 08:33:17 +0000 (08:33 +0000)]
src/jtag/drivers/ftdi: fix swd pin comment and links

- TDI/DO is not pin 2 and in fact, we don't even need to mention which
pin number it is. "TDI/DO pin" is descriptive enough.

- FT2232D link didn't work anymore. It could have been updated to the
current working FT2232D link but changed to link the FT2232H instead
which is the latest generation and the most commonly used these days.

- Taking advantage of the change, link to the MPSSE document updated.
It still worked but through a redirection, so updated just in case the
redirection stops working.

Change-Id: Ia7d01bbcac2158026831edb010a6b50f58351e42
Signed-off-by: Diego Herranz <diegoherranz@diegoherranz.com>
Reviewed-on: http://openocd.zylin.com/4908
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
5 years agogdb_server: remove warning for stepi after gdb_sync 64/4764/2
Antonio Borneo [Wed, 7 Nov 2018 16:55:43 +0000 (17:55 +0100)]
gdb_server: remove warning for stepi after gdb_sync

The command "gdb_sync" is used to resynchronize gdb with OpenOCD.
It is supposed to be follow by the gdb command "stepi" that will
be ignored by OpenOCD.

Don't annoy the user with a warning message when the stepi
command is ignored, but simply log a debug message.

Change-Id: Ie4cffa89e761d7335e5961900b62e31f209d4b1b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4764
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoarmv8: allow halt on exception 79/4479/10
Matthias Welwarsky [Thu, 5 Apr 2018 11:42:21 +0000 (13:42 +0200)]
armv8: allow halt on exception

add command 'catch_exc' to halt a core on entering any of Secure EL1 or
EL3 or Non-Secure EL1 or EL2.

Change-Id: I0c68e247af68dd96616855a9bc1063c277d222e5
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4479
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoUse enum for target_register_timer_callback() 21/4921/3
Marc Schink [Fri, 15 Feb 2019 13:36:54 +0000 (14:36 +0100)]
Use enum for target_register_timer_callback()

Change-Id: I268e8c5d783914aa97cbde301448b2c5bc3cb9e6
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4921
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agotarget: Use proper data types for timer callback 20/4920/3
Marc Schink [Fri, 15 Feb 2019 13:31:19 +0000 (14:31 +0100)]
target: Use proper data types for timer callback

Change-Id: I5ca6da767f9e96180c43b179b2c682b1b7c98563
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4920
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agoflash: stm32f2/f4/f7: Add One-Time-Porgrammable (OTP) support 29/829/9
Moritz Fischer [Mon, 21 Jan 2019 17:24:12 +0000 (09:24 -0800)]
flash: stm32f2/f4/f7: Add One-Time-Porgrammable (OTP) support

The OTP is part of the flash memory. It has 512 (1024 for F7) bytes
and is organized in 16 sectors with 32 (64 for F7) bytes each.
The OTP is exposed as separate flash bank 1 and can be used
with the usual flash commands.

Writing the OTP can be done as follows:

> stm32f2x otp 1 enable
> flash write bank 1 foo.bin 0
> mdw 0x1fff7800 4
> verify_image foo.bin 0x1fff7800
> stm32f2x otp 1 disable

Note: This patch is largely a rebase/cleanup of a patch
from 2012 by Laurent Charpentier and he did most of the work.

No new Clang-Analyzer warnings.

Change-Id: I5e6371f6a7c7a9929c1d7907d6ba4724f9d20d97
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Reviewed-on: http://openocd.zylin.com/829
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agojtag: drivers: cmsis-dap: correct vendor request code 55/3855/2
Paul Fertser [Fri, 4 Nov 2016 10:58:05 +0000 (13:58 +0300)]
jtag: drivers: cmsis-dap: correct vendor request code

While at it, change the macro name to make it obvious it's a string,
not some numeric ID. This also matches ARM code that's using

Change-Id: Id35ba5b95cef0ac77657c40985b24c1ae2720748
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/3855
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agoaarch64: fix a potential memory leak in aarch64_target_create() 24/4924/2
Antonio Borneo [Fri, 15 Feb 2019 20:31:02 +0000 (21:31 +0100)]
aarch64: fix a potential memory leak in aarch64_target_create()

If the function aarch64_target_create() exits for an error, the
value of pointer aarch64 get lost, causing a memory leak.

Move the allocation of aarch64 after the check on the parameters.
While there, add a check on the value returned by calloc().

Issue highlighted by clang 7.0.0.

Change-Id: Ib9ad27f4acd940da308c01fdbf33cfe51ab0c639
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4924
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agomem_ap: fix a potential memory leak in mem_ap_target_create() 23/4923/2
Antonio Borneo [Fri, 15 Feb 2019 20:26:27 +0000 (21:26 +0100)]
mem_ap: fix a potential memory leak in mem_ap_target_create()

If the function mem_ap_target_create() exits for an error, the
value of pointer mem_ap get lost, causing a memory leak.

Move the allocation of mem_ap after the check on the parameters.
While there, add a check on the value returned by calloc().

Issue highlighted by clang 7.0.0.

Change-Id: Ia2c11b14fde9694f28bf6efe01d278923db0f0d4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4923
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agocortex_a: fix a potential memory leak in cortex_a_target_create() 25/4925/2
Antonio Borneo [Fri, 15 Feb 2019 20:33:34 +0000 (21:33 +0100)]
cortex_a: fix a potential memory leak in cortex_a_target_create()

If the function cortex_a_target_create() or the function
cortex_r4_target_create() exit for an error, the value of pointer
cortex_a get lost, causing a memory leak.

Move the allocation of cortex_a after the check on the parameters.
While there, add checks on the value returned by calloc().

Issue highlighted by clang 7.0.0.

Change-Id: Ic6eeb9c3b39922d016f6d0319eada1a97a6681f0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4925
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agoserver: fix small mem leak of bindto_name 09/4909/2
Tomas Vanek [Mon, 21 Jan 2019 20:51:04 +0000 (21:51 +0100)]
server: fix small mem leak of bindto_name

Change-Id: Ib9c8003e164a156f1c4d3cde47e4158d867d82c6
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4909
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 years agoFix support for single-bank stm32l4 processors 13/4913/3
Armin van der Togt [Thu, 14 Feb 2019 14:35:07 +0000 (15:35 +0100)]
Fix support for single-bank stm32l4 processors

Recent patches for STM32L4+ assumed all STM32L4 processors have a dual-
bank option. This is not the case for STM32L4{3,4,5,6}xx processors and
therefore, these processors (like STM32L433) failed when attempting to
flash the second half of the flash memory. This patch fixed this issue.
Tested on STM32L433xC, STM32L476xG and STM32L471xG.

Change-Id: I8262ba4f05190802c5868d753f3e7af50e581811
Signed-off-by: Armin van der Togt <armin@otheruse.nl>
Reviewed-on: http://openocd.zylin.com/4913
Tested-by: jenkins
Reviewed-by: Peter Tettelaar <peter@float-iot.nl>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Mark Schulte <mschulte@lyft.com>
5 years agoftdi: use "adapter usb location" instead of ftdi_location command 71/4771/10
Oleksij Rempel [Fri, 16 Nov 2018 07:58:58 +0000 (08:58 +0100)]
ftdi: use "adapter usb location" instead of ftdi_location command

Use unified "adapter usb location" instead of driver specific
command.

Change-Id: I568a76b87d09cea0f40f1580cf81f7c51402f6f1
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/4771
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agotarget, breakpoints: improve error handling 71/4871/4
Tomas Vanek [Thu, 24 Jan 2019 13:33:16 +0000 (14:33 +0100)]
target, breakpoints: improve error handling

handle_bp_command_set() showed the error message
"Failure setting breakpoint, the same address(IVA) is already used"
on any error returned from (xxx_)breakpoint_add().
Paradoxically breakpoint_add() returned ERROR_OK if it detected
duplicated bp address.
context_breakpoint_add() and hybrid_breakpoint_add() returned -1
instead of OpenOCD compatible error if they detected duplicity.

Introduce ERROR_TARGET_DUPLICATE_BREAKPOINT
Unify error handling to LOG_ERROR() any error in (xxx_)breakpoint_add()
Remove misleading error messages from handle_bp_command_set()
handle_bp_command_set() returns error if the target does not implement
add_context_breakpoint or add_hybrid_breakpoint.

Change-Id: If17dfad1756d82a77028ebdc4b305f9c8e1365ba
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4871
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agodoc: fix typo in "adapter usb location" command 07/4907/3
Oleksij Rempel [Mon, 11 Feb 2019 06:14:06 +0000 (07:14 +0100)]
doc: fix typo in "adapter usb location" command

Change-Id: If959c5461904cdf4bcdf1887a9afaa9c2c94282b
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/4907
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
5 years agodoc/openocd.texi: fix xref warning 05/4905/2
Tomas Vanek [Sat, 9 Feb 2019 15:06:22 +0000 (16:06 +0100)]
doc/openocd.texi: fix xref warning

Xref without trailing '.' or ',' was introduced in
deaf3d264123391d8fe5c4cccbf8fb8852e1be23

Change-Id: I99afd40e1ffeddd1298b7b07e4deba3dcc41799f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4905
Tested-by: jenkins
5 years agotarget/riscv-011: Fix memory leak in handle_halt_routine() 84/4884/2
Marc Schink [Wed, 6 Feb 2019 11:07:10 +0000 (12:07 +0100)]
target/riscv-011: Fix memory leak in handle_halt_routine()

Tested with SiFive HiFive1 development board.

Change-Id: Ie0d9fa0899804d17ccdd84b03ba4028e97b632b8
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4884
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
5 years agojlink: Use correct SWD buffer size 78/4878/2
Marc Schink [Tue, 29 Jan 2019 08:23:09 +0000 (09:23 +0100)]
jlink: Use correct SWD buffer size

Currently, the SWD buffer size is adjusted corresponding to the free
device memory. However, the adjusted size is not used.

This fixes SWD operations on devices with small device memory, such as
EFM32PG12 Pearl Gecko STK. It should also fix #184.

Change-Id: I2ec5cf25c62f18bd9e99a2f4aa1aa8d85ed0821b
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4878
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
5 years agodrivers/bitbang: remove unused extern declaration of jtag_interface 74/4874/2
Antonio Borneo [Tue, 22 Jan 2019 15:08:22 +0000 (16:08 +0100)]
drivers/bitbang: remove unused extern declaration of jtag_interface

After commit a6c4eb03455f ("swd: Remove DAP from parameter list")
the global variable jtag_interface is not referenced in the driver.

Remove the extern declaration.

Change-Id: I72018a59c9cecaa52d9a49ec0d7816ac0e656314
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4874
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@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)