aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-06-24tcl: add SPDX tagAntonio Borneo54-0/+101
For historical reasons, no license information was added to the tcl files. This makes trivial adding the SPDX tag through script: fgrep -rL SPDX tcl | while read a;do \ sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n }' $a;done With no specific license information from the author, let's extend the OpenOCD project license GPL-2.0-or-later to the files. Change-Id: Ief3da306a6e1978de7dfb8f552f9ff23151f9944 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7030 Tested-by: jenkins
2022-06-24tcl/interface: add SPDX tagAntonio Borneo115-0/+230
For historical reasons, no license information was added to the tcl files. This makes trivial adding the SPDX tag through script: fgrep -rL SPDX tcl/interface | while read a;do \ sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n }' $a;done With no specific license information from the author, let's extend the OpenOCD project license GPL-2.0-or-later to the files. Change-Id: I7bd6a628e9e153fc477cddf9b97087a39ec48aa7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7029 Tested-by: jenkins
2022-06-24tcl/board: add SPDX tagAntonio Borneo319-0/+636
For historical reasons, no license information was added to the tcl files. This makes trivial adding the SPDX tag through script: fgrep -rL SPDX tcl/board | while read a;do \ sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n }' $a;done With no specific license information from the author, let's extend the OpenOCD project license GPL-2.0-or-later to the files. Change-Id: Ibcf7da62e842aafd036a78db9ea2b9f11f79af16 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7028 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-06-24tcl/target: add SPDX tagAntonio Borneo270-0/+535
For historical reasons, no license information was added to the tcl files. This makes trivial adding the SPDX tag through script: fgrep -rL SPDX tcl/ target| while read a;do \ sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n }' $a;done With no specific license information from the author, let's extend the OpenOCD project license GPL-2.0-or-later to the files. Change-Id: I7b2610300b24cccd07bfa6fb5f1266970d5d3a1b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7027 Tested-by: jenkins
2022-06-24tcl: move SPDX tag as first lineAntonio Borneo12-24/+24
The SPDX tag is aimed at machine handling and it's thus expected to be placed in the first line. Change-Id: I3992856eeb28b333c38d010ef286e22471ede263 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7026 Tested-by: jenkins
2022-06-24tcl: replace FSF boilerplate with SPDX tagAntonio Borneo3-42/+6
OpenOCD project is switching to SPDX tags. Replace the few FSF boilerplate in tcl folder. Change-Id: I15b146eb77cc491ed7355178f684f3e76fc763b4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7025 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-06-24tcl/board/steval-idb012v1: fix SPDX tagAntonio Borneo1-2/+3
Remove trailing '.' While there, add newline to file's last line. Change-Id: I3a727e406b572d051b28e17688c24627e55520c4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7024 Tested-by: jenkins
2022-06-24tcl/interface/vdebug: add newline to file's last lineAntonio Borneo1-1/+1
Change-Id: I83d2477e8bc837aeac69bd5d08fdd923fd00a37c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7023 Tested-by: jenkins
2022-06-24semihosting: remove comparison with NULLAntonio Borneo1-1/+1
Commit b9526f140127 ("semihosting: permit redirection of semihosting I/O to TCP") introduces a new comparison with NULL. Remove it. Change-Id: Ice4333c50d16f7592f0ff86b1640217fa42e34f6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: b9526f140127 ("semihosting: permit redirection of semihosting I/O to TCP") Reviewed-on: https://review.openocd.org/c/openocd/+/7031 Tested-by: jenkins
2022-06-24drivers/linuxgpiod: simplify gpio releaseAntonio Borneo1-32/+13
We already have a helper to release the gpio. Extend it to also release its corresponding gpio chip. As side effect, remove comparison with NULL. Change-Id: I47cd446edfaead662d63c3330f25a791b747e882 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7033 Tested-by: jenkins Reviewed-by: Steve Marple <stevemarple@googlemail.com>
2022-06-24drivers/linuxgpiod: release gpio at exitAntonio Borneo1-0/+1
Commit 20adf85f3484 ("linuxgpiod: add SWDIO buffer") introduces an additional gpio for SWDIO direction, but does not release it at driver's exit. Release the gpio at exit. Change-Id: If7ea31f79ffed04af585864e49bcf1f35e118bdd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7032 Tested-by: jenkins Reviewed-by: Steve Marple <stevemarple@googlemail.com>
2022-06-24aarch64: fix handling of 'reset halt'Antonio Borneo1-5/+5
Commit 6c0151623cb0 ("aarch64: add support for "reset halt"") introduces the register setting to halt at reset vector, but: - does not consider the case 'srst_pulls_trst' that makes useless setting the registers as they will be erased by the pulled trst; - does not clean sticky errors in case of 'srst_gates_jtag'. Avoid any register initialization on 'srst_pulls_trst' and move the cleaning of sticky errors in the common block. Change-Id: I6f839f06f7b091e234ede31ec18096e51f017bcd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 6c0151623cb0 ("aarch64: add support for "reset halt"") Reviewed-on: https://review.openocd.org/c/openocd/+/7034 Tested-by: jenkins Reviewed-by: Christian Hoff <christian.hoff@advantest.com>
2022-06-24tcl/target/imx8m: use hwthread rtosAlvin Šipraga1-1/+2
In order to facilitate debugging multiple cores, specify the coreid and the hwthread rtos in the imx8m target configuration. Change-Id: Ibd871517a160ceca15002fb10e27cb793f14d086 Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk> Reviewed-on: https://review.openocd.org/c/openocd/+/7019 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-24semihosting: add custom user command handlerErhan Kurubas2-19/+33
Custom user syscalls can be handled with target events in the TCL scripts. This patch gives another opportunity to handle custom syscalls in the c files. Besides that some utility functions are also exported for the custom handlers. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Ice13d527540a0de0b2a8abda912ae3dcff3834b7 Reviewed-on: https://review.openocd.org/c/openocd/+/6889 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-24esp32s2: convert counted timeout to timeval_msErhan Kurubas1-6/+8
Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Id685408281478cec0e7e886dbedb3b8972c7b652 Reviewed-on: https://review.openocd.org/c/openocd/+/7020 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Ian Thompson <ianst@cadence.com>
2022-06-24target: add Espressif ESP32-S3 basic supportErhan Kurubas10-2/+1035
ESP32-S3 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: I44e17088030c96a9be9809f6579a4f16dbfc5794 Reviewed-on: https://review.openocd.org/c/openocd/+/6990 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-24target: add Espressif ESP32 basic supportErhan Kurubas18-3/+1950
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-24target/board: Add Ampere QS|MQ config filesDaniel Goehring3-0/+597
Add Ampere Altra ("Quicksilver") and Ampere Altra Max ("Mystique") target/board configuration files. The target configuration file supports silicon and emulation. The board configuration files support 1 and 2 socket platforms. Tested on Ampere emulation and silicon Change-Id: I036c798a50624e30ab51ccd2895b6f60c40be096 Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Reviewed-on: https://review.openocd.org/c/openocd/+/5591 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2022-06-24arm_adi_v5: parse ROM tables behind SoC-600 APv1 adapterAntonio Borneo1-3/+12
Arm "CoreSight System-on-Chip SoC-600" specification describes a bridge "Access Port v1 adapter" aimed to "connect a legacy Access Port (AP) ... into an CoreSight Architecture v3 system". A ROM table can be located in the "legacy" part of the system, on the legacy AP behind the APv1 adapter. For the purpose of scanning the ROM tables, consider an ADIv6 SoC-600 APv1 adapter as an ADIv5 AP. Change-Id: I97d42fb77013c1251fb68d0caa4274086bf38a70 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6827 Tested-by: jenkins
2022-06-24adiv6: stay in same AP during dap_lookup_cs_component()Antonio Borneo1-0/+7
Configuration file can specify, as target's debug AP, an AP that contains a ROM table that points, in turn, to other APs. Current code in cortex_a and aarch64 is not able to handle a return from dap_lookup_cs_component() that points to another AP. While it could be interesting to specify 'root' as target's debug AP, drop any found value if it's not in the starting AP. Change-Id: Id206e4fa7a29e9402c8e2393026817b410bbb8bd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6826 Tested-by: jenkins
2022-06-24adiv6: add support for ROM tables in APAntonio Borneo1-31/+141
ADIv6 adds AP that only contain a ROM table in the AP itself, that can point to other AP containing either another AP level ROM table or a MEM-AP to be parsed as usual. Add support for parsing AP level ROM tables. Change-Id: Ic25863b16463b8a6adc3b15e26db7fdca858d6df Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6467 Tested-by: jenkins
2022-06-24adiv6: prepare for AP level ROM tablesAntonio Borneo1-16/+28
ADIv6 adds AP that only contain a ROM table in the AP itself, that can point to other AP containing either another AP level ROM table or a MEM-AP to be parsed as usual. To handle recursive AP access, reorganize the code to: - pass the depth==0 from the command 'dap info'; - print the AP number as first line, adding proper indentation on depth>0; - align the following print with proper indentation. Change-Id: I5b811810c807fc51b307bd60f67817d9de2aa095 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6466 Tested-by: jenkins
2022-06-24arm_adi_v5: add option 'root' to 'dap info' commandAntonio Borneo4-8/+66
On ADIv6 the system root ROM table is found by reading the DAP DP registers BASEPTR0 and BASEPTR1. Add option 'root' to the commands 'dap info' to let it retrieve the system root ROM table's AP from DAP DP, then use such AP for following dump. Change-Id: I1789457a005faa3870c5d14f763378d2f6a5f095 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6462 Tested-by: jenkins
2022-06-24adiv6: use struct adiv5_ap->ap_num to contain the AP base addressAntonio Borneo9-73/+156
ADIv5 DAP can only have 256 AP, while ADIv6 can provide till 2**40 (1,099,511,627,776) AP per DAP. Reuse the field ap_num in struct adiv5_ap, currently used on ADIv5 to hold the ADIv5 AP number (apsel), to contain the ADIv6 AP base address. Convert struct adiv5_ap->ap_num to 64 bit and initialize it to DP_APSEL_INVALID for unused AP. Restrict dap_find_get_ap() to ADIv5 only. To be enhanced. On ADIv6, let dap_get_ap() return an already allocated AP, or allocate and return an unused AP. Add function is_ap_num_valid() and use it. Change-Id: Ib2fe8c7ec0d08393cd91c29fdac5d632dfc1e438 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6461 Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Tested-by: jenkins
2022-06-24adiv6: add low level swd transportAntonio Borneo1-26/+52
During enter in SWD read DP_DPIDR without selecting the register bank through DP_SELECT_DPBANK. Handle the different format of DP_SELECT register. Change-Id: Iea1b8eb6ec94177e16a430d5885595a38e833eeb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6697 Tested-by: jenkins
2022-06-24adi_v5_jtag: extend memaccess_tck to every AP accessKevin Burke1-8/+5
ADIv5 reports: Accessing AP registers or debug resources in connected device through an AP can be subjected to other variable response delays in the system. A debugger that can adapt to these delays and avoid wasting WAIT scans operates more efficiently and provides higher maximum data throughput. The existing code in OpenOCD uses extra tck only for accessing resources through an AP. Extend the use of extra tck also for accessing an AP register. Split from change https://review.openocd.org/6077/ Change-Id: I2082362e098d09f4ba0668e01f5196afc965c8f3 Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6460 Tested-by: jenkins
2022-06-24adiv6: add low level jtag transportKevin Burke5-19/+134
swd and dap-direct are not implemented yet Split from change https://review.openocd.org/6077/ Change-Id: I6d73d8adf6a6090001c5d4771325fb1d63c45e3c Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6459 Tested-by: jenkins
2022-06-24adi_v5_jtag: clear sticky overrun errorAntonio Borneo1-2/+2
By accessing invalid AP in JTAG mode, it's possible to trigger the error: JTAG-DP STICKY ERROR After that the sticky error is never cleared and the whole DAP gets not anymore accessible. Clean-up the sticky error once detected. Change-Id: I8b07263b30f9e46645f0c29084b8f1626e241f45 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6430 Tested-by: jenkins
2022-06-24adiv6: read ROM Table address sizeKevin Burke2-0/+20
Required for parsing ADIv6 ROM tables. Split from change https://review.openocd.org/6077/ Change-Id: I849543b7b4a4455b10bd9fc7da38a37849d71700 Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6458 Tested-by: jenkins
2022-06-24adiv6: re-organize mem_ap registers definitionKevin Burke5-115/+143
ADIv5 MEM-AP registers are a subset of ADIv6 MEM-AP registers and are located at different offset. To prepare for introducing ADIv6, add 'struct adiv5_dap *' as argument to ADIv5 registers macro. Check the ADI version and use the proper address. Both adapter drivers rshim and stlink are ADIv5 only, so let them use the ADIv5 macros only. Split from change https://review.openocd.org/6077/ Change-Id: Ib861ddcdab74637b2082cc9f2612dea0007d77b1 Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6457 Tested-by: jenkins
2022-06-24adiv6: add dap flags -adiv5 and -adiv6Kevin Burke3-1/+38
Add flags to 'dap create' command and set the field adi_version in struct adiv5_dap. Actually only ADIv5 is functional. Other patches are needed to get ADIv6 working. Split from change https://review.openocd.org/6077/ Change-Id: I63d3902f99a7f139c15ee4e07c19eae9ed4534b9 Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6456 Tested-by: jenkins
2022-06-24arm_adi_v5: add ap refcount and add get/put around ap useAntonio Borneo12-69/+330
While an ADIv5 DAP can only have 256 AP, ADIv6 can provide till 2**40 (1,099,511,627,776) AP per DAP. The actual trivial code implementation for ADIv5 (that uses an array of 256 ap in the struct adiv5_dap) cannot be extended as-is to handle ADIv6. The simple array of 256 AP can be reused as a dynamic storage for ADIv6 ap: - the ADIv5 AP number is replaced by the ADIv6 base address; - the index of the array (equal to ADIv5 AP number) has no link to any ADIv6 property; - the ADIv6 base_address has to be searched in the array of AP. The 256 elements in the AP array should be enough for any device available today. In future it can be easily increased, if needed. To efficiently use the 256 elements in the AP array, the code should associate one element of the array to an ADIv6 AP (through the AP base address), then cancel the association when the AP is not anymore needed. This is important to avoid saturating the AP array while exploring the device through 'dap apreg' commands. Add a reference counter in the struct adiv5_ap to track how many times the struct has been associated with the same base address. Introduce the function dap_get_ap() to associate and return the struct, and dap_put_ap() to release the struct. For the moment the code covers ADIv5 only, so the association is through the index. Use the two functions above and dap_find_get_ap() throughout the code. Check the return value of dap_get_ap(). It is always not NULL in the current ADIv5-only implementation, but can be NULL for ADIv6 when there are no more available AP in the array. Instrument dap_queue_ap_read() and dap_queue_ap_write() to log an error message if the AP has reference counter zero, meaning that the AP has not been 'get' yet. This helps identifying AP used without get/put, e.g. code missed by this patch, or merged later. Instrument dap_cleanup_all() to log an error message if an AP has reference counter not zero at openocd exit, meaning that the AP has not been 'put' yet. Change-Id: I98316eb42b9f3d9c9bbbb6c73b1091b53f629092 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6455 Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Tested-by: jenkins
2022-06-10semihosting: fix accessing memory outside the bounds of the fn arrayErhan Kurubas1-3/+5
There is an accsess to wrong index, when arm semihosting_basedir command not used or basedir set to empty string. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I3afa049d74b30496f5c03ba4ef67431784f81bdc Fixes: ce5027ab019a ("semihosting: add semihosting_basedir command") Reviewed-on: https://review.openocd.org/c/openocd/+/7005 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-10tcl: add get_bit & get_bitfield memory helper functionsErhan Kurubas1-0/+19
Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I21506526e3ebd9c3a70a25ba60bf83aee431feb6 Reviewed-on: https://review.openocd.org/c/openocd/+/7016 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-10telnet_server: fix scan-build warningTarek BOCHKATI1-1/+5
fix "Declared variable-length array (VLA) has zero size" warning raised in .../src/server/telnet_server.c:633:2: Change-Id: Icff5228b02790c472b212a86a3849b1a3df98fdb Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6565 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-10arm_adi_v5: check for calloc() return valueAntonio Borneo1-0/+4
In function adiv5_jim_configure() check that calloc() returns a valid allocated memory pointer. Change-Id: I97287e168834693900341add9d9eb9a5f38c55b4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7014 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-06-10drivers/bitbang: silence scan-build warningAntonio Borneo1-1/+2
The array is partially initialized with buf_set_u32(,5,32,), then the rest of the array is read from SWD. But scan-build report the array to have garbage content after the initialization, due to the offset of 5 bit that only inits part of the first byte. Silence the false positive from scan-build by initializing the array. Change-Id: Ic38d50280f67939e3ec5fa05741f66d5f993f8c2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7013 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-06-10arm_adi_v5: fix scan-build warning [3/3]Antonio Borneo1-0/+2
While scan-build complains that dap_p or ap_num_p could be NULL, the current code never passes NULL pointers. Add an assert() to silent scan-build and prevent any further use of the function with incorrect parameters. Change-Id: I656810dddcea61e85d85b13efb114f7607ef837c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7012 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-06-10arm_adi_v5: fix scan-build warning [2/3]Antonio Borneo1-1/+3
Commit d01b3d69ec17 ("arm_adi_v5: separate ROM table parsing from command output [3/3]") introduces a new scan-build warning because removing one return in case of error causes using uninitialized values. Add back the return on error. Change-Id: I10ddc548b756d34aaccc0511f091b4caa5ec271a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: d01b3d69ec17 ("arm_adi_v5: separate ROM table parsing from command output [3/3]") Reviewed-on: https://review.openocd.org/c/openocd/+/7011 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-06-10arm_adi_v5: fix scan-build warning [1/3]Antonio Borneo1-2/+3
Commit 21f7885d1c2a ("arm_adi_v5: separate ROM table parsing from command output [1/3]") introduces a new scan-build warning because continues the execution even when dap_get_debugbase() returns error. The value of 'apid' can be uninitialized: 5th function call argument is an uninitialized value Check the return value and quit on error. While there, remove the useless initialization of 'dbgbase' that was apparently required for the same problem. Change-Id: Iade26a152925ee0f1bf114ed829b94f7ed5b254f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 21f7885d1c2a ("arm_adi_v5: separate ROM table parsing from command output [1/3]") Reviewed-on: https://review.openocd.org/c/openocd/+/7010 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-06-10flash/nor/numicro: remove useless architecture checkTomas Vanek1-7/+0
target_to_armv7m() just returns a type-cast of target->arch_info, so the test has no value. Following target_run_algorithm() checks magic number so we need not worry about execution on mismatched architecture. Change-Id: Ic9892a488a42af1d8e8731eddb39240deeb26020 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6755 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-08telnet_server: fix valgrind errorErhan Kurubas1-10/+1
Error: Uninitialised value was created by a heap allocation at telnet_new_connection (telnet_server.c:227) Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I698a3648be698c93a2395a718ee1ade028226995 Reviewed-on: https://review.openocd.org/c/openocd/+/7006 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-06-04flash/stm32l4x: fix scan-build warningsTarek BOCHKATI1-42/+47
fix "Declared variable-length array (VLA) has zero size" warnings while at there instrument the probe function to ensure the flash bank contains at least 1 sector Change-Id: I3ba0e6345881557ad1aab2d1b41eee438b49fe04 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6470 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-04stlink: manage TCP_BUSY status code when using RW MISCTarek BOCHKATI1-0/+7
Change-Id: I4f9eed3781b549742565a3a8ac5245a4b94ceb53 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6994 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-04target/riscv: drop unused variable registers_initializedTomas Vanek2-8/+0
Change-Id: If7bfe38ac273ce9e54003e003807e128cced1568 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6995 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-04target: add Espressif ESP32-S2 basic supportErhan Kurubas17-1/+5122
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
2022-06-03cortex_a: get rid of not needed log messagesTarek BOCHKATI1-1/+1
when using semi-hosting with cortex_a this LOG_INFO pollutes openocd console, so just reduce the log level of this message. Change-Id: I91aa70492f4e361b25a0e5517d0cf73f2f8ed599 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://gerrit.st.com/c/stm32ide/official/openocd/+/248225 Tested-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6993 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-03github/workflow: enable libftdi based adaptersTarek BOCHKATI2-4/+19
Change-Id: I74b07b21573294dd7d9d3caf41c5755622c77149 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7008 Tested-by: jenkins Reviewed-by: Xiaofan Chen <xiaofanc@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-06-03github workflow: use libusb 1.0.26 and hidapi 0.11.2Tarek BOCHKATI1-2/+2
Change-Id: Id5348f86026330581d4bae081c9ab2bef435e6a6 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6992 Tested-by: jenkins Reviewed-by: Xiaofan Chen <xiaofanc@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-29flash/nor/core, target: don't ask for working mem if no target algoTomas Vanek2-2/+6
The command 'flash erase_check' showed the message 'Running slow fallback erase check - add working memory' even in the case the target didn't implement blank_check_memory. Change return code of target_blank_check_memory() in this case and sense it in default_flash_blank_check() and show a message without a request for working memory. Change-Id: I7cf9bf77742964b4f377c9ce48ca689e57d0882f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6765 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>