Mete Balci [Sat, 30 Mar 2019 11:27:57 +0000 (12:27 +0100)]
target/aarch64: a64 disassembler
Add A64 (AArch64) Disassembler using Capstone framework.
Change-Id: Ia92b57001843b11a818af940a468b131e42a03fd Signed-off-by: Mete Balci <metebalci@gmail.com>
[Antonio Borneo: Rebased on current HEAD] Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5004 Tested-by: jenkins
Adrian Negreanu [Mon, 7 Sep 2020 19:36:10 +0000 (22:36 +0300)]
drivers/jlink: fix calculate_swo_prescaler formula
a) TPIU_ACPR is defined as:
SWO_baudrate = TRACECLKIN/(TPIU_ACPR +1)
b) TPIU_ACPR is set by armv7m_trace_tpiu_config()
target_write_u32(target, TPIU_ACPR, Prescaler-1), so
TPIU_ACPR = Prescaler-1
Replacing TPIU_ACPR in a), we get:
SWO_baudrate = TRACECLKIN/Prescaler, so
c) Prescaler = TRACECLKIN/SWO_baudrate
The Prescaler calculated by calculate_swo_prescaler() is greater by 1:
Prescaler = TRACECLKIN/SWO_baudrate + 1
The second problem is that even in situations when
an exact baudrate match is possible,
the resulting TRACECLKIN/Prescaler already has a 3% deviation.
For example, TRACECLKIN=88000000, SWO_baudrate=500000,
calculate_swo_prescaler will return Prescaler=171.
The correct value should be Prescaler=176 (TPIU_ACPR=175).
Might be related to https://sourceforge.net/p/openocd/tickets/263/
Change-Id: Ib4d6df6e34685a9be4c2995cb500b2411c76e39b Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/5807 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tarek BOCHKATI [Tue, 2 Jun 2020 21:03:18 +0000 (22:03 +0100)]
GitHub: add workflow to provide an openocd snapshot binaries for win32
This change could be used within OpenOCD GitHub forks.
Once workflow actions are enabled in the GitHub project, this workflow
will be run automatically on each push into OpenOCD.
This workflow will provide a neutral build of openocd for win32, then
the package will be available for download in Actions section.
Note: the artifact will be deleted after 90 day (actual GitHub rules)
If the push is a tag, the generated package will be uploaded to release
pane under the corresponding release, and it will resides forever.
The built openocd enables libusb1, hidapi and libftdi adapters,
and could be extended to cover more adapters and Oses
PS: ./contrib/cross-build.sh updated to build libftdi from source like
libusb1 and hidapi.
Antonio Borneo [Mon, 17 Aug 2020 07:58:58 +0000 (09:58 +0200)]
target: avoid checking for non NULL pointer to free it
The function free() can be called with a NULL pointer as argument,
no need to check the argument before. If the pointer is NULL, no
operation is performed by free().
Remove the occurrences of pattern:
if (ptr)
free(ptr);
In target/openrisc/jsp_server.c, an error is logged if the ptr was
already NULL. This cannot happen since the pointer was already
referenced few lines before and openocd would have been already
SIGSEGV in that case, so remove the log.
Change-Id: I290a32e6d4deab167676af4ddc83523c830ae49e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5809 Tested-by: jenkins
Antonio Borneo [Mon, 17 Aug 2020 08:05:11 +0000 (10:05 +0200)]
jtag: avoid checking for non NULL pointer to free it
The function free() can be called with a NULL pointer as argument,
no need to check the argument before. If the pointer is NULL, no
operation is performed by free().
Remove the occurrences of pattern:
if (ptr)
free(ptr);
Change-Id: I2938e333bd1eac5218bd67aefb9d8f373da017a8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5810 Tested-by: jenkins
openrisc: Fix segv jsp due to free of unallocated data
The prompt pointer in the jtag serial port is never zero'd or allocated.
Completely remove it since there is not much use for it as the target
software will provide the actual prompt.
Antonio Borneo [Sat, 22 Aug 2020 23:43:21 +0000 (01:43 +0200)]
openocd: fix command's usage string
The usage string should contain only the command parameters.
OpenOCD will automatically prepend the command name to the usage
string while dumping the usage or help message.
Remove the repeated command name from the usage string.
Change-Id: If10a0f1c254aee302b9ca08958390b7f21cdb21b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5824 Tested-by: jenkins
Antonio Borneo [Sat, 22 Aug 2020 23:35:09 +0000 (01:35 +0200)]
jtag/aice: fix command's usage string
The usage string should contain only the command parameters.
OpenOCD will automatically prepend the command name to the usage
string while dumping the usage or help message.
Remove the repeated command name from the usage string.
Change-Id: Idbc301b34fab19e221131d232577c1629568e6ea Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5823 Tested-by: jenkins
Antonio Borneo [Sat, 22 Aug 2020 23:28:38 +0000 (01:28 +0200)]
target/arc: fix command's usage string
The usage string should contain only the command parameters.
OpenOCD will automatically prepend the command name to the usage
string while dumping the usage or help message.
Remove the repeated command name from the usage string.
Change-Id: I691094a6395acb0e4ea3bea2347ff38379002464 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5822 Tested-by: jenkins
Antonio Borneo [Tue, 18 Aug 2020 16:31:53 +0000 (18:31 +0200)]
jtag/aice: avoid abusing of int32_t type
In several cases the 'int' status value returned by libusb and by
aice internal functions is taken in a variable of type 'int32_t',
requiring an implicit (but trivial) cast.
This makes compulsory using 'PRId32' in the format strings that
print such 'int32_t' result and requires an additional implicit
conversion to return the 'int32_t' as 'int'.
Replace to type 'int' all the occurrences of 'int32_t result' and
fix accordingly the format strings.
Plus, all the size of aice commands are stored as int32_t const
variables with uppercase name, violating the coding style, and are
then passed as 'int' parameter to the read/write functions.
Replace the variables with C macros carrying an 'int' value.
While there, replace also a 'uint32_t' loop index with 'unsigned'
and fix the format string in the loop.
Change-Id: Ic57d58770f1af95f003b5a02fbcb7c926ec06fd1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5814 Tested-by: jenkins
Antonio Borneo [Sun, 16 Aug 2020 19:35:10 +0000 (21:35 +0200)]
openocd: avoid checking for non NULL pointer to free it
The function free() can be called with a NULL pointer as argument,
no need to check the argument before. If the pointer is NULL, no
operation is performed by free().
Remove the occurrences of pattern:
if (ptr)
free(ptr);
While there replace a sequence malloc(size)+memset(,0,size) with a
calloc(1,size).
Replace a pointer assignment to '0' with an assignment to NULL.
In server/*, an error is logged if the ptr was already NULL. This
cannot happen since the pointer was already referenced few lines
before and openocd would have been already SIGSEGV in that case,
so remove the log.
Change-Id: I10822029fe8390b59edff4070575bf7f754e44ac Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5808 Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com> Tested-by: jenkins
Antonio Borneo [Mon, 17 Aug 2020 08:08:35 +0000 (10:08 +0200)]
flash: avoid checking for non NULL pointer to free it
The function free() can be called with a NULL pointer as argument,
no need to check the argument before. If the pointer is NULL, no
operation is performed by free().
Remove the occurrences of pattern:
if (ptr)
free(ptr);
There are cases where the pointer is set to NULL after free(), but
then re-assigned within few lines. Drop the setting to NULL when
this is evident. Anyway, the compiler will remove the useless
assignment so no reason to be too much aggressive in this change.
Change-Id: I55b2ce7cbe201410016398933e34d33a4b66e30b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5811 Tested-by: jenkins
Antonio Borneo [Fri, 14 Aug 2020 08:54:32 +0000 (10:54 +0200)]
adi_v5: use macro DP_APSEL_MAX to allocate struct adiv5_ap
Commit 11019a824d02 ("adi_v5: enforce check on AP number value")
introduces the macro DP_APSEL_MAX and use it in place of hardcoded
magic numbers for the upper limit of AP selection value.
Use the macro also while defining the array of struct adiv5_ap in
struct adiv5_dap.
Change-Id: I88f53ceb710f92a48a8026a365709fbf2d9e6912 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5806 Tested-by: jenkins
Antonio Borneo [Sun, 27 Jan 2019 14:49:34 +0000 (15:49 +0100)]
hla_transport: split command registration per transport
All the HLA transports (hla_swd and hla_jtag) register the same
set of commands. Such commands are mainly aimed at handling JTAG
compatibility that is required for the transport hla_jtag only.
Split per transport the command registration and limit the
commands to only those required by the transport itself.
Replace the command "hla newtap" with the transport specific
"swd newdap" or "jtag newtap".
Deprecate the command "hla".
Change-Id: I79c78fa97b707482608516d3824151a4d07644c0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4877 Tested-by: jenkins
Antonio Borneo [Sat, 26 Jan 2019 15:19:55 +0000 (16:19 +0100)]
tcl/target: use command 'jtag newtap' to add a boundary scan TAP
A JTAG TAP for boundary scan should be added in the scan chain
through the command "jtag newtap".
In some TCL target script the boundary scan TAP is added through
the command "swj_newdap", command that is inappropriate in this
context because specific for arm adi-v5 SWJ-DP.
This situation was probably created to bypass the error with HLA
framework, caused by missing command "jtag newtap".
Add the command "jtag newtap" in HLA, by reusing the existing
code for command "hla newtap".
Fix the TCL target scripts to use the command "jtag newtap" for
the boundary scan TAPs.
The TCL script target/psoc6.cfg has no evident reference to HLA,
so the reason for using "swj_newdap" is less clear. Nevertheless
it uses the wrong command and, once HLA is fixed, there is no
reason to avoid fixing it too.
Change-Id: Ia92f8221430cf6f3d2c34294e22e5e18963bb88c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4873 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Samuel Obuch [Tue, 11 Aug 2020 15:37:01 +0000 (17:37 +0200)]
Fix debug prints when loading to flash
While loading to flash with debug level at least 3,
OpenOCD tries to print the whole loaded bitstream.
This will be very-very-slow due to implementation of
conversion from buffer to string.
* fix condition on selected debug level in jtag/core.c
* replace slow buf_to_str function from helper/binarybuffer.c
with faster but_to_hex_str function
Change-Id: I3dc01d5846941ca80736f2ed12e3a54114d2b6dd Signed-off-by: Samuel Obuch <sobuch@codasip.com>
Reviewed-on: http://openocd.zylin.com/5800 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Antonio Borneo [Thu, 23 Apr 2020 22:28:49 +0000 (00:28 +0200)]
log: handle LOG_*() before calling to log_init()
There are cases where LOG_*() functions are called before the logs
are initialized with log_init().
E.g. in transport_register() that is executed in gcc constructors,
thus called even before main().
With debug_level set to LOG_LVL_USER=-1 all the LOG_ERROR() get
dropped.
Properly initializing debug_level cause segmentation fault due to
log_output still not initialized.
Initialize debug_level to LOG_LVL_INFO so errors get printed.
Handle separately the case of log_output still NULL, meaning that
log_init() is not called yet.
Change-Id: I2ea32c87a4955fb44e79b38131c456e25dfbc327 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5602 Tested-by: jenkins
Christopher Head [Mon, 10 Aug 2020 18:09:02 +0000 (11:09 -0700)]
server/gdb_server: fix incorrect condition check
The warning message should be printed if the target is NOT halted, not
if it IS halted.
Change-Id: I0a38292a8a2e20e4a4a5ada92b475d551d4cbf38 Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5794 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Hellosun Wu [Tue, 29 Oct 2019 05:36:31 +0000 (13:36 +0800)]
tcl: Add support for NDS V5 target and xc7/Corvette-F1
The "Corvette-F1" is an Arduino-compatible evaluation platform,
which fully supports AndesCore. The board has FTDI FT2232 to
connected to FPGA's JTAG interface.
The "ADP-XC7KFF676" is a development and prototyping board that
provides capacity for evaluation of AndesCore processors.
It works with AICE in-circuit debugging tools.
This patch also include target/nds32v5.cfg to support AndesCore
N22/N25F and AndeShape Platform AE250.
Christopher Head [Fri, 17 Jul 2020 21:44:35 +0000 (14:44 -0700)]
src/flash/nor/virtual: handle null pointers
Either of protect and protect_check driver callbacks can be NULL. In
virtual_protect, reuse flash_driver_protect which checks for that case
and generates a nice error message and return code. In
virtual_protect_check, there is no corresponding flash_driver_*
function, so add the NULL check directly.
Change-Id: Ia63d85ede640a8382cf5cad0760f5d1ffe4d7cfe Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5782 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Christopher Head [Fri, 17 Jul 2020 18:17:52 +0000 (11:17 -0700)]
flash/nor/stm32f2x: clean up data types
Change-Id: I677bc4487fc2eff2c32e14ca2db5470fddaa63b5 Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5778 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Christopher Head [Fri, 17 Jul 2020 21:54:46 +0000 (14:54 -0700)]
src/flash/nor/stm32h7x: fix format strings
* use proper type codes
* add 0x in front of hex values
* remove some concatenated empty strings
Change-Id: I06a8344d0ed62de7a0f3e2dd8fba69b17eeb3626 Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5783 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Sat, 11 Jul 2020 14:37:28 +0000 (16:37 +0200)]
target: fix memory leaks on target_create() fail
There are failure cases of target_create() that are not checked.
Plus, in case of failure the memory allocated in not properly
released before returning error.
Check all the possible failure in target_create().
Change current_target only when target is successfully created.
Add the new target to all_targets list only when target is
successfully created.
Release all the allocated memory before quit on failure.
Use malloc() instead of calloc() for target->type, because the
struct will be fully populated with memcpy().
Change-Id: Ib6f91cbb50c28878e7c73dc070b17b8d7d4e902f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5776 Tested-by: jenkins
Antonio Borneo [Tue, 4 Jun 2019 10:06:44 +0000 (12:06 +0200)]
gdb_server: refuse gdb connection if target is not examined
If the target is not examined, many internal data required for the
gdb connections are not ready nor allocated. This causes OpenOCD
to hit a segmentation fault.
After the execution of the gdb-attach event handler, check if
target has been examined and eventually return error to refuse the
gdb connection.
Plus, since OpenOCD does not implements non-stop mode yet, gdb
expects the target to be halted by the inferior when the
connection is established.
Print a warning to inform the user in case the target is not
halted, but still accept the gdb connection to permit the
non-intrusive memory inspection with gdb, as explained in
http://openocd.org/doc/html/GDB-and-OpenOCD.html#gdbmeminspect
Change-Id: If727d68f683c3a94e4826e8c62977de41274ceff Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5201 Tested-by: jenkins
As the comment states, the 'init' command is issued before the
command 'dap apsel', otherwise it fails.
This dependency has been already fixed in commit e48690cb26e4
("target/arm_adi_v5: allow commands apsel and apcsw during init
phase"), so the command 'dap apsel' can now be issued directly.
Remove both the unneeded 'init' command and the comment that
documents and justify its presence.
Change-Id: I50f0a820fa7ead6f5a3bd9cc5180d521070822c9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5786 Tested-by: jenkins
Antonio Borneo [Tue, 19 May 2020 14:41:17 +0000 (16:41 +0200)]
target: use one second timeout while halting target at gdb attach
By default GDB timeouts after 2 seconds, even if this value can be
modified with GDB command "set remotetimeout".
On OpenOCD side, the default event for GDB attach is to halt the
target and wait it to halt. But here the default timeout of the
halt command is 5 seconds!
If the target cannot be halted (e.g. it's kept in reset by another
core or the debugger doesn't have enough privileges) then GDB will
timeout while OpenOCD is still waiting and is unable to
communicate with GDB.
Decrease the halt timeout to 1 second in the default GDB attach
event handler.
Change-Id: I231c740816bb6a0d74b0bc679a368a6cbfb34824 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5687 Tested-by: jenkins
jtag/drivers: add support for Nu-Link (Nuvoton ICE) over usb
Add support for Nu-Link1 over usb hidapi and config file.
The original work is fetched from Nuvoton github.
Code cleanup, fix merge conflicts, compile and runtime issues.
Switch the code from libusb to hidapi, being the device HID based.
Add documentation.
Merge fixes for multi-word memory read.
Reset is not fully compatible with openocd framework; currently
the target is reset and then halt at openocd start.
cmsis_dap_usb: Support for Microchip's nEDBG CMSIS-DAP interface
This commit fixes support for the nEDBG CMSIS-DAP interface
which is used ie. on the Curiosity Nano SAMD21 board.
nEDBG, similarily to mEDBG, does not support 512 byte HID packets.
This patch adds its USB PID to the exclusion list to make sure that
we stick with the default 64 bytes.
Change-Id: I9010b0cf77c0b1347269a759b5d16ee5155abb16 Signed-off-by: Michal Potrzebicz <michal@elevendroids.com>
Reviewed-on: http://openocd.zylin.com/5756 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Sat, 11 Jul 2020 22:00:47 +0000 (00:00 +0200)]
flash: fix typos and duplicated words
Fix typos and duplicated words in comments and strings.
Change-Id: I64282c7018462deefeeb8e5f4d0d81942425b3fc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5758 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Christopher Head <chead@zaber.com>
Antonio Borneo [Mon, 25 May 2020 09:19:07 +0000 (11:19 +0200)]
target/arm720t: fix memory leak of register cache
There is no method to free the register cache, allocated in
arm720t_init_target().
Issue identified by tracking all calls to arm7tdmi_init_target().
Implement the method arm720t_deinit_target() by calling directly
arm7tdmi_deinit_target().
NOT TESTED on a real arm720t target.
Tested on a arm926ejs (SPEAr320) by hacking the target type and
pretending it is a xscale:
sed -i s/arm926ejs/arm720t/ tcl/target/spear3xx.cfg
Change-Id: I53c1f46c1a355a710e8df01468b19220671569dc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5697 Tested-by: jenkins
Antonio Borneo [Mon, 25 May 2020 08:58:40 +0000 (10:58 +0200)]
target/arm7tdmi: fix memory leak of register cache
There is no method to free the register cache, allocated in
arm7tdmi_init_target(), so we get a memory leak.
Issue identified by tracking all calls to arm_build_reg_cache().
Implement the method arm7tdmi_deinit_target() that in turn calls
arm7tdmi_free_reg_cache().
NOT TESTED on a real arm7tdmi target.
Tested on a arm926ejs (SPEAr320) by hacking the target type and
pretending it is a arm7tdmi:
sed -i s/arm926ejs/arm7tdmi/ tcl/target/spear3xx.cfg
Change-Id: Iad465b708eb4ebb298725d7155fea76357e9045c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5696 Tested-by: jenkins
Antonio Borneo [Mon, 25 May 2020 08:43:53 +0000 (10:43 +0200)]
target/xscale: fix memory leak of register cache
There is no method to free the register cache, allocated in
xscale_build_reg_cache(), so we get a memory leak.
Issue identified by tracking all calls to arm_build_reg_cache().
Implement the method xscale_deinit_target() that in turn calls the
new xscale_free_reg_cache().
Fix leak of struct xscale.
NOT TESTED on a real xscale target.
Tested on a arm926ejs (SPEAr320) by hacking the target type and
pretending it is a xscale:
sed -i s/arm926ejs/xscale/ tcl/target/spear3xx.cfg
Change-Id: Ibb2104c42411b76f4bb77c2fa387d1b85a3d2d5d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5695 Tested-by: jenkins
Antonio Borneo [Mon, 25 May 2020 09:28:22 +0000 (11:28 +0200)]
target: fix memory leaks on targets based on arm9tdmi
Similarly to the fix for arm926ejs (also base on arm9tdmi), fix
the other targets based on arm9tdmi.
The fix for arm926ejs is tested on SPEAr320 target.
This fix is proposed separately because is not tested on a correct
target device, but tested on SPEAr320 by hacking the target type
and pretending it is the correct one, e.g.:
sed -i s/arm926ejs/arm920t/ tcl/target/spear3xx.cfg
The memory leaks detected and fixed are:
- arm register cache;
- EmbeddedICE register cache;
- arm_jtag_reset_callback internal data;
- struct <target_type>_common.
Change-Id: I565f9a5bf144a9df78474434d86a64127ef0fbe5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5699 Tested-by: jenkins
Christopher Head [Fri, 17 Jul 2020 18:37:59 +0000 (11:37 -0700)]
src/flash/nor/stm32f2x: fix format strings
* use proper type codes
* add 0x in front of hex values
* remove some concatenated empty strings
Change-Id: I77e8dd161887f02ecf8019b43d3e8e7cc122ad0e Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5780 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Christopher Head [Fri, 17 Jul 2020 18:04:50 +0000 (11:04 -0700)]
doc/target/mips: fix grammar
Change-Id: Ib9012a1cfccbe4f69682d106688536c4d92392dd Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5777 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
Evgeniy Didin [Fri, 10 Jul 2020 11:52:35 +0000 (14:52 +0300)]
target/arc: Introduce Actionpoints support
Actionpoint mechanism allows to setup HW breakpoints and watchpoints on Synopsys ARC CPUs.
This mechanism is controlled by DEBUG register and by a set of auxilary registers.
Each actionpoint is controlled by 3 aux registers: Actionpoint(AP) match mask(AP_AMM),
AP match value(AP_AMV) and AP control(AC).
Note: some fields of actionpoint_t structure will be used in further
support of watchpoints.
Change-Id: I4efb24675f247cc19d9122501c9e63c3126fcab4 Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-on: http://openocd.zylin.com/5763 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Hellosun Wu [Mon, 3 Feb 2020 02:47:02 +0000 (10:47 +0800)]
spi: add MX25U1635E flash
* Macronix 16 MBit SPI flash
* https://www.macronix.com/en-us/products/NOR-Flash/Serial-NOR-Flash/Pages/spec.aspx?p=MX25R1635F&m=Serial%20NOR%20Flash&n=PM2161
* used e.g. on Andestech ADP-XC7KFF676
Change-Id: Ida701cf3832e3302aa29b4dded1c390c5ff8c482 Signed-off-by: Hellosun Wu <wujiheng.tw@gmail.com>
Reviewed-on: http://openocd.zylin.com/5428 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Antonio Borneo [Mon, 29 Jun 2020 21:58:09 +0000 (23:58 +0200)]
cmsis-dap: fix USB interface for NXP LPC-Link2
The adapter NXP LPC-Link2 is a USB composite device that provides
five interfaces; among three of them that are of HID class, only
one is cmsis-dap.
Accordingly to ticket 255, OpenOCD code is not opening the right
HID interface; then it fails to communicate with the cmsis-dap
while checking the adapter's info.
Unfortunately, hidapi does not provide any support for reading the
string descriptor of the interface, otherwise it would have been
trivial to look for the right cmsis-dap interface.
In fact the cmsis-dap specification reports:
The CMSIS-DAP Firmware can be also part of a USB composite
device. If this case, the HID Interface String must
contain the sub-string CMSIS-DAP.
This requirement is satisfied by the USB device descriptor of the
LPC-Link2 reported below, but cannot be used.
Add a quirk to let OpenOCD only accept interface number zero on a
LPC-Link2 device.
Bus 001 Device 050: ID 1fc9:0090 NXP Semiconductors
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x1fc9 NXP Semiconductors
idProduct 0x0090
bcdDevice 1.00
iManufacturer 1 NXP Semiconductors
iProduct 2 LPC-LINK2 CMSIS-DAP V5.224
iSerial 3 I3F4AABA
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x00ab
bNumInterfaces 5
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 4 LPC-LINK2 CMSIS-DAP V5.224
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 35
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 4
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 4
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 4
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 7 LPC-LINK2 DATA PORT
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 35
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 1
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 1
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 0
iFunction 5 VCOM
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 0
iInterface 5 VCOM
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x01
call management
bDataInterface 2
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 1
bSlaveInterface 2
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 4
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 5 VCOM
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 6 LPCSIO
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 33
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 2
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 2
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)
Change-Id: Ib3d46f87743a2d35a266842cb356035d898d466e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Suggested-by: Masatoshi Tateishi <tateishim3@gmail.com> Reported-by: Donald Bailey <donaldb@users.sourceforge.net> Fixes: https://sourceforge.net/p/openocd/tickets/255/
Reviewed-on: http://openocd.zylin.com/5732 Tested-by: jenkins
Antonio Borneo [Mon, 29 Jun 2020 21:22:37 +0000 (23:22 +0200)]
cmsis-dap: prevent hidapi to search again for the adapter
The code in cmsis_dap_usb_open() already searches for the right
HID device that corresponds to the adapter. By calling hid_open()
it asks hidapi to re-search the adapter again based on the VID:PID
and the serial string of the adapter it has just found!
Apart from being a run-time overhead, this has an additional
drawback; there are USB adapters built as composite USB devices
that, beside the cmsis-dap HID interface, have other HID
interfaces for other purposes.
A typical example is the NXP LPC-Link2, that over the 5 interfaces
0) cmsis-dap (HID)
1) VCOM-CDC
2) VCOM-CDC
3) LPCSIO (HID)
4) LPC-LINK2 DATA PORT (HID)
has 3 of them of HID class.
The code in cmsis_dap_usb_open() could select the right interface
but then cannot propagate this information to hid_open().
Replace the call to hid_open() with hid_open_path(), passing as
parameter the "unique" path of the HID device already found.
Checking in hidapi source code, the implementation of hid_open()
consists in enumerating the HID devices, scan for the first one
matching VID:PID and serial number, and opening it by calling
hid_open_path(). This analysis highlights that using directly
hid_open_path() should not introduce any regression.
While applying these changes, move hid_init() before enumerating
the HID devices. This has no real consequences because the HID API
is marked as optional but, logically, it should be called before
any other HID API.
Antonio Borneo [Sun, 29 Mar 2020 14:08:50 +0000 (16:08 +0200)]
jtag/drivers: add linuxgpiod driver
New adapter driver for GPIO bitbanging over Linux GPIO descriptors
through the library libgpiod.
On Debian based distribution, the package libgpiod-dev is required
for build.
Change-Id: I1ce1a4f1ca79096d6d476b01b523c8c10f2cac07 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5559 Tested-by: jenkins
Antonio Borneo [Wed, 1 Apr 2020 09:37:54 +0000 (11:37 +0200)]
sysfsgpio: enable only the transport specific gpio
If the configuration file specifies both SWD and JTAG gpios, the
current code request all of them. In case of overlap a warning is
generated when the same gpio is released for the second time.
Require and release only the gpio needed by the specified
transport.
Change-Id: I41a0970980ceeb559afa98ab34cfe93dffed2e1c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5556 Tested-by: jenkins
Antonio Borneo [Wed, 1 Apr 2020 09:00:39 +0000 (11:00 +0200)]
bitbang: split jtag and swd operations
The split in OpenOCD between SWD and JTAG has been already fully
implemented. The bitbang driver still keeps a single API write()
to drive the output lines.
Introduce a new SWD specific API swd_write().
Move the existing SWD bitbang drivers to the new API by extracting
the available conditional implementation.
Cleanup some function prototype.
Remove the now unused global swd_mode, handled implicitly.
Rename bitbang_exchange() as bitbang_swd_exchange() to track its
scope for SWD only.
Change-Id: Ie53080b941cb1ac7a34a1f80bad8bee4e304454d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5555 Tested-by: jenkins
Antonio Borneo [Wed, 1 Apr 2020 07:39:40 +0000 (09:39 +0200)]
bitbang: remove superfluous switch between jtag and swd
The SWD framework already takes care of switching between JTAG and
SWD by calling driver's switch_seq() in swd_connect() and in
swd_quit(); there is no need for the driver to force the switch
again.
Remove the extra switch between jtag and swd.
Change-Id: I84de4bffb593374b96fce31951c6cc83f92d2578 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5554 Tested-by: jenkins
Tomas Vanek [Thu, 2 Jul 2020 08:50:15 +0000 (10:50 +0200)]
flash/nor/kinetis: fix FCF handling
Kinetis Flash Configuration Field needs special handling to prevent unwanted
locking of the device. Warn user about any difference between generated
FCF and FCF data in the programmed file. Inform user that re-programming
of already programmed FCF may fail on devices with FTFE flash module.
While on it remove useless setting of is_erased flag after erase.
Tomas Vanek [Thu, 2 Jul 2020 07:33:57 +0000 (09:33 +0200)]
flash/nor/kinetis: use target_get_working_area_avail()
Since e22c6484eaedd56d71 the trial/error allocation shows
"not enough working area available(requested 2048)" message
on klx.cfg. The message is not clear if it means a problem or not.
Replace with new style allocation using target_get_working_area_avail()
Change-Id: I87fe1e38248fcac29982b72aaba12217a0552f38 Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5752 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Antonio Borneo [Fri, 27 Sep 2019 11:17:15 +0000 (13:17 +0200)]
gdb_server: suggest user to prefer GDB extended mode
In case of GDB connection not using extended mode, issue a warning
message to suggest the user to switch using the extended mode.
Issue the message only once at each run of OpenOCD, to avoid too
much noise.
Update the documentation to suggest using extended mode.
Change-Id: I9326e84f748d5d7912d5a48f00f0fb541ca19221 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5311 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au>
This patch also fixes an incorrect function prototype in zy1000.c.
ZY1000 minidriver implementation overrides the function
arm11_run_instr_data_to_core_noack_inner(), but the prototype is
not the same as in src/target/arm11_dbgtap.c and to avoid compile
error it was changed also the prototype of the called function
arm11_run_instr_data_to_core_noack_inner_default().
Change-Id: I476cda8cdb0e1e280795b3b43ca95c40d09e4a3d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5630 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Antonio Borneo [Mon, 6 May 2019 16:16:17 +0000 (18:16 +0200)]
coding style: fix space separation
The checkpatch script from Linux kernel v5.1 complains about using
space before comma, before semicolon and between function name and
open parenthesis.
Fix them!