Commit Graph

10144 Commits

Author SHA1 Message Date
Tim Newsome c05e4c5a2a jtag/drivers/xds110: Fix compiler warning.
Compiler would complain that `written` was used without being
initialized.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: Ibada85dcccfca6f1269c584cdbc4f2e3b93bb8f3
2023-07-13 13:13:55 -07:00
Laurent LEMELE 4a96776178 jtag/stlink: add STLINK-V3PWR support
STLINK-V3PWR is both a standalone debugger probe compatible with
STLINK-V3 and a source measurement unit (SMU).
Link: http://www.st.com/stlink-v3pwr

This code adds support for the debugger probe functionality.

Change-Id: Ib056e55722528f922c5574bb6fbf77e2f2b2b0c1
Signed-off-by: Laurent LEMELE <laurent.lemele@st.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7755
Tested-by: jenkins
2023-07-08 18:06:33 +00:00
Daniel Anselmi a27907aed1 ipdbg/pld: ipdbg can get tap and hub/ir from pld driver.
To start a ipdbg server one needs to know the tap and the
instruction code to reach the IPDBG-Hub. This instruction is
vendor/family specific. Knowledge which can be provided by the
pld driver.

Change-Id: I13eeb9fee895d65cd48544da4704fcc9b528b869
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7369
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-08 18:04:24 +00:00
Daniel Anselmi 373d7eaa70 pld/virtex2: add program/refresh command
Change-Id: If6d237a6f27c4232849f73d08e7ca74276e6d464
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7714
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-07-08 18:03:18 +00:00
Daniel Anselmi e95f8e2b25 pld/gowin: add missing documentation
Add short description for gowin {read_status/read_user/reload}
commands.

Change-Id: Ib441f3a2c0f00346decdeb505c27afa2630e9b5d
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7736
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-07-08 18:02:29 +00:00
Daniel Anselmi d654e523ba tcl/cpld: add config files for more xilinx fpga families
Use configurable virtex pld driver to add support for more
xilinx fpga families.

Change-Id: Iff10c8c511787734fa289bdba15f03131d51e071
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7352
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-07-08 18:01:37 +00:00
Daniel Anselmi 9cb09f8cfe pld/xilinx: make instruction codes configurable
Change-Id: I4d2c1fbd4d6007ba8d5c8c687a7c13e25fb6a474
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7713
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-08 18:01:18 +00:00
Daniel Anselmi 5ae0264055 pld: give devices a name for referencing in scripts
Change-Id: I05e8596ffacdb6cd8da4dd8a40bb460183f4930a
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7728
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-08 18:00:52 +00:00
Daniel Anselmi 7335fbdbda tcl/board/bemicro: source cycloneiii.cfg from correct path
Change-Id: Ib1d1be1067107633949a202a05f7fd06831ba84b
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7751
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-08 18:00:11 +00:00
Marek Vrbka 56fd04832a semihosting: fix handling of errno
This patch fixes the handling of errno by setting the sys_errn
only if error has actually occurred during the semihosting call.
It also fixes few issues where error was not set in the first place.

Change-Id: I2fbe562f3ec5e6220b800de04cd33aa1f409c7a0
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7730
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-07-01 17:58:52 +00:00
Marek Vrbka 6ef75352f1 semihosting: improve semihosting opcode debug messages
This patch introduces function semihosting_opcode_to_str() which
converts semihosting opcodes to strings. This function is then
used in debug messages to improve log analysis and troubleshooting.

Change-Id: Iffea49dae13d6a626ae0db40d379cba3c9ea5bd3
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7726
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-07-01 15:03:30 +00:00
Marek Vrbka eebcf3cff1 riscv/semihosting: Fix ebreak skip on fileio mode
This patch fixes skipping the semihosting sequence if
the fileio mode is enabled on riscv. This change was
tested by me and is in the riscv-openocd fork for a year now.

Original merge request:
https://github.com/riscv/riscv-openocd/pull/699

Original author: Wu Zhigang
zhigang.wu@starfivetech.com
https://github.com/wzgpeter

Change-Id: Iadaa0a48d1f82d3a7ca168f8a6b656ff6ab78e03
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7729
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
2023-06-16 22:11:51 +00:00
Lorenz Brun 63f4e7c72a target/ti-cjtag: make switching to JTAG more reliable
The current cJTAG to JTAG switching commands for TI chips are not
particularly reliable, especially on chips with accurate timing.
On a Raspberry Pi the existing sequence has (depending on cabling and
chip) a ~50% chance of working, on a much better-behaved FT2232H
it doesn't manage to enable full JTAG at all.

This change runs a bunch of test-idle cycles before actually attempting
to switch to full JTAG. This makes the switch reliable even at high
clock speeds (>100kHz) and from precise sources like the FT2232H.

Change-Id: I9293e884bf3e9606d529756ae4483b844d3c39db
Reported-by: Phil Wiggum <p1mail2015@mail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/375/
Signed-off-by: Lorenz Brun <lorenz@brun.one>
Reviewed-on: https://review.openocd.org/c/openocd/+/7419
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-10 17:11:46 +00:00
Antonio Borneo d8c9f66d25 jep106: update to revision JEP106BG May 2023
The original document from Jedec does not report the entry for
"21  NXP (Philips)", replaced by "c". It's clearly a typo.

Keep the line from JEP106BF.01 for "NXP (Philips)".

Change-Id: I30215c4ff08d5f112305cde6ab7a3176cdcef948
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7727
Tested-by: jenkins
2023-06-10 17:11:12 +00:00
Marek Vrbka 9f23a1d7c1 semihosting: fix non-zero value on Windows isatty()
On Windows, isatty() can return any non-zero value if it's an interactive
device. Which diverges from the ARM semihosting specification. This patch
introduces a fix to make the SYS_ISTTY operation conform to spec.

Change-Id: I9bc4f3cb82370812825d52419851910b3e3f35cc
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7725
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-06-10 17:10:27 +00:00
Marek Vrbka 71180e6753 gdb_server: refactor and unify function gdb_get_char_inner
The old implementation of gdb socket error handling
in the gdb_get_char_inner() differs between Windows and *nix
platforms. This patch simplifies it by using an existing
function log_socket_error() which handles most of the platform
specific things. It also provides better error messages.

Change-Id: Iec871c4965b116dc7cfb03c3565bab66c8b41958
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7724
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-10 17:10:07 +00:00
Marek Vrbka 0854c83076 gdb_server: add debug signal reason prints
Added debug prints to show what is the target debug reason. Also added
debug print for Ctrl-C response. This is useful for troubleshooting and
log analysis.

Change-Id: I055936257d989efe7255656198a8d73a367fcd15
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7720
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-06-10 17:00:26 +00:00
iosabi 370bf43fb1 flash/nor: add support for NXP QN908x
This patch adds support for the NXP QN908x family of Bluetooth
microcontrollers, such as the QN9080. This chip features a Cortex-M4F
with 512 KiB of flash on all the available versions, although the
documentation suggests that there might be 256 kB versions as well.

The initial support allows to read, erase and write the whole user flash
area. Three new sub-commands under the new "qn908x" command are added
in this patch as well: disable_wdog to disabled the watchdog,
mass_erase to perform a mass erase and allow_brick to allow programming
images that disable the SWD interface.

Disabling the watchdog is required after a "reset halt" in order to run
the CRC algorithm from RAM when verifying the chip. However, this is not
done automatically on probing or other initialization since disabling
the watchdog might interfere with debugging real applications.

The "mass_erase" command allows to erase the whole flash without
probing it, since in some scenarios the chip can be locked such that no
flash or ram can be accessed from the SWD interface, allowing only to
run a mass_erase to be able to flash the program.

The flashing process allows to compute a checksum, similar to the
lpc2000 driver "calc_checksum" but done over a different region of the
memory. This checksum is required to be present for the QN908x
bootloader ROM to boot, and otherwise is useless. As with the lpc2000
design, verification when using "calc_checksum" is expected to fail if
the checksum was not valid in the image being verified.

This was manually tested on a QN9080, including the scan-view,
AddressSanitizer/UBSan and test coverage configurations.

Change-Id: Ibd6d8f3608654294795085fcaaffb448b77cc58b
Co-developed-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Signed-off-by: iosabi <iosabi@protonmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5584
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-06-10 16:58:35 +00:00
Jacek Wuwer 24b656bff5 jtag/vdebug: adding xtensa config
This change adds the extensa sample target and board configurations.
it removes the obsoleted vd_xtensa_jtag.cfg from targets.

Change-Id: I9d4d25abde46c0b15e5211a973012447872cb405
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7723
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-06-02 21:04:37 +00:00
Jacek Wuwer 146fec5820 jtag/vdebug: using tap_state
This change implements the predefined type tap_state instead of generic
uint8_t in the driver

Change-Id: I3478e8d7b40b961f3ba77711179016cdcc35cd32
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7722
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-06-02 21:04:17 +00:00
Jacek Wuwer 81cf948bf4 jtag/vdebug: fix endianness support
This change fixes endianness support in the driver.

Change-Id: Ida360bb58e988cea0a66fdc79e1610b528846fc4
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7721
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-02 21:01:20 +00:00
Erhan Kurubas 4dc4280555 target/espressif: fix clang scan-build warning
Clang reports that 3rd function call argument is an uninitialized value
file esp32_apptrace.c line:1270

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I73e254d4eb0c6b3152229717d8827d334784ab92
Reviewed-on: https://review.openocd.org/c/openocd/+/7719
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-06-02 21:00:32 +00:00
Wolfram Sang b02cbafcc9 tcl/board/calao-usb-a9g20-c01: add proper initialization
Initialize clocks to max speed and setup SDRAM. NAND support is still
incomplete. Originally found at:

elinux.org/index.php?title=Calao_Atmel_AT91_development_board&oldid=73933

Updated the code from 2011 and improved it a bit.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Change-Id: I83474e07c8de8cc3b5d058029551935549693ef9
Reviewed-on: https://review.openocd.org/c/openocd/+/7578
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-02 20:59:57 +00:00
Dominik Wernberger 00cbf7bd31 Add/Correct STM8L15xx2/3/4/6/8 devices
Change-Id: I83fe1e50821ec15e1853aca96ebb32fe1ff5328f
Signed-off-by: Dominik Wernberger <dominik.wernberger@gmx.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7690
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-02 20:59:36 +00:00
Antonio Borneo 0e526314a1 flash: jtagspi: fix clang build warning
Clang is unable to fully track the content of the array
write_buffer[] and incorrectly complains that it could contain
some uninitialized value.

To help clang to track the execution flow, rewrite the handling of
the buffer by using simpler indexing and by moving away cmd_byte
from the first buffer's element to the variable cmd_byte.

While there:
- fix the error codes returned while parsing the command line and
- use directly command_print_sameline() instead of passing through
  intermediate buffers.

Change-Id: I1969e896887ea3a4abebee057cc04c03005fa57c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7718
Tested-by: jenkins
2023-06-02 20:58:53 +00:00
Antonio Borneo 00603bf156 flash: psoc4: fix clang error
Clang 15.0.7 complains about snprintf output truncation due to
output between 13 and 22 bytes into a destination of size 20.

Increase the size of the buffer.

Change-Id: I0369255ca1bc02a0cf494f765e91a608c960a0d6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7717
Tested-by: jenkins
2023-06-02 20:58:36 +00:00
Bohdan Tymkiv 72131e05e9 cortex_m: fix reading of DCB_DSCSR register
Value in the 'dscsr' variable is garbage until the DAP queue is run.
Postpone evaluation of the 'secure_state' variable. Reading the
core registers in between will execute the DAP queue.

Change-Id: I44959e882dbafb1b9779e813c3d13f3b3dbcd47f
Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7693
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-06-02 20:57:49 +00:00
Antonio Borneo 4a57f3ebb2 target: armv8: fix support of pointer authentication
The registers pauth_dmask and pauth_cmask are not accessible in
AARCH32 mode. Tagging them as 'hidden' is not enough and triggers
error:
	Failed to read pauth_dmask register
while halting the core.

Tag the pauth registers as not existing, unless required by user.

Note: for non existing registers there should be no need to
      allocate their register cache. Let's keep this for a further
      improvement.

Change-Id: Iaa0d006a3d8ee611ee93333ed49a8615a6c94276
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: d0436b0cda ("armv8: Add support of pointer authentication")
Reviewed-on: https://review.openocd.org/c/openocd/+/7712
Tested-by: jenkins
Reviewed-by: Koudai Iwahori <koudai@google.com>
2023-06-02 20:57:05 +00:00
Daniel Anselmi 78688fea98 flash/jtagspi: sending command and setting parameters without probing.
Change-Id: I6b9d90265ca5112b9ab2aae97bb4c6cf3ebc4112
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7432
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2023-05-27 06:44:31 +00:00
Ian Thompson 2dd34cbe0b target/xtensa: add file-IO support
- Manual integration of File-IO support from xt0.2 release
- Verified with applications linked using gdbio LSP
- No new clang static analysis warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: Iedc5f885b2548097ef4f11ae1a675b5944f5fdf0
Reviewed-on: https://review.openocd.org/c/openocd/+/7550
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-27 06:43:59 +00:00
Jan Matyas df12552b5b jtag/adapter: Removed unused include of strings.h
Removed an unused include from src/jtag/adapter.c.

Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Change-Id: Ia5ea0acdfa1c011d7c88decd0f63e8032aafd699
Reviewed-on: https://review.openocd.org/c/openocd/+/7687
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-27 06:43:27 +00:00
Antonio Borneo 8297836170 jtag: rewrite jim_jtag_tap_enabler() as COMMAND_HANDLER
The function is used for commands:
- jtag tapisenabled
- jtag tapenable
- jtag tapdisable

While there, add the missing .help and .usage fields and fix the
incorrect check in jtag_tap_enable() and jtag_tap_disable().

Change-Id: I0e1c9f0b8d9fbad19d09610a97498bec8003c27e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7554
Tested-by: jenkins
2023-05-27 06:42:51 +00:00
Antonio Borneo 5dd047fbbe jtag: rewrite commands 'jtag newtap' and 'swd newdap' as COMMAND_HANDLER
While there:
- fix memory leak in case of error on values tap->chip,
  tap->tapname, tap->expected_ids;
- check for out of memory error;
- fix minor coding style issue;
- add the missing .usage field;
- remove functions not in use anymore.

Change-Id: I1c8c3ffeb324e9eacb919c7e0d94fd72122c9a81
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7431
Tested-by: jenkins
2023-05-27 06:42:01 +00:00
Antonio Borneo da76f8f0b4 target: use unsigned int for timeout_ms
Change the prototype of functions:
- target_run_algorithm()
- target_wait_algorithm()
- target_wait_state()
- struct target_type::run_algorithm()
- struct target_type::wait_algorithm()
to use unsigned int for timeout_ms instead of int.
Change accordingly the variables passed as parameter.

Change-Id: I0b8d6e691bb3c749eeb2911dc5a86c38cc0cb65d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7562
Tested-by: jenkins
2023-05-27 06:41:17 +00:00
Antonio Borneo fe6befbd80 target: rewrite command 'arp_waitstate' as COMMAND_HANDLER
While there, add the missing .usage field and remove the now
unused function jim_target_tap_disabled().

Change-Id: I79afcc5097643fc264354c6c3957786a55f40498
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7561
Tested-by: jenkins
2023-05-27 06:40:40 +00:00
Antonio Borneo 22ababc12e target: rewrite command 'arp_examine' as COMMAND_HANDLER
Change-Id: I8f227b219ca39f198e1e39847ddd36bb9880a328
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7560
Tested-by: jenkins
2023-05-27 06:40:16 +00:00
Antonio Borneo 0f0a4b1452 target: espressif: apptrace: declare a local function as static
The function esp32_cmd_apptrace_generic() is not used outside the
file.

Declare it as static.
Detected through 'sparse' tool.

Change-Id: I08c6b92fb01594320bc3ae6b16067ac4eb51ca12
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7676
Tested-by: jenkins
2023-05-27 06:39:35 +00:00
Erhan Kurubas a0fecd6c41 target/espressif: add system level tracing feature
Produces traces compatible with SEGGER SystemView tool.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: If1057309edbb91ed2cf1ebf9137c378d3deb9b88
Reviewed-on: https://review.openocd.org/c/openocd/+/7606
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-27 06:38:51 +00:00
Antonio Borneo 144d940a8b Revert "target/image: zero-initialize ELF segments up to p_memsz"
This reverts commit 047b1a8fc2.

Commit 047b1a8fc2 ("target/image: zero-initialize ELF segments
up to p_memsz") breaks the backward compatibility introducing some
problem:
- an empty bss segment with paddr in SRAM gets zero filled at load
  but does not survive after a reset, causing verify to fail;
- an empty bss segment with paddr in FLASH causes excessive flash
  usage, which can exceed flash size (causing error) and makes
  flash aging faster.

Revert it while looking for a better implementation.

Change-Id: Iaaf926dafce46a220a5bbe20c8576eb449996d76
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7658
Reviewed-by: Bohdan Tymkiv <bohdan200@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Peter Collingbourne <pcc@google.com>
Tested-by: jenkins
2023-05-27 06:38:12 +00:00
Matthijs Kooijman a5d34202c6 flash/nor/stm32f2x: Show error message when unprotecting OTP
Trying to disable OTP write protection by running e.g. `flash protect
1 0 1 off` would already be rejected with an error code, but that would
result in a generic "failed setting protection for blocks 0 to 1"
message. Now a more specific error message is also printed, telling the
user why it failed.

Change-Id: I6d4974eb0bcd23a0a6cf68ff955d9e59b8b1b06a
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Reviewed-on: https://review.openocd.org/c/openocd/+/7615
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-25 16:25:44 +00:00
Matthijs Kooijman 3733cf1961 flash/nor/stm32f2x: Fix typos in log messages
Change-Id: I0f27e1c64972a58ac146c391761008cdca610afe
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Reviewed-on: https://review.openocd.org/c/openocd/+/7614
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2023-05-25 16:25:09 +00:00
Amaury Pouly 5924d9f30c target/riscv-013: clear sticky error when DMI operation fails
When a DMI operation does not succeed (either because of a timeout
or an error), the specification says that the error in the `op`
field is sticky and needs to cleared by writing `dmireset` in `dtmcs`.
This is already done for timeouts in increase_dmi_busy_delay
but not for errors.

Change-Id: I7c5f27a5cf145511a1a8b64a45a586521e1cbe41
Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org>
Reviewed-on: https://review.openocd.org/c/openocd/+/7688
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-05-25 16:19:12 +00:00
Tarek BOCHKATI 4defa3b1e3 flash/stm32l4x: support STM32C0x devices
this new STM32 series family introduces 2 devices:
STM32C011xx (0x443) and STM32C031xx (0x453)

both devices have 32 Kbytes single flash bank.

Change-Id: I4e890789e44e3b174c0e9c0e1068383ecdbb865f
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6874
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-24 05:28:09 +00:00
Tomas Vanek 5c46a5de49 jtag/drivers/bcm2835gpio: add peripheral_mem_dev config command
The bcm2835gpio driver preferred /dev/gpiomem for access to
memory mapped GPIO control and used /dev/mem as a fallback
only if it couldn't open /dev/gpiomem.

/dev/mem usually requires elevated rights or specific capabilities
of the opening process, so the fallback failed anyway.

Although /dev/gpiomem is the strongly preferred option with respect
to security, there could be also use cases which require /dev/mem
even if /dev/gpiomem is available (e.g. changing the GPIO pad
settings is necessary or testing/debugging OpenOCD).
It was difficult to handle such cases because they required
to block globally the system device /dev/gpiomem
(remove, rename or chmod).

Drop the fallback feature and select the memory device
by 'bcm2835gpio peripheral_mem_dev' configuration command.
Use /dev/gpiomem as a default.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I60e427bda795d7a13d55d61443590dd31d694832
Reviewed-on: https://review.openocd.org/c/openocd/+/7350
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-05-24 05:27:02 +00:00
Tomas Vanek b41b368255 jtag/drivers/bcm2835gpio: extend peripheral_base to off_t
Raspberry Pi 4 with 64-bit kernel and arm_peri_high=1 config.txt
parameter needs peripheral_base 0x47e000000, uint32_t is not enough.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Icedd084e2916657fa4478d452a5eb1e84a45c281
Reviewed-on: https://review.openocd.org/c/openocd/+/7685
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-24 05:25:54 +00:00
Tomas Vanek c164906420 jtag/drivers/bcm2835gpio: don't touch pad setting on /dev/gpiomem
The pads were configured at a wrong memory address
if /dev/gpiomem was mapped.

The pad setting registers are not accessible in mapped /dev/gpiomem,
disable the pads setting if the driver doesn't open /dev/mem.

While on it, do not fail the driver initialization if pad mapping fails
- just emit a warning and work with unchanged pad setting.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I0bce76cade8f7efd75efd9087a7d9ba6511a6239
Reviewed-on: https://review.openocd.org/c/openocd/+/7684
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-24 05:25:28 +00:00
Phil Kirkpatrick 30b0e9af8d tcl/target: Add support for TMS570LC43xx
Added support for TMS570LC43xx series parts.  This uses the pre-existing
ti_tms570.cfg parent config.  In ti_tms570.cfg, dbgbase was changed.
Note 1: Based on the following TI E2E post, the previous dbgbase was wrong
and the new value isn't due to a difference in parts.
Link: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1106954/tms570ls3137-debugging-with-openocd
Note 2: Both the previous dbgbase and the one suggested in the TI E2E post
have the 2 LSB set. In the current version of OpenOCD, this will cause
cortex_a_read_cpu_memory_fast and cortex_a_write_cpu_memory_fast to fail
due to an alignment checks in
mem_ap_<read/write>_buf_noincr()->mem_ap_<read/write>().
In all other uses of dbgbase for arm cortex parts, the 2 LSB are masked
and ignored.

Change-Id: Ic936722e5a4cfc7161b0df1fe3325ee12fd901c6
Signed-off-by: Phil Kirkpatrick <p.kirkpatrick@reflexaerospace.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7682
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-18 10:23:18 +00:00
Daniel Anselmi d4225192df flash/jtagspi: handle error return values where needed
Change-Id: Id46c2799f954fb1d4353f652ba3115796c88936d
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7422
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2023-05-18 10:20:24 +00:00
Antonio Borneo 3c2cc6efb8 pld/virtex2: check error propagated by virtex2_read_stat()
Commit dd9137dc0e ("pld/virtex2: add missing error checks") adds
checks on the return value of several functions, allowing also
virtex2_read_stat() to propagate such returned values.
This triggers an error with clang, as it is now able to identify a
possible execution path that makes uninitialized the variable
status.

Check for the returned value of virtex2_read_stat() before using
the variable status and propagate the returned value.
While there, drop a useless empty string.

Change-Id: I7a23d3f904d4e07cdb6f6dfdf1179889b6b8afb8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7657
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-18 10:18:42 +00:00
Antonio Borneo f20173a01f HACKING: add info on usage of sparse
Add short example on how to run the static analyser 'sparse' on
OpenOCD code.

Change-Id: Ieba8ae926d0e02ca9e6ac619b13b0832136f82cb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7679
Tested-by: jenkins
2023-05-18 10:17:30 +00:00