According to GigaDevice user manuals the devices have OBRLD bit in FMC_CTL
register which is functionally compatible with OBL_LAUNCH @ FLASH_CR
of STM32 counterparts.
Change-Id: I84d231b38815fcb6452fd73b9153b269cce3b737
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6759
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
The flash is compatible with stm32f1x, reuse the driver.
Extend the size of work area to RAM size of the smallest device.
Stop watchdogs before flash programming.
Change-Id: I67a7654a6e196f9d4b2409edaa7990c53334437e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6711
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
The device has compatible flash macro with STM32F1 family, reuse
stm32f1x driver code.
Detect non-ARM target - for simplicy test target type name 'riscv'
and the address has 32 bits.
In case of RISC-V CPU use simple chunked write algo - async algo
cannot be used as the core implemented in this device doesn't
allow memory access while running.
Change-Id: Ie3886fbd8573652691f91a02335812a7300689f7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6704
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Zephyr plan to remove openocd specific symbols in favour
of more generic one.
These generic symbols has been introduced in Zephyr 2.6.
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Change-Id: I89418c9c378fb8b8baa29763fc6f1b6e652dc7ef
Reviewed-on: https://review.openocd.org/c/openocd/+/6844
Tested-by: jenkins
Reviewed-by: Stephanos Ioannidis <root@stephanos.io>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixed the reading of p_flags in ELF64 segment headers - that field
is 64 bits wide.
Change-Id: I053ca57d36efb54b7c638484acd6c7a2fbcbd05a
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6927
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Current implementation for gdb remote monitor command uses the
command_run_line() to execute the command.
While command_run_line() has several advantages, it unfortunately
hides the error codes and outputs the result of the command
through LOG_USER(), which is not what gdb requires. See 'qRcmd' in
https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html
Replace command_run_line() with Jim_EvalObj() and parse the output
to provide the proper result to gdb.
Can be tested by defining in OpenOCD:
proc a {} {return hello}
proc b {} {return -code 4}
proc c {} {return -code 4 "This is an error!"}
then by executing in gdb console:
monitor a
monitor b
monitor c
monitor foo
Change-Id: I1b85554d59221560e97861a499e16764e70c1172
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Torbjorn Svensson <torbjorn.svensson@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6886
Tested-by: jenkins
The target nds32 and its companion adapter aice have not received
any real improvement since 2013.
It has been hard to keep them aligned during the evolution of
OpenOCD code, with no way for maintainers to really check if they
are still working.
No real documentation is present for them in OpenOCD.
The arch nds32 has been dropped from Linux kernel v5.18-rc1.
Deprecate both nds32 target and aice adapter with the target of
dropping them for v0.13.0.
Remove automatic build of aice, forcing user to select it.
Change-Id: Ib465d676246fa3b4e95c3d399ba9a5cf1f8b3baf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6887
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
* riscv: Add a option to specify the JTAG TAP IR used to access the bscan tunnel.
Change-Id: Ice8798823313e2177e75473e62b06e7da74bbba2
Signed-off-by: Charles Papon <charles.papon.90@gmail.com>
* risc-v: Add litex doc about the set_bscan_tunnel_ir command
Change-Id: I1237213f32886d20fc7d60d5ca1e2124953eaeda
Signed-off-by: Dolu1990 <charles.papon.90@gmail.com>
* risc-v: remove tunnel ir length assert when ir is set by the user
Change-Id: I2b33fc6205f37461ff1bd15601b460a2467ea32b
Signed-off-by: Dolu1990 <charles.papon.90@gmail.com>
* Open riscv: Add a option to specify the JTAG TAP tunnel IR
Typo
Co-authored-by: Tim Newsome <tim@sifive.com>
* riscv: Add a option to specify the JTAG TAP tunnel IR
typo
Co-authored-by: Tim Newsome <tim@sifive.com>
Co-authored-by: Tim Newsome <tim@sifive.com>
The current code locks the flash controller in case of error during
flash write only. An error in other flash operations may cause the
flash is left unlocked.
Implement locking also after error in erase, mass erase, options
write and erase.
Change-Id: I26c2ed7914e7847122306f29b777b9eefd1dc580
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6710
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
stm32x_wait_status_busy() has two side effects in case of flash programming error:
- reports error
- clears error bit in status register
Use stm32x_wait_status_busy() to report also flash error during target
algo flash write.
While on it use more descriptive error codes in stm32x_wait_status_busy().
Change-Id: I6e1cffc2aa5411b918a23ed62d5194910888a9d1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6709
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Use target_get_working_area_avail() instead of try-fail iteration.
Call destroy_reg_param() in a for cycle.
Change-Id: I1891d1ffdea99010c6ab66b9578400b9d7922e20
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6708
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Mostly refactoring.
Rename original stm32x_write_block() to stm32x_write_block_async()
as it uses target async algo.
Introduce new stm32x_write_block() and move slow, host controlled
fallback flash write there.
The change allows stm32x_write_options() to use slow flash write fallback.
While on it rename variables where halfword count is stored.
Change-Id: I386ae15cf052b1490461ed8f7eea5b4403d466f7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6706
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
When we debug a target that works as a USB device, halting
the target causes the USB communication with the USB host to
become unresponsive. The host will try to reconnect/reset/setup
the unresponsive device during which communication with other
devices on the same USB bus can get stalled for several seconds.
If the JTAG adapter is on the same bus, we need to make sure
openOCD will wait for packets at least as long as the host USB
stack. Otherwise the USB stack might deliver a valid packet, but
openOCD would ignore it due to the timeout. The xHCI spec uses 5
sec timeouts, so let's use that in openOCD with some margin.
Use this value in all libusb calls. HID API might have a libusb
backend and would probably be victim to the same bug, so it
should use this timeout, too.
Ticket: https://sourceforge.net/p/openocd/tickets/343/
Signed-off-by: Gabor Csapo <gaborcsapo@google.com>
Change-Id: Ia3dc1356e676fe550f57a4c72f7a24ba296b6af2
Reviewed-on: https://review.openocd.org/c/openocd/+/6882
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
- Print also the target name, not just the packet contents.
This is important when there are more GDB servers (more
debug-able targets) active in one OpenOCD session.
- Log also the received Ctrl-C requests coming from GDB
(one byte 0x3), ACKs ("+") and NACKs ("-").
- Do not print zero-length incoming packets (this occurred
when Ctrl-C packets were received).
- Removed a stray apostrophe "'" that got printed
in gdb_log_outgoing_packet()
Signed-off-by: Jan Matyas <matyas@codasip.com>
Change-Id: If68fe0a8aa635165d0bbe6fa0e48a4645a02da67
Reviewed-on: https://review.openocd.org/c/openocd/+/6879
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
To support 64 bits bit and masks
Replace local definition of BIT in rtos/chromium-ec
Change-Id: I1f268d6e8790f1b07bf798680b797878ce81064b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6857
Tested-by: jenkins
Including config.h as first is required for every C file.
Add it to the C files that still miss it.
Change-Id: I1a210e7d3a854958a85a290b086ad8a9f5176425
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6856
Tested-by: jenkins
While the documentation reports that SWO pin frequency can be
omitted to let the adapter autodetect the value, the code wrongly
drops an error when pin frequency is not specified.
Don't require the pin frequency to be set at "enable", but verify
that the adapter has properly changes it to a valid value.
Change-Id: I3dfbe3256e8887ef4f03512769b06381cdc9db0d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Karl Palsson <karlp@tweak.net.au>
Fixes: 184724d14e ("arm_tpiu_swo: add support for independent TPIU and SWO")
Reviewed-on: https://review.openocd.org/c/openocd/+/6310
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Tested on an EFM32PG12 Starter Kit.
Change-Id: I2cbc36fe0d2ad2089bf8c1e7d2260daaae4ddbb4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/5353
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Commit dbbac5f11d ("semihosting: use open mode flags from GDB,
not from sys/stat.h") fixes the conversion of the mode flags from
ARM semihosting encoding for SEMIHOSTING_SYS_OPEN to GDB mapping
for open().
Doing this, it breaks the conversion to local host's OS mapping
for open().
Split the conversion array to one for GDB and one for local host.
The local host conversion array is taken directly from the old
code.
Change-Id: I385321ddd32c3ac5cf6da3f1ce9eff76b05dd527
Fixes: dbbac5f11d ("semihosting: use open mode flags from GDB, not from sys/stat.h")
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6870
Tested-by: jenkins
* Fix checkpatch workflow: ignore changes in .github/
Ignore changes in .github/ directory when running checkpatch.
Checkpatch emits false alarms on substrings "CC:" found in *.yml
workflow files, apparently thinking it is a "Cc:" signature in
commit message.
Change-Id: Id977d5a8838797e4676758066af4825651c41a87
* Fix: Set proper debug_reason in deassert_reset()
The issue was visible for example when user's .cfg file ended
with "reset halt" command:
In such case, the hart would remain halted but the debug_reason would not be
updated and may retain an incorrect value, e.g. DBG_REASON_NOTHALTED.
In such cases, gdb_last_signal() would provide an incorrect reply to GDB.
Change-Id: Ie6f050295fb5cbe9db38b189c4bc385662acf5b4
Signed-off-by: Jan Matyas <matyas@codasip.com>
* Fix checkpatch workflow: add 'apt-get update'
Change-Id: Ic5843ec86d16a187d01970a3253caade3d13b7ab
Signed-off-by: Jan Matyas <matyas@codasip.com>
Some configuration of GCC could default to -fno-inline, causing
the build to fail after commit fb43f1ff4e ("target: Rework 'set'
variable of break-/watchpoints").
Switch the new inline functions to 'static inline', as it's widely
used in the rest of the code.
Change-Id: I8bf31045a137bd34ed825f4b2a9338eb3c70046d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: fb43f1ff4e ("target: Rework 'set' variable of break-/watchpoints")
Reviewed-on: https://review.openocd.org/c/openocd/+/6881
Tested-by: jenkins
The 'set' variable name suggests a boolean data type which determines
whether a breakpoint (or watchpoint) is active. However, it is also
used to store the number of the breakpoint.
This encoding leads to inconsistent value assignments: boolean and
integer values are mixed. Also, associated hardware comparator
numbers, which are usually numbered from 0, cannot be used directly.
An additional offset is required to store the comparator numbers.
In order to make the code more readable and the value assignment more
consistent, change the variable name to 'is_set', its data type to 'bool'
and introduce a dedicated variable for the break-/watchpoint
number.
In order to make the review easier, the data types of various related
variables (e.g. number of breakpoints) are not changed.
While at it, fix a few coding style issues.
Change-Id: I2193f5639247cce6b80580d4c1c6afee916aeb82
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6319
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Considering this use case: (using STM32 L5 or U5)
1- first probe : TZEN enabled, RDP level 0
flash_regs_base |= STM32L5_REGS_SEC_OFFSET => 0x50022000
2- the user promotes the RDP to level 0.5
3- the second probe, fails to read OPTR using secure flags_regs_base:
used OPTR address is 0x50022040
Step 3 fails because when RDP is level 0.5, we should use Non-Secure
flash registers.
To fix this, always use NS flash regs to read OPTR in probe functions.
Fixes: 80d323c6e8 (flash/stm32l4x: introduce auto-probe when OPTR is changed)
Change-Id: I296aa633972b0c410b927488c999584a07b912d3
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6864
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
ST-Link Server 2.1.0-1 fixes concurrency issue with RW_MISC command
Starting from this version the ST-Link Server API is now v3.
In this change we save the ST-Link Server version, and check if the
API is greater or equal to 3 to enable the queuing.
Change-Id: I239eb81024700514c607a269b66651f457206faa
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6876
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This command permits the usage of a TCP port to perform debug and stdio
operations:
- debug : READC, WRITEC and WRITE0
- stdio : READ, WRITE
This will permit the separation of semihosting message from OpenOCD log,
and separate semihosting messages per core.
syntax: arm semihosting_redirect (disable | tcp <port> [debug|stdio|all])
this allows to select which operations to be performed via TCP (debug,
stdio or all (default)).
Note: for stdio operations, only I/O from/to ':tt' file descriptors are
redirected.
tested using netcat on ubuntu
Change-Id: I37053463667ba109d52429d4f98bc98d0ede298d
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5562
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
OpenOCD implements the GDB keep-alive by sending empty strings as
output for GDB client. This has been implemented as part of the
log framework, creating an odd dependency.
Move the keep-alive notifications out of log framework.
For the moment, keep keep_alive() inside log.c, but it should be
moved in server.c
This should also fix an old issue with KDE Konsole when tab alert
for activity is enabled. The empty strings is sent to all the
connections, including telnet, and causes the tab running OpenOCD
telnet to continuously show activity even when no new text is
printed. Anyway, I cannot replicate this issue anymore.
Change-Id: Iebb00b00fb74b3c9665d9e1ddd3c055275bfbd43
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6840
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
GDB client cannot always display generic messages from OpenOCD.
The callback gdb_log_callback() is continuously added and removed
to follow the GDB status and thus enabling/disabling sending the
OpenOCD output to GDB.
While this is a nice stress test for log_{add,remove}_callback(),
it is also a waste of computational resources that could impact
the speed of OpenOCD during GDB user interactions.
Add a connection-level flag to enable/disable the log callback and
simply change the flag instead of adding/removing the callback.
Use an enum for the flag instead of a bool. This improves code
readability and allows setting other states, e.g. keep-alive
through asynchronous notification https://review.openocd.org/4828/
Change-Id: I072d3c6928dedfd0cef0abe7acf9bdd4b89dbf5b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6839
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
To easily add new methods to a service, pass all the methods
through a struct.
While there, drop the typedef for the methods and add currently
unused new methods to support keep-alive and connections during
keep-alive.
No change in functionality.
Change-Id: I2b5e7140db95021f6e7201e9d631ee340c60b453
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6838
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
The value of this variable is not shared across functions, so the
variable can be local.
Change-Id: I00b0444209e81c07bb57fb732f47052ad0596728
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6837
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins