Commit Graph

12555 Commits

Author SHA1 Message Date
Evgeniy Naydanov 8c82210c43 Merge up to a168c63412 from upstream
There was a bunch of conflicts due to commit
297844cf46 ("target: Use 'bool' data type
in target_{step,resume}")

Resolved by updating the corresponding data types throughout the
codebase.

Change-Id: I9574deeda754b2843b69b4afe80b293d4b357ddd
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-03-05 15:12:05 +03:00
Tomas Vanek a168c63412 configure: better differentiate CMSIS-DAP versions
and keep them together in the configuration summary.

Change-Id: I5937393590ac72f1d499457e67763686a79cadee
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8765
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-01 15:15:53 +00:00
Tomas Vanek d126cdb923 drivers/cmsis_dap: fix misleading error selecting not compiled backend
If one of CMSIS-DAP backends was not compiled (due to
missing library or configure --disable-cmsis-dap) and
Tcl config explicitly selected it, a misleading message
"invalid backend argument to cmsis-dap backend <backend>"
was printed.

Create dummy backends in struct cmsis_dap_backend
to replace a not built backend.

Check for NULL open backend method to distinguish
the backend is dummy.

Rework 'cmsis-dap backend' command to honour dummy
backend. While on it print more helpful error messages.

Change-Id: I8f12aeaaecf19302032870bc232e5135c1d935e7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8760
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-01 15:15:41 +00:00
Jim Paris accbeaed99 gdb_server: fix invalid free
`gdb_service_free` calls `free(gdb_port_next)`, so this needs to be an
allocated string.  Otherwise we trip up detectors like Android's tagged
pointers.

Change-Id: Ib08ea55a38af4e15c4fbae95f10db0e3684ae1af
Signed-off-by: Jim Paris <jimparis@meta.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8768
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-03-01 15:12:36 +00:00
Marek Kraus c986b4dbf2 tcl/target: add Bouffalo Lab BL602 and BL702L chip series support
BL602, BL702 and BL702L series of chips are sharing same architecture,
so they all need same software reset mechanism as well.
Only difference (in terms of configuration needed for JTAG) are TAP ID,
workarea address and size. This is addressed by creating bl602_common.cfg
tcl file, which contains all those common stuff between the chips.
The script is prefixed by bl602, as this was
first *publicly* available chip from Bouffalo with this architecture.

This patch also improves reset mechanism. Previous reset mechanism did not
worked properly when slower JTAG adapter was used (it attached too late).
New reset mechanism uses various methods to keep CPU in BootROM, until
the JTAG adapter does not attach again after reset. Additionally,
we trigger SW Reset by directly using DMI commands to write to register
with system bus method, to avoid getting error about unsuccessful write.
The new method works on both FT232H (8MHz JTAG clock) and
unnamed CMSIS-DAP dongle (1.5MHz JTAG clock).

Change-Id: I5be3694927793fd3f64c9ed4ee6ded2db0d25cae
Signed-off-by: Marek Kraus <gamelaster@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8593
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-03-01 15:11:33 +00:00
Antonio Borneo e1425845ea target: algorithm: change reg_name to const in init_reg_param()
The function init_reg_param() initializes a struct where the
pointer reg_name is assigned to a 'const char *'.

Change the prototype of init_reg_param() to make also the reg_name
parameter as 'const char *'.

Change-Id: Ib999eaa5786ad24aa2a361070162c6f362784758
Reported-by: Marek Kraus <gamelaster@outlook.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8797
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Marek Kraus <gamelaster@outlook.com>
2025-03-01 15:11:03 +00:00
Evgeniy Naydanov fa7e2351c8
Merge pull request #1227 from fk-sc/fk-sc/type-safe-enum
target/riscv: make mem_access_result_t enum type safe
2025-02-26 14:12:34 +03:00
Marc Schink 91c11ea469 rtos: Use lower case filenames
Change-Id: I309c7a649e33f516e28037fef2dc6e574d48c000
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8334
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-22 22:58:23 +00:00
Antonio Borneo 9470853d47 jep106: update to revision JEP106BL Feb 2025
Update to latest available document.

Change-Id: Ic7f31bf74c25aaebc5a2ecc7d5a0e516321bf862
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8766
Tested-by: jenkins
2025-02-22 18:52:48 +00:00
Marc Schink 297844cf46 target: Use 'bool' data type in target_{step,resume}
While at it, adapt data types of related functions and fix some coding
style issues.

Change-Id: I74db9258fc17b1ee8aa446f35ae722ea7c2f67e6
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8524
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-22 18:37:01 +00:00
Tomas Vanek f63b41bbe4 drivers/linuxspidev: fix compilation on Linux older than 3.15
Although the commit [1] which introduced SPI_IOC_WR_MODE32 is 10 years
old, some hardware may enforce old Linux because the vendor
didn't bother with system updates.

Change-Id: I76d0b38c8646b1be329418860916b9f01b90990d
Link: [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/include/uapi/linux/spi/spidev.h?h=linux-3.15.y&id=dc64d39b54c1e9db97a6fb1ca52598c981728157
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8759
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-22 18:33:33 +00:00
Evgeniy Naydanov 0d7d178ed4 flash/nor/rsl10: drop unused `rsl10_info` in `rsl10_protect_check()`
`struct rsl10_info *chip` is only used in `rsl10_protect_check()` in an
assertion triggerring `-Wunused-variable` when compiled with `DNDEBUG`.
Drop it.

Change-Id: Ib302aea742131479f04f32e8fe8a88a3230ae203
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8755
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-02-21 21:20:15 +00:00
Evgeniy Naydanov 583506730d target/adi_v5_swd: drop unused `swd_driver` in `swd_queue_dp_write()`
`struct swd_driver swd` is only used in `swd_queue_dp_write()` in an
assertion triggerring `-Wunused-variable` when compiled with `DNDEBUG`.
Drop it.

Change-Id: Id3283b9e2c36a74cda9fc4afc16da02ac4d62b69
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8754
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-02-21 21:19:37 +00:00
Evgeniy Naydanov f32f17831e
Merge pull request #1231 from en-sc/en-sc/from_upstream
Merge up to 1f3f635693 from  upstream
2025-02-21 13:48:38 +03:00
Farid Khaydari c14d9b6d1d target/riscv: make mem_access_result_t enum type safe
Make mem_access_result_t enum type safe and fix related problems

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Change-Id: Ie5a8c71f3a8ad803f1660114c399c5a4dd0f7414
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-21 13:45:49 +03:00
Farid Khaydari 7335759845 target/riscv: set appropriate memory access result codes
Set appropriate memory access result codes

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Change-Id: Ib73b5a041e5f15aef150b80fdd45f107de19d3a6
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-21 13:44:47 +03:00
Evgeniy Naydanov 56b7830d65
Merge pull request #1194 from fk-sc/fk-sc/merge-read-write
target/riscv: merged read/write functions to one access function
2025-02-21 13:42:19 +03:00
Farid Khaydari dce6182d4b target/riscv: merged read/write functions to one access function
Commit merges read/write functions to access function.
It allows to decrease amount of code duplication.

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-17 19:09:33 +03:00
Evgeniy Naydanov 95cb368095 Merge up to 1f3f635693 from upstream
Conflict in `src/rtos/hwthread.c` between commit
57dbcb1d02 ("Improve a couple of
user/debug messages. (#763)") and commit
7f2db80ebc ("rtos/hwthread: Use
LOG_TARGET_xxx()"). Resolved by using `LOG_TARGET_xxx()` without
changing the message.

Change-Id: I1c1ab321b54f2ef8267f0dca63e16ca8ed6b4655
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-02-17 17:38:44 +03:00
Evgeniy Naydanov fac1412ace
Merge pull request #1218 from fk-sc/fk-sc/ref-mem-acc-res
target/riscv: refactored memory access result codes
2025-02-17 15:13:45 +03:00
Evgeniy Naydanov e1fe15ff76
Merge pull request #1209 from en-sc/en-sc/riscv-info-mtopx
target/riscv: drop `mtopi_readable/mtopei_readable`  `riscv_info` fields
2025-02-17 15:11:08 +03:00
Evgeniy Naydanov dd72250c63
Merge pull request #1208 from en-sc/en-sc/pass-tap
target/riscv: pass `jtag_tap` instead of `target`
2025-02-17 15:09:22 +03:00
Antonio Borneo 1f3f635693 build: drop space after 'angie' folder name
The makefile consider the two white spaces between the end of the
folder name and the '#' character for the beginning of the comment
as part of the folder name.
This cause 'make install' to create a folder named  'angie  ' that
is not welcome on all the OS.

Drop the comment and the space after the folder name.

Reported-by: Liviu Ionescu <ilg@livius.net>
Change-Id: Iadd6803431edb83d0d84f4e4dc6d36b454f912ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 0ed03df6e9 ("amend angie build definitions to fix make dist")
Reviewed-on: https://review.openocd.org/c/openocd/+/8740
Reviewed-by: Liviu Ionescu
Tested-by: jenkins
Reviewed-by: Adrien Charruel <acharruel@nanoxplore.com>
2025-02-16 16:31:39 +00:00
Tomas Vanek ed4e584104 jtag/core: fix segfault when adapter driver has no reset method
xlnx-pcie-xvc and linuxspidev adapter drivers does not implement
the reset method.
Although it is likely both adapters will implement the method in
the near future, avoid segfault and return an error instead.

Change-Id: If8ddf165dbc563cf6d64b2094968151075778ba7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Fixes: commit 8850eb8f2c ("swd: get rid of jtag queue to assert/deassert srst")
Reviewed-on: https://review.openocd.org/c/openocd/+/8735
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:31:06 +00:00
Tomas Vanek 71f92c9446 target/cortex_m: call adapter_deassert_reset() only if srst is configured
Deasserting is useless if reset was not asserted except the very corner
case: changed reset_config during reset processing.

Change-Id: I1d1ea142980d67293daa348a2869b68ffd78d0eb
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8734
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:30:28 +00:00
R. Diez dcf02f46ff Makefile.am: DISTCHECK_CONFIGURE_FLAGS -> AM_DISTCHECK_CONFIGURE_FLAGS
The Automake manual states: "The user can still extend or override
the flags provided there by defining the DISTCHECK_CONFIGURE_FLAGS
variable". Overriding variable DISTCHECK_CONFIGURE_FLAGS in Makefile.am
makes it impossible for the user to do that. I discovered this
when trying to pass --enable-internal-jimtcl to distcheck.

Change-Id: Ibe5b1f23ccf3fbaa21c48b574a1b3f3e9f6fb916
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8724
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:29:00 +00:00
R. Diez 5e4ad24ba6 configure.ac: show vdebug in the config summary
Also enable this adapter by default (auto).

Change-Id: Id011168b93c4cdc602ab78eabfb9a64ca8d8a7df
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8601
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:28:34 +00:00
R. Diez 4deb76fc9d options.c: option --help should yield exit code 0
--help is supported and there is no reason to signal failure

Change-Id: I59fda5336df47ec0b8172541a5fbfe60014bba7e
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8723
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-16 16:28:07 +00:00
Antonio Borneo a71f2b7089 README: report dependency from libjim
The support for jimtcl submodule is deprecated.
Report libjim as a dependency for building OpenOCD.

Change-Id: Iaaeb03dc810451c0d72add281016c81b8cbf7059
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8722
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:27:19 +00:00
Daniel DeGrasse 44e782d55b target/arc: allow reading memory while target runs
There is no reason that ARC can't support reading from memory over JTAG
while the target is executing, and this is in fact required for RTT
support. Remove this check from arc_mem_read and arc_mem_write

Change-Id: I2accfb4b99bf77c5473d133623e0eb0632cb45f6
Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8721
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-16 16:26:42 +00:00
Chris Friedt 9bb0a4558b target/arc: add RTT commands
Since RTT is architecture agnostic, add support for using it on
the ARC architecture as well.

Change-Id: Icd0dec105177a1a224bfb1a63f0be5f03561b166
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8720
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-16 16:24:41 +00:00
Antonio Borneo 9ccd6265dd checkpatch: enable check for new typedefs
We should strictly check for every new typedef.
Let checkpatch detect them and let developer use
	Checkpatch-ignore: NEW_TYPEDEFS
if it's really needed to add a new typedef.
With this change chackpatch will not complain for typedef on
function's type but only on enum, struct, variable's type.

Change-Id: I644a753e97de877d892af3a0219716f022fb1c59
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8710
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:23:22 +00:00
Antonio Borneo 4895a556fa jtag: drop useless typedef tap_state_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I9eb2dc4f926671c5bb44e61453d92880e3036848
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8709
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:23:03 +00:00
Antonio Borneo 0d1932520b jtag: openjtag: drop useless typedef openjtag_tap_state_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I31531b80eaf7f3d0ee6cd22844e60a05c6b748dc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8708
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:22:47 +00:00
Antonio Borneo 54d07de86e jtag: bitbang: drop useless typedef bb_value_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I8800c95f97d2bafe27c699d7d451fb9b54286d99
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8707
Tested-by: jenkins
2025-02-16 16:22:33 +00:00
Antonio Borneo 8a5c331831 jtag: remote_bitbang: drop useless typedef flush_bool_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I122784ddd7b81ccd86da258b08526685c3d70033
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8706
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:22:18 +00:00
Antonio Borneo 894a39eda3 target_request: drop useless typedef target_req_cmd_t
No need to use a typedef for an enum.
Drop it.

Change-Id: Ib5a872b52a6f3d7379d2662e4ff84f32c2bd2ef8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8705
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:22:03 +00:00
Antonio Borneo c50b541471 target: trace: drop useless typedef trace_status_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I31e0e3869c7277bcb14e05cfcac82c9655963ae6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8704
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:21:48 +00:00
Antonio Borneo ff5fb8f610 target: etm: drop useless typedefs
No need to use a typedef for an enum.
Drop etmv1_pipestat_t and etmv1_branch_reason_t.

Change-Id: I03ae4de3efe699d9635fc4f162649f6bedcef4c0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8703
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:21:31 +00:00
Antonio Borneo b023c4c6c5 nor: lpc2000: drop useless typedef lpc2000_variant
No need to use a typedef for an enum.
Drop it.

Change-Id: Iec690ebf6704f346d010cad1e6c65496f7bcc218
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8702
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:21:16 +00:00
Antonio Borneo e325b482b1 target: esp_algorithm: drop useless typedefs
There is no need to use extra typedef for the functions in struct
esp_algorithm_run_data.
Declare the type of the functions in the struct.
Split the comment lines to stay in the line limits.

Change-Id: I0afa6242e57133f8bf1b13ba541abd6b067350b0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8701
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
2025-02-16 16:20:58 +00:00
Antonio Borneo 4140fa2a81 drivers: rshim: drop useless typedef
Use 'struct name' instead of typedef.

Change-Id: Ifff56811f53a260c314c8f5473d368599e0912e6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8700
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:20:42 +00:00
Antonio Borneo 3e4512d62d openocd: drop useless typedef
There is no need to use typedef for the array of functions.
Drop it.

While there, move the declaration outside the function and use the
array size to drop the error-prone sentinel to NULL.

Change-Id: I424964a6ef82ed1a7b27e78fbd19aa9f985b52c7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8699
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:20:30 +00:00
Antonio Borneo 6e39af3b0e rtt: drop useless typedefs
There is no need to use extra typedef for the rtt functions.
Declare the type of the functions in the struct.

Change-Id: Idf2fee6e63ec3b3add38d042bbebe8d74613627c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8698
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:20:12 +00:00
Samuel Obuch 73e9b7898f github/workflow: build jimtcl from sources
JimTCL submodule was deprecated, this patch modifies
the GitHub snapshot action to build from sources instead.

Change-Id: Ie9ab20dbfd70506992d11a91489e82a9fa6e13ce
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8751
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2025-02-12 16:49:24 +00:00
Richard Pasek d09f53a930 driver/linuxspidev: Clear queue on allocation
SWD idle clocks are added to the queue by advancing the queue index
assuming the queue is zeroed. If the queue isn't zeroed, these idle
clocks end up being filled with junk data. Lets clear the queue and
associated buffers on queue allocation.

TEST: Connects successfully and ran the following TCL command:
  dump_image /dev/null 0x20000000 0x42000
  Host: Unnamed Qualcomm SoC with QUPv3 based SPI port
  Target: RT500

Signed-off-by: Richard Pasek <rpasek@google.com>
Change-Id: Ie660c10c27c4d0937ab0629138935ddbf5aeb0ae
Fixes: 83e0293f7b ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8730
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Jonathon Reinhart <jrreinhart@google.com>
Tested-by: jenkins
2025-02-11 11:57:58 +00:00
Tomas Vanek 82277462b9 drivers/linuxspidev: fix use of uninitialized speed variable
Valgrind reported
== Syscall param ioctl(generic) points to uninitialised byte(s)
==    at 0x4ABF990: ioctl (ioctl.S:26)
==    by 0x19D00B: spidev_speed (linuxspidev.c:181)
==    by 0x19D00B: spidev_init (linuxspidev.c:307)

Indeed, spidev_init() uses adapter_get_speed(), it calls
adapter_khz_to_speed() and it returns early without setting
the output parameter if adapter is not initialized.
Of course the adapter initialized flag is not set until
spidev_init() returns.

Simply drop this code as the adapter infrastructure initializes
adapter speed just after spidev_init() return.

Change-Id: I26f011ae59fc942a34d9bb517f467c22f735091d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Fixes: 83e0293f7b ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8733
Tested-by: jenkins
Reviewed-by: Richard Pasek <rpasek@google.com>
2025-02-11 11:56:39 +00:00
Tomas Vanek 7dd875900e drivers/linuxspidev: fix minor memory leak
free() strduped spi_path on quit.
Found by valgrind.

Change-Id: Iaa59c7258c920b5e60d615df790dfe815831b925
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Fixes: 83e0293f7b ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8732
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Richard Pasek <rpasek@google.com>
2025-02-11 11:56:09 +00:00
Marc Schink 7f2db80ebc rtos/hwthread: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() to indicate which target the message belongs to.

While at it, fix some coding style issues.

Change-Id: Iac0296498557a689468a4a19d0bc64f03178a0d0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8727
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-02-11 11:53:59 +00:00
Evgeniy Naydanov 06e673ebc6 target/riscv: drop `mtopi_readable/mtopei_readable` `riscv_info` fields
These fields duplicate the info in the corresponding register cache
entries.

Change-Id: Ic0d264e78c527e92bb069258ce39b614d8f5bcde
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-02-07 12:43:38 +03:00