Commit Graph

10144 Commits

Author SHA1 Message Date
Erhan Kurubas 227577ba76 rtos: remove config.h includes from stackings headers
And add its own header to the rtos_xxx_stackings.c

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I084130fde7ee8645129a7cf60bb7bf59448e2f39
Reviewed-on: https://review.openocd.org/c/openocd/+/7441
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:55:36 +00:00
Tomas Vanek bec6c0eb09 tcl/interface: universal config for all Raspberry Pi models
Speed calibration coeffs are computed from cpufreq/scaling_max_freq
and from the device-tree compatibility information.

Raspberry Pi linux offers /dev/gpiomem for non-root access
to the GPIO registers since ~2016.
Do not configure 'bcm2835gpio peripheral_base' as it is necessary
only if /dev/mem is used - it requires running OpenOCD as root
- it's a security risk so it should be avoided.

The configuration of the GPIO connector (40-pin header)
is factored out and ready to use in interface configuration
for other driver (e.g. linux gpiod).

Mark raspberrypi2-native.cfg as deprecated and redirect
it to raspberrypi-native.cfg

Change-Id: Icce856fb660b45374e94174da279feb51f529908
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7264
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:55:10 +00:00
Tomas Vanek 2dde7e914b jtag/drivers/bcm2835gpio: refactor delays to inline function
No functional change, the delay is unchanged.

Change-Id: I5b5e837d741ac01fc573657357c5fe61ad901319
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7262
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:54:32 +00:00
Tomas Vanek b4dd8dbc37 jtag/drivers/bcm2835gpio: use rounding in delay math
After setting adapter speed to some values, the driver
shows the real speed little bit higher.
Although it does not impose a problem from technical point
of view because the difference is smaller than usual speed error,
it looks at least strange to the user. The documentation reads
that real frequency should be same or lower than requested.

Use proper rounding in speed -> delay and delay -> speed
conversions.

Change-Id: I1831112cc58681875548d2aeb688391fb79fa37f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7261
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:54:17 +00:00
Tomas Vanek 148bc7e215 jtag/drivers/bitbang: avoid mostly harmless glitch on SWDIO
bitbang_swd_exchange(rnw=true,...) calls bitbang_interface->swd_write()
with swdio clamped to 0.
bitbang_swd_write_reg() reads 1 turnaround bit, 3 ack bits
and 1 turnaround by one call to bitbang_swd_exchange()
and then switches SWDIO to output.
AFAIK all bitbang interfaces switch SWDIO GPIO direction immediately
in bitbang_interface->swdio_drive().
The GPIO now drives SWDIO line to the value stored in the output register
which is always zero from previous bitbang_swd_exchange(rnw=true,...).
In case the following data bit (bit 0) is 1 we can observe a glitch
on SWDIO:
                                         _____ out 1 ____
HiZ/pull-up ----\                       /
                 \                     /
                  \______ out 0 ______/
          swdio_drive(true)   swd_write(0,1)

The glitch fortunately takes place far enough from SWCLK rising edge
where SWDIO is sampled by the target, so I believe it is harmless
except some corner cases where the reflected wave is delayed on long
line.

Anyway keeping electrical signals glitch free is a good practice.
To keep performance penalty minimal, pre-write the first data
bit to SWDIO GPIO output buffer while clocking the turnaround bit.
Following swdio_drive(true) outputs the pre-written value
and the same value is rewritten by the next swd_write()
instead of glitching SWDIO.

Change-Id: I72ea9c0b2fae57e8ff5aa616859182c67abc924f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7260
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:53:21 +00:00
N S 20285b9100 jtag/drivers/openjtag: fix annoying num_cycles > 16 warning
The OpenJTAG driver logs "num_cycles > 16 on run test" warning
whenever the JTAG_RUNTEST operation cycle count is larger than 16.

Instead of logging the warning and only running the first 16 TCLK
cycles, remove the warning and queue up multiple operations of up
to 16 cycles each.

Signed-off-by: N S <nlshipp@yahoo.com>
Change-Id: Id405fa802ff1cf3db7a21e76bd6df0c2d3a0fe61
Reviewed-on: https://review.openocd.org/c/openocd/+/7420
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:52:54 +00:00
Andreas Fritiofson d032e7ec8c rtos: Fix constness of struct rtos_type
Change-Id: Iaa89f2ff4036c23f944ffb4f37fe0c7afaf5069b
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6680
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:52:25 +00:00
Andreas Fritiofson 43c8aa28cb rtos: Support rt-kernel
Works for the proprietary rt-kernel from rt-labs.

See: https://rt-labs.com/product/rt-kernel/
Change-Id: Id2c2e292c15fb17eab25e3d07db05014daa2a2b0
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6668
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:52:03 +00:00
Erhan Kurubas cf50bcb841 rtos/nuttx: add stacking info for Espressif Xtensa chips
ESP32, ESP32-S2 and ESP32-S3 stack register offsets added

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ic6215c1d0152853fd08f82cbd3c138c7d62dbc46
Reviewed-on: https://review.openocd.org/c/openocd/+/7443
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:51:15 +00:00
Erhan Kurubas 59bc761d56 rtos: add custom stack read function
This is optional field for the targets which has to implement
their custom stack read function.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Icbc9ed66a052fc2cc0ef67e3ec4d85ab0c2c1b94
Reviewed-on: https://review.openocd.org/c/openocd/+/7442
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:50:50 +00:00
Erhan Kurubas dfbbfac4d7 rtos/nuttx: add riscv stacking info
Tested with Espressif ESP32-C3 MCU

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ia71ace4909f2dc93ddc07a2ec5524cf374f1937c
Reviewed-on: https://review.openocd.org/c/openocd/+/7251
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:50:33 +00:00
Erhan Kurubas 463df95215 rtos/nuttx: move stacking info to the new nuttx stackings file
Other OSes have separate files to keep stack register offsets.
Adding them for NuttX as well will provide a clearer way to expand.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I1428fefefa199a95431f2073c0279dd7028ad8da
Reviewed-on: https://review.openocd.org/c/openocd/+/7250
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:43:02 +00:00
Erhan Kurubas 41231db3f0 doc:usb_adapters: add lsusb dump of esp_usb_jtag
Also, esp_usb_jtag added to the supported driver list of
"adapter serial" command.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie65cbf9b44f5de6d7995102d1a281161468f6103
Reviewed-on: https://review.openocd.org/c/openocd/+/7440
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:22:04 +00:00
N S 98d816ff77 doc: fix broken link to IgnoreHardwareSerialNumber in README.Windows
URL for Microsoft documentation on IgnoreHardwareSerialNumber
   redirects to generic USB driver landing page instead of specific
   article. Update link to go to correct page.

Signed-off-by: N S <nlshipp@yahoo.com>
Change-Id: Ifac6c730a1438242cdfe0a0a2867e043e03ceec7
Reviewed-on: https://review.openocd.org/c/openocd/+/7439
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28 15:17:48 +00:00
Andreas Fritiofson bc3c07b176 stm32f3x: Allow overriding the flash bank size
Same mechanism as in stm32f1x.cfg reused here.

Change-Id: I81f02feb2b655e8259341b22180f3a8b82e28d05
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7438
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-21 22:58:16 +00:00
Marian Buschsieweke 6e67f1473a helper: Add generic little endian CRC32 function
This generalizes the little endian CRC32 function used in the OR1K
target and moves it to a common helper, so that other places do not need
to reinvent the wheel. It is directly used in the OR1K target.

Change-Id: I0e55340281a5bfd80669bb1994f3a96fecc1248a
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7415
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-21 22:57:33 +00:00
Tomas Vanek 92dd917f5a flash/nor/psoc4: drop jtag_poll_mask() from flash write
Polling the target makes no harm during PSoC 4 flash write in the current
OpenOCD code. Don't mask it.

Change-Id: I6625ded0162ee3a96b92188844d0d2d6c30101c2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7162
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-21 22:56:32 +00:00
Antonio Borneo cda39f929e jtag: hla: use generic helper for commands 'jtag newtap' 'swd newdap'
The commands 'jtag newtap' and 'swd newdap' have to work either on
HLA transport and on standard JTAG/SWD. Having a dedicated
implementation for HLA is a non-sense.

Reuse the generic code jim_jtag_newtap() and drop the files
hla_tcl.[ch] as they are now empty.

Change-Id: I9dabbdc2a6f338f23b2fd3ed1a4dc3da0200c080
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7428
Tested-by: jenkins
2023-01-15 15:12:05 +00:00
Antonio Borneo 7a890a8f25 jtag: parse command options in 'swd newdap'
The same code is currently used for commands 'jtag newtap' and
'swd newdap' (plus dapdirect versions), but for SWD case the code
skips the parsing of the command line as not every flag is used.
This has the drawback that syntax errors get unchecked.

Move the check about the transport so the command line get always
parsed even when the corresponding flags are not useful.

Change-Id: I596c3beb04e9e8a9ebe6ee68a61395b679d43b3e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7427
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-01-15 15:11:50 +00:00
Marian Buschsieweke 69571354f4 .gitignore: Add .cache and compile_commands.json
Enhancing the editor / IDE experience with the use of the language
server protocol (lsp) is getting more and more common. The most widely
used lsp implementation for C/C++ outside of Redmond is clangd.

Clangd uses compile_commands.json, that contains the compiler invocation
for each compilation unit, to get the required $CFLAGS to successfully
located header files etc. This is best automatically generated from with
bear on Makefile based build systems. Hence, there is little value in
adding it to the git repo.

In addition, clangd generates cache files in the .cache folder. Again,
there is no reason in tracking it with git.

Change-Id: Ic5165d10aca3a1cc9e9398af9dd2fbf0977608b3
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7414
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:11:21 +00:00
Marc Schink dbb42ca18d flash/nor/stm32l4x: Add revision 'X' and 'C' for STM32U575/585 devices
Change-Id: I4d950dc0a1421036418f2e5c1f0ed8eca86efc1a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7390
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:10:59 +00:00
Antonio Borneo a3ed12401b tcl/target: enable -rtos hwthread
The rtos hwthread has been merged in 2019 with commit 85ba2dc4c6
("rtos/hwthread: add hardware-thread pseudo rtos").
During review in patchset 19 the name of the rtos has been changed
from 'hawt' to 'hwthread'.

Some target config file was already merged ready for hwthread, but
keeping the relevant lines commented and still reporting the old
name.

Enable rtos hwtread to the target that were supposed to use it.
Fix the name of the rtos.

Change-Id: I877862dcdba39f26462bb542bac06d1a5f5f222d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7384
Tested-by: jenkins
2023-01-15 15:10:42 +00:00
Tomas Vanek 5292c7eae9 jtag/drivers/cmsis_dap: prevent conn/discon workaround before line reset
The line reset SWD sequence is used quite often in SWD multidrop mode.
Prevent the ugly connect/disconnect adapter firmware bug workaround
to be called before each line reset.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Id85bff075dba9077e4e501e2cdcfd64d5d9d0531
Reviewed-on: https://review.openocd.org/c/openocd/+/7381
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:10:16 +00:00
Tomas Vanek 630cb5ea4d jtag/drivers/cmsis_dap: speed up long transfers using DAP_TransferBlock
DAP_TransferBlock command saves n - 3 bytes in comparison to DAP_Transfer,
where n is number of transfers.

Use DAP_TransferBlock optionaly to save some USB bandwidth.

The change increases the speed of the write transfer
from 40 KiB/s to 42 KiB/s @ USB FS, adapter speed 1000.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ifde0159cfd44481d2b81b90daa088e731c03e26d
Reviewed-on: https://review.openocd.org/c/openocd/+/7372
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:09:47 +00:00
Tomas Vanek 40bac8e8c4 jtag/drivers/cmsis_dap: improve USB packets filling
DAP write transaction occupies 5 bytes of a command packet.
DAP read transaction needs just one byte in a command packet
and expect 4 bytes in a response.

The fixed maximal number of transactions in a packet caused
packet filling less than optimal.

Compute both command and expected response sizes based on
read or write direction of each transaction.
Run the queue if one of sizes does not fit into a packet.

The change increases the speed of the mostly read transfer
from 36 KiB/s to almost 40 KiB/s @ USB FS, adapter speed 1000
due to reduction of adapter inserted RDBUFF reads.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib70812600eaae0403b8ee8673b6f897348496569
Reviewed-on: https://review.openocd.org/c/openocd/+/7364
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:09:07 +00:00
Tomas Vanek 3d3d35c9b8 jtag/drivers/cmsis_dap: introduce packet_usable_size
USB bulk backend needs to avoid zero sized USB packets
sent after each full sized packed for performance reasons.

HID backend uses fixed size HID reports so the full size
of the report can be utilized.

Introduce packet_usable_size to reflect it.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I34094c9edac5730624480711cbd6aa65883c47c7
Reviewed-on: https://review.openocd.org/c/openocd/+/7363
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:08:49 +00:00
Tomas Vanek 600d0165cc jtag/drivers/cmsis_dap: use unsigned types
Not all variables converted, JTAG part is left as is.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ie9cc890769a2f53cb3a07fd457030e1b98910d44
Reviewed-on: https://review.openocd.org/c/openocd/+/7362
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:08:05 +00:00
Tomas Vanek a9b48a6f48 jtag/drivers/cmsis_dap: use dap parameter instead of cmsis_dap_handle
Replace the direct dereference of cmsis_dap_handle by dereference
of the dap function parameter wherever possible.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I32601dbe0270267642720a8524706aa76d187c3b
Reviewed-on: https://review.openocd.org/c/openocd/+/7361
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:07:51 +00:00
Tomas Vanek 128736d23f jtag/drivers/cmsis_dap: move pending request FIFO
Move all pending request FIFO related variables to
the struct cmsis_dap

Pure refactoring, no functional changes.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I2cea9c1e265ac102ec0f314767b8b9afdcda9ee9
Reviewed-on: https://review.openocd.org/c/openocd/+/7360
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:07:38 +00:00
Antonio Borneo 9dac3b247b tools: add disassembler helper for files .inc
We are moving the binary helpers in files .inc in contrib/loaders/
but we have no support to disassemble them for checking their
content, nor documentation to give any hint.

Add a simple script that uses objdump to directly disassemble a
file .inc
Use Cortex-M settings as default, but provide the flexibility to
reuse the script for any other target CPU.

Change-Id: I12e79580f2936b1622fb7231d9a2484a763ba72a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7347
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-01-15 15:06:56 +00:00
Antonio Borneo 6d76a91521 doc: usb_adapters: add other adapters
Mainly get from web or from OpenOCD users

Change-Id: Id4d6354bc9b6972622adfacf3549c7c3e0549bc2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7298
Tested-by: jenkins
2023-01-15 15:05:15 +00:00
Antonio Borneo e0059dfffa doc: usb_adapters: add lsusb dump of few adapters
Real dumps from adapters I have access to.
Serial numbers have been manually edited but are still consistent.

Change-Id: Iee2d16e09615746e29588f91fdfb77eb9fad4daa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7297
Tested-by: jenkins
2023-01-15 15:05:07 +00:00
Antonio Borneo 2c191ef1da doc: usb_adapters: add container for lsusb dump of adapters
When extending an existing adapter driver, developer has to
carefully avoid to break backward compatibility.
But not all developers have access to many adapters for testing.

Prepare a folder aimed at containing 'lsusb -v' dumps of adapters
to be used as reference.
Add documentation and a simple dump script.

Change-Id: Ia3a9132d65ec8869734721f9605cebcebcf33608
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7296
Tested-by: jenkins
2023-01-15 15:04:57 +00:00
Jian-Hong Pan 9ffda10298 flash/nor, contrib/loaders: move numicro M0 write assembly to contrib/loaders
Simply move numicro M0 flash write assembly to contrib/loaders. Also,
modify corresponding Makefile and generated numicro_m0.inc.

To make the path more general, this patch rename the path
"contrib/loaders/flash/numicro_m4" to "contrib/loaders/flash/numicro" as
well.

Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I9adea24c2b3c97319a9b015cf50257f3d131dc26
Reviewed-on: https://review.openocd.org/c/openocd/+/7346
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:04:25 +00:00
Jian-Hong Pan 63336f4aaf flash/nor, contrib/loaders: move numicro M4 write assembly to contrib/loaders
Simply move numicro M4 flash write assembly to contrib/loaders. Also,
add corresponding Makefile and generated numicro_m4.inc.

Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I22b8be0a245857335b11bd0b538db415fc34748d
Reviewed-on: https://review.openocd.org/c/openocd/+/7343
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:04:06 +00:00
Zale Yu 21b14028ad tcl: add a configuration file for Nuvoton M541 & NUC442/472 series
This patch is picked from the tcl part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
to support the communication with Nuvoton's Cortex-M4 chips: M541 &
NUC442/472 series.

This patch has been tested with Nuvoton's NuTiny-SDK-NUC472 development
board [2].

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705
[2]: https://www.nuvoton.com/export/resource-files/UM_NuTiny-SDK-
     NUC472_EN_Rev1.02.pdf

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I27ac58dd1c98a76e791a4f1117c31060cf5522e8
Reviewed-on: https://review.openocd.org/c/openocd/+/7330
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:03:35 +00:00
Zale Yu d1b0cb2b77 flash: support Nuvoton M541 & NUC442/472 series
This patch is picked from the flash part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
to support flashing Nuvoton's Cortex-M4 chips: M541 & NUC442/472 series.

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I9dc69eccb851df14c1b0ce2f619d7b3da0aa92aa
Reviewed-on: https://review.openocd.org/c/openocd/+/7329
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:03:09 +00:00
Zale Yu 776e045de0 flash/nor/numicro: reorder the parts list
This patch is picked from the flash part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
It reorders Nuvoton MCU part list and spreads out the way to define the
banks' base address & size of the parts.

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I1f21f54dfdf53e5b8ea04d803347d1dbc8c321a0
Reviewed-on: https://review.openocd.org/c/openocd/+/7339
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:01:23 +00:00
Boris-Chengbiao Zhou 11ee500bff target/armv7m: Rename xPSR to xpsr
The org.gnu.gdb.arm.m-system GDB feature defines the name in lowercase
letters.[1] Not adhering to the definition can cause issues with tools
interacting with the GDB which expect the correct casing.

[1]: https://sourceware.org/gdb/onlinedocs/gdb/ARM-Features.html

Change-Id: I0b6584a78f86b053947d79686baad5dac3ec4a00
Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7292
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 15:01:03 +00:00
Tarek BOCHKATI 66da6f20e4 flash/stm32l4x: avoid multiple assignments
Change-Id: I6d8e0fbfa7e05f26295fc22733c65c11f7460b51
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7282
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2023-01-15 15:00:38 +00:00
Jan Matyas 30631224da adapter: Improve three adapter-related prints
- Do not warn the user about adapter speed not being set
  if the selected adapter does not support configurable speed.
  This would be confusing to users.

- Minor reword in the "adapter speed is not selected" warning.

- Print the adapter name in the "adapter doesn't support
  configurable speed" log entry

- Another minor reword: autoselect --> autoselecting

Signed-off-by: Jan Matyas <matyas@codasip.com>
Change-Id: I4c198b547544fd8199921f092153562c5f159134
Reviewed-on: https://review.openocd.org/c/openocd/+/7269
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:57:25 +00:00
Antonio Borneo f2fc23e16b riscv: drop deprecated command 'riscv test_sba_config_reg'
Change-Id: I51c1b1cb3de8cb86ee38280fa3f035f6f7a63dbc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7272
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
Tested-by: jenkins
2023-01-15 14:56:59 +00:00
Antonio Borneo 27edeb7757 riscv: drop deprecated command 'riscv set_prefer_sba'
Change-Id: I546efe4e1a6b673b26cfb4a74b5c3809fecda49c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7271
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
2023-01-15 14:56:50 +00:00
Tomas Vanek 228fe7300c tcl/target: remove rp2040-core0.cfg
rp2040-core0.cfg configuration file was intended for a special adapter
which selects a SWD multidrop target on its own. This means
that rp2040-core0.cfg is totally unusable with a standard SWD
adapter. The file was marked as deprecated in 0.12 release.

The reworked rp2040.cfg can be restricted to use just one core:
  openocd ... -c 'set USE_CORE 0' -f target/rp2040.cfg

Remove the obsoleted config.

Change-Id: Id886471622bb4a8cb83f5c4c3660657407aaaf74
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7326
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:56:27 +00:00
Tomas Vanek 8af4d4462f tcl/target: add SMP mode to rp2040.cfg
Add the variable selected configuration for SMP debug with rtos hwthread.

Use SMP by default.

Change-Id: I1c37d91688a3ab58d65c15686737892965711adc
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7242
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:55:45 +00:00
Tomas Vanek 0979cbc5bc flash/nor/rp2040: make SPI flash ID detection optional
Do not read ID from SPI flash and suppress autodetection
if non-zero flash bank size is configured.

Change-Id: Idcf9ee6ca17f9fa89964a60da7bf11e47b4af5e7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7241
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:55:25 +00:00
Tomas Vanek 59763653c6 target/cortex_m: add SMP support for Cortex-M
Cortex-M support for SMP multicore targets.

This SMP implementation unlike older ones does not act
on the first halted target found. It polls targets
until a SMP group is finished and stores eventual
'halted' events instead of emitting them. As soon as polling
of a group is done, poll proceeds with SMP related tasks.
This approach improves detection of a reason why debug
stopped - a correct reason is detected for all targets,
not only for the first found.
Drawback: SMP target group should be defined in the same
order as the targets were defined.

Obsolete gdb 'J' packet/smp_gdb command core switching is not implemented,
use with rtos hwthread.

Only one core is resumed if debug_execution is requested.

Some ideas taken from Graham Sanderson's [4936]
and src/target/aarch64.c

Added error checking of armv7m_restore_context().

Change-Id: I60f5b79e74b624dc2b5835ff10e38ac2ccb23792
Link: [4936]: target/cortex_m: Add smp support for Cortex M | https://review.openocd.org/c/openocd/+/4936
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7239
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:54:50 +00:00
Tomas Vanek 083100fca3 target/armv7m: check error in armv7m_restore_context()
Return error if arm.write_core_reg() fails.

Change-Id: Ide8f5aa5958532b202dc9f5e13d3250a706d832d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7238
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:54:27 +00:00
Koudai Iwahori d0436b0cda armv8: Add support of pointer authentication
When pointer authentication is enabled, some upper bits of the link
register (LR[63:VA_SIZE]) are used to store a signature. Therefore, GDB
need to remove the signature to get backtraces.
GDB has support of pointer authentication. When pointer authenticaion is
enabled, GDB requests 8-bytes mask to the target to remove the
signature. mask[63:VA_SIZE] should be all set and mask[VA_SIZE-1:0]
should be all cleared. GDB removes the signature by addr&~mask or
addr|mask.
I added a feature to provide the mask for pointer authentication.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: I56fbbf9cc23619b6536ecd326f350c8bf137f322
Reviewed-on: https://review.openocd.org/c/openocd/+/7248
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15 14:51:44 +00:00
James G. Smith d96dc47ef6 src/rtos/eCos : Support per-build configuration specific structure layouts
Extended feature. This is a large patch, but is self-contained to the
eCos support and does not affect any other openocd functionality. It
does NOT affect existing eCos RTOS plugin users where their
applications do not provide the extended symbolic helper
information. If the helper symbols are not available the rtos support
code will behave as before. This "dynamic" functionality is *required*
because eCos does NOT have a fixed/hardwired, known, layout for the
thread descriptor structure. The per-application build eCos
configuration can affect the shape of the thread descriptor structure
(field presence, and hence offsets of subsequent fields) such that
constant values cannot be used to consistently interpret all possible
eCos application configurations. For historical reasons, there is not
yet a consistent namespace for the helper symbols across eCos HALs
hence the support is currently limited to specific architectures
(Cortex-M and ARM/Cortex-A). No new Clang analyser warnings are raised
by this changeset.

Change-Id: Ib3a36877326eeb56595cbca55e21b9e59a59c98a
Signed-off-by: James G. Smith <jsmith@rallysmith.co.uk>
Reviewed-on: https://review.openocd.org/c/openocd/+/6275
Reviewed-by: Alex Schuilenburg <alex.schuilenburg@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2023-01-15 14:51:21 +00:00