Commit Graph

12153 Commits

Author SHA1 Message Date
Antonio Borneo fcda9f1561 gdb_server: fix segfault with GDB command 'flash-erase'
Running the GDB command 'flash-erase' triggers sending the remote
GDB commands 'vFlashErase' (one per flash bank) followed by one
single 'vFlashDone', with no 'vFlashWrite' commands in between.
This causes the field 'gdb_connection->vflash_image' to be NULL
during the execution of 'vFlashDone', triggering a segmentation
fault in OpenOCD.

While parsing 'vFlashDone', check if any image to flash has been
received.

Change-Id: I443021c7a531255b60f2c44c2685e52e3c34b5c8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8164
Tested-by: jenkins
2024-03-09 11:04:29 +00:00
Antonio Borneo 5c395fdef4 mem_ap: fix GDB connections
After commit d9b2607ca0 ("gdb_server: support sparse register
maps"), GDB crashes while requesting the value of 'cpsr' because
the fake register is tagged as not existing.

Change the logic and set all register as existing, while still
limiting the list for the initial GDB request at connect.

Change-Id: I1c4e274c06147683db2a59a8920ae5ccd863e15c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8163
Tested-by: jenkins
2024-03-09 11:03:49 +00:00
Tomas Vanek 61e19349b2 flash/nor/nrf5: use BIT() instead of << operator
for features flags.

Change-Id: I8bff0f5fac41c50180c847f36c6d2a075eca32ca
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8109
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 11:02:43 +00:00
Tomas Vanek cdc569ce3a flash/nor/nrf5: drop nrf5 info command
The command substantially complicates support of nRF53/91
series. It was not even properly ported to nRF52.
The informative value is disputable. Who wants to see
e.g. override trim values for radio or unique device ID?

Drop it and simplify the driver.

Change-Id: Ia7fb20ce2ebf16065705c5d18deaf934e58db426
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8108
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:02:17 +00:00
Tomas Vanek 2db325f539 flash/nor/nrf5: drop nrf5_get_probed_chip_if_halted()
nrf5_get_probed_chip_if_halted() was somewhat bizarre
combination of functions:
- test if the target is halted is appropriate for flash
  erase/write only, certainly not for getting chip info
- getting chip pointer takes place more frequently
  and using one temporary variable for dereference
  makes no harm
- probing chip is useless at all as the flash
  infrastructure always calls auto_probe() before
  entering a flash operation

Replace the function by ordinary and readable code.

Change-Id: Ic31f4e33d8b7b36687be3f40bfd0fe913d17b75f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8107
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:02:02 +00:00
Tomas Vanek 42e4f26a3d flash/nor/nrf5: add missing device types
from nRF52 family.

Change-Id: I6d2b4586700bb4014c0b77dbf4ea26d1b5dc9715
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8106
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 11:01:20 +00:00
Tomas Vanek 85bc328969 flash/nor/nrf5: add missing package codes
from Product Specification of nRF52805, 810, 811
820, 833 and 840.

While on it, rename the table to make sure the codes
are valid for nRF52 series only.

Change-Id: Id8f78fd214c5d345d1769378ae546a6be5a183ba
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8105
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:01:04 +00:00
Tomas Vanek 19ef6634f0 target/nrf51: use PAN #16 workaround in reset-init only
After 'reset run' or 'reset halt' the loaded application
is expected to manipulate RAMON register to workaround
the known silicon errata.

Moreover, writing to RAMON register from 'reset-end' event
after 'reset run' may collide with application intentions.

Use the workaround in 'reset-init' event only to ensure
correct function of target algorithms.

Change-Id: I7d2d92e6805a05a83676edb46b3163ef39b9a7e4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8104
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:00:50 +00:00
Tomas Vanek 1354ff7adf flash/nor/nrf5, target/nrf51: deprecate nrf51 flash driver
Use the newer driver name 'nrf5' instead.

While on it set the unused parameters of flash bank
creation to zero.

While on it remove 2 empty comments.

Change-Id: I9cf0eadc5b696e6c8b7e6aec0ea3345967523e87
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8103
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 11:00:30 +00:00
Tomas Vanek 46ae39c623 flash/nor/nrf5: drop unused part of HWIDs table
While on it update table comment and drop
not working URLs.

Change-Id: I9e21c72aa75a908c644460e43c148d3240c49b2d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8102
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 10:59:58 +00:00
Evgeniy Naydanov 19acf51c39 Merge up to 07141132a7 from upstream
Change-Id: Ibca0c8093e2983e1ee199f79ed777f5136794195
2024-03-07 12:38:57 +03:00
Antonio Borneo 07141132a7 gdb_server: don't send unrequested ACK at connection
On 2008-03-05, before git's age, commit 6d95014674 adds sending
an ACK ('+' char) at GDB connection, before receiving any GDB
remote command that requires to be ACK'ed.

Neither the text added in the commit message ("added ACK upon
connection (send +)") nor in the associated comment ("send ACK to
GDB for debug request") provide an exhaustive explanation for
sending this unsolicited ACK.

This code has never been touched since its introduction.

Analysis of GDB code doesn't show it's required, including old GDB
code.
Running gdbserver (from GDB package) and attaching it with "nc"
shows that gdbserver does not send any ACK to a new connection.
Same for lldb-server.

Drop it!

Change-Id: Id68c352ce44dd85a1ea3d67446e17e2a241ef058
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6768
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Anatoly P <anatoly.parshintsev@syntacore.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-03-02 11:05:47 +00:00
Erhan Kurubas 271c4e5253 target/esp_xtensa_smp: don't use coreid as an SMP index
For the sake of https://review.openocd.org/c/openocd/+/7957

Instead of "coreid", 'target smp' command call order used as
an index

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Iab86b81868d37c0bf8663707ee11367c41f6b96d
Reviewed-on: https://review.openocd.org/c/openocd/+/8162
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-02 11:04:14 +00:00
Luca Rufer 56a7925a1d src/jtag/drivers/mpsse: Add support for new FTDI chip types.
The new FTDI ICs with USB-C Support have different bcdDevice
identifiers. The added bcdDevice identifiers are taken from
the chips datasheet, respectively. The patch was tested with
a FT4232HP IC.
The used bcdDevice IDs can be found in Section 8.1 of the respective
Datasheets:
https://ftdichip.com/wp-content/uploads/2023/09/DS_FT233HP-v1.4.pdf
https://ftdichip.com/wp-content/uploads/2023/09/DS_FT2233HP-v1.4.pdf
https://ftdichip.com/wp-content/uploads/2023/09/DS_FT4233HP-v1.5.pdf

Change-Id: I701083cb72030e398ce1c74310676e13895a77ff
Signed-off-by: Luca Rufer <lucarufer333@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8134
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-02 11:03:10 +00:00
Evgeniy Naydanov ca7d882526
Merge pull request #977 from kr-sc/kr-sc/improve-riscv-controls
target/riscv: Improve riscv controls that manage the set of available triggers for watchpoints
2024-02-27 14:04:49 +03:00
SydMontague 179169268c jtag/commands: fixed buffer overflow
When performing a command queue allocation larger than the default page
size of 1MiB any subsequent allocations will run into an integer under-
flow when checking for the remaining memory left in the current page.
Causing the function returning a pointer past the end of the buffer and
thus creating a buffer overflow.

This has been observed to cause some transfers to Efinix FPGAs to fail,
because another buffer can get corrupted in the process, causing its
respective free() to fail.

Change-Id: Ic5a0e1774e2dbd58f1a05127f14816c8251a7d9c
Signed-off-by: SydMontague <sydmontague@phoenix-staffel.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8126
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-24 13:41:06 +00:00
Sevan Janiyan 33573cda4a src/target/riscv: Help older compilers
find members of a union, nested in struct.
Allows file to be compiled with GCC 4.0

Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk>
Change-Id: Ied68668d3b5f811573a20e11e83aceff268963eb
Reviewed-on: https://review.openocd.org/c/openocd/+/8120
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-24 13:37:49 +00:00
Evgeniy Naydanov 3c88a95d44
Merge pull request #1018 from en-sc/en-sc/from_upstream
Merge up to efdd5e0 from upstream
2024-02-24 15:55:18 +03:00
Evgeniy Naydanov 9f4c0ba1cc
Merge pull request #1014 from riscv-collab/riscv-batch-cleanup
Fixes and cleanup in riscv batch and related functions
2024-02-21 14:40:48 +03:00
Kirill Radkin b6ee137206 driver: Add additional check for count of BYPASS devices
At least one TAP shouldn't be in BYPASS mode

Change-Id: Ic882acbfc9b6a9f4b0c3bb4741a49f3981503c8c
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7741
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-18 18:41:41 +00:00
wangyanwen 9d5117a23e server/gdb-server: fix type error.
Fix flash operation error when addr-width > 32bit
on any 32-bit OS and some 64-bit OS (windows).

Change-Id: I199f1cc5128c45bd0bb155e37acb2fb6325dff88
Signed-off-by: wangyanwen <wangyanwen@nucleisys.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8095
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-02-17 19:44:23 +00:00
Evgeniy Naydanov a5464a54d3
Merge pull request #1016 from tom-van/free-dm-target_list
Free dm and target_list structures
2024-02-16 11:05:22 +03:00
Jan Matyas 9bcbae13e0 Fixes of review findings
Change-Id: Ie9889d995d7b2a6e458ad5f66cc3d990888f54ec
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-15 12:22:42 +01:00
Sevan Janiyan 7145b984a9 portability fix: Switch binary literals to hex
Allows build with legacy toolchains which do not support
C23 nor GCC extension for binary literals.

Change-Id: I742d3a8a86bf16f81421d11c59d3cb155ee17aed
Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk>
Reviewed-on: https://review.openocd.org/c/openocd/+/8123
Tested-by: jenkins
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-02-15 09:00:50 +00:00
Evgeniy Naydanov bfedb42adf Merge up to efdd5e09b1 from upstream
There is an ongoing discussion on
https://review.openocd.org/c/openocd/+/8124 regarding
0d3d4c981a, but AFAIU it seems that the
patch does not break anything.

Change-Id: I48037504300e517b14e41a00f3bf978a16172d14
2024-02-15 11:17:13 +03:00
Kirill Radkin 5003b3642c target/riscv: Improve riscv controls that manage the set of available triggers for watchpoints
Add more debug messages connected with triggers.
Update names for internal flags to make them more clarified.

Change-Id: I5642346ce4a1e9bf79b22cdbf36bd757a7beffa8
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
2024-02-13 16:27:12 +03:00
Jan Matyas 5d4fa0001e
Merge pull request #1011 from en-sc/en-sc/wa-halt-groups
target/riscv: set `state` and `debug_reason` in `riscv_halt_go_all_harts()`
2024-02-12 07:51:22 +01:00
Antonio Borneo efdd5e09b1 jep106: update to revision JEP106BI January 2024
The original documents from Jedec since JEP106BG, do 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: I293173c4527c2eabebdc33a94cd23d3a557a4618
Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8132
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:13:33 +00:00
Evan Hunter 847f1209d6 jtag interfaces: Reduce usage of global for jtag queue
Makes driver interface slightly more flexible.

Change-Id: I2c7f5cb6d014e94a0e6122cbe2f4002c77fbabb9
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Signed-off-by: David Ryskalczyk <david.rysk@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/945
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:12:03 +00:00
N S c6e7e48b05 jtag/drivers: fix reset logic handling in OpenJTAG
The OpenJTAG driver behaviour always forces a system reset on jtag_init.
The driver was incorrectly assuming that when execute_reset is called
with trst set to 1 - perform a software TAP reset, otherwise perform a
system reset when trst is 0.

The set_state call assumes the that OpenJTAG hardware will perform a
software TLR reset if the target state is TAP_RESET. This is not the
case: the published VHDL will simply find the shortest path to TLR and
not perform a fixed 5 cycle operation with TMS held high.

Fix the code to only perform system resets when srst is 1 in
execute_reset and to force a software TAP reset operation in set_state
when the target state is TAP_RESET.

Change-Id: I7e0f76f8491efefff1ccaeb4b1ae16e722d76df4
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8121
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:11:00 +00:00
N S 7295ddc15c jtag/drivers: OpenJTAG standard variant perf improvement
Calculate exact size of response expected from OpenJTAG device so that
openjtag_buf_read_standard doesn't spend 5 retry cycles waiting for
data that isn't coming.

Change-Id: Icd010d1fa4453d6592a1f9aed93fb1f01e0a19da
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8101
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:10:30 +00:00
Antonio Borneo 81a50d3e90 jtag: fix jtag configure command containing events
Commit ea2e26f7d5 ("jtag: rewrite jim_jtag_configure() as
COMMAND_HANDLER") breaks the option -event if it is the last of
the command line.
This can be tested, even without any device connected, through:
	#> openocd -f board/ti_cc26x0_launchpad.cfg
	wrong # args: should be "-event <event-name> <event-body>"

Fix the check on available arguments after -event.

Change-Id: Iec1522238f906d61a888a09a7685acd9ac6442a7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Lorenz Brun <lorenz@brun.one>
Fixes: ea2e26f7d5 ("jtag: rewrite jim_jtag_configure() as COMMAND_HANDLER")
Reviewed-on: https://review.openocd.org/c/openocd/+/8125
Tested-by: jenkins
Reviewed-by: Lorenz Brun <lorenz@brun.one>
2024-02-11 23:07:46 +00:00
Evgeniy Naydanov d0548940f2 helper/log: report the file in `log_output` command
Prior to the change when calling `log_output` without any arguments it
was unclear where the log was redirected.

Change-Id: Iaa3ecea8166f9c7ec8aad7adf5bd412799f719a1
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8071
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:07:09 +00:00
Parshintsev Anatoly 50be4bd267 jtag/mpsse: mpsse_flush should not treat LIBUSB_ERROR_INTERRUPTED as an error
LIBUSB_ERROR_INTERRUPTED can happen when (among other things) OpenOCD
process receives a signal like SIGHUP or SIGINT during a call to libusb.
Such situations are expected and should not be treated as an error - the
affected request should just be restarted.

Without this patch applied if a signal arrives during FTDI initialization
procedure we can easily end up (if JTAG speed is low) in situations like
https://review.openocd.org/c/openocd/+/4767. This happens because
fpsse_flush fails due to LIBUSB_ERROR_INTERRUPTED .

It should be noted that the current usage of mpsse_flush should be
revised since it seems that we don't always process error codes returned
by the function.

Change-Id: Ifa063ce828068f8d0371e1c2a864bb6174649848
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7769
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:04:48 +00:00
N S 3b5ef1726a jtag/drivers: Add vid_pid command to OpenJTAG
Enable support for USB vid and pid combinations other than 0x0403/0x6001
on OpenJTAG adapters.

Change-Id: Ibb5fb14a6f33abbc011dbf3179df20d79ed74a7a
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8100
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:04:13 +00:00
Tomas Vanek 79f519bb63 target/cortex_m: fix couple of comments
Fix obsoleted references to Cortex-M3 from the time
when M3 was the only supported Cortex.

Fix typo.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I6f93265f1b9328fec063fecd819210deb28aaf2c
Reviewed-on: https://review.openocd.org/c/openocd/+/8099
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:02:56 +00:00
Tomas Vanek 226085065b target/cortex_m: drop useless target_halt() call
In 2008 the commit 1829361253 ("define resetting
the target into the halted or running state as an atomic operation.")
introduced the target_halt() call to the end of cortex_m3_assert_reset(),

Checkpatch-ignore: GIT_COMMIT_ID

A year later the commit ed36a8d15d
("... Updated halt handling for cortex_m3")
prevented cortex_m3_halt() take any action in case of TARGET_RESET state.
This narrowed the target_halt() called from cortex_m3_assert_reset()
to setting target->halt_issued and storing a time stamp.

Introducing ocd_process_reset(_inner) made the setting of halt_issued
and halt_issued_time useless. The Tcl function waits for halt
of all targets if applicable.

cortex_m_halt() and also target_halt() does not work as expected
if the cached target state is TARGET_RESET (although the core could
be out of reset and ready to be halted, just have not been polled).
Explicit Tcl arp_poll must be issued in many scenarios.

Remove the useless hack.

Also remove the explicit error return from cortex_m_halt_one()
in case of RESET_SRST_PULLS_TRST and asserted srst. If the communication
with the target is gated by any reset, cortex_m_write_debug_halt_mask()
fails. Propagate the error return of this call instead.

Change-Id: I0da05b87f43c3d0facb78e54d8f00c1728fe7c46
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8098
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:02:29 +00:00
Tomas Vanek 3861699074 target/cortex_m: prevent asserting reset if examine is deferred
In a corner case when debug_ap is not available,
cortex_m_assert_reset() asserts reset to restore
communication with the target.

Prevent to do so on targets with defer_examine,
as such targets need some special handling to enable them
after reset anyway.

The change makes possible to handle a multicore Cortex-M SoC with
an auxiliary Cortex-M core(s) switched of by default
even with 'reset_config srst_gates_jtag'

Change-Id: I8cec7a816423e588d5e2e4f7904c81c776eddc42
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8097
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:02:09 +00:00
Tomas Vanek c83bd69b39 target/riscv: free dm and target_list structures
Fix memory leak on exit.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I6a89ac0c93b11da35b90eec3abcc5b6fd5d1be68
2024-02-11 19:58:21 +01:00
Jan Matyas b7e7a030c1
Merge pull request #1013 from riscv/dm-calls-cleanup
Cosmetic cleanup of dm_*() calls in riscv-013.c
2024-02-09 07:40:14 +01:00
Jan Matyas 4f17df0d1d
Merge pull request #1008 from en-sc/en-sc/from_upstream
Merge up to 9659a9b5e2 from upstream
2024-02-09 07:02:29 +01:00
Jan Matyas 2fc7360190
Merge pull request #1012 from riscv/remove-dead-code-riscv-program-exec
riscv/program: Remove dead code for save/restore of registers
2024-02-09 06:56:39 +01:00
Vincent Fazio 0d3d4c981a jtag/adapter: retype adapter_gpio_config.{gpio,chip}_num
Previously, the gpio_num and chip_num members of adapter_gpio_config
were typed as 'int' and a sentinel value of -1 was used to denote
unconfigured values.

Now, these members are typed as 'unsigned int' to better reflect their
expected value range.

The sentinel value now maps to UINT_MAX as all adapters either define an
upper bound for these members or, in the case of bcm2835gpio, only
operate on a specific chip, in which case the value doesn't matter.

Format specifiers have been left as %d since, when configured, valid
values are within the positive range of 'int'. This allows unconfigured
values to display as a more readable value of -1 instead of UINT_MAX.

Change-Id: Ieb20e5327b2e2e443a8e43d8689cb29538a5c9c1
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8124
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-02-08 21:16:30 +00:00
Jan Matyas d0615e4a12 riscv/program: Removed dead code for restoring register values
Function riscv_program_exec() contains code for restoring
of register values after progbuf execution. This code is
not used anymore by current OpenOCD, and hence removed.

Related discussion can be found under:
https://github.com/riscv/riscv-openocd/issues/982

Change-Id: I4c79bec081522b6fc0d16367cef51ed19a131962
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-06 14:34:22 +01:00
Jan Matyas 67a3d4fe7f Fixes and cleanup in riscv batch and related functions
Fixes:

- Data types of address & data parameters in riscv_batch_add_*()
  and riscv*_fill_dm*() changed to uint64_t and uint32_t.

- Corrected the comparison in riscv_batch_full().

- Corrected assertions in riscv_batch_get_dmi_read_op()
  and riscv_batch_get_dmi_read_data().

Cleanup:

- Simplified calloc() fail handling in riscv_batch_alloc().

- Added explicit NULL assignments in riscv_batch_alloc()
  for clarity and readability. Don't rely on calloc().

- Removed suffix `_u64` from riscv_*_fill_dm*() since it
  does not have any meaning.

- Renamed *dmi_write_u64_bits() to *get_dmi_scan_length()
  which better describes its purpose.

Change-Id: Id70e5968528d64b2ee5476f1c00e08459a1e291d
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-06 14:24:02 +01:00
Jan Matyas 0e03f9bf0a Cosmetic cleanup of dm_*() calls in riscv-013.c
Cleanup, non-functional changes:
- Replaced one call of low-level function dm_op()
  by high-level dm_read().
- Made sure that truncation of values passed to dm_*
  is explicit. (Added explicit casts.)

Change-Id: I1d1b2f29a822b6841373f3313de2b1e96f514116
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-05 13:08:38 +01:00
Tomas Vanek 4593c75f0b jtag/drivers/jlink: make jlink quiet polling target in -d 3
Jlink driver floods the debug log by a message per one poll interval.

Avoid annoying messages, change their logging level to LOG_DEBUG_IO

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I84ea6aa9cdfd44b5985c5393519d1efb7de9530a
Reviewed-on: https://review.openocd.org/c/openocd/+/8116
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-02-04 02:56:09 +00:00
Evgeniy Naydanov 24d71d7a72 target/riscv: set `state` and `debug_reason` in `riscv_halt_go_all_harts()`
If targets are in a halt group, and a target in the group reaches a
breakpoint, the target's state was able to remain `TARGET_RUNNING`.

Addresses issue #1010

Change-Id: I734bc6da71d289c4d05b417c8bf67a7d1a56574f
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-02-02 18:42:26 +03:00
Jan Matyas 87331a82a2
Merge pull request #1006 from en-sc/en-sc/break-ll-revert
Revert "break from long loops on shutdown request"
2024-01-29 17:51:51 +01:00
Evgeniy Naydanov 16e7adbd9c Merge up to 9659a9b5e2 from upstream
Change-Id: I2fda9689d3465b3d8c8f3459b1ed954cb1d70fdc
2024-01-29 14:28:24 +03:00