aboutsummaryrefslogtreecommitdiff
path: root/src/target/xtensa
AgeCommit message (Collapse)AuthorFilesLines
2024-06-23Remove other '_s' suffix from structsAntonio Borneo2-3/+3
Most of the work is already done by [1]. Remove few more '_s' suffix and also fix some comment referring to the old name of the struct. Link: https://review.openocd.org/c/openocd/+/8340 Change-Id: Ifddc401c3b05e62ece3aa7926af1e78f0c4a671e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8341 Reviewed-by: zapb <dev@zapb.de> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-05-11target/xtensa: avoid IHI for writes to non-executable memoryIan Thompson1-8/+81
For MPU configs, determine memory access rights by probing protection TLB. Issuing IHI without execute permissions can trigger an exception. No new clang static analyzer warnings. Change-Id: Iea8eab5c2113df3f954285c3b9a79e96d41aa941 Signed-off-by: Ian Thompson <ianst@cadence.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8080 Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16target/arm_adi_v5: introduce adiv5_jim_configure_ext()Tomas Vanek1-11/+1
Allow direct pointer to struct adiv5_private_config for targets with adiv5_private_config inside of a bigger private config container. Use it instead of the private_config pointer toggling hack in aarch64.c Allow optional use of -dap parameter and use it instead of the static variable hack in xtensa_chip.c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I7260c79332940adfa49d57b45cae39325cdaf432 Reviewed-on: https://review.openocd.org/c/openocd/+/8138 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-28target: get_gdb_arch() accepts target via const pointerEvgeniy Naydanov2-2/+2
The function in question does not need to change target state. It is a target-type-dependant function, however, IMHO, it is safe to assume that any target type would not need to change type-independant state of a target to figure out the arch. Change-Id: I607cb3aee6529cd5a97bc1200a0226cf6ef43caf Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8093 Tested-by: jenkins Reviewed-by: Jan Matyas <jan.matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-21target/xtensa: update COMMAND_HELPER output to use command_print() APIIan Thompson1-48/+38
- Change LOG_ERROR() and LOG_INFO() output, but keep DEBUG and WARNING levels for verbosity - Update command error code return values and remove unnecessary output. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I4ef0753b3a56be02716f2db43a7d4370a1917237 Reviewed-on: https://review.openocd.org/c/openocd/+/8076 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13target/xtensa: enable xtensa algo supportianst3-4/+23
- Add extra error checking - Cache PS; lower PS.INTLEVEL to allow breakpoint trigger (LX) - Xtensa algo support functional on LX per functional flash driver - Test on NX via manual algo validation Change-Id: Ie7cff4933979a0551308b382fa33c33c66376f25 Signed-off-by: ianst <ianst@cadence.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8075 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Tested-by: jenkins
2024-01-13target/xtensa: extra debug info for "xtensa exe" failuresianst1-6/+12
- Read and display EXCCAUSE on exe error - Clean up error messages - Clarify "xtensa exe" documentation Signed-off-by: ianst <ianst@cadence.com> Change-Id: I90ed39f6afb6543c0c873301501435384b4dccbe Reviewed-on: https://review.openocd.org/c/openocd/+/7982 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-12-10target/xtensa: add algorithm supportErhan Kurubas2-0/+234
Add arch level functions to execute code on the target Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I089095de6fcb9906ad8c84232fa52a77db5e6185 Reviewed-on: https://review.openocd.org/c/openocd/+/7771 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-12-01target: clarify usage of `coreid`Evgeniy Naydanov1-1/+1
By definition in `target/target.h`, `coreid` is not a unique identifier of a target -- it can be the same for targets on different TAPs. Change-Id: Ifce78da55fffe28dd8b6b06ecae7d8c4e305c0a2 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7997 Tested-by: jenkins Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-11-24target: remove `target_number`Evgeniy Naydanov1-1/+1
Change-Id: Id36e5ad2967303483392fd2670630289ecde2553 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7998 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2023-11-18xtensa: update XDM register map for TRAX supportianst3-0/+117
- Include additional debug module registers - Add translation function for DM reg addr -> ID - Add DM read/write commands Signed-off-by: ianst <ianst@cadence.com> Change-Id: If95419d24a9f27a40fa695c8c15326cdfd127ef1 Reviewed-on: https://review.openocd.org/c/openocd/+/7973 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-08-08breakpoints: use 64-bit type for watchpoint mask and valueParshintsev Anatoly1-1/+1
This patch changes data types of watchpoint value and mask to allow for 64-bit values match that some architectures (like RISCV) allow. In addition this patch fixes the behavior of watchpoint command to zero-out mask if only data value is provided. Change-Id: I3c7ec1630f03ea9534ec34c0ebe99e08ea56e7f0 Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7840 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-07-29target: fix messages and return values of failed op because not haltedTomas Vanek1-5/+5
Lot of messages was logged as LOG_WARNING, but the operation failed immediately. Sometimes no error message was logged at all. Add missing messages, change warnings to errors. Sometimes ERROR_TARGET_INVALID was returned. Some command handlers returned ERROR_OK! Always return ERROR_TARGET_NOT_HALTED. While on it use LOG_TARGET_ERROR() whenever possible. Prefix command_print() message with 'Error:' to get closer to LOG_TARGET_ERROR() variant. Error message was not added to get() and set() methods of struct xxx_reg_type - the return value is properly checked and a message is logged by the caller in case of ERROR_TARGET_NOT_HALTED. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I2fe4187c6025f0038956ab387edbf3f461c69398 Reviewed-on: https://review.openocd.org/c/openocd/+/7819 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-27target/xtensa: add file-IO supportIan Thompson5-3/+247
- Manual integration of File-IO support from xt0.2 release - Verified with applications linked using gdbio LSP - No new clang static analysis warnings Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: Iedc5f885b2548097ef4f11ae1a675b5944f5fdf0 Reviewed-on: https://review.openocd.org/c/openocd/+/7550 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-13xtensa: fix build with gcc 13.1.1Antonio Borneo1-1/+1
New gcc does not understand that the variable 'restore_ms' is set to 'true' only when the variable 'ms' is assigned in static int xtensa_write_dirty_registers(...) { xtensa_reg_val_t ms; bool restore_ms = false; ... if (...) { ms = regval; restore_ms = true; ... } ... if (restore_ms) { USE(ms); } ... } and complains about possible use of uninitialized variable 'ms'. Sadly initialize 'ms' to zero to hide this false positive. Change-Id: I1fb3949070c8abbf4aa45a740f0ca2fdb753d4fa Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7681 Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Reviewed-by: Ian Thompson <ianst@cadence.com> Tested-by: jenkins
2023-05-05target: with pointers, use NULL instead of 0Antonio Borneo1-2/+2
Don't assign pointer to 0, use NULL. Don't pass 0 ad pointer argument, pass NULL. Detected through 'sparse' tool. Change-Id: I806031d2ae505fa5f0accc6be1936d48cd365ca4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7604 Tested-by: jenkins
2023-03-18target/xtensa: add NX supportIan Thompson3-52/+370
- Manual integration of NX support from xt0.2 release - No new clang static analysis warnings Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I95b51ccc83e56c0d4dbf09e01969ed6a4a93d497 Reviewed-on: https://review.openocd.org/c/openocd/+/7356 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15target/xtensa: remove needless target_was_examined checkErhan Kurubas1-2/+1
In any case flag will be set as examined. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I5177ee656f726a807269e2f4725223f50e49e855 Reviewed-on: https://review.openocd.org/c/openocd/+/7231 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-21target/xtensa: remove redundant call for `TARGET_EVENT_HALTED`Erhan Kurubas1-2/+6
`xtensa_do_step` is invoked from `xtensa_prepare_resume` to silently step over BP/WP before resuming. For example; in the case of WPs (DEBUGCAUSE_DB), in the current implementation `xtensa_do_step` will generate one more `TARGET_EVENT_HALTED` after the original one caused by WP itself. This patch moves the halted event cb call after the step is done successfully. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I9048e14fb316dc124847a42cfaefb1f76b5ce53e Reviewed-on: https://review.openocd.org/c/openocd/+/7274 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-15target/xtensa: fill register number field in the cacheErhan Kurubas1-0/+6
Currently 'number' field is zero in the register cache and this causes an issue on `rtos get_thread_reg_list` calls. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Iaef11e01f55d012969bbc1933f82847d5e02fec5 Reviewed-on: https://review.openocd.org/c/openocd/+/7246 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/xtensa: pass correct buffer on read memory retryErhan Kurubas1-2/+2
Read values must be at albuff so that can be copied to buffer on function exit. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I74a533e8f12f1002ca06a98a7c7cd928552b4cc5 Reviewed-on: https://review.openocd.org/c/openocd/+/7226 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/xtensa: rename pc and ps macro namesErhan Kurubas1-8/+9
Actually they are the base of epc and eps Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I4f43b9609a9929399fb5d3fa0203efc8a98e94c9 Reviewed-on: https://review.openocd.org/c/openocd/+/7227 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-23target/xtensa: fix final clang analyzer warningIan Thompson1-15/+9
Reworked xtensa_read_memory() logic to always allocate and initialize working buffer with sufficient padding. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: Ia9ab53336537adebf99f8156f481ca8279a7cd5d Reviewed-on: https://review.openocd.org/c/openocd/+/7211 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2022-09-18openocd: fix SPDX tag format for files .cAntonio Borneo3-3/+3
With the old checkpatch we cannot use the correct format for the SPDX tags in the file .c, in fact the C99 comments are not allowed and we had to use the block comment. With the new checkpatch, let's switch to the correct SPDX format. Change created automatically through the command: sed -i \ 's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \ $(find src/ contrib/ -name \*.c) Change-Id: I6da16506baa7af718947562505dd49606d124171 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7153 Tested-by: jenkins
2022-09-18target/xtensa: invalidate register cache on resetIan Thompson1-2/+5
Resolves issues where registers are accessed when poll() logic is inactive or has not yet been triggered. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: If7a4d00938fb188b008325249627f7773c3484c5 Reviewed-on: https://review.openocd.org/c/openocd/+/7197 Tested-by: jenkins Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-18target/xtensa: fix clang analyzer warningIan Thompson1-9/+12
Reworked xtensa_queue_exec_ins_wide() logic to properly handle endian issues while executing arbitrary instructions. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I5752dd254ce8b8822886ffc7edecaa242a93cce8 Reviewed-on: https://review.openocd.org/c/openocd/+/7198 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-17target/xtensa: populate PS correctly during fetchIan Thompson1-0/+3
Read PS from EPS[debuglevel] during fetch such that it reflects the correct value when read via telnet (not just via gdb_server). Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I8504f68989bc6d5fe451a8cb69d01c86f4ec0100 Reviewed-on: https://review.openocd.org/c/openocd/+/7195 Tested-by: jenkins Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-13target/xtensa: fully initialize buffers for PWRSTAT readIan Thompson1-2/+2
Read buffer is sized for 32-bit APB version of PWRSTAT/PWRCTL registers. Initialize to zero so 8-bit JTAG register mirrors are accurate. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I81310649fa7180893d0188aab3c8a14315aaea0a Reviewed-on: https://review.openocd.org/c/openocd/+/7183 Tested-by: jenkins Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-13xtensa: make local symbols staticAntonio Borneo2-6/+6
Symbols that are not exported should be declared as static. Change-Id: Ieb627f7f896e4663b0d5b18c4ab1853b39d23d03 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7167 Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Reviewed-by: Ian Thompson <ianst@cadence.com> Tested-by: jenkins
2022-09-13target/xtensa: fix step state transitionIan Thompson1-3/+4
For some configurations, notably on DAP systems, resolve issue where single-stepping does not always transition into the HALTED state. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I053f4eaffad8c3228878ba87580ada640e4bd2fe Reviewed-on: https://review.openocd.org/c/openocd/+/7150 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-13target/xtensa: enable DAP/SWD for generic xtensaIan Thompson4-37/+191
- Enable ADIv5 DAP systems via JTAG or SWD transport - Select correct PWRCTL/PWRSTAT bits for XDM/APB Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I5894210c804f85075da868d0cfc6fb20b589d99f Reviewed-on: https://review.openocd.org/c/openocd/+/7144 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-08target/xtensa: virtualize XDM registersIan Thompson4-239/+390
Use indirect enum IDs to access XDM registers in preparation for supporting both NAR (JTAG) and APB (DAP). No new clang static analysis warnings. Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: I0b742fe4661ff3cf609454b8650493d141a1e1ff Reviewed-on: https://review.openocd.org/c/openocd/+/7143 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-27target/xtensa: fix clang analyzer warningsIan Thompson1-0/+2
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-21target/xtensa: fix clang analyzer warnings and gcc12 build errorsErhan Kurubas1-3/+6
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-20target: add generic Xtensa LX supportIan Thompson6-1031/+2462
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-15target/espressif: remove author lines from esp32xx and xtensa filesErhan Kurubas4-9/+2
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-07-23openocd: src/target: replace the GPL-2.0-or-later license tagAntonio Borneo5-65/+10
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: I255ad17235ff1e01bf0aa4deed4d944e1d693ddb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7071 Tested-by: jenkins
2022-07-23openocd: build: add SPDX tagAntonio Borneo1-0/+2
Add the SPDX tag to makefiles, configuration scripts and tcl files present in the folders under src/ Change-Id: I1e4552aafe46ef4893d510da9d732c5f181784a4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7051 Tested-by: jenkins
2022-06-24target: add Espressif ESP32 basic supportErhan Kurubas1-0/+10
ESP32 is a dual core Xtensa SoC Not full featured yet. Some of the missing functionality: -Semihosting -Flash breakpoints -Flash loader -Apptrace -FreeRTOS Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I76fb184aa38ab9f4e30290c038b5ff8850060750 Reviewed-on: https://review.openocd.org/c/openocd/+/6989 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-04target: add Espressif ESP32-S2 basic supportErhan Kurubas6-0/+4069
ESP32-S2 is a single core Xtensa chip. Not full featured yet. Some of the missing functionality: -Semihosting -Flash breakpoints -Flash loader -Apptrace -FreeRTOS Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I2fb32978e801af5aa21616c581691406ad7cd6bb Reviewed-on: https://review.openocd.org/c/openocd/+/6940 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins