Florian Fainelli [Tue, 11 Jun 2019 18:55:23 +0000 (11:55 -0700)]
target/cortex_a: Extract code to read/write from/to register to/from DCC
In preparation for supporting the ARM MCRR and MRRC commands which will
require using two 32-bit registers to read/write a 64-bit internal
register, extract the common logic to read/write from/to a register
to/from DCC and make that parameterized such that we can do this through
not just r0.
gdb_server: Support vRun packet, allow setting cmdline from GDB
GDB uses the vRun packet if available to restart a running process in
extended remote mode. Support this like the R packet and set the
semihosting command-line to allow it to be specified from GDB.
Change-Id: I9cb812b22170630f782113c9927e46e0cd5b1f0f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/5186 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Antonio Borneo [Sat, 27 Apr 2019 13:52:52 +0000 (15:52 +0200)]
target/cortex_a: use aligned accesses for read/write cpu memory slow
Armv7a is able to read and write memory at un-aligned address, but
only when bit SCTLR.A (Alignment check enable) is zero and the
address belongs to a memory space with attribute "Normal" (see [1]
chapter A3.2.1 "Unaligned data access"). In all the other cases
the memory access will trigger an alignment fault data abort
exception.
Memory attributes are explained in [1] chapter A3.5 "Memory types
and attributes and the memory order model".
Disabling the MMU cause a change in memory attribute, as explained
in [1] chapter B3.2 "The effects of disabling MMUs on VMSA
behavior".
This can cause several issues. e.g. a SW breakpoint on un-aligned
4-byte Thumb instruction, set when MMU is on, can be impossible to
remove when MMU turns off.
While is possible to check all the possible conditions before an
un-aligned memory access, it's clearly more maintainable to skip
such complexity and only perform aligned accesses.
Check the alignment and eventually modify the data size before
calling the functions cortex_a_{read,write}_cpu_memory_slow().
Change the comment in the two functions above to comply with the
new behaviour.
[1] ARM DDI 0406C.d - "ARM Architecture Reference Manual, ARMv7-A
and ARMv7-R edition"
Bohdan Tymkiv [Tue, 26 Feb 2019 09:45:40 +0000 (11:45 +0200)]
adi_v5_jtag: avoid RAM exhaustion by limiting jtag queue size
Issue has been found when I tried to read 64 MiB QSPI flash bank.
Bank is memory mapped, default_flash_read() is used for 'flash read_bank'
command. OpenOCD consumed as much as 6.8 GiB of RAM during this
process. Investigation showed that this happens because JTAG queue
is not limited in any way. OpenOCD queues 16 millions of AP reads
allocating all corresponding data structures.
Most of this memory is allocated in:
cmd_queue_alloc (commands.c) - 4.2 GiB
dap_cmd_new (adi_v5_jtag.c) - 2.25GiB
This patch implements a pool of "struct dap_cmd" objects using
linked list. Objects are taken from a pool in "dap_cmd_new()" and
returned to the pool when they are not needed. Size of the pool
is limited to 64K of objects, JTAG queue is forcibly executed
when this limit is reached.
Checked with Valgrind and Clang analyzer - no new warnings.
Make driver_priv point directly into the corresponding chip bank structure
and add a pointer to it to get back to its chip when it's needed. This
removes the need to keep track of any bank number, either global or chip-
local.
In addition, it simplifies the cases where the chip structure was just used
to access the chip bank fields; now they are directly accessible.
Change-Id: Iaa353cd4fa7d8ff94c2ef69028c7cb32fade0420 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/4775 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
target: Switch to target_read_buffer() in verify_image fallback
The current code checks the count to determine whether to read bytes or
words. However it fails to consider whether the base address is suitably
aligned.
Instead use the target_read_buffer() function which is for exactly this
purpose and generates optimal accesses with natural alignment.
Change-Id: I32ab5417890ee2219902df1529bc220fe353b4c7 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/3217 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/flash/startup.tcl: Add preverify to program command
The preverify option allows to check whether flashing is necessary.
If the target is flashed often/automatically this can save time and
preserve the flash. This is expecially helpful in CI environments.
Change-Id: Iead0a269e1a772b751d4dd9e8b53b2fecc874624 Signed-off-by: Moritz 'Morty' Strübe <moritz.struebe@redheads.de>
Reviewed-on: http://openocd.zylin.com/5292 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tim Newsome [Wed, 14 Nov 2018 19:55:09 +0000 (11:55 -0800)]
Add wall clock timeout warning to mpsse_flush()
I think that libusb_handle_events_timeout_completed is supposed to make
progress or time out, but sometimes we hit a case where it makes no
progress, and mpsse_flush() loops forever. This wall clock timeout
notifies the user that this is going on.
When I wrote this code, this bug would reproduce every hour or two, but
right now it's not happening for me.
Change-Id: I7eb66f43462298e263a48048aa0c8769095661eb Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: http://openocd.zylin.com/4767 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Fix expression "(pin_status | 0x4)" which was always true rather than
testing a bit. Untested - was clearly not expressing the intent of the
author by inspection. Found by automated tooling and rtrieu@google.com.
Signed-off-by: Seth LaForge <sethml@google.com>
Change-Id: I4bb91e60e8ce9757bf21976cc48de6f85a39c68d
Reviewed-on: http://openocd.zylin.com/5301 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
The C standard says that errno is set to ERANGE if an out-of-range value
is returned by strtol, strtoul, et. al., but it does not say that errno
is cleared if the function is successful (and, indeed, it is not on
glibc). This means that, if errno is ERANGE before strtol is called, and
if the value to be converted is exactly the maximum (or, for a signed
conversion, the minimum) legal value, COMMAND_PARSE_NUMBER will
erroneously indicate that the value is out of range.
Change-Id: I8a8b50a815b408a38235968f1c1d70297ea1a6aa Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5298 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Han Hartgers [Mon, 17 Jun 2019 18:39:31 +0000 (20:39 +0200)]
target/dsp563xx: dsp563xx restore reg support
Added "exist=true" field to the reg_list struct to make access to the
dsp563xx registers again possible. Without it defaults to exist=false
and all the reg related functions will return nothing.
Seth LaForge [Mon, 19 Aug 2019 17:40:07 +0000 (10:40 -0700)]
src/flash/nand: Fix some operator precedence bugs.
Fix two expressions where precedence of operator | vs ?: was clearly confused.
Untested - was clearly not expressing the intent of the author by inspection.
Found by automated tooling and rtrieu@google.com.
1. Add get_thread_reg() to rtos. It's used in rtos_get_gdb_reg() to read
the value of a single register, instead of reading all register values
by calling get_thread_reg_list().
2. Add set_reg() to rtos. gdb_server uses this to change a single
register value for a specific thread.
3. Add target_get_gdb_reg_list_noread() so it's possible for gdb to get
a list of registers without attempting to read their contents.
The clang static checker doesn't find any new problems with this change.
This is causing repeated build failures. Its design is so fundamentally
broken that if someone actually wants to use it, a full rewrite is the
only option. So it's not even worth deprecating in the hope that someone
will notice and fix it, just get rid of it.
Change-Id: I513069919a3873bd69253110f7fb6f622ee7d061 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/5243 Tested-by: jenkins Reviewed-by: Jeffrey Booher-Kaeding <Jeff.Booher-Kaeding@arm.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Antonio Borneo [Sat, 2 Mar 2019 23:22:37 +0000 (00:22 +0100)]
cortex_m: set C_DEBUGEN in 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.
Without a better replacement of the command, it's worth fixing it.
Accordingly to ARM DDI 0403E.d, chapter C1.4.1 "Entering Debug
state on leaving reset state", to halt the core at reset both bits
DHCSR.C_DEBUGEN and DEMCR.VC_CORERESET must be set.
Current code only sets the latter bit, relying on having C_DEBUGEN
already set through other commands, e.g. "halt". This prevents the
command "soft_reset_halt" to work if issued as very first command.
Set the bit C_DEBUGEN in command "soft_reset_halt".
Change-Id: I66bfd6a0da1fca5049dea037b4d258cf6f842966 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4987 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
The `command_run_line` function contains a comment saying it should be
reentrant. However, it isn’t: it NULLs out `current_target_override` and
doesn’t restore it before returning, and it changes the `context`
associated data of the `interp` object and then deletes that associated
data before returning rather than restoring it to its previous value.
Change-Id: I84fd46ef7173f08cf7c57b9a5b76e4986a60816f Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5223 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Omair Javaid [Sat, 30 Mar 2019 20:35:43 +0000 (01:35 +0500)]
Configs for ARM corelink SSE-200 target and Musca A board
This patch adds configuration files for ARM CoreLink SSE-200 SoCs. Also
adds configuration file for SSE-200 based Musca A board. Flash programming
support for Musca A QSPI flash is still not functional. This configuration
will be updated once that support lands into OpenOCD.
Please refer to ARM documentation for more information about SSE-200 and
Musca A.
Antonio Borneo [Mon, 3 Jun 2019 13:30:41 +0000 (15:30 +0200)]
jtag: fix error on TCL command "return" in jtag event handler
The TCL command "return" always returns error code JIM_RETURN, to
indicate that the effective error code and message are elsewhere.
In the current implementation, the caller of jtag's event only
checks for return code JIM_OK and considers any other value,
including JIM_RETURN, as an error condition.
It can be tested running openocd on a jtag target and adding a
jtag event "setup" with a single line "return", e.g.
openocd -f board/ti_cc3200_launchxl.cfg \
-c 'jtag configure cc32xx.cpu -event setup return'
to get the message:
../src/jtag/core.c:1599: Error:
in procedure 'jtag_init' called at file "../src/jtag/core.c",
line 1599
Modify jtag_tap_handle_event() to detect the specific return value
of the "return" command and to test the real error code that is,
eventually, specified to the TCL "return" command.
Change-Id: I6d6febc15ef169638afffbffc1810e0b84fcf5c8 Reported-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5199 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Tue, 26 Feb 2019 08:57:14 +0000 (09:57 +0100)]
target: fix error on TCL command "return" in target event handler
The TCL command "return" always returns error code JIM_RETURN, to
indicate that the effective error code and message are elsewhere.
In the current implementation, the caller of target's event only
checks for return code JIM_OK and considers any other value,
including JIM_RETURN, as an error condition, thus dumping the
call-trace. The execution is not stopped because the error is not
further propagated, but the error message is annoying and
misleading.
It can be tested running
openocd -f ./test.cfg
using the following script "test.cfg". You can replace the board
file in line 1, to use a board available in your lab:
1 source [find board/st_nucleo_f4.cfg]
2 [target current] configure -event reset-start {}
3 [target current] configure -event reset-end {return}
4 init
5 proc a {} {[target current] invoke-event reset-start}
6 proc b {} {[target current] invoke-event reset-end}
7 proc c {} {a;b;echo "arrived at the end"}
8 c
9 shutdown
The execution produces:
./test.cfg:7: Error:
in procedure 'c' called at file "./test.cfg", line 8
in procedure 'b' called at file "./test.cfg", line 7
arrived at the end
that shows the call-trace but does not halt the execution.
The developer can avoid using the "return" command in the event
body by defining a TCL procedure that implements the handler and
that contains the "return" command, reducing the handler body to
a simple call to the procedure above. But this approach is either
not documented nor always intuitive while writing the handler,
causing waste of time to look for the false error.
Modify target_handle_event() to detect the specific return value
of the "return" command and to test the real error code that is,
eventually, specified to the TCL "return" command.
Change-Id: I2b860bab7233c6ed13ee4098e348d7533e1c4626 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4974 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Commit c2e18bfaeafd changed the size of the JTAG-to-SWD sequence
from 15 bytes to 17 bytes. This broke SWD switch sequence transfer
for buspirate, since buspirate packets can only hold a payload of up
to 16 bytes and we tried to fit the whole sequence in a single packet.
Splitting up the sequence transfer in appropriately sized packets
makes buspirate SWD work again (successfully tested with buspirate
firmwares v6.1 and v7.0).
Change-Id: Ib5b412b9e77287d705d2762e31c16d30318b50e3 Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
Reviewed-on: http://openocd.zylin.com/5200 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: If1f56fd5d610b993a4ecbc900fac9f90638037c9 Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5202 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tomas Vanek [Fri, 26 Apr 2019 06:44:38 +0000 (08:44 +0200)]
target: make target re-configuration possible again
Before commit 877cec20dca6e78f9f029f0f173879cda101a6c2
("command: check command mode for native jim commands") all the jim commands
were erroneously treated as they had mode COMMAND_ANY.
The command '$_TARGET configure -xxx' was therefore applicable on running
OpenOCD to change the target configuration. It is handy e.g. for changing
an event handler or changes of the work area.
Change 'configure' command .mode to COMMAND_ANY to make it possible again.
The only parameter which cannot be re-configured after init is -gdb-port.
Test the command mode and refuse setting of gdb port after init.
Change-Id: I88493ac10a46647dc52a88fbc9f8ce6b5ba3bcd0 Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5214 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Antonio Borneo [Fri, 15 Mar 2019 22:20:55 +0000 (23:20 +0100)]
mem_ap: fix format of logged addresses
The macro TARGET_ADDR_FMT, defined in helper/types.h, already
includes the prefix "0x" in front of the hexadecimal number,
being defined as:
#define TARGET_ADDR_FMT "0x%8.8" TARGET_PRIxADDR
An additional "0x" is present in mem_ap; it prints debug messages
with a double "0x" before the address:
Debug: 2921 34180 mem_ap.c:153 mem_ap_write_memory():
Writing memory at physical address 0x0x5000000c; size 4;
count 1
Florian Fainelli [Tue, 19 Mar 2019 17:36:39 +0000 (10:36 -0700)]
armv7a_mmu: Add support for decoding Super Sections
The ARMv7-A architecture supports super sections which allows mapping
physical addresses up to 40-bit into a 32-bit virtual address using the
short descriptor format (see ARM DDI 0406C.c section B4.1.112 for
details).
Florian Fainelli [Tue, 19 Mar 2019 16:50:41 +0000 (09:50 -0700)]
armv7a_mmu: Do not restrict virtual addresses to uint32_t
In preparation for adding super section decoding, do not restrict
armv7a_mmu_translate_va_pa() to 32-bit virtual addresses since ARMv7-A
processors with VMSA extensions (including LPAE) can issue wider
physical addresses. Update casting to uint32_t where necessary.
This function is not used anywhere in the tree, remove it, such that we
only have a single function moving forward that might need to deal with
short vs. long format specifics.
Tomas Vanek [Tue, 4 Jun 2019 23:09:15 +0000 (01:09 +0200)]
target/armv7m: fix register number in armv7m_get_core_reg()
armv7m_get_core_reg() calls arm->read_core_reg()
arm->read_core_reg() expects the register number as an index
to core reglist, not an ARMv7M specific register code.
Use reg->number instead of armv7m_reg->num.
The change solves assert
src/target/armv7m.c:222: armv7m_read_core_reg: Assertion
`num < (int)armv7m->arm.core_cache->num_regs' failed.
when gdb 'info reg' is issued on a Cortex-M target and
no cortex_m_debug_entry() has been called since OpenOCD start
(target was halted before OpenOCD start).
Change-Id: I32a2294693ef979b613be93aeceb3b0eb06ee6df
Ticket: https://sourceforge.net/p/openocd/tickets/216/ Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5203 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Antonio Borneo [Wed, 13 Feb 2019 17:28:50 +0000 (18:28 +0100)]
gdb_server: remove call to jtag_execute_queue()
In the initial commit 6c9b804d6187edda4f46f8458deec0b17ec76bb9
in 2007's svn://svn.berlios.de/openocd/trunk@246
a target script gdb_program_config was called before gdb flash
programming. To guarantee the script does not left any pending
command in the jtag queue, a call to jtag_execute_queue() was
inserted after the execution of the script.
In following commit ef1cfb23947bd32798077c6abb5c25a049460ae9
in 2008's svn://svn.berlios.de/openocd/trunk@975
the script was replaced by the event "old-gdb_program_config" and
the call to jtag_execute_queue() get executed in every case, even
if the event handler was not present.
At last, commit bb3793c9a4ccd232c4ee3ce0a36bf200589ca0bb
("target: remove legacy target events") stripped away the
obsolete event but left the call to jtag_execute_queue(), now
completely useless.
Remove the call to jtag_execute_queue() and clean-up the code
around it.
Change-Id: I284f54d656d431ad6cdc25ca18218c09db31bd25 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4911 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Wed, 13 Feb 2019 16:15:58 +0000 (17:15 +0100)]
target/cortex_m: remove dependency from jtag queue
Since the first commit 09883194f867 that introduced cortex_m, the
code has a delay of 50ms after srst has been asserted.
The specific delay is implemented through the JTAG_SLEEP command
sent in the jtag queue.
To remove the dependency from the jtag queue, replace the delay
with a transport independent function.
In case of jtag transport, this change keeps the same behaviour
only if the jtag queue has been flushed before the delay. This
does not happen if the call to dap_dp_init(), few lines above,
fails while calling a dap_queue_dp_{read,write}(); in this case
the jtag queue will be flushed later, after the delay, while in
the original code the delay would follow the flushing of the
commands already queued. Anyway, this different behavior would
only happen in case of DAP already not responsive so anticipating
the delay in such error condition is not supposed to add further
problems.
Change-Id: If15978246764e4266b10e707d86c03e5ed907de7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4912 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Wed, 11 Jul 2018 08:21:04 +0000 (10:21 +0200)]
jtag: simplify management of non-implemented handlers
There is just a single entry point for the jtag API .khz(),
.speed_div(), .power_dropout(), .srst_asserted().
Simplify the code by in-lining the default handler.
The overall code behaviour is not changed.
This change prevents modifying at run-time the content of
struct jtag_interface.
Inspired from change http://openocd.zylin.com/943
by Evan Hunter <ehunter@broadcom.com>
Change-Id: I09aeb76d614db57b1884ac7ee9f00c152cd77849 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4892 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Mon, 6 Aug 2018 15:31:36 +0000 (17:31 +0200)]
swd: remove unused API frequency()
The specific SWD API to change/query the adapter speed is never
called because the equivalent JTAG API is used in place of it.
In the restructure of struct jtag_interface, the JTAG API is
promoted as global adapter API, thus a specific SWD one is not
anymore required.
Change-Id: I1e810d255b4dfcd5791b4fac8ae1260c31a057fd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4891 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
gdb_server: fix GDB_BUFFER_SIZE usage, fix unaligned access during bulk transfers
Currently size of the GDB buffer is 16384 bytes but it is treated as
nul-terminated string in most of the code, so effective size of the
buffer is actually 16383 bytes. OpenOCD responds with `PacketSize=3fff`
to qSupported request. Result of GDB's `m` command is encoded in hex so
each data byte uses two bytes in the buffer. As a result GDB will split
bulk read requests into chunks 0x1fff bytes each. This causes troubles
on targets (or memory regions) which support only aligned, word-sized
access (such as MMIO buffers).
OpenOCD:
Error: Failed to read memory at 0x40321ffe
Error: Failed to read memory at 0x40321000
Error: Failed to read memory at 0x40323000
Error: Failed to read memory at 0x40325ffe
Error: Failed to read memory at 0x40329ffa
Error: Failed to read memory at 0x40329ffc
Error: Failed to read memory at 0x4032bffc
Error: Failed to read memory at 0x4032dffa
Consolidate GDB_BUFFER_SIZE usage: ensure size of each buffer is
(GDB_BUFFER_SIZE + 1), add explicit comment that additional byte is used
for nul-termination. Report correct size of the buffer to GDB (0x4000)
as recommended in GDB's docummentation: `if the stub stores packets in a
NUL-terminated format, it should allow an extra byte in its buffer for
the NUL`
Checked with clang-asan, clang-analyzer, valgrind - no new errors.
Antonio Borneo [Sun, 7 Apr 2019 10:18:05 +0000 (12:18 +0200)]
helper/command: remove dead code in command_unknown()
Commit 89fa493a3bc34d22eeca06fa4e78523ac3b766a8 removes the top
level command "unknown" and adds in command_unknown() some unclear
code that should detect a user-implemented "unknown" command.
But, all the commands that trigger the execution of the function
command_unknown() are registered in register_command_handler() and
have the command name prefixed with "ocd_".
Due to such "ocd_" prefix in cmd_name, the condition
if (strcmp(cmd_name, "unknown") == 0) { ... }
is always false.
Nobody complained for almost 10 years so we can proceed to remove
this dead code, before merging any change that obsoletes the
prefix "ocd_" and potentially makes the condition true.
Remove the dead code guarded by the condition above.
Change-Id: Icf11a956bb2d68fc84e6eb5779edf8e35db8fa53 Fixes: 89fa493a3bc3 ("remove unknown handler") Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5096 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Steven Stallion [Tue, 21 May 2019 18:29:27 +0000 (11:29 -0700)]
doc/openocd.texi: fix bad aarch64 merge
The documentation added for commit b3d29cb5441ee5d38e8f7b561a58f03eb269dbe4
was merged after the end of the eSi-RISC section rather than AARCH64.
This patch relocates this hunk to the correct location.
Antonio Borneo [Wed, 15 May 2019 14:27:26 +0000 (16:27 +0200)]
helper/command: print the command output in case of error
In case of error, a command should use command_print() to report
the error message, so it get printed only on the session that run
the command itself, and the message can be intercepted with the
tcl command catch if it has to be handled differently.
Current code drops the command output when the command returns
error, claiming that it's the command that *should* have printed
it already. This is true only if we *abuse* of the LOG functions,
but accepting the side issue of having the LOG printed in every
session and being unable to catch{} the error message.
Since we have switched to command_print(), change the code to
propagate the command output also in case of error.
Change-Id: I95de424a65e63702bdb3b2277749a0ac6aaaa503 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5178 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Jan Matyas [Wed, 15 May 2019 05:38:51 +0000 (07:38 +0200)]
jtag/drivers/imx_gpio: fixed calls to command_print
Two calls to command_print() in imx_gpio fixed - the first parameter
adjusted (CMD_CTX -> CMD) per the changes from this commit: 6cb5ba6f1136df2986850f5c176cb38e34ca1795
Change-Id: I6cb0909439a632d3109edfc68070b9b561f86d49 Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/5176 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
Antonio Borneo [Tue, 14 May 2019 21:38:29 +0000 (23:38 +0200)]
drivers/bcm2835gpio: fix build for ARM host
The commit 84ca4995adfa ("drivers/bcm2835gpio: fix usage messages")
has been merged before commit 6cb5ba6f1136 ("helper/command: change
prototype of command_print/command_print_sameline") introducing two
new call to command_print() that were not modified by the second
commit.
This triggers a compile error on ARM host.
Fix the incorrect function call.
Change-Id: I2736bae24141685b7590fd6b4aa5e6a29b2cab29 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5174 Tested-by: jenkins
Jan Matyas [Mon, 6 May 2019 05:20:33 +0000 (07:20 +0200)]
jtag_vpi: fixed state transitions in "stableclocks"
In jtag_vpi_stableclocks() the TMS line needs to be set properly
based on the current JTAG TAP state (TMS=1 in TAP_RESET state vs.
TMS=0 in other cases).
Change-Id: Id49622ba83015f97b61b6a896edde4448f1fbdc6 Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/5151 Tested-by: jenkins Reviewed-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Sun, 12 May 2019 12:09:51 +0000 (14:09 +0200)]
helper/command: fix printing usage for incomplete commands
The commit "helper/command: do not replace new commands with
ocd_ prefix" breaks the print of usage text when a multi-word
command is typed incompletely.
Fix it by explicitly running the "usage" command.
Change-Id: I46f8e521d9b6ac617bff8938cf8fc96f0ade45c8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5166 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Antonio Borneo [Sun, 7 Apr 2019 03:12:31 +0000 (05:12 +0200)]
helper/command: send command output only to the right server
When opening multiple telnet connections, the command output on
one console is broadcast to all the other console.
Send the command output only to the output handler that has been
set for that context.
For the moment, still broadcast the errors.
Note that contexts which doesn't explicitly set the output handler
(e.g. gdb_server), will inherit the global output handler
configuration_output_handler() that will broadcast the output.
Change-Id: I1f2d6e6a3bbf730f5fa77246730fce1445742a1e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5093 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>