Commit Graph

7717 Commits

Author SHA1 Message Date
Erhan Kurubas 6db57051d0 flash/nor/kinetis: fix clang scan-build error format-truncation
kinetis.c:994:61: error: '%u' directive output may be truncated
writing between 1 and 10 bytes into a region of size 4
[-Werror=format-truncation=]

tested with scan-build-14

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I72d141a3f8e19ca3596beee2be8434fc8492946f
Reviewed-on: https://review.openocd.org/c/openocd/+/7140
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2022-09-01 10:22:29 +00:00
Tim Newsome a527112dae target/riscv: Update with latest encoding from riscv-opcodes
This gets us a clearly labeled BSD-3-Clause header, which should be
compatible with OpenOCD and Fedora, and also make it clear what the
license actually is.

See https://github.com/riscv/riscv-openocd/pull/710,
https://github.com/riscv/riscv-openocd/pull/713, and
https://github.com/riscv/riscv-openocd/pull/717.

Change-Id: I992b4f3bb230edb9f281e2278dd41c712098ed4c
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7084
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:21:15 +00:00
Ian Thompson d93ac5482a target/xtensa: fix clang analyzer warnings
Scan-build of target/xtensa/ has no clang analyzer warnings from xtensa source files.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I11a125c923ece9a6fd0d9ee1698f742f88ee5cab
Reviewed-on: https://review.openocd.org/c/openocd/+/7141
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:20:44 +00:00
Tomas Vanek d8307ed460 flash/nor/bluenrg-x: clarify target algo stack usage
While on it rename misleading write_algorithm_sp to write_algorithm_stack
and change messages referring 'stack pointer' instead of stack.

No functional change.

Change-Id: Ibb9897d3f01734812ed0f8bc8cd43b935a573f8a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7132
Tested-by: jenkins
Reviewed-by: Salvatore Giorgio Pecorino <salvatore-giorgio.pecorino@st.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:20:14 +00:00
Tomas Vanek 50f80530c5 flash/nor/nrf5: don't misuse uint32_t for refcount
Change-Id: I016fc9ae037fae75528850d35da059d1db5a4d45
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7131
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:19:46 +00:00
Tomas Vanek 60396be0b6 flash/nor/core: remove unused define
FLASH_MAX_ERROR_STR is not used since commit 815c3b3533
(merged in ~2008)

Change-Id: Ic117a2e3d22235c31dc14533b6564ebf5a13ae58
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7121
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:19:16 +00:00
Antonio Borneo 7bc4e67d65 flash/nor: remove empty command definitions
The value of struct flash_driver::command can be NULL when the
flash driver does not need to add any new command.

Remove empty command definitions.

Change-Id: I5413967d4069030234469822d24e9825425ae012
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7120
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2022-08-27 16:18:46 +00:00
Tomas Vanek 63cc08f6a2 server/server: fix target timer timing
The change 6363: Call poll at a fixed interval
switched from target_call_timer_callbacks() to target_call_timer_callbacks_now().
It breaks the timing as all timers callbacks are called every time
one timer expires.

Revert this part of change and use target_call_timer_callbacks().

Fixes: db16b3dc5b (Call poll at a fixed interval.)
Change-Id: Ib5b7774de9694d40c55d2a4109d0d1582fc5008b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7118
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:17:53 +00:00
Tomas Vanek 65de7c95f4 jtag/drivers/kitprog: workaround serious firmware problem
Since commit 88f429ead0
5321: target/cortex_m: faster reading of all CPU registers
debugging with a kitprog adapter freezes at debug entry.

How to replicate:
 openocd -f interface/kitprog.cfg -f target/psoc4.cfg

Connect to telnet server.
Make sure the target is running:
 resume

Halt the target:
 halt

Without this patch OpenOCD freezes in kitprog_hid_command()
in library call hid_write().

Reduce the number of SWD transactions sent in one USB bulk write
as a workaround, simply use shorter buffer.
For details see the comment in src/jtag/drivers/kitprog.c

Change-Id: I0116894d5ebf1655f6011f0d35acdbbc178cd48c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7107
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:15:01 +00:00
Tomas Vanek 1a9d991619 jtag/drivers/kitprog: use HID read timeout
Use hid_read_timeout() instead of hid_read().
Improve error messages.

Change-Id: Ia75b4fcd610442ab926bc454341f928d59843fcf
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7106
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:14:47 +00:00
Paul Fertser 66d6f9a1e7 flash: nor: use binary prefixes consistently
When printing memory sizes standard ISO 80000-1 prefixes should be used.
Also a space should be added between any number and its unit according
to papers publication rules.

Change-Id: Id1d35e210766b55c201de4e80ac165d8d0414d0a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6416
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27 16:13:07 +00:00
Erhan Kurubas f77c919cf4 target/xtensa: fix clang analyzer warnings and gcc12 build errors
Fix Unused code	Dead assignment at line 657
Fix Memory error Double free at line 2851
Fix Memory error Memory leak at line 2530
Fix error: 'a3' may be used uninitialized at line 758
Fix error: '%04x' directive writing between 4 and 8 bytes
into a region of size 5 at line 2471

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I0382a622bc7c4108a335fd741816577e79240397
Reviewed-on: https://review.openocd.org/c/openocd/+/7137
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-21 22:04:07 +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
MadSquirrel 5f46de2e79 server/gdb_server: Add support for default thread, use by IDA debugger
Signed-off-by: Benoit Forgette <benoit.forgette@ci-yow.com>
Change-Id: Ia3a29a3377be650f0ccad11a0ae4fe4da78b3ab4
Reviewed-on: https://review.openocd.org/c/openocd/+/7017
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-20 15:29:12 +00:00
Erhan Kurubas c271958850 target/semihosting: drop type casting from semihosting->result
Also used type helper (PRId64) to specify format of int64_t

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I594863eab594aff621c26fefcc69a1872e9730ee
Reviewed-on: https://review.openocd.org/c/openocd/+/7111
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-20 15:27:46 +00:00
Erhan Kurubas 9cd714cd14 target/espressif: remove author lines from esp32xx and xtensa files
Some files have author info some doesn't. For the consistency we removed all.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie6f1ec012302e3a954c75c5106f12820722cb715
Reviewed-on: https://review.openocd.org/c/openocd/+/7104
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:27:10 +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 903f2e92a1 drivers/am335xgpio: Release resources on error and when quitting
The /dev/mem file descriptor can be closed without invalidating the
mappings so close as soon as possible.

munmap() all memory, either on error or from quit.

Change-Id: I9466edd2f43791e64f2dce719957c67728f3ec06
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7047
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:24:46 +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
Tomas Vanek 3adbec9aab target/cortex_m: supress historical reset detection
The S_RESET_ST sticky bit is reset after DHCSR read.
It is set at power-on reset and keeps active until the debuger reads DHCSR.

Ignore S_RESET_ST at the very first read after OpenOCD start
and suppress possibly misleading message "external reset detected"
if we cannot guarantee the reset happened recently.

While on it add a TODO comment.

Change-Id: I15217c2ca6f69ac97aff8be86bce67cba94a42cd
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7109
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:23:57 +00:00
Ian Thompson 48db36f436 gdb_server: custom target-specific GDB queries
Provide a customizable hook for handling target-specific GDB queries

Valgrind-clean, no new Clang analyzer warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I684a259ed29f3651cbce668101cff421e522f79e
Reviewed-on: https://review.openocd.org/c/openocd/+/7082
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:23:05 +00:00
Ian Thompson d9b2607ca0 gdb_server: support sparse register maps
Add additional error handling for targets where gaps may exist in reg_list[]

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I65232429e2de08f5d54eeca53aea0db8ce2b58af
Reviewed-on: https://review.openocd.org/c/openocd/+/7103
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:22:40 +00:00
Antonio Borneo e282d20832 openocd: prevent target polling during 'init'
The command 'init' causes the execution of few lower level
commands, e.g. 'target init', and switches from command mode
COMMAND_CONFIG to COMMAND_EXEC, with an intermediate switch back
to mode COMMAND_CONFIG.

A timed target polling can occur during the execution of 'init'
and the target's status can trigger the execution of some events.
E.g. if a target has been left halted by a previous execution of
OpenOCD, the first poll will find the target halted, calling the
corresponding 'halted' event.
The event handler can use commands that can only be executed in
mode COMMAND_EXEC. If the poll happens while OpenOCD is in mode
COMMAND_CONFIG, the triggered handler will fail.

Prevent the target polling to operate during the execution of the
'init' command.

Change-Id: Ia435a5d2039be9b247e2336616dab53ed5d983ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7007
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2022-08-15 13:22:18 +00:00
Antonio Borneo 0d56f379b5 target: add API to temporarily mask target polling
The same flag 'jtag_poll' is currently used as local data for the
command 'poll' and to temporarily mask the target polling.
This can cause unexpected behavior if the command 'poll' is
executed while polling is temporarily masked.

Add a new flag 'jtag_poll_en' to hold the temporarily mask
condition and keep 'jtag_poll' for the 'poll' command only.

While there, change the initial assignment of 'jtag_poll' using
the proper boolean value.

Change-Id: I18dcf7c65b07aefadf046caaa2fcd2d74fa6fbae
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7009
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2022-08-15 13:22:06 +00:00
Ian Thompson c3138e2d80 gdb_server: add "not supported" Z-packet reply
GDB remote serial protocol specifies breakpoint/watchpoint packet
responses can be an empty string to indicate the specified breakpoint
type is not supported.  Add support for this response alongside existing
"OK", "E NN" replies.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: Iaf6280e4c936eb95a92bc80cc74d451ebb328dc3
Reviewed-on: https://review.openocd.org/c/openocd/+/7102
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:21:37 +00:00
Erhan Kurubas 9903203d73 adapter: run at default speed when clock speed not specified
Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I8d2db4a1f618790907265a45d28a212551800b6c
Reviewed-on: https://review.openocd.org/c/openocd/+/7004
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-08-15 13:19:45 +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
Tim Newsome 81aa5fd6b4 target/riscv: Update debug_defines.h.
This one doesn't have the license in there, which means now it's
acceptable to GPLv2 again.

See https://github.com/riscv/riscv-openocd/pull/711

Change-Id: I8ba27801172ffa955470d2627fa656cad282ee99
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7087
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-15 13:18:16 +00:00
Tomas Vanek 0e1fe03f4b target/arm: do not expose 'arm reg', 'arm mcr/mrc' commands on Cortex-M
Tcl commands 'arm reg', 'arm mcr/mrc' do not work on M-profile based devices.
Isolate them from 'arm core_state' and 'arm disassemble' and do not chain
them from armv7m_command_handlers.

Change-Id: I2c6befdf82575e95cf05ed158ab5e6faa1a182c3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7101
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2022-08-14 14:43:48 +00:00
Tomas Vanek dee7b7d821 target/arm: make 'arm core_state' command compatible with Cortex-M
Tcl command 'arm core_state' was exposed even on Cortex-M devices.
However it returned message "Unsupported Command" without error status
on such device.

Set the only possible arm->core_state ARM_STATE_THUMB in armv7m init.
Block setting core_state to arm on Cortex-M.

Change-Id: I9525553ac8863a6cf77bbacbcd57e354b6cfe1ca
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7100
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2022-08-14 14:43:04 +00:00
Tomas Vanek b6dad912b8 target/cortex_m: prevent segmentation fault in cortex_m_poll()
If a Cortex-M MCU become unresponsive during a debug session and
re-examination fails to find MEM-AP, debug_ap pointer is set to NULL.

Eventual call of cortex_m_poll() dereferences debug_ap.

Check debug_ap validity at the begin of cortex_m_poll().

Change-Id: I9519f48760c91a48a9e5e8c34634d247098cb14a
Fixes: 35a503b08d (arm_adi_v5: add ap refcount and add get/put around ap use)
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7108
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-14 12:11:26 +00:00
Tomas Vanek cae0c8b32b target: move parent target structs just after common_magic
Just a cosmetic refactoring.

Change-Id: I7fbc05324e346fafc98d1b42691d33d3d8fbd04e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7003
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2022-08-14 12:10:14 +00:00
Tomas Vanek ea49b2b2a2 target/aarch64: fix duplicate common magic
AARCH64_COMMON_MAGIC was same as CORTEX_A_COMMON_MAGIC, probably copy pasta.
Define unique AARCH64_COMMON_MAGIC

Change-Id: Ie30e0028453a1fce5624ecad9bf73d5ac3791281
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6997
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-14 12:03:23 +00:00
Tomas Vanek 8f299c6aec target: consolidate existing target/algo common_magic
Unify common_magic type to unsigned int
Move common_magic to be the first member of the struct
Add unsigned specifier to xxx_COMMON_MAGIC #defines

Change-Id: If961d33232698529514ba3720e04418baf6dc6fe
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6996
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-14 12:02:38 +00:00
Tomas Vanek b76a7a82b2 flash/nor: remove useless setting of bus_width and chip_width
The flash/nor subsystem uses bus_width and chip_width for CFI
external flash only. Drop setting these values for internal flash.

Change-Id: I64e79ab38b6e39e845ff96fbf4f60145e3b9690a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7098
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-08 20:52:50 +00:00
Tomas Vanek 2aaa991a50 target: fix unaligned return of target_get_working_area_avail()
The working area allocation routines use 4 byte word alignment.
In the corner case the size of the working area is not aligned,
target_alloc_working_area() of size = target_get_working_area_avail()
will fail because the size gets aligned up and does not fit to the area
which size is aligned down.

Align down the result of target_get_working_area_avail() to cope with that
corner case.

While on it use fancy ALIGN_... macros instead of bitwise and operator.

Change-Id: Ia2a1e861c401c2c78fe6323379a3776fb4f47b06
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7096
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-08 20:51:52 +00:00
Martin Hierholzer d9940cc9bc fix Kinetis 100 MHz rev 1.x programming
Kinetis 100 MHz rev 1.x devices have no SMC and hence need different
checking of the run mode. Details about the differences between rev 1.x
and 2.x of the Kinetis 100 MHz series can be found here:
https://www.nxp.com.cn/docs/en/application-note/AN4445.pdf

Signed-off-by: Martin Hierholzer <martin.hierholzer@desy.de>
Change-Id: Ib705385a931275159bdae9b31caecc6ec9c0da1e
Reviewed-on: https://review.openocd.org/c/openocd/+/7015
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-08-08 20:50:20 +00:00
Frank Dischner df75bbd536 FreeRTOS: Always show current execution before scheduler is started
Previously, if the target was halted before the FreeRTOS scheduler was
started but after at least one thread was created, then the current thread
would be set to whichever thread had the highest priority. In addition to
being misleading, because that thread is not actually running, it can
cause issues with gdb. For instance, breaking somewhere before the first
thread is created will show the current execution as the current thread,
but stepping over a line that creates a thread will cause the current
thread to switch to the newly created thread and the current execution to
disappear. The sudden disappearance of the current execution thread seems
to confuse some versions of gdb.

With this change, the value of xSchedulerRunning is checked to determine
whether the scheduler has been started. If it hasn't, then a fake
'current execution' thread is always created and made the current thread.

Signed-off-by: Frank Dischner <frank.dischner@gmail.com>
Change-Id: Ide0fe7d9ffb9fac95cee4c805735f434c7c4934d
Reviewed-on: https://review.openocd.org/c/openocd/+/6935
Tested-by: jenkins
Reviewed-by: Asier Llano <asierllano@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-08-08 20:48:10 +00:00
Frank Dischner 3865c411ee FreeRTOS: Fix current thread ID when no threads are active
When there are no rtos threads or none are active, a fake thread with
ID 1 is created for the current execution, but the current thread ID was
never set to this new fake ID. This would lead to an incorrect attempt to
read stacked registers for this fake thread. Explicitly setting the
current thread ID to the fake ID ensures that the registers are read from
the core instead of calling freertos_get_thread_reg_list.

Signed-off-by: Frank Dischner <frank.dischner@gmail.com>
Change-Id: I694509a0e01df089429b20ff1b879fc0592b532d
Reviewed-on: https://review.openocd.org/c/openocd/+/6934
Tested-by: jenkins
Reviewed-by: Asier Llano <asierllano@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-08-08 20:47:52 +00:00
Tomas Vanek b5dd6faf8d target/cortex_a: remove unused CORTEX_A15_COMMON_MAGIC
Change-Id: I7dddc6cb7b0ee8aec7164998f1124b522e899f3d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reported-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7099
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-08 19:59:22 +00:00
Tomas Vanek a895b3b4f8 flash/nor/fespi: check target type
Change-Id: I09d3ed20966b37ec63c09c2ffb0e0403986cb1e5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7001
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
2022-08-01 08:59:39 +00:00
Tomas Vanek 1d8bc131a6 target/riscv: add common magic
Add common_magic member to struct riscv_info.
Introduce is_riscv() helper.

Change-Id: I1af05988ad869342ba5dc6d4d0ba0ec6a8bf7bc7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6999
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
2022-08-01 08:58:02 +00:00
Tomas Vanek 82e76262a1 target/riscv: use struct riscv_info instead of typedef riscv_info_t
Make the main RISC-V structure more compliant with OpenOCD coding style.
Other typedefs remains as is.

Change-Id: I5657ad28fea8108fd66ab27b2dfe1c868dc5805b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6998
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
2022-08-01 08:57:41 +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 49cf334e98 target/semihosting: export semihosting_common_handlers[] from header file
Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I4add0c1dc7888497ee90fd02754607a16434b66f
Reviewed-on: https://review.openocd.org/c/openocd/+/7075
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-07-23 14:00:26 +00:00
Antonio Borneo 32f517f5d6 helper/jim-nvp: avoid camelcase error by deprecated API
Commit b8e18d292e ("helper/jim-nvp: comply with coding style
[1/2]") tags as deprecated the old CamelCase API of jim-nvp, so
that old patches already in gerrit or in user's local git can
still build while dumping a deprecated message.

So far, we have not found any such case, so the deprecated API can
be safely dropped in preparation of v0.12.0-rc1.

Drop the compile flag "-Wno-error=deprecated-declarations" and the
deprecated API.

Change-Id: I52ce47eda69a51c2dd29aac15f16e285492d89b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7052
Tested-by: jenkins
2022-07-23 13:59:49 +00:00
Antonio Borneo 757895b8ee openocd: src: replace SPDX to remaining files
With most of the files already processed through scripts, replace
manually the license to the few remaining files.

Change-Id: I3c7131e66b89ddad482f1074b5be5a9a69fdf6fd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7073
Tested-by: jenkins
2022-07-23 13:59:25 +00:00
Antonio Borneo b86f296ac6 openocd: src: replace the GPL-2.0-or-later license tag
Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I30cd66ac7d737f1973c68fdbb841ffcf00e917c4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7072
Tested-by: jenkins
2022-07-23 13:59:13 +00:00