openocd.git
2 months agoUpdate Autotools Mythbuster link to avoid multiple redirects. 09/5709/2
Diego Elio Pettenò [Tue, 2 Jun 2020 10:52:01 +0000 (11:52 +0100)]
Update Autotools Mythbuster link to avoid multiple redirects.

While I'm hoping to maintain the chain of redirects for the foreseeable
future, it makes sense to point at the final URL now that Autotools
Mythuster has had its domain for a long while.

Change-Id: I6d912e3be0f81b25bec14746ebfee58f29f144b6
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.com>
Reviewed-on: http://openocd.zylin.com/5709
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2 months agohelper/command: remove unused functions and make static local ones 63/5663/2
Antonio Borneo [Sun, 10 May 2020 08:57:59 +0000 (10:57 +0200)]
helper/command: remove unused functions and make static local ones

The function command_find_in_parent() is never used in OpenOCD, so
remove it.

The functions command_name() and [un]register_command() are only
used internally in command.c, so make them static.

Change-Id: Ide9842659796f4884fb6c1fcf5979b3b71b67abb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5663
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2 months agoopenocd: properly use jim data types 62/5662/2
Antonio Borneo [Tue, 12 May 2020 00:52:30 +0000 (02:52 +0200)]
openocd: properly use jim data types

The jim library exports all the data types through typedef, so
there is no need to use the internal struct types.

Fix the few remaining inconsistencies in the code.

Change-Id: Id4ae0083563ea7a371833374e7b39f17158f66a4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5662
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2 months agohelper/command: fix check on value returned by jim API 61/5661/2
Antonio Borneo [Tue, 12 May 2020 22:47:17 +0000 (00:47 +0200)]
helper/command: fix check on value returned by jim API

Either Jim_CreateCommand() and register_command_handler() return
the jim error code JIM_OK/JIM_ERR.

Fix the check and the initialization of retval.

Change-Id: I3073c66764670128706ad979a43bb3edbbeb0ab0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5661
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2 months agohelper/command: strip replicated command name in log 60/5660/2
Antonio Borneo [Sun, 20 Oct 2019 17:40:28 +0000 (19:40 +0200)]
helper/command: strip replicated command name in log

After commit 0840414f0e57 ("helper/command: do not replace new
commands with ocd_ prefix"), the command name is present in
argv[0], so there is no need to pass it directly. The current code
causes the command name to be logged twice, once explicitly and
then from the content of argv[0]:
openocd -c 'debug_level 3; echo hello; shutdown'
<snip>
Debug: 13 3 command.c:142 script_debug(): command - echo echo hello
<snip>
Debug: 16 4 command.c:142 script_debug(): command - shutdown shutdown

Remove the command name from the arguments of the function
script_debug().

Change-Id: I57860774f450ff717ee71ef9dc07590549a84319
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5660
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2 months agostlink: fix open AP for v2j37 and v3j7 91/5691/3
Antonio Borneo [Thu, 21 May 2020 11:24:32 +0000 (13:24 +0200)]
stlink: fix open AP for v2j37 and v3j7

The new stlink firmware requires opening the AP before issuing
any operation.
In the current code we have a 'questionable' check about the core
model to set the TAR autoincrement, that is issued without opening
the AP, thus causing a STLINK_BAD_AP_ERROR.

Modify the AP open API to handle this case and open AP#0 before
the memory access to check the core model.

Change-Id: I576955b5094bd41d63ff1fbad7b4fd9433253321
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: http://openocd.zylin.com/5691
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
2 months agostlink: fix incorrectly returned error on v2j28 83/5683/2
Antonio Borneo [Fri, 15 May 2020 12:55:42 +0000 (14:55 +0200)]
stlink: fix incorrectly returned error on v2j28

Firmware v2j28 introduces the API to open and close the AP, but
closing AP always returns error 0x1d (STLINK_BAD_AP_ERROR).

Ignore the error returned by the bogus firmware on closing AP.

Change-Id: I992ddbf7acb10f1d376ed8f781eeb3344605b85d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5683
Tested-by: jenkins
2 months agostlink: default dapdirect to SWD instead of JTAG 38/5538/5
Antonio Borneo [Mon, 23 Mar 2020 14:58:01 +0000 (15:58 +0100)]
stlink: default dapdirect to SWD instead of JTAG

When the transport is not specified, OpenOCD uses the first listed
by the selected adapter driver.
The old HLA driver for stlink lists SWD as first. The new driver
dapdirect instead lists JTAG, making more difficult a fallback to
HLA when dapdirect is not available due to old stlink FW.
Plus, in case of JTAG wiring, SWD is still possible, while the
opposite is not.

Reorder the list of transports to grant the default to SWD.

Change-Id: Id9c529e921b148d5b352d4603a9028c2a5f15d83
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Suggested-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5538
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 months agostm8 target: make adapter speed settings work 48/5548/4
Ake Rehnman [Sun, 29 Mar 2020 19:57:53 +0000 (21:57 +0200)]
stm8 target: make adapter speed settings work

Previously the adapter speed settings were hard-coded to
connect with low speed then switch over to high speed
regardless what was mentioned in the cfg files. Now the
stm8 target intercept adapter speed settings and configure
the stm8 control registers accordingly.

Change-Id: I7419514e5214e4b43b9d51253cf5b7f04a233533
Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com>
Reviewed-on: http://openocd.zylin.com/5548
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agotcl/board: add board ST nucleo-8l152r8 43/5543/4
Antonio Borneo [Thu, 26 Mar 2020 09:49:04 +0000 (10:49 +0100)]
tcl/board: add board ST nucleo-8l152r8

The transport SWIM is selected twice, in board and in target, thus
a warning is generated at run-time. It should be fixed by remove a
line in the target file, but does not harm so let's keep it there
for the time being.

Change-Id: I479004dc16005a330d552c8dbd5def61690f9b9f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5543
Tested-by: jenkins
2 months agoRevert "adapter: expose HLA interface in struct adapter_driver" 33/5533/6
Antonio Borneo [Thu, 19 Mar 2020 11:12:20 +0000 (12:12 +0100)]
Revert "adapter: expose HLA interface in struct adapter_driver"

No reason to keep longer this temporary hack.
Remove it by reverting the original commit.

Change-Id: I5c6dcdb1f4755b7dba4c03a5033913ef8db35e18
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5533
Tested-by: jenkins
2 months agostlink: simplify handling of SWIM 32/5532/6
Antonio Borneo [Tue, 28 Jan 2020 14:53:06 +0000 (15:53 +0100)]
stlink: simplify handling of SWIM

Now that SWIM is not accessed through HLA anymore, decouple the
SWIM code and remove the conditional execution.

Fix the inconsistency of the return type for stlink_usb_state() in
case of SWIM (returns ERROR_OK while type is enum target_state)
introduced by commit 3de6b5f6e52f ("jtag/drivers/stlink_usb :
implemented and repaired SWIM support").
The code added by commit above in stlink_usb_state() is an hack to
reuse existing HLA API to perform a reconnect.
Move the SWIM specific code from stlink_usb_state() to a dedicated
stlink_swim_op_reconnect() that provides consistent data type.

Change-Id: I3fe175fef00b0735bea6139b057f217a080c9d38
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 3de6b5f6e52f ("jtag/drivers/stlink_usb : implemented and repaired SWIM support")
Reviewed-on: http://openocd.zylin.com/5532
Tested-by: jenkins
2 months agostlink: simplify mem R/W with SWIM 31/5531/7
Antonio Borneo [Tue, 4 Feb 2020 11:53:54 +0000 (12:53 +0100)]
stlink: simplify mem R/W with SWIM

Thanks to API separation between SWIM and the other transports, we
can easily split the memory read/write for SWIM from the rest of
the code.
While there, use the macro STLINK_DATA_SIZE as size of data chunks
that can be read/write in SWIM. This was not implemented before.

Change-Id: I7d913c92539007e4d914480bacc0126a8f0e9705
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5531
Tested-by: jenkins
2 months agoswim: add new transport 30/5530/6
Antonio Borneo [Mon, 27 Jan 2020 17:45:10 +0000 (18:45 +0100)]
swim: add new transport

Add SWIM and STM8 to documentation and update TODO file.
Introduce transport "swim" and command "swim newtap".
Switch in swim.c from HLA API to the new SWIM API.
Implement in stlink driver the SWIM APIs as wrappers of existing
HLA functions.
Remove any SWIM related reference from HLA files.
Update stm8 config files and stlink-dap interface config file.

Change-Id: I2bb9f58d52900f6eb4df05f979f7ef11fd439c24
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5530
Tested-by: jenkins
2 months agoswim: fix adapter speed handling 29/5529/6
Antonio Borneo [Tue, 4 Feb 2020 10:07:01 +0000 (11:07 +0100)]
swim: fix adapter speed handling

SWIM transport only supports two adapter speeds:
- "low speed"  equal to 363 kHz (8 MHz / 22)
- "high speed" equal to 800 kHz (8 MHz / 10)

Replace the previous convention that use "0" or "1" for "low" or
"high" speed with the effective speed in kHz.
Rework the implementation of stlink_speed_swim().
Set low speed in the stm8 config files, because only low speed is
permitted at debug connection; the previous code ignores the
initial value.

Change-Id: I2484c9419a2c554c59eb6b9216339393ab0b54f3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5529
Tested-by: jenkins
2 months agoswim: abstract the transport in stm8 target 28/5528/6
Antonio Borneo [Sun, 26 Jan 2020 16:00:55 +0000 (17:00 +0100)]
swim: abstract the transport in stm8 target

SWIM is implemented by (ab)using the HLA API. This was acceptable
when OpenOCD code did not provided a clear separation between
transports and related APIs. Still today SWIM in OpenOCD is only
supported by STLink, so the decision to re-use the HLA API was the
simpler way to implement it.
After commit efd1d642220a ("adapter: switch from struct
jtag_interface to adapter_driver") the transports API are better
split and SWIM can be implemented as a separate set of API. This
would open the possibility to extend OpenOCD for other adapters
that provide SWIM, e.g. versaloon, or through SPI emulation [1].

Introduce a new set of files swim.[ch] to handle the SWIM API.
Beside the API that almost match the transport low-level data
communication (system_reset, read_mem, write_mem), add a further
API reconnect. Today, inside HLA STLink code, the reconnect is
implemented by hacking the HLA API state(). Please notice that
due to this hack the return type is incorrect; stlink_usb_state()
returns ERROR_OK in SWIM mode, while its return type is enum
target_state. Ignore the type mismatch and still call the HLA API
state in the new SWIM API reconnect. Further commit will fix it.

[1] http://kuku.eu.org/?projects/stm8spi/stm8spi

Change-Id: I52018e1e2200cbd41af8e5031f7b35dc761b61d6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5528
Tested-by: jenkins
2 months agoadapter: expose HLA interface in struct adapter_driver 27/5527/6
Antonio Borneo [Sun, 26 Jan 2020 15:30:14 +0000 (16:30 +0100)]
adapter: expose HLA interface in struct adapter_driver

The transition of STM8/SWIM out of HLA will require a new struct
swim_ops in struct adapter_driver.
To simplify the development, make the HLA interface temporarily
accessible through the struct adapter_driver.
This commit will be reverted after the swim rework.

Change-Id: I1e4f370cf64641164d7bcaa22f75ac58c9240052
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5527
Tested-by: jenkins
2 months agostlink: reduce use of hla specific enum hl_transports 26/5526/6
Antonio Borneo [Wed, 18 Mar 2020 21:35:26 +0000 (22:35 +0100)]
stlink: reduce use of hla specific enum hl_transports

In the driver's code it's widely used the enum hl_transports for
any check concerning the current transport, even for the non-hla
transport dapdirect.
The driver already provides a stlink specific enum stlink_mode
that can be used in place of the hla one.

Replace the hla enum with the stlink one allover the code.
Introduce a hla specific wrapper stlink_usb_hl_open() to cope with
the only API that requires the hla specific enum.

The overall behaviour is not changed, with exception for a debug
message in stlink_usb_open() than now prints the numeric value of
stlink enum in place of the numeric value of the corresponding hla
one.

This change prepares the road for moving SWIM transport out of hla
by removing any reference to the macro HL_TRANSPORT_SWIM from the
stlink driver.

Change-Id: Ieeea34f312245a94bfc1333087afdb8eb9f77139
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5526
Tested-by: jenkins
2 months agoflash/nor/sh_qspi: Fix dead assignment 45/5645/2
Marc Schink [Mon, 4 May 2020 14:56:14 +0000 (16:56 +0200)]
flash/nor/sh_qspi: Fix dead assignment

Change-Id: I6a99076fea30062535e615244895698e51107441
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5645
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agoarm_disassembler: fix typo 'ARM_UNKNOWN_INSTUCTION' to '.._INSTRUCTION' 57/5657/2
Tarek BOCHKATI [Tue, 12 May 2020 20:00:18 +0000 (21:00 +0100)]
arm_disassembler: fix typo 'ARM_UNKNOWN_INSTUCTION' to '.._INSTRUCTION'

Change-Id: I3a3d566fe96fb1497cf8337389e993e0f728a64b
Signed-off-by: Laurent LEMELE <laurent.lemele@st.com>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5657
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agonor/flash: Add keep_alive() during flash write handler 82/5682/2
Edward Fewell [Thu, 14 May 2020 20:49:15 +0000 (15:49 -0500)]
nor/flash: Add keep_alive() during flash write handler

Added keep_alive() call inside main flash write loop. Large
files where causing a gdb timeout warning.

Change-Id: I525dad2d644e248dd9ecf678e4d8e33c22eefdf2
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/5682
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 months agoflash/nor/jtagspi: propagate error from jtag_execute_queue() 84/5684/3
Tomas Vanek [Sun, 17 May 2020 06:17:25 +0000 (08:17 +0200)]
flash/nor/jtagspi: propagate error from jtag_execute_queue()

Change-Id: Ib985bdf3d60345a1e701f9cc98f89a47ff74d3e2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5684
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agortos/ChibiOS: Fix some coding styles 89/4989/3
Marc Schink [Wed, 6 Mar 2019 11:16:53 +0000 (12:16 +0100)]
rtos/ChibiOS: Fix some coding styles

Change-Id: I2648479df1a2dd95f8a57868c4ed4259e0fbbe11
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4989
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agocontrib: Add HiFive1 to udev rules 78/5678/2
Alistair Francis [Wed, 13 May 2020 22:03:14 +0000 (15:03 -0700)]
contrib: Add HiFive1 to udev rules

Change-Id: I4ba9219e1c673d650931f8f9426d554de8322abf
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-on: http://openocd.zylin.com/5678
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agoflash: nor: jtagspi: make read_status report errors 83/4383/2
Paul Fertser [Tue, 30 Jan 2018 09:17:33 +0000 (12:17 +0300)]
flash: nor: jtagspi: make read_status report errors

This is a follow-up to 3c9bd7c6f30a34e3930e44dd2e8ce5f5a877b4eb.

Change-Id: If430f7fcfbba084d9cd74b32344ad43508a96a77
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4383
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 months agotarget/arc: fix build with clang 55/5655/2
Antonio Borneo [Tue, 12 May 2020 14:21:13 +0000 (16:21 +0200)]
target/arc: fix build with clang

Commit da41bce3aee9 ("target/arc: introduce breakpoint
functionality") introduces a mismatch between the format string
and one int constant.

Change the format string to match the int constant.

Change-Id: I0d59552205551b90e165c0a2e3fef247ad0c7701
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: da41bce3aee9 ("target/arc: introduce breakpoint functionality")
Reviewed-on: http://openocd.zylin.com/5655
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2 months agocortex_m: make bit fields in cortex_m unsigned. 83/5583/6
iosabi [Thu, 9 Apr 2020 16:23:34 +0000 (16:23 +0000)]
cortex_m: make bit fields in cortex_m unsigned.

Expression like (0xffff << 16) evaluate to type int, which is not able
to hold that value, producing a warning when compiling with
-fsanitize=undefined. This patch makes most of the cortex_m constants
unsigned using the BIT() macro or appending "ul" when possible to fix
the undefined behavior warning.

Signed-off-by: iosabi <iosabi@protonmail.com>
Change-Id: I7af194305ef612d7a32e74eaf9f11dd85fa87f32
Reviewed-on: http://openocd.zylin.com/5583
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2 months agoflash/nor/bluenrg-x: Minor code cleanups 62/5462/4
Marc Schink [Thu, 20 Feb 2020 20:55:53 +0000 (21:55 +0100)]
flash/nor/bluenrg-x: Minor code cleanups

Change-Id: I7844eb30d58b0a23ca5bcc94181066cca6fa0861
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5462
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agocoding style: open function's brace at beginning of new line 28/5628/3
Antonio Borneo [Mon, 6 May 2019 16:32:02 +0000 (18:32 +0200)]
coding style: open function's brace at beginning of new line

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types OPEN_BRACE -f {} \;

Change-Id: I6d1356ed11e2699525f384efb7556bc2efdc299f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5628
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 months agocoding style: wrap lines longer than 120 chars 26/5626/3
Antonio Borneo [Mon, 6 May 2019 13:07:19 +0000 (15:07 +0200)]
coding style: wrap lines longer than 120 chars

The coding style is quite permissive allowing 120 chars per line,
but abuses are still present.
Fix them, wrapping the lines.

Change-Id: I94d66b651d759a60ec35f7ba115c43933e70ed69
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5626
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agocoding style: join consecutive string fragments 25/5625/3
Antonio Borneo [Mon, 6 May 2019 12:37:19 +0000 (14:37 +0200)]
coding style: join consecutive string fragments

The re is no need to split a long string, apart for fitting the
predefined line width.
Join the consecutive string fragments.

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types STRING_FRAGMENTS -f {} \;

Change-Id: I8de52d572b0e3d4788c1d4d2b0cf8f94c7f08409
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5625
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agocoding style: let "else" follow the close brace 23/5623/2
Antonio Borneo [Mon, 6 May 2019 10:56:38 +0000 (12:56 +0200)]
coding style: let "else" follow the close brace

The statement "else" should not be on a new line when follows a
close brace '}'. Fix it!

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types ELSE_AFTER_BRACE -f {} \;

Change-Id: I8af247ec3f75a69713d7cb1e73881254d16c189e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5623
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agocoding style: remove useless return statement from void functions 22/5622/2
Antonio Borneo [Mon, 6 May 2019 10:41:22 +0000 (12:41 +0200)]
coding style: remove useless return statement from void functions

For void functions, a return as last statement is useless.
Remove it.

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types RETURN_VOID -f {} \;

Change-Id: Ie0616fe98623f30d2d7b04ac9517d669774092de
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5622
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agocoding style: prototype of functions with no parameters 21/5621/2
Antonio Borneo [Mon, 6 May 2019 10:31:57 +0000 (12:31 +0200)]
coding style: prototype of functions with no parameters

Functions that have no parameters should use "void" as parameter
in the function declaration.

Issue identified and fixed by script checkpatch from Linux kernel
v5.1 using the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types FUNCTION_WITHOUT_ARGS --fix-inplace -f {} \;

Change-Id: If104ac75b44e939ec86155ff7b5720f2e33c6b39
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5621
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agocoding style: add missing space when split strings 20/5620/2
Antonio Borneo [Mon, 6 May 2019 10:18:30 +0000 (12:18 +0200)]
coding style: add missing space when split strings

Long strings are split across few lines; usually split occurs at
the white space between two words.
Check that the space between the two words is still present.
While there, adjust the amount of space between words.

Issue identified by checkpatch script from Linux kernel v5.1 using
the command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types MISSING_SPACE -f {} \;

Change-Id: I28b9a65564195ba967051add53d1c848c7b8fb30
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5620
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agocoding style: avoid unnecessary line continuations 19/5619/2
Antonio Borneo [Sun, 5 May 2019 23:03:52 +0000 (01:03 +0200)]
coding style: avoid unnecessary line continuations

Line continuation, adding a backslash as last char of the line, is
requested in multi-line macro definition, but is not necessary in
the rest of C code.

Remove it where present.

Identified by checkpatch script from Linux kernel v5.1 using the
command

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types LINE_CONTINUATIONS -f {} \;

Change-Id: Id0c69e93456731717a7b290b16580e9f8ae741bc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5619
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agocoding style: add parenthesis around the argument of sizeof 18/5618/2
Antonio Borneo [Sun, 5 May 2019 22:35:52 +0000 (00:35 +0200)]
coding style: add parenthesis around the argument of sizeof

The script checkpatch available in new Linux kernel offers an
experimental feature for automatically fix the code in place.
While still experimental, the feature works quite well for simple
fixes, like parenthesis.

This patch has been created automatically with the script under
review for inclusion in OpenOCD, using the command:

find src/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types SIZEOF_PARENTHESIS --fix-inplace -f {} \;

Change-Id: I8adb325bdb0e13211f8bae8b4770ec1979c176bf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5618
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agocoding style: remove useless break after a goto or return 17/5617/2
Antonio Borneo [Sun, 5 May 2019 22:03:03 +0000 (00:03 +0200)]
coding style: remove useless break after a goto or return

In a switch/case statement, a break placed after a goto or return
is never executed.
The script checkpatch available in Linux kernel v5.1 issues a
warning for such unused break statements.
In the process of reviewing the new checkpatch for its inclusion
in OpenOCD, let's get rid of these warnings.

The script checkpatch is unable to fixup automatically this case.
Thanks to having "break" command using a single code line, this
patch has been generated using the script below:

find src/ -type f -exec ./tools/scripts/checkpatch.pl -q \
 --types UNNECESSARY_BREAK -f {} \; \
| sed -n '/^#/{s/^.*FILE: //;s/:$//;s/:/ /;p}' \
| awk 'function P() {print "sed -i '\''"b"'\'' "a};
       {
         if ($1!=a) {
           if (a) {P()};
           a=$1;
           b=$2"{d}";
         } else {
           b=b";"$2"{d}"
         }
       };
       END {P()}'

Change-Id: I56ca098faa5fe8d1e3f712dc0a029a3f10559d99
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5617
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agotcl: remove trailing whitespace 16/5616/2
Antonio Borneo [Sat, 25 Apr 2020 23:07:27 +0000 (01:07 +0200)]
tcl: remove trailing whitespace

The script checkpatch available in new Linux kernel offers an
experimental feature for automatically fix the code in place.
While still experimental, the feature works quite well for simple
fixes, like spacing.

This patch has been created automatically with the script under
review for inclusion in OpenOCD, using the command:
find tcl/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types TRAILING_WHITESPACE --fix-inplace -f {} \;

The patch only changes amount and position of whitespace, thus
the following commands show empty diff
git diff -w
git log -w -p
git log -w --stat

Change-Id: Ie7e3a236f4db9c70019e3b3c7e851edbd3a9dd84
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5616
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agotcl: fix typo and spelling 15/5615/2
Antonio Borneo [Sat, 25 Apr 2020 23:25:32 +0000 (01:25 +0200)]
tcl: fix typo and spelling

Identified by checkpatch script from Linux kernel v5.7-rc1 using
the command
find tcl/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types TYPO_SPELLING --strict -f {} \;

Change-Id: I7b523f0ab5ec047ff167742a44c29984ac672cf4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5615
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agodoc: fix typo and spelling 14/5614/2
Antonio Borneo [Sat, 25 Apr 2020 23:39:16 +0000 (01:39 +0200)]
doc: fix typo and spelling

Identified by checkpatch script from Linux kernel v5.7-rc1 using
the command
find doc/ -type f -exec ./tools/scripts/checkpatch.pl \
-q --types TYPO_SPELLING --strict -f {} \;

Change-Id: I1269ac966027439e16eb6e63179e43925bec37fa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5614
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agodoc: fix texinfo warning on @deffn not at the line beginning 13/5613/2
Antonio Borneo [Mon, 27 Apr 2020 14:52:31 +0000 (16:52 +0200)]
doc: fix texinfo warning on @deffn not at the line beginning

Commit 87a4158acf56 ("drivers: xds110: Clean up command syntax and
documentation") does not follow the documentation structure that
lists the adapters in cpt 2 "Debug Adapter Hardware" then lists
the adapter commands in cpt 8.2 "Interface Drivers"; it puts all
in cpt 2.
While doing that, uses an incorrect texinfo syntax that causes the
following warnings at compile time:
doc/openocd.texi:543: warning: @deffn should only appear at the beginning of a line
doc/openocd.texi:547: warning: @deffn should only appear at the beginning of a line
doc/openocd.texi:552: warning: @deffn should only appear at the beginning of a line

Move the documentation of xds110 commands in the proper chapter
and fix the texinfo syntax.

Change-Id: I0b3f0fe0c687f194bb02e2d81aca86fcd4fdd718
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 87a4158acf56 ("drivers: xds110: Clean up command syntax and documentation")
Reviewed-on: http://openocd.zylin.com/5613
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Edward Fewell <efewell@ti.com>
3 months agohelper/ioutil: silence gcc-8 on strncpy 31/5631/3
Antonio Borneo [Mon, 27 Apr 2020 21:19:14 +0000 (23:19 +0200)]
helper/ioutil: silence gcc-8 on strncpy

Starting from version 8, gcc issues a warning if strncpy could be
able to truncate a string (so without adding the zero-termination
char in destination) by copying exactly "size" char from a source
string not shorter than "size".
Such truncation from strncpy could actually be the desired code
behaviour, but the way to silent gcc only locally (without global
disabling with -Wno-stringop-truncation) through pragma has other
side effects on portability.

In current code, the source string is always "eth0", because has
been checked right above. So this is a false positive from gcc,
being always strlen("eth0") < 16, the sizeof(ifreq.ifr_name).

Silent gcc by decrementing the "size" and remove:
error: ‘strncpy’ specified bound 16 equals destination
size [-Werror=stringop-truncation]

This file is only optionally compiled together with ZY1000 driver
with --enable-zy1000 --enable-ioutil. This combination is not
checked in jenkins, so the error passed unnoticed.
Plus, the configure flags above are both deprecated!

Change-Id: I229e66227cfd3513139feeaffa47a6e1ec00767b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5631
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 months agohelper/command: register all commands through register_commands() 44/5644/2
Antonio Borneo [Fri, 1 May 2020 16:30:00 +0000 (18:30 +0200)]
helper/command: register all commands through register_commands()

The commands "ocd_find" and "capture" are registered directly
through the jim API, instead of the common way to describe them
in a struct command_registration that is then passed to the helper
register_commands().
This cause the two commands above to not have either "help" nor
"usage" string nor a properly identified "mode".

Since the following line registers the commands listed in struct
command_builtin_handlers, simply add the two commands above in the
same struct.

Change-Id: Id6ee11dac3b18364deeed65ee8e18ad80152750a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5644
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agotcl: stm32mp15x: fix "reset halt" on CM4 in engineering boot 49/5649/2
Antonio Borneo [Tue, 5 May 2020 16:11:47 +0000 (18:11 +0200)]
tcl: stm32mp15x: fix "reset halt" on CM4 in engineering boot

The state machine of cortex-m have to pass through a set of state
before it get in "halted".

Add one more "arp_poll" to achieve the proper state during a
"reset halt" command in engineering boot.

Change-Id: I90828bf20ef75bd4018f8b911f727ae69c4d6e8f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5649
Tested-by: jenkins
Reviewed-by: Richard Braun <rbraun@sceen.net>
3 months agoflash/nor/efm32: Some small code cleanups 20/5420/3
Marc Schink [Tue, 28 Jan 2020 20:40:37 +0000 (21:40 +0100)]
flash/nor/efm32: Some small code cleanups

Change-Id: I547970ce31435f75bae01d6d2cc96ebc9c15588c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5420
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoserver/telnet: Fix history output 14/3414/3
Marc Schink [Wed, 13 Apr 2016 11:36:26 +0000 (13:36 +0200)]
server/telnet: Fix history output

Restore the prompt after the "history" command is invoked.

Change-Id: I3d0744abbc58e82b039e06f21675efa180e8e1b0
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/3414
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agohla: remove unused hl_interface_param_s.api 11/5611/2
Tarek BOCHKATI [Sun, 26 Apr 2020 19:21:16 +0000 (20:21 +0100)]
hla: remove unused hl_interface_param_s.api

Change-Id: I90a23293c7e3a6067d56e56d186f9f452af7c15e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5611
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agoflash/nor/avrf: Minor code cleanups 61/5461/2
Marc Schink [Thu, 20 Feb 2020 20:54:18 +0000 (21:54 +0100)]
flash/nor/avrf: Minor code cleanups

Change-Id: I64aa8e41f336584b524445e0ee7f986a0032852a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5461
Tested-by: jenkins
Reviewed-by: Lars Poeschel <poeschell+openocd@mailbox.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoflash/nor/kinetis: Minor code cleanups 59/5459/2
Marc Schink [Thu, 20 Feb 2020 20:49:17 +0000 (21:49 +0100)]
flash/nor/kinetis: Minor code cleanups

Change-Id: Id74cb6c238b803d1a1566fc615e22ea478f2e15e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5459
Tested-by: jenkins
Reviewed-by: Lars Poeschel <poeschell+openocd@mailbox.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget/arc: introduce breakpoint functionality 41/5641/3
Evgeniy Didin [Mon, 16 Mar 2020 17:38:00 +0000 (20:38 +0300)]
target/arc: introduce breakpoint functionality

With this patch we introduce set/unset breakpoints
routines and add/remove bp handlers.
Currently soft breakpoints are only supported.

Changes since v1:
* Change if-statement in arc_remove_breakpoint
* Squash changes from http://openocd.zylin.com/#/c/5641/
  in this commit to fix build.

Change-Id: Ib10ccdb02fd1606e4f407f012b1bee106a8ffccd
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5641
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agotarget/arc: introduce arc_read/write_instruction functions 40/5640/2
Evgeniy Didin [Mon, 16 Mar 2020 12:00:16 +0000 (15:00 +0300)]
target/arc: introduce arc_read/write_instruction functions

This commit introduces helper instruction read/write functions
for further bp functionality.

Change-Id: I619fbe2870ef6365c29ed1618bb83b6f7eb84690
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5640
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agotarget/arc: Add initial stepping functions 43/5643/2
Evgeniy Didin [Wed, 18 Mar 2020 13:12:04 +0000 (16:12 +0300)]
target/arc: Add initial stepping functions

Change-Id: I84845f2ec6f1cff975990f0a495165a02de33227
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5643
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agoAdd get_thread_reg() and set_reg() for hwthread 24/5324/3
Tim Newsome [Thu, 17 Oct 2019 22:12:55 +0000 (15:12 -0700)]
Add get_thread_reg() and set_reg() for hwthread

get_thread_reg() allows gdb to request the register value of a specific
"thread."
set_reg() allows register writes without getting a giant list of
registers first.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I87faa1c8793916b9ee476dd696f0695a07ca2b41
Reviewed-on: http://openocd.zylin.com/5324
Tested-by: jenkins
3 months agoloaders/flash/nrf5: add CPU type to loader source 88/5588/2
Tomas Vanek [Mon, 13 Apr 2020 15:33:10 +0000 (17:33 +0200)]
loaders/flash/nrf5: add CPU type to loader source

Change-Id: Ia65ac21bd99d76c8dace4e9ede060e870cad14de
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5588
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoflash/stm32l4x: always use stm32l4_get_flash_reg 08/5508/2
Tarek BOCHKATI [Mon, 9 Mar 2020 18:10:56 +0000 (19:10 +0100)]
flash/stm32l4x: always use stm32l4_get_flash_reg

this change is a preparation for STM32L5 support on top of L4 driver
STM32L5 flash is quite similar to L4 flash, mainly register names
and offsets and some bits are changed.
a table with register offset will be introduced, thus correct register
addresses will be obtained using this table and the driver internal
function 'stm32l4_get_flash_reg' will be responsible of this.

Change-Id: I74bf61a83fe53575623640af0328b3253ecc796f
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5508
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Michael Jung <mijung@gmx.net>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agorevision id for STM32L4P5/Q5 corrected 21/5521/3
Andreas Bolsch [Sun, 15 Mar 2020 11:21:37 +0000 (12:21 +0100)]
revision id for STM32L4P5/Q5 corrected

According to RM0432 rev. 6, only 0x1001 "Z" rev. applies for STM32L4P5/Q5.
Verified on real device. Whether other revisions exist is unclear.

Change-Id: I761ae077d089b06925fc0fe1ff2b1e478b8a66fa
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: http://openocd.zylin.com/5521
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agotarget/armv7m: cosmetic refactorization 26/5326/2
Tomas Vanek [Sun, 20 Oct 2019 08:08:07 +0000 (10:08 +0200)]
target/armv7m: cosmetic refactorization

Introduce a variable 'size' and reduce the number of dereferencing
*reg_list_size by using the variable.

Change-Id: I3bdf1485a4ed8e34435e8acb3efd0df8d802508c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5326
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agojtag: remove unused function adapter_driver_modules_load() 01/5601/2
Antonio Borneo [Wed, 22 Apr 2020 20:39:07 +0000 (22:39 +0200)]
jtag: remove unused function adapter_driver_modules_load()

Commit c2cecc74b0ac ("Move JTAG interface list to new files.")
merged in mid 2009 introduces an unused and empty function that
the developer expects to use for loading adapter drivers from
shared libraries. This have never happened and the function is
still empty and unused.

Remove it.

Change-Id: I7c88dbf8a9747e96e5ca4e6e7038ac0f232604fd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5601
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
3 months agoserver: set tcp port and bind address before init 95/5595/2
Antonio Borneo [Mon, 20 Apr 2020 21:54:38 +0000 (23:54 +0200)]
server: set tcp port and bind address before init

All the servers open the listening socket during openocd "init";
it's not possible to change the tcp port or the bind address
after "init".

In current code, the call order during "init" permits to change
the port and bind address of tcl and telnet server if the related
command is issued after "init" in the same script or on openocd
command line. This is not guaranteed to work if the call order
during "init" changes, so it's incorrect.

Change the commands "bindto" and "*_port" to COMMAND_CONFIG.

Change-Id: Id88f225a67a872b4bcaf3b799466bddedc248015
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Christopher Head <chead@zaber.com>
Fixes: https://sourceforge.net/p/openocd/tickets/264/
Reviewed-on: http://openocd.zylin.com/5595
Reviewed-by: Christopher Head <chead@zaber.com>
Tested-by: jenkins
3 months agocoding style: contrib: remove empty lines at end of text files 73/5173/6
Antonio Borneo [Sun, 12 May 2019 10:57:49 +0000 (12:57 +0200)]
coding style: contrib: remove empty lines at end of text files

Empty lines at end of text files are useless.
Remove them.

Change-Id: I4efbd9af5be7e16213dcc7cb95de936ecde2fcef
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5173
Tested-by: jenkins
3 months agocoding style: src: remove empty lines at end of text files 72/5172/6
Antonio Borneo [Sun, 12 May 2019 10:55:18 +0000 (12:55 +0200)]
coding style: src: remove empty lines at end of text files

Empty lines at end of text files are useless.
Remove them.

Change-Id: Ibac9b36682d58f81e34ca2b51e6260e7d472fb0e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5172
Tested-by: jenkins
3 months agocoding style: tcl: remove empty lines at end of text files 71/5171/6
Antonio Borneo [Sun, 12 May 2019 10:53:56 +0000 (12:53 +0200)]
coding style: tcl: remove empty lines at end of text files

Empty lines at end of text files are useless.
Remove them.

Change-Id: I503cb0a96c7ccb132f4486c206a48831121d7abd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5171
Tested-by: jenkins
3 months agobitbang: Fix FTBFS with GCC 10 92/5592/2
Andreas Fritiofson [Fri, 17 Apr 2020 11:49:28 +0000 (13:49 +0200)]
bitbang: Fix FTBFS with GCC 10

GCC 10 defaults to -fno-common which breaks the sharing of bitbang_swd
struct between bitbang drivers due to a missing extern.

Change-Id: I2b4122f7939cec91a72284006748f99a23548324
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/5592
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 months agoflash/nor/stm32l4x: cast wrpxxr_mask to uint16_to to print 90/5590/2
Ilya Kharin [Wed, 15 Apr 2020 23:21:30 +0000 (03:21 +0400)]
flash/nor/stm32l4x: cast wrpxxr_mask to uint16_to to print

Fix build error on Mac OS X Catalina (10.15.4) caused by formatting
stm32l4_info->wrpxxr_mask, which is uint32_t, as uint16_t in the debug
log message. Adding casting to uint16_t before substitution because only
lower 16 bits are significant for debug purposes.

Change-Id: Iddb87cd156dfc84ab1f91cd15a1ddee6b646d412
Signed-off-by: Ilya Kharin <akscram@gmail.com>
Reviewed-on: http://openocd.zylin.com/5590
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoftdi: Report an error if no ftdi_vid_pid is specified 40/5440/2
Leonard Crestez [Thu, 6 Feb 2020 14:13:25 +0000 (16:13 +0200)]
ftdi: Report an error if no ftdi_vid_pid is specified

By default the list of VID/PID is empty so if ftdi_vid_pid is not called
then no matches are attempted. The only message is at -d3:

Command 'init' failed with error code -100"

Check for this condition explicitly to make life easier for people
configuring adapters.

Change-Id: If0f93370c9e9ddc9700aae7c346c1c6dd319152e
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-on: http://openocd.zylin.com/5440
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget/armv8: Add ARM target name on halt status 71/5571/2
Kevin Burke [Mon, 4 Nov 2019 20:11:06 +0000 (20:11 +0000)]
target/armv8: Add ARM target name on halt status

The CPU target name is added to the HALT status message so the user
can see which target halted at the designated program counter.

Tested on an Ampere eMAG8180 and Quicksilver silicon

Change-Id: I51e6f21296c85a822df28c5b7c4068e8ff66f29e
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: http://openocd.zylin.com/5571
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget/armv7m: minor fixes of target algo exit point check 29/5329/2
Tomas Vanek [Sun, 20 Oct 2019 13:03:44 +0000 (15:03 +0200)]
target/armv7m: minor fixes of target algo exit point check

Introduce a new ERROR_TARGET_ALGO_EXIT as currently used
ERROR_TARGET_TIMEOUT should be reserved for the timeout only.

Do not load PC directly from CPU HW as the register value
has already been cached.

Change-Id: I0d3630da41fd021676789dc12b52545cc0432ba8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5329
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 months agoflash/nor: add flash mdw/h/b commands 76/4776/5
Tomas Vanek [Thu, 22 Nov 2018 18:05:04 +0000 (19:05 +0100)]
flash/nor: add flash mdw/h/b commands

Some flash banks are not mapped in the target memory
(e.g. SPI flash, some special pages).

Add flash version of mdw/h/b which reads data using
the flash driver.

Change-Id: I66910e0a69cf523fe5ca1ed6ce7b9e8e176aef4a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4776
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotcl/target/nrf52.cfg: detect AP lock and add command to recover 84/4984/3
Tomas Vanek [Fri, 1 Mar 2019 12:35:31 +0000 (13:35 +0100)]
tcl/target/nrf52.cfg: detect AP lock and add command to recover

Change-Id: I8d2e29ed88a957d412473255e42b022a00dfb9cb
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4984
Tested-by: jenkins
3 months agonrf5: Comment the flash loader 72/5272/3
Aurélien Martin [Tue, 6 Aug 2019 20:08:18 +0000 (22:08 +0200)]
nrf5: Comment the flash loader

Change-Id: Ia84b5b8ede53f59299a02dc6163d6bbaa31e0fbd
Signed-off-by: Aurélien Martin <martaurel@gmail.com>
Reviewed-on: http://openocd.zylin.com/5272
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agonrf5: Refresh the watchdog while flashing 66/5266/7
Aurélien Martin [Mon, 22 Jul 2019 21:13:29 +0000 (23:13 +0200)]
nrf5: Refresh the watchdog while flashing

If watchdog is enabled, there's no way we can disable it while the flashing firmware
is running. (Halt disables it, but software reset doesn't.) So let's have the flashing
firmware refresh the watchdog regularly, in case it has been enabled by previously
running software. Failure to do so could lead to a watchdog reset in the middle of
the chip bieng programmed.

Change-Id: I79d41593948aae0080480e891552e1c2ee3ccbd0
Signed-off-by: Aurélien Martin <martaurel@gmail.com>
Reviewed-on: http://openocd.zylin.com/5266
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agonrf5: Include generated loader code 67/5267/5
Aurélien Martin [Tue, 23 Jul 2019 19:21:39 +0000 (21:21 +0200)]
nrf5: Include generated loader code

Dump legacy hexadecimal machine code

Change-Id: I336efa461058bccc3894131cb22473785b68479c
Signed-off-by: Aurélien Martin <martaurel@gmail.com>
Reviewed-on: http://openocd.zylin.com/5267
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agoRemove BUILD_TARGET64 40/5240/4
Florian Fainelli [Mon, 17 Jun 2019 22:46:11 +0000 (15:46 -0700)]
Remove BUILD_TARGET64

BUILD_TARGET64 creates a larger test matrix and mostly gates the
building of the aarch64/armv8 target, make that unconditional, which
would help fixing any issues with 64-bit address types anyway.

Rebased by Antonio Borneo after commit 1fbe8450a9dd ("mips: Add
MIPS64 support")

Change-Id: I219f62b744d540d9dde9a42e6b63fd7d91df3dbb
Suggested-by: Matthias Welwarsky <matthias@welwarsky.de>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5240
Tested-by: jenkins
3 months agojtag/drivers/rshim: Disable the driver by default 63/5563/5
Liming Sun [Sat, 4 Apr 2020 02:51:13 +0000 (22:51 -0400)]
jtag/drivers/rshim: Disable the driver by default

This is a follow-up change of commit 6d6a69d5 to disable it by
default. The driver was introduced in 6d6a69d5 and enabled by
default in order to run the jenkins build.

Signed-off-by: Liming Sun <lsun@mellanox.com>
Change-Id: I5c5fc6711b971b65dd5846a6163025879044ec40
Reviewed-on: http://openocd.zylin.com/5563
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agojtag/drivers: add debugging support for Mellanox BlueField SoC 57/5457/7
Liming Sun [Fri, 10 May 2019 15:02:31 +0000 (11:02 -0400)]
jtag/drivers: add debugging support for Mellanox BlueField SoC

This commits adds debugging support for the Mellanox BlueField
SoC via rshim, which is an interface accessible from external USB
or PCIe (for SmartNIC case) via the rshim driver. It implements
the arm dap interfaces based on the existing dapdirect framework.

Change-Id: I18eb1c54293ec2c581f853e0e55b3f96d7978b56
Signed-off-by: Liming Sun <lsun@mellanox.com>
Reviewed-on: http://openocd.zylin.com/5457
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotools/checkpatch.sh: remove flag --no-tree 10/5110/2
Antonio Borneo [Wed, 10 Apr 2019 10:46:54 +0000 (12:46 +0200)]
tools/checkpatch.sh: remove flag --no-tree

Commit c5d89883165e02ea4f318e3cb0ba40d1fb6f04d1 ("checkpatch.pl:
check for openocd tree, not for kernel tree") has already fixed
the check for OpenOCD tree, thus we do not need to skip it in the
shell wrapper.

Remove flag --no-tree from the shell wrapper.

Change-Id: I8be497258624d89bde7742fee141a8f56bf9188e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5110
Tested-by: jenkins
3 months agotcl/target: Drop reference to renesas_gen2_common.cfg 64/5564/2
Marek Vasut [Sat, 4 Apr 2020 11:20:56 +0000 (13:20 +0200)]
tcl/target: Drop reference to renesas_gen2_common.cfg

Drop bogus reference to board/renesas_gen2_common.cfg , which is a
non-existing file.

Fixes: a01474bb4c4c ("tcl/target: Switch Renesas R-Car Gen2 boards to new config")
Change-Id: Icb22d8456b7ac94d3a9a4ed354b246ee1332b122
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5564
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agotcl: stm32mp15x: add target and board config files 54/5454/4
Antonio Borneo [Fri, 14 Feb 2020 15:49:45 +0000 (16:49 +0100)]
tcl: stm32mp15x: add target and board config files

The stm32mp15x has one or two Cortex-A7 (depending on the P/N) and
one Cortex-M4.
The second core is automatically detected by the target script.
In "engineering boot" all the cores are accessible.
In "production boot" the Cortex-M4 is kept in reset state after
power-on or NRST.

The board DK2 includes a ST-Link/V2, but only SWD is connected.

Change-Id: Ib6ebefcc696b1716e0f98694cadf0b04fd7d11d6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5454
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agojtag/drivers/ulink: fix clang static analyzer warnings 70/5370/3
Tomas Vanek [Fri, 13 Mar 2020 14:34:47 +0000 (15:34 +0100)]
jtag/drivers/ulink: fix clang static analyzer warnings

scan-build-9:
Description: Potential leak of memory pointed to by 'cmd'
File: /home/vanekt/openocd/scanbuild9/../src/jtag/drivers/ulink.c
Line: 1075

Description: Potential leak of memory pointed to by 'cmd'
File: /home/vanekt/openocd/scanbuild9/../src/jtag/drivers/ulink.c
Line: 1275

ulink_append_xxx_cmd() functions allocate memory for cmd
and then call ulink_allocate_payload(), which allocates cmd->payload_out
or cmd->payload_in.

ulink_append_queue() checks the size of queue and if the new payload
does not fit, calls ulink_execute_queued_commands() and then
ulink_post_process_queue(). If any of these two fails, an error is
returned, allocated cmd struct leaks and the queue is left in an undefined
state.

Change ulink_append_queue() flow to proceed to appending cmd to the queue
even in the case of fail in previous ulink_execute_queued_commands()
or ulink_post_process_queue(). In case of fail then clear the queue
including the last appended cmd.

Change-Id: I967c07af19e9020c93bcb4ef403cf1f557dd1db1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5370
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agojtag/drivers/ulink: fix clang static analyzer warning 20/5520/2
Tomas Vanek [Fri, 13 Mar 2020 14:13:21 +0000 (15:13 +0100)]
jtag/drivers/ulink: fix clang static analyzer warning

scan-build-9:
Description: Access to field 'payload_in' results in a dereference
 of a null pointer (loaded from field 'queue_start')
File: src/jtag/drivers/ulink.c
Line: 2216

Set input/output_signals conditionally if ulink_append_get_signals_cmd()
and ulink_execute_queued_commands() returns no error.
Do not fail driver initialisation as the signals are only printed.

Change-Id: I6c842f0e9a604712abf7444a2fa95ba5810de1ff
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5520
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agojtag/drivers/ulink: fix clang static analyzer warning 19/5519/2
Tomas Vanek [Fri, 20 Dec 2019 22:34:19 +0000 (23:34 +0100)]
jtag/drivers/ulink: fix clang static analyzer warning

scan-build-9:
Description: Potential leak of memory pointed to by 'tdo_buffer'
File: src/jtag/drivers/ulink.c
Line: 1629

Free the buffer before error return.

Change-Id: Ic47651a5ae78c7a47ae4fcbad225f329b14c45cb
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5519
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agoflash/nand/core: fix clang static analyzer warning 18/5518/2
Tomas Vanek [Fri, 13 Mar 2020 11:10:50 +0000 (12:10 +0100)]
flash/nand/core: fix clang static analyzer warning

core.c:446:
The left operand of '>>' is a garbage value

There are many places where an error code returned from nand->controller
operations are ignored. To keep the change minimal, the error checks are
added only to reading of extended nand info as it was suspected
to be the cause of the warning.

Addition of the error checks did not fix the warning.
scan-build-9 report was inspected and IMHO the warning is bogus:
the term (nand->device->erase_size == 0) cannot give false at line 395
and then evaluate true at line 462. Fixed by zeroing id_buff.

Change-Id: I97ed7ce0fdf1aa23d746d5fb898bacd050e20ae8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5518
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agotarget/arc: remove saving context during reset 24/5524/3
Evgeniy Didin [Tue, 17 Mar 2020 11:06:24 +0000 (14:06 +0300)]
target/arc: remove saving context during reset

In arc_poll() function we handle the cases, when jtag indicates, that
processor is halted, but target->state is not TARGET_HALTED.
In case, when processor was halted and target->state was TARGET_RUNNING,
we should save context. At the same time if target->state was TARGET_RESET
we do not need to save context.

Changes: 16.04:
Fix - Move setting target->state = TARGET_HALT after
"target->state == TARGET_RUNNIG" check, otherwise
this check makes no sense

Change-Id: I92ab6ec71cf58273bb8401d14a562035de3deab4
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5524
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agoAdd documentation section for ARCv2 51/5351/6
Evgeniy Didin [Thu, 28 Nov 2019 05:34:46 +0000 (08:34 +0300)]
Add documentation section for ARCv2

Changes since v1:
-Moved from http://openocd.zylin.com/#/c/5332/4
 into separate commit.

28.02.2020:
-Removed multiple cpu configuration section, currently
 only ARC EM is supported.

17.03.2020:
-Some cleanup
-For "arc set-reg-exists" command limitize the number of
 arguments (50 maximum).

17.03.2020(v2):
-Revert limitation for "arc set-reg-exist" command

Change-Id: I4b06f89df95f2773bfde6e1bd2ae2b6b880bfaa8
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5351
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agoIntroduce ARCv2 tcl config files 50/5350/6
Evgeniy Didin [Thu, 28 Nov 2019 05:34:01 +0000 (08:34 +0300)]
Introduce ARCv2 tcl config files

With this commit we add tcl files which describes
ARCv2 architecture features and configure files
for ARCv2 EMSK board.

Changes since v1:
-Moved from http://openocd.zylin.com/#/c/5332/4
 into separate commit.

Changes:
22.01.2020:
-Removed "actionpoints" handling code in
 tcl/cpu/arc/v2.tcl because this capability
 is not supported yet.

Changes:
17.03.2020:
-Update Licence headers
-Cleanup indents
-Removed "reset halt" in boards .tcl
-Updated adapter frequency commands

Changes:
15.03.2020:
-Removed "init" in the of boards .tcl

Change-Id: I51bf620abe7b8e046e1dccc861a7d963965d3a42
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5350
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
3 months agoRevert "rtos/FreeRTOS: Fix FreeRTOS thread list reading" 77/5577/3
Tomas Vanek [Sun, 5 Apr 2020 15:34:14 +0000 (17:34 +0200)]
Revert "rtos/FreeRTOS: Fix FreeRTOS thread list reading"

This reverts commit 6568d29cc1d0d94daafec5bdb73de7d4f17da257.
The reverted change caused some tasks were missing in thread list.

While on it add a comment explaining the relation of uxTopUsedPriority
and configMAX_PRIORITIES, introduce config_max_priorities and
change types to unsigned.

Change-Id: I4371c8882470d13ee7360ef21b132c56ecb95af8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5577
Tested-by: jenkins
3 months agoflash/nor/efm32: Chip support extension (EFM32GG12B Giant) 67/5567/2
tscn92 [Mon, 6 Apr 2020 13:51:23 +0000 (15:51 +0200)]
flash/nor/efm32: Chip support extension (EFM32GG12B Giant)

For flash/nor/efm32 the EFM32GG12B Giant chip has been added to the
efm32_family along with its respective series and msc_rebase.
Testen on EFM32GG12B390F board

Change-Id: Idd7dfa93f26ac22566aed1be28f30db678cc0a25
Signed-off-by: tscn92 <tscn@kamstrup.com>
Reviewed-on: http://openocd.zylin.com/5567
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 months agoserver: set connection::input_pending type to bool 65/5565/3
Tarek BOCHKATI [Mon, 6 Apr 2020 12:41:36 +0000 (13:41 +0100)]
server: set connection::input_pending type to bool

Change-Id: Ifae8ac2761a7a8fa12732b71c2de456e7558bd2b
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5565
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 months agoserver/gdb_server: set gdb_connection::ctrl_c type to bool 66/5566/2
Tarek BOCHKATI [Mon, 6 Apr 2020 12:49:17 +0000 (13:49 +0100)]
server/gdb_server: set gdb_connection::ctrl_c type to bool

Change-Id: I828b83b181f7a222ee2e6cb67eb337c6cd8712ac
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5566
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 months agoEntering SWIM mode on ST-LINK does not update swim status word. 47/5547/4
Ake Rehnman [Sun, 29 Mar 2020 10:13:18 +0000 (12:13 +0200)]
Entering SWIM mode on ST-LINK does not update swim status word.

As a consequence of a previous failed SWIM command any
subsequent attempts to enter SWIM mode fails. Change
stlink_usb_mode_enter to use stlink_usb_xfer_noerrcheck
instead.

Change-Id: I5c6a1a8e68d3dc77ec37264880383366fa6a75d9
Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com>
Reviewed-on: http://openocd.zylin.com/5547
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agostlink: always use a valid endpoint 55/5455/4
Tarek BOCHKATI [Mon, 30 Mar 2020 11:06:18 +0000 (13:06 +0200)]
stlink: always use a valid endpoint

In order to extend the driver to support stlink-server over TCP,
we should always use a valid endpoint, as stlink-server is not permissive
and do not accept the invalid STLINK_NULL_EP.

STLINK_NULL_EP value was used for commands without an expected reply,
this value could be replaced with a valid endpoint without any impact
when the size is set to zero.

Change-Id: I003ad364e03d3a10bc036772db86310d996cbe81
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5455
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agojtag: flush queue after reset for drivers using old reset model 30/5430/2
Antonio Borneo [Mon, 3 Feb 2020 09:02:54 +0000 (10:02 +0100)]
jtag: flush queue after reset for drivers using old reset model

Not all the jtag drivers have been migrated to the new reset model
and for those only we need to flush the jtag queue to make the
reset working with command 'adapter [de]assert ...'.

Add a queue flush and a FIXME comment to remove both when all the
drivers would be migrated.

Change-Id: Ib6667f987b1be2bce492841040302e742dd1cad1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5430
Tested-by: jenkins
3 months agogdb_server: print the target associated to the gdb port 25/5525/2
Antonio Borneo [Mon, 16 Mar 2020 13:53:18 +0000 (14:53 +0100)]
gdb_server: print the target associated to the gdb port

While running OpenOCD on multi-target SoC, it's not immediate to
detect which target is associated to each GDB port. The log only
reports:
Info : Listening on port 3333 for gdb connections
and a verbose debug log is required to get such info.

Promote to LOG_INFO() the existing debug message that already
reports the association, obtaining for each port:
Info : starting gdb server for stm32mp15x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections

Change-Id: I1bd75655a3449222c959e6e82f5e0f8f5acd908a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5525
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 months agocortex_m: remove deprecation for soft_reset_halt 14/5514/2
Antonio Borneo [Tue, 10 Mar 2020 22:07:42 +0000 (23:07 +0100)]
cortex_m: remove deprecation for soft_reset_halt

The command "soft_reset_halt" is deprecated since mid 2013 with
the commit 146dfe32956d ("cortex_m: deprecate soft_reset_halt").
Nevertheless it is still extremely useful with multicore chips
where it allows to reset only one of the cores, option not
available through asserting the chip-wide srst.
It also get useful to handle the reset on some problematic chip,
as in http://openocd.zylin.com/5489

Replace the warning about deprecation with a more light debug
message.

Change-Id: I52de6359475ba31014ae77e596a87fe88b252177
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5514
Tested-by: jenkins
Reviewed-by: Edward Fewell <efewell@ti.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 months agocortex_a: don't wait for target halted in deassert_reset() 72/5472/2
Antonio Borneo [Wed, 12 Feb 2020 21:26:51 +0000 (22:26 +0100)]
cortex_a: don't wait for target halted in deassert_reset()

The tcl script src/target/startup.tcl has already the proper
centralized support to wait for all targets to halt after the
command "reset halt". The extra wait in cortex_a_deassert_reset()
is not required.
This extra wait is also an issue for multi-core support, because
waiting for one core to halt can delay the halt request to the
other cores.

Replace the indirect call to cortex_a_halt(), that embeds the wait
for halt, with a low-level halt sequence.

The on-going work on the reset framework is compatible with this
change; in fact it keeps in startup.tcl the wait for targets to
halt, even if current code proposal for cortex_a simply removes
the function cortex_a_deassert_reset().

Change-Id: Ic661c3791a29ba7d520e31f85a61f939a646feb5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5472
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 months agostlink: remove only instance of useconds_t 44/5544/3
Antonio Borneo [Thu, 26 Mar 2020 14:16:52 +0000 (15:16 +0100)]
stlink: remove only instance of useconds_t

The usleep() function, and its associated useconds_t type
specifier, has been obsoleted by POSIX.1-2008.

OpenOCD has 28 call to usleep(), that should be migrated to the
replacement nanosleep(), but due to the different prototype
int nanosleep(const struct timespec *req, struct timespec *rem);
this can take some effort.

The type useconds_t is used in only one case, where it's used both
as parameter of usleep() and as value passed to LOG_DEBUG(). Due
to different implementation of useconds_t, there are cases that
trigger a compile warning in LOG_DEBUG() when useconds_t is more
than 32 bit.
E.g. with unistd.h in MinGW 4.x, useconds_t is defined as unsigned
long, thus being 32 or 64 bits depending on the target.

Replace the only instance of useconds_t.

Change-Id: I21724f8b06780abdb003a57222ff1d6840ff5419
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5544
Tested-by: jenkins
Reviewed-by: Ake Rehnman <ake.rehnman@gmail.com>
3 months agoflash/nor/nrf5: pass unsigned char to isalnum() 45/5545/4
Antonio Borneo [Thu, 26 Mar 2020 22:35:08 +0000 (23:35 +0100)]
flash/nor/nrf5: pass unsigned char to isalnum()

In newlib, the argument of isalnum() and the similar functions in
ctype.h is checked to be either an int or an unsigned char.
Using a normal (signed) char triggers a compile time warning
warning: array subscript has type ‘char’ [-Wchar-subscripts]

Rewrite the function to separate the internal unsigned char
operations from the (signed) char parameter.

Change-Id: I5f19115f0b2de2b5b35dc07ef4b58a96161268ee
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Åke Rehnman <ake.rehnman@gmail.com>
Fixes: 5da746fa09 ("flash/nor/nrf5: detect newer devices without HWID table")
Reviewed-on: http://openocd.zylin.com/5545
Tested-by: jenkins
Reviewed-by: Ake Rehnman <ake.rehnman@gmail.com>
3 months agosysfsgpio: minor fix for bool types 52/5552/2
Antonio Borneo [Sun, 29 Mar 2020 21:19:29 +0000 (23:19 +0200)]
sysfsgpio: minor fix for bool types

Return bool value in functions that return bool.
Change return type to bool to function is_gpio_valid().

Change-Id: Ic2e62be737772b22e69881c034956549f659370b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5552
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 months agotravis: Add .travis.yml 14/5414/11
Marek Vasut [Fri, 10 Jan 2020 01:06:45 +0000 (02:06 +0100)]
travis: Add .travis.yml

Add basic Travis-CI .travis.yml, to let Travis CI run automated build tests.

Change-Id: Iceae442c13f30b57842b300c0920108b614c75f7
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/5414
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>