Commit Graph

6844 Commits

Author SHA1 Message Date
Antonio Borneo ffe6bc8220 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
2020-05-24 21:32:05 +01:00
Antonio Borneo ac05f929ed 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
2020-05-24 21:31:21 +01:00
Antonio Borneo ac18e960ce 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 efd1d64222 ("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
2020-05-24 21:29:42 +01:00
Antonio Borneo 93c4c0fcbe 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
2020-05-24 21:29:11 +01:00
Antonio Borneo 94dfa68647 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
2020-05-24 21:27:34 +01:00
Marc Schink 17789d3762 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>
2020-05-24 21:27:08 +01:00
Tarek BOCHKATI ac870d80a9 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>
2020-05-24 21:26:47 +01:00
Edward Fewell 763f2549ad 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>
2020-05-24 21:26:26 +01:00
Tomas Vanek 9a5af06f82 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>
2020-05-24 21:25:48 +01:00
Marc Schink ec30634c13 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>
2020-05-24 21:25:25 +01:00
Paul Fertser e41c0f4906 flash: nor: jtagspi: make read_status report errors
This is a follow-up to 3c9bd7c6f3.

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>
2020-05-18 04:50:02 +01:00
Antonio Borneo 11c5efd2ec target/arc: fix build with clang
Commit da41bce3ae ("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: da41bce3ae ("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>
2020-05-14 20:28:24 +01:00
iosabi dadf46f618 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>
2020-05-12 06:05:45 +01:00
Marc Schink b604bc6c4c 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>
2020-05-12 06:03:49 +01:00
Antonio Borneo 59cc1f6629 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>
2020-05-09 14:41:31 +01:00
Antonio Borneo e41c3f78d1 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>
2020-05-09 14:40:52 +01:00
Antonio Borneo 4625257007 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>
2020-05-09 14:40:40 +01:00
Antonio Borneo 1946b50dba 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
2020-05-09 14:40:14 +01:00
Antonio Borneo 3883e769f4 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
2020-05-09 14:40:07 +01:00
Antonio Borneo 3474aa223a 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
2020-05-09 14:39:59 +01:00
Antonio Borneo 185834ef8a 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
2020-05-09 14:39:44 +01:00
Antonio Borneo 4f459660a9 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
2020-05-09 14:39:29 +01:00
Antonio Borneo e66bb9d312 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
2020-05-09 14:39:19 +01:00
Antonio Borneo 9b29cb58ac 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
2020-05-09 14:39:05 +01:00
Antonio Borneo 4738a55da4 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>
2020-05-09 14:36:56 +01:00
Antonio Borneo 8807a5937e 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>
2020-05-09 14:36:44 +01:00
Marc Schink fdad56ecb0 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>
2020-05-09 14:36:04 +01:00
Marc Schink 82f71aa274 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>
2020-05-09 14:35:43 +01:00
Tarek BOCHKATI 6f91aae159 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
2020-05-09 14:35:01 +01:00
Marc Schink 22797616ac 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>
2020-05-09 14:34:32 +01:00
Marc Schink ed8d4a2e3b 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>
2020-05-09 14:34:15 +01:00
Evgeniy Didin da41bce3ae 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>
2020-05-08 21:23:05 +01:00
Evgeniy Didin c693508f77 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>
2020-05-08 15:09:46 +01:00
Evgeniy Didin 0af37282c7 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>
2020-05-08 05:57:12 +01:00
Tim Newsome 05eb9a357c 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
2020-05-07 21:32:32 +01:00
Tarek BOCHKATI 880508f68f 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>
2020-05-03 21:43:13 +01:00
Andreas Bolsch f6cf185564 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>
2020-05-03 21:42:46 +01:00
Tomas Vanek e888fe3987 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>
2020-05-03 21:42:23 +01:00
Antonio Borneo 8f2afaafe2 jtag: remove unused function adapter_driver_modules_load()
Commit c2cecc74b0 ("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
2020-05-02 15:41:21 +01:00
Antonio Borneo ebc2871005 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
2020-05-02 15:40:57 +01:00
Antonio Borneo 6572dd97b3 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
2020-05-02 15:40:21 +01:00
Andreas Fritiofson c60252ac2b 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>
2020-04-24 17:44:13 +01:00
Ilya Kharin bed0215573 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>
2020-04-24 17:43:30 +01:00
Leonard Crestez 38d205ecc5 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>
2020-04-24 17:40:07 +01:00
Kevin Burke 86cf8d9fb0 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>
2020-04-24 17:39:41 +01:00
Tomas Vanek ff9ee132e5 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>
2020-04-21 16:49:02 +01:00
Tomas Vanek 6e86ad6166 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>
2020-04-21 16:47:43 +01:00
Aurélien Martin 3c8aa12859 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>
2020-04-21 16:40:35 +01:00
Aurélien Martin 65d8fdf0d1 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>
2020-04-21 16:38:58 +01:00
Florian Fainelli 5c6e32612d 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 1fbe8450a9 ("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
2020-04-21 12:55:41 +01:00