Commit Graph

924 Commits

Author SHA1 Message Date
Antonio Borneo 424f9f6796 doc: how to use QEMU to test big-endian build
Document the process of using buildroot to build a big-endian
binary of OpenOCD and using QEMU User Mode Emulation for running
the big-endian binary on a little-endian host PC.

Change-Id: Ic5fe26e353a4cf69e57af3c23ae7fa4b25347b2b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6968
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-08-27 16:18:17 +00:00
Ian Thompson ce5ca9f7ba target: add generic Xtensa LX support
Generic Xtensa LX support extends the original Espressif/Xtensa
patch-set to support arbitrary Xtensa configurations, as defined in
a core-specific .cfg file.  Not yet fully-featured.  Additional
functionality to be added:
- Xtensa NX support
- DAP/SWD support
- File-IO support
- Generic Xtensa multi-core support

Valgrind-clean, no new Clang analyzer warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I08e7bf8fa57c25b5d0cb75a1aa7a2ac13a380c52
Reviewed-on: https://review.openocd.org/c/openocd/+/7055
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-20 15:38:41 +00:00
Steve Marple 290eac04b9 drivers/linuxgpiod: Migrate to adapter gpio commands
Use the new "adapter gpio" commands to configure the GPIOs used by the
linuxgpiod driver.

Adds support for drive mode and resistor pull options on all signals.

Change-Id: Ic90cb4f06db82435294228b6793330107a9f3606
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7048
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:24:54 +00:00
Steve Marple ace028262b drivers/am335xgpio: Migrate to adapter gpio commands
Use the new "adapter gpio" commands to configure the GPIOs used by the
am335xgpio driver. The AM335x has 4 GPIO 'chips' (chip number 0-3
inclusive), with each one providing 32 GPIOs (gpio_num 0-31 inclusive).

Change-Id: I7c63c0e4763657ea51790c43fc40d32b7c3580bb
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6984
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:24:36 +00:00
Steve Marple 82fd400542 jtag/adapter: Add command 'adapter gpio'
Most adapters define their own commands to obtain the GPIO number and
other GPIO configuration information such as chip number, output drive
type, active high/low.

Define a general command 'adapter gpio' as replacement for the
driver-specific ones.

Change-Id: I1ca9ca94f0c7df5713172e9f62ffb0ad64e9ee97
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6967
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:24:22 +00:00
Asier Llano 6d6207a8d3 rtos: Support for "none" rtos
After a certain RTOS has been configured there is no mechanism
to go back to no RTOS support. It may be useful for debugging
purposes. With the provided modification, the "none" option
of RTOS is provided as a valid option.

It has been tested in two different board (Cortex M4 and Cortex M33).
Documentation has also been updated.

Signed-off-by: Asier Llano <allano@hubbell.com>
Change-Id: I602210bff31ccadd41c41e9454c52b5fffa1671e
Reviewed-on: https://review.openocd.org/c/openocd/+/7092
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:19:21 +00:00
Ben Bender 2c6571b9b1 arm_adi_v5: Adding Nuvoton NPCX quirk
We found that the NPCX has an issue with the byte lanes so that non byte
aligned writes aren't working. To overcome this, for byte accesses we
copy the byte to be written to all of the byte lanes.

doc: Document command nu_npcx_quirks

Signed-off-by: benjbender <benjbender@gmail.com>
[Andreas Fritiofson: Squashed commits]
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Change-Id: I9ef63bf692f4e68f57459e1ec33f3abcbf533cd2
Reviewed-on: https://review.openocd.org/c/openocd/+/6630
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-07-30 08:49:47 +00:00
Jacek Wuwer f97915f248 drivers/vdebug: add support for DAP level interface
This patch adds support for DAP interface to Cadence vdebug driver.
It implements a new transport layer for dapdirect_swd.

Change-Id: I64b02a9e1ce91e552e07fca692879655496f88b6
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6965
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-07-30 08:48:21 +00:00
Erhan Kurubas 3d61a9593e jtag: add esp_usb_jtag driver
This driver is used with the ESP32 chips which has builtin USB-JTAG
interface. e.g. with ESP32-C3, ESP32-S3

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: If966268cb8d26f76540dd5440245a17ed0b72c61
Reviewed-on: https://review.openocd.org/c/openocd/+/6943
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2022-07-02 08:24:01 +00:00
Erhan Kurubas 2053120ba1 target: add Espressif ESP32-S3 basic support
ESP32-S3 is a dual core Xtensa SoC
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I44e17088030c96a9be9809f6579a4f16dbfc5794
Reviewed-on: https://review.openocd.org/c/openocd/+/6990
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-24 21:46:42 +00:00
Erhan Kurubas 77287b8d47 target: add Espressif ESP32 basic support
ESP32 is a dual core Xtensa SoC
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I76fb184aa38ab9f4e30290c038b5ff8850060750
Reviewed-on: https://review.openocd.org/c/openocd/+/6989
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-24 21:46:07 +00:00
Antonio Borneo 8c1d518232 arm_adi_v5: add option 'root' to 'dap info' command
On ADIv6 the system root ROM table is found by reading the DAP DP
registers BASEPTR0 and BASEPTR1.

Add option 'root' to the commands 'dap info' to let it retrieve
the system root ROM table's AP from DAP DP, then use such AP for
following dump.

Change-Id: I1789457a005faa3870c5d14f763378d2f6a5f095
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6462
Tested-by: jenkins
2022-06-24 21:38:08 +00:00
Antonio Borneo 3f4bc6ce7f adiv6: use struct adiv5_ap->ap_num to contain the AP base address
ADIv5 DAP can only have 256 AP, while ADIv6 can provide till
2**40 (1,099,511,627,776) AP per DAP.

Reuse the field ap_num in struct adiv5_ap, currently used on ADIv5
to hold the ADIv5 AP number (apsel), to contain the ADIv6 AP base
address.

Convert struct adiv5_ap->ap_num to 64 bit and initialize it to
DP_APSEL_INVALID for unused AP.
Restrict dap_find_get_ap() to ADIv5 only. To be enhanced.
On ADIv6, let dap_get_ap() return an already allocated AP, or
allocate and return an unused AP.
Add function is_ap_num_valid() and use it.

Change-Id: Ib2fe8c7ec0d08393cd91c29fdac5d632dfc1e438
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6461
Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Tested-by: jenkins
2022-06-24 21:37:44 +00:00
Kevin Burke 1fe82f9f1d adiv6: add dap flags -adiv5 and -adiv6
Add flags to 'dap create' command and set the field adi_version
in struct adiv5_dap.

Actually only ADIv5 is functional. Other patches are needed to get
ADIv6 working.

Split from change https://review.openocd.org/6077/

Change-Id: I63d3902f99a7f139c15ee4e07c19eae9ed4534b9
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6456
Tested-by: jenkins
2022-06-24 21:34:30 +00:00
Erhan Kurubas 78c87f5e81 target: add Espressif ESP32-S2 basic support
ESP32-S2 is a single core Xtensa chip.
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I2fb32978e801af5aa21616c581691406ad7cd6bb
Reviewed-on: https://review.openocd.org/c/openocd/+/6940
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2022-06-04 08:18:44 +00:00
Erhan Kurubas ce5027ab01 semihosting: add semihosting_basedir command
This command allows users to set base working directory for the
semihosting I/O operations.Default is the current OpenOCD directory.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I80c5979e4c96d66cccdd12cc6fcd5f353e5c6b4d
Reviewed-on: https://review.openocd.org/c/openocd/+/6888
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-21 09:01:56 +00:00
Steve Marple 62cea61237 doc: Document linuxgpiod driver commands
Change-Id: I84ad5dba9ab2099137595b46822bc10a0b089524
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6962
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-14 09:00:01 +00:00
Steve Marple bd4bd54b60 drivers/am335xgpio: Add AM335x driver for bitbang support on BeagleBones
Change-Id: Iac1c9f3d380e2474c8b77407c89c2aad96fbf2ea
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6941
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-14 08:59:30 +00:00
Antonio Borneo cc75aa37c5 openocd: add post-init and pre-shutdown helpers
It is a common requirement to automatically execute some command
after "init".
This can be achieved, either in scripts or through OpenOCD command
line, by explicitly calling "init" followed by the commands.
But this approach fails if the request for post-init commands is
spread across configuration files; only one of the files can split
pre-init and post-init status by calling "init".
The common workaround is to "rename" the command "init" and
replace it with a TCL proc that calls the original "init" and the
post-init commands. E.g. in Zephyr script [1].

To simplify and formalize the post-init execution, use a TCL list
that contains the list of commands to be executed. Every script
can contribute adding new commands, e.g. using "lappend".

In the same way, formalize the pre-shutdown execution with a TCL
list of user commands to be executed before OpenOCD exit.

Document them and add trivial examples.

Drop from documentation the suggestion to rename "shutdown".

Change-Id: I9464fb40ccede3e7760d425873adca363b49a64f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.7.1/boards/arm/nucleo_h743zi/support/openocd.cfg#L15
Reviewed-on: https://review.openocd.org/c/openocd/+/6851
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2022-05-14 08:58:36 +00:00
Piotr Kasprzyk 2fa3e2489f doc: fix typo s/Not/Note/
Append lacking e to word Note

Signed-off-by: Piotr Kasprzyk <ciri@ciri.pl>
Change-Id: Ibd40a2f93d11cf1945361f0c46329b88963d6826
Reviewed-on: https://review.openocd.org/c/openocd/+/6963
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-07 11:05:15 +00:00
Salvatore Giorgio PECORINO ad5ca263e9 bluenrg: add support for bluenrg-lps device and board
Added bluenrg-lps support
Added file for the board steval-idb012v1
Fixed size_info information using a mask
Changed the if condition in bluenrg-x.cfg to be valid only for bluenrg-1 and bluenrg-2

Signed-off-by: Salvatore Giorgio PECORINO <salvatore-giorgio.pecorino@st.com>
Change-Id: Ic0777ec0811ee6fac7d5e1d065c4629e47d84a1f
Reviewed-on: https://review.openocd.org/c/openocd/+/6928
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-07 11:03:25 +00:00
Antonio Borneo b4f8d99c8d smp: deprecate legacy SMP core switching support
The deprecation was already in the documentation since v0.11.0
through commit 85ba2dc4c6 ("rtos/hwthread: add hardware-thread
pseudo rtos") but OpenOCD was not informing the user printing a
runtime message.

Remove the deprecated method from the documentation and print a
deprecated message at runtime.
There is no reliable way to print the same message in GDB console,
so we have to rely on user noticing it in the OpenOCD log.
Target is to remove the functionality after v0.12.0.

Change-Id: Idd2d9e3b6eccc92dcf0432c3c7de2f8a0fcabe9f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6862
Tested-by: jenkins
2022-05-07 11:00:00 +00:00
Tomas Vanek f2b4897773 flash/stm32f1x: add support for RISC-V GigaDevice GD32VF103
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>
2022-04-24 08:26:08 +00:00
Antonio Borneo 2e5df83de7 nds32: deprecate it, together with aice adapter driver
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
2022-04-23 09:16:52 +00:00
Tarek BOCHKATI b9526f1401 semihosting: permit redirection of semihosting I/O to TCP
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>
2022-03-19 09:11:05 +00:00
Marc Schink e370e06b72 target: Deprecate 'array2mem' and 'mem2array''
Replace 'mem2array' and 'array2mem' with a Tcl wrapper that
internally uses 'read_memory' and 'write_memory'.

The target-specific 'mem2array' and 'array2mem' functions
remain for now.

Change-Id: If24c22a76ac72d4c26916a95f7f17902b41b6d9e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6308
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-12 09:48:00 +00:00
Marc Schink 38183dc856 target/tcl: Add 'read_memory' and 'write_memory'
These functions are meant as replacement for 'mem2array' and
'array2mem'.

The main benefits of these new functions are:

 * They do not use Tcl arrays but lists which makes it easier
   to parse (generate) the data. See the Python Tcl RPC code
   in contrib as a negative example.

 * They do not operate on Tcl variables but instead return (accept)
   the Tcl list directly. This makes the C and Tcl code base
   smaller and cleaner.

 * The code is slightly more performant when reading / writing
   large amount of data. Tested with a simple Python Tcl RPC
   benchmark.

Change-Id: Ibd6ece3360c0d002abaadc37f078b10a8bb606f8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/6307
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-12 09:47:42 +00:00
Marc Schink e8e62c5aca target/tcl: Add get_reg function
Change-Id: Id1be9554d1df2c07cec3161a0fd3a586fdf18246
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/5312
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-05 13:21:24 +00:00
Marc Schink da73280101 target/tcl: Add set_reg function
Change-Id: I97a01b93046cb7af289792489f77f5580312585a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/5313
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-05 13:11:25 +00:00
Jacek Wuwer f998a2aaf1 Cadence virtual debug interface (vdebug) integration
Change-Id: I1bc105b3addc3f34161c2356c482ff3011e3f2cc
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6097
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-02-14 15:12:10 +00:00
Zoltán Dudás 5ab74bde06 semihosting: User defined operation, Tcl command exec on host
Enabling a portion (0x100 - 0x107) of the user defined semihosting
operation number range (0x100 - 0x1FF) to be processed with the help of
the existing target event mechanism, to implement a general-purpose Tcl
interface for the target available on the host, via semihosting
interface.

Example usage:
- The user configures a Tcl command as a callback for one of the newly
	defined events (semihosting-user-cmd-0x10X) in the configuration
	file.
- The target can make a semihosting call with <opnum>, passing optional
	parameters for the call.

If there is no callback registered to the user defined operation number,
nothing happens.

Example usage: Configure RTT automatically with the exact, linked
control block location from target.

Signed-off-by: Zoltán Dudás <zedudi@gmail.com>
Change-Id: I10e1784b1fecd4e630d78df81cb44bf1aa2fc247
Reviewed-on: https://review.openocd.org/c/openocd/+/6748
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-02-05 21:40:17 +00:00
Adrien Grassein 666ff828b2 jtag: Add an option to ignore the bypass bit
Some CPU wrongly indicate the bypas bit in the codeid.
It's the case of the NanoXplore NG-ULTRA chip that export a
configurable (and potentially invalid) ID for one of
its component.
Add an option to ignore it.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
Change-Id: Ic59743f23bfc4d4e23da0e8535fec8ca9e87ff1a
Reviewed-on: https://review.openocd.org/c/openocd/+/6802
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2022-01-22 10:20:17 +00:00
Antonio Borneo 5a8d32fcb9 doc: use the new jimtcl syntax for 'expr'
With jimtcl 0.81 the syntax of the TCL command 'expr' requires the
multiple arguments to be within curly brackets.

Update the examples in the documentation to follow the new syntax.
While there, split one example to avoid it to exceed the line size
during pdf document generation.

Change-Id: I91cca419f8273415ccb0c2ce369fc6ac476e34e5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6809
Tested-by: jenkins
2022-01-22 10:13:36 +00:00
Doug Brunner aad8718058 flash/nor/efr32: fixed lockbits and user data
Changed flash driver to support writing to the user data page, as well as to any portion of the lockbits page above 512 bytes (the amount used for the actual page lock words). The top part of the lockbits page is used on at least the EFR32xG1 chips for the SiLabs bootloader encryption keys.

As presented to the user, the lockbits page is the same size as the other pages, but any attempt to write to its low 512 bytes is an error. To enforce this, efr32x_write is renamed to efm32x_priv_write and a wrapper function is provided in its place. If the user erases the lockbits page, the driver rewrites the cached lock words after the erase. When the driver erases the lockbits page in order to update the lock words, it first takes a copy of anything stored in the top part of the page, and re-programs it after the erase operation.

There are now multiple instances of flash_bank for each target, and the flash_bank instances must share their cached lock words to operate as intended. Therefore, when a bank is created, the global flash bank list is used to find any other banks that share the same target. Since some banks in the global list are invalid at the time free_driver_priv is called, reference counting is used to decide when to free driver_priv.

To avoid the need to find the lockbits flash_bank from another flash_bank, efm32x_priv_write and efm32x_erase_page now take an absolute address.

There didn't seem to be any reason to prohibit unprotecting individual flash pages, so that limitation is removed from efm32x_protect().

This addresses ticket #185.

Valgrind-clean, except for 2x 4kiB not freed/still reachable blocks that were allocated by libudev.
No new Clang analyzer warnings, no new sanitizer warnings.

Signed-off-by: Doug Brunner <doug.a.brunner@gmail.com>
Change-Id: Ifb22e6149939d893f386706e99b928691ec1d41b
Reviewed-on: https://review.openocd.org/c/openocd/+/6665
Tested-by: jenkins
Reviewed-by: Fredrik Hederstierna <fredrik.hederstierna@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-01-05 17:57:08 +00:00
Tim Newsome d27d66bc1b Document how vector registers are exposed to gdb.
See https://github.com/riscv/riscv-openocd/pull/570

Change-Id: Ie7cdef3717e107a9df0b48316cfbc547dea9a7fd
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6776
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-24 15:13:14 +00:00
Jan Matyas 654c18a408 doc: Updated RISC-V memory-related cmds in documentation
- "riscv set_prefer_sba" - removed from the doc, superseded
  by the latter
- "riscv set_mem_access" - new command, new entry added
  into the doc

This change only addresses the documentation. The corresponding
implementation of the RISC-V commands is already merged.

Change-Id: I3c07672cde94324407cf667504dba5402f63a543
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6743
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2021-12-11 17:44:17 +00:00
Jan Matyas d8f64f8e35 doc: Update doc for commands "riscv expose_csrs" and "riscv expose_custom"
These commands were extended/improved in the last drop
of RISC-V target updates. Update also the documentation
to properly describe how the commands should be used now.

Change-Id: I9e2ba6adbe1a4c032b96f5f8ff2d4791fa4c2527
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6738
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
2021-12-11 17:43:40 +00:00
Yasushi SHOJI e5a93e3e7a doc/openocd.texi: Document find and ocd_find command
Document both find and ocd_find command under Config File Guidelines
-> Interface Config Files.  find command is used in the previous
section as well but the previous section is more about using OpenOCD.

The section added is "aimed at any user who needs to write a config
file".

Change-Id: I698207fe58d564c615a15b50756aa5547a5f40b7
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6737
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11 17:42:52 +00:00
Yasushi SHOJI 37407f4a7b doc/openocd.texi: Document command mode command
Document "command mode" command Server Configuration -> Configuration
Stage.  The text is taken from command's help string.

In addition to the help string, this commit explain the words
mismatch, the doc uses "stage" but the command and source code uses
"mode" to describe the same thing.

Change-Id: I1d5fc8c64a3a0b07ea8430bf016bcbd54e52da1c
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6736
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11 17:42:33 +00:00
Tomas Vanek 2753c9868e doc: document noinit command
Change-Id: I915c7d3231935fd44407b5fa65d86d4cb93e8db5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6761
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11 17:41:01 +00:00
Tomas Vanek dfc9b8e90d doc: list internal commands called by init
Change-Id: I5534c94a983906533a1b38c30ec3eb982e62dee7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6760
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11 17:40:43 +00:00
Yasushi SHOJI 15110b2b5b doc/openocd.texi: Document usage command
Document usage command under General Commands -> Server Commands. The
text is taken from the command's help string.

Change-Id: I957cb46cca98181c3c5e676228c5c103e47bb655
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6735
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03 21:55:46 +00:00
Yasushi SHOJI 39197e3e53 doc/openocd.texi: Document add_help_text and add_usage_text
Document add_help_text and add_usage_text under Genral Commands ->
Misc Commands.  The text are taken from command's help strings.

Change-Id: I2bbbee8e5faa8d9654227c304e0528f5144275e8
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6734
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03 21:55:02 +00:00
Tomas Vanek 6179d9f848 doc: document 'cmsis-dap cmd' command
Change-Id: I90b7f020ee2bf078fdf22e3d21423f333ae061ac
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6732
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03 21:54:03 +00:00
Tomas Vanek bbe8b0df17 doc: fix list of supported nRF52 devices
Change-Id: I64d6d851dd9333689556b7062b1ff38d41b5ad32
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6731
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03 21:53:49 +00:00
Tomas Vanek c07e4b3782 doc: document 'atsamv gpnvm' command
Change-Id: I922c75e2d074447558f85bfda5421aa24a850be1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6729
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03 21:53:22 +00:00
Tomas Vanek af723387be doc: mention SWD multidrop
Change-Id: I361dc351c407b67613eadef4d29e27ed0e00bd05
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6744
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2021-12-03 21:52:12 +00:00
Antonio Borneo 1d1386e31e drivers: call adapter_get_required_serial() in jtag_libusb_open()
Now that adapter serial is handled independently from the adapter
drivers, move inside jtag_libusb_open() the call to
adapter_get_required_serial(), so every adapter that uses libusb
will automagically get USB serial support.

Extend the documentation to list the adapters involved.

Change-Id: I75b3482d38f8ed3418329f3106c5e8b689fd460b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6663
Tested-by: jenkins
2021-11-28 11:01:32 +00:00
Antonio Borneo c6460ea36d jtag/hla, jtag/stlink: switch to command 'adapter serial'
The driver hla defines the command 'hla_serial' to specify the
serial string of the adapter.
The driver st-link defines the command 'st-link serial' to specify
the serial string of the adapter.

Remove and deprecate the driver commands and use 'adapter serial'.

Change-Id: I9505c398a77125b1ebf4ba71da7baf4d663b75be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6657
Tested-by: jenkins
2021-11-28 11:01:16 +00:00
Antonio Borneo ad18c1a47f jtag/jlink: switch to command 'adapter serial'
The driver jlink defines the command 'jlink serial' to specify the
serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Note: in former code the commands 'jlink serial' and 'jlink usb'
were mutually exclusive; running one of them would invalidate the
effect of a previous execution of the other. The new code gives
priority to 'adapter serial', even if executed before 'jlink usb'.

Change-Id: I920b0c136716f459b6fd6f7da8a01a7fa1ed389f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6656
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2021-11-28 11:00:55 +00:00