aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2023-05-27target: use unsigned int for timeout_msAntonio Borneo16-38/+38
Change the prototype of functions: - target_run_algorithm() - target_wait_algorithm() - target_wait_state() - struct target_type::run_algorithm() - struct target_type::wait_algorithm() to use unsigned int for timeout_ms instead of int. Change accordingly the variables passed as parameter. Change-Id: I0b8d6e691bb3c749eeb2911dc5a86c38cc0cb65d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7562 Tested-by: jenkins
2023-05-27target: rewrite command 'arp_waitstate' as COMMAND_HANDLERAntonio Borneo1-42/+27
While there, add the missing .usage field and remove the now unused function jim_target_tap_disabled(). Change-Id: I79afcc5097643fc264354c6c3957786a55f40498 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7561 Tested-by: jenkins
2023-05-27target: rewrite command 'arp_examine' as COMMAND_HANDLERAntonio Borneo1-27/+18
Change-Id: I8f227b219ca39f198e1e39847ddd36bb9880a328 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7560 Tested-by: jenkins
2023-05-27target: espressif: apptrace: declare a local function as staticAntonio Borneo1-1/+1
The function esp32_cmd_apptrace_generic() is not used outside the file. Declare it as static. Detected through 'sparse' tool. Change-Id: I08c6b92fb01594320bc3ae6b16067ac4eb51ca12 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7676 Tested-by: jenkins
2023-05-27target/espressif: add system level tracing featureErhan Kurubas5-17/+954
Produces traces compatible with SEGGER SystemView tool. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: If1057309edbb91ed2cf1ebf9137c378d3deb9b88 Reviewed-on: https://review.openocd.org/c/openocd/+/7606 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-27Revert "target/image: zero-initialize ELF segments up to p_memsz"Antonio Borneo1-34/+20
This reverts commit 047b1a8fc237af480e3bab66a9827a358afd7547. Commit 047b1a8fc237 ("target/image: zero-initialize ELF segments up to p_memsz") breaks the backward compatibility introducing some problem: - an empty bss segment with paddr in SRAM gets zero filled at load but does not survive after a reset, causing verify to fail; - an empty bss segment with paddr in FLASH causes excessive flash usage, which can exceed flash size (causing error) and makes flash aging faster. Revert it while looking for a better implementation. Change-Id: Iaaf926dafce46a220a5bbe20c8576eb449996d76 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Reviewed-on: https://review.openocd.org/c/openocd/+/7658 Reviewed-by: Bohdan Tymkiv <bohdan200@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Reviewed-by: Peter Collingbourne <pcc@google.com> Tested-by: jenkins
2023-05-25flash/nor/stm32f2x: Show error message when unprotecting OTPMatthijs Kooijman1-1/+3
Trying to disable OTP write protection by running e.g. `flash protect 1 0 1 off` would already be rejected with an error code, but that would result in a generic "failed setting protection for blocks 0 to 1" message. Now a more specific error message is also printed, telling the user why it failed. Change-Id: I6d4974eb0bcd23a0a6cf68ff955d9e59b8b1b06a Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl> Reviewed-on: https://review.openocd.org/c/openocd/+/7615 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-25flash/nor/stm32f2x: Fix typos in log messagesMatthijs Kooijman1-2/+2
Change-Id: I0f27e1c64972a58ac146c391761008cdca610afe Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl> Reviewed-on: https://review.openocd.org/c/openocd/+/7614 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2023-05-25target/riscv-013: clear sticky error when DMI operation failsAmaury Pouly1-0/+2
When a DMI operation does not succeed (either because of a timeout or an error), the specification says that the error in the `op` field is sticky and needs to cleared by writing `dmireset` in `dtmcs`. This is already done for timeouts in increase_dmi_busy_delay but not for errors. Change-Id: I7c5f27a5cf145511a1a8b64a45a586521e1cbe41 Signed-off-by: Amaury Pouly <amaury.pouly@lowrisc.org> Reviewed-on: https://review.openocd.org/c/openocd/+/7688 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-05-24flash/stm32l4x: support STM32C0x devicesTarek BOCHKATI2-1/+44
this new STM32 series family introduces 2 devices: STM32C011xx (0x443) and STM32C031xx (0x453) both devices have 32 Kbytes single flash bank. Change-Id: I4e890789e44e3b174c0e9c0e1068383ecdbb865f Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6874 Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-24jtag/drivers/bcm2835gpio: add peripheral_mem_dev config commandTomas Vanek1-8/+37
The bcm2835gpio driver preferred /dev/gpiomem for access to memory mapped GPIO control and used /dev/mem as a fallback only if it couldn't open /dev/gpiomem. /dev/mem usually requires elevated rights or specific capabilities of the opening process, so the fallback failed anyway. Although /dev/gpiomem is the strongly preferred option with respect to security, there could be also use cases which require /dev/mem even if /dev/gpiomem is available (e.g. changing the GPIO pad settings is necessary or testing/debugging OpenOCD). It was difficult to handle such cases because they required to block globally the system device /dev/gpiomem (remove, rename or chmod). Drop the fallback feature and select the memory device by 'bcm2835gpio peripheral_mem_dev' configuration command. Use /dev/gpiomem as a default. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I60e427bda795d7a13d55d61443590dd31d694832 Reviewed-on: https://review.openocd.org/c/openocd/+/7350 Tested-by: jenkins Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-05-24jtag/drivers/bcm2835gpio: extend peripheral_base to off_tTomas Vanek1-6/+10
Raspberry Pi 4 with 64-bit kernel and arm_peri_high=1 config.txt parameter needs peripheral_base 0x47e000000, uint32_t is not enough. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: Icedd084e2916657fa4478d452a5eb1e84a45c281 Reviewed-on: https://review.openocd.org/c/openocd/+/7685 Tested-by: jenkins Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-24jtag/drivers/bcm2835gpio: don't touch pad setting on /dev/gpiomemTomas Vanek1-11/+23
The pads were configured at a wrong memory address if /dev/gpiomem was mapped. The pad setting registers are not accessible in mapped /dev/gpiomem, disable the pads setting if the driver doesn't open /dev/mem. While on it, do not fail the driver initialization if pad mapping fails - just emit a warning and work with unchanged pad setting. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I0bce76cade8f7efd75efd9087a7d9ba6511a6239 Reviewed-on: https://review.openocd.org/c/openocd/+/7684 Tested-by: jenkins Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-18flash/jtagspi: handle error return values where neededDaniel Anselmi1-2/+2
Change-Id: Id46c2799f954fb1d4353f652ba3115796c88936d Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7422 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2023-05-18pld/virtex2: check error propagated by virtex2_read_stat()Antonio Borneo1-2/+6
Commit dd9137dc0e0c ("pld/virtex2: add missing error checks") adds checks on the return value of several functions, allowing also virtex2_read_stat() to propagate such returned values. This triggers an error with clang, as it is now able to identify a possible execution path that makes uninitialized the variable status. Check for the returned value of virtex2_read_stat() before using the variable status and propagate the returned value. While there, drop a useless empty string. Change-Id: I7a23d3f904d4e07cdb6f6dfdf1179889b6b8afb8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7657 Reviewed-by: Daniel Anselmi <danselmi@gmx.ch> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-18rtos: uCOS-III: split struct ucos_iii_paramsAntonio Borneo1-47/+35
The static analyser 'sparse' complains about using sizeof() on a struct that has variable size: src/rtos/uCOS-III.c:267:32: warning: using sizeof on a flexible structure src/rtos/uCOS-III.c:269:41: warning: using sizeof on a flexible structure src/rtos/uCOS-III.c:275:66: warning: using sizeof on a flexible structure The struct ucos_iii_params contains either constants values for different target type and variable fields. The last field is an variable size array, always allocated to UCOS_III_MAX_THREADS items. It's not practical to fix this size because we would get too huge initialization in data segment. Split away from struct ucos_iii_params all the variable fields and put them in struct ucos_iii_private. Add in the new struct a pointer to the selected element of ucos_iii_params_list[] and fix the size of array threads[] to its maximum value; this would be allocated at run-time, avoiding impacts to data segment. Change-Id: I569011a257783d35a8795adbda06e942b4157f2a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7678 Tested-by: jenkins
2023-05-18rtos: move prototype of rtos_thread_packet() in rtos.hAntonio Borneo4-7/+1
The function rtos_thread_packet() is used across rtos and declared locally as extern. Move the prototype of the function in common include rtos.h Change-Id: I50d311b583148a2de628de0997ef1afc9103a70e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7677 Tested-by: jenkins
2023-05-18target: arm_adi_v5: move in include file the declaration of dap_opsAntonio Borneo2-2/+3
The struct containing SWD and JTAG operations are declared as extern in the C file. Mode them in include file arm_adi_v5.h to silent 'sparse' error for global variable definition without declaration in an include file. Change-Id: I59088512c052d5a120c38404a882ed512a68ca02 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7675 Tested-by: jenkins
2023-05-18flash: nand: move in include file the declaration of 'nand_devices'Antonio Borneo2-3/+1
The pointer nand_devices is used in two file. Move the extern prototype in code.h Detected through 'sparse' tool. Change-Id: I7237359fd1a008770a624725cd0b3d8632b4166e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7674 Tested-by: jenkins
2023-05-18server: gdb: export gdb_actual_connections through a functionAntonio Borneo4-12/+17
The internal variable 'gdb_actual_connections' is used by log and by semihosting to determine if there are active GDB connections. Keep the variable local in server's code and only export its value through a dedicated function. This solves the issue detected by 'parse' of the variable defined as global but not declared in any include file. Change-Id: I6e14f4cb1097787404094636f8a2a291340222dd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7673 Tested-by: jenkins
2023-05-18jtag: move declaration outside functionAntonio Borneo2-5/+3
The function jtag_debug_state_machine_() is only used by a static inline function and declared inside it as private. The static analyser 'sparse' complains that the function is defined as global but not cross checked against a prototype in an include file. Move the declaration outside the inline function so it get visible by interface.c, which already includes interface.h While there, change the argument type from 'unsigned' to 'unsigned int' to pass checkpatch check. Change-Id: Ia5dfb92dc4bc6d52ead4f0cb8c68319c83ff85b0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7672 Tested-by: jenkins
2023-05-18hello: include hello.hAntonio Borneo1-0/+1
Let source file to include its file .h to validate the exported prototypes. Detected through 'sparse' tool. Change-Id: I6197f21c857833dafc3d6e3b750c764bf4610abd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7671 Tested-by: jenkins
2023-05-18helper: types: rework h_u32_to_le() and similar for sparseAntonio Borneo1-18/+18
The static analyser 'sparse' complains about values bigger that 255 that gets cast-ed and/or stored in an 8 bit variable. Rework the functions: - h_u32_to_le() - h_u32_to_be() - h_u24_to_le() - h_u24_to_be() - h_u16_to_le() - h_u16_to_be() to avoid all the related warnings, without adding any functional change. Any modern compiler should not be impacted by this. Change-Id: I0b84043600a41c72d0e4ddb3dd195d69e3b2896b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7670 Tested-by: jenkins
2023-05-18target: arm_dpm: with pointers, use NULL instead of 0Antonio Borneo1-1/+1
Don't assign pointer to 0, use NULL. Detected through 'sparse' tool. Change-Id: I34551112ddab9dedf8537c8111d32356c170e7d5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7669 Tested-by: jenkins
2023-05-18pld: fix new warnings from sparseAntonio Borneo2-3/+1
The new committed files add some warning from the static analyser 'sparse': - Don't assign pointer to 0, use NULL. - switch with no cases. Fix them. Change-Id: I2c02d629bd80b71c8e42553be5d9388bb9b6bcd0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7668 Tested-by: jenkins
2023-05-18helper: replacements: rework including replacements.hAntonio Borneo2-8/+11
The static analyser 'sparse' complains that the functions clear_malloc() and fill_malloc() are defined global but not cross checked against a prototype in an include file. Rework replacements.h and replacements.c to let the former be included by the latter. Change-Id: I536393a9c3718dcd7e144cde8f02e169f64c88e0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7667 Tested-by: jenkins
2023-05-18nand: declare exported function in core.hAntonio Borneo2-2/+2
Don't use 'extern' in a C file, but declare the exported function in a H file. This helps validating the function prototype across declaration and use. Detected through 'sparse' tool. Change-Id: I2c22b084fb513f4b3b1b1db96dfbc8fa4bfe7238 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7666 Tested-by: jenkins
2023-05-18jtag: move in interface.h the adapter_driver's declarationAntonio Borneo2-114/+40
The static analyser 'sparse' complains, while compiling a jtag driver, that the struct adapter_driver is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of adapter_driver's declaration in interface.h Drop the preprocessor #ifdef/#endif around the declaration, as it has no effect when the declaration is not used and/or the symbol does not exist. Change-Id: I5b8f5fe48a89ff0ffce38d547c551cd196379fbf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7665 Tested-by: jenkins
2023-05-18pld: validate exported functions by including its own .hAntonio Borneo3-0/+3
Let source files to include its file .h to validate the exported prototypes. Detected through 'sparse' tool. Change-Id: I217c2903fdb19e1a2cce39d2536a903c3d72f3f7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7664 Tested-by: jenkins
2023-05-18pld: move in pld.h the pld_driver's declarationAntonio Borneo2-9/+7
The static analyser 'sparse' complains, while compiling a pld driver, that the struct pld_driver is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of pld_driver's declaration in pld.h Change-Id: I0f917aecc7534c1b51af0afa9b32ccfd33db3511 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7663 Tested-by: jenkins
2023-05-18nor: move in driver.h the flash_driver's declarationAntonio Borneo8-80/+74
The static analyser 'sparse' complains, while compiling a nor driver, that the struct flash_driver is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of flash_driver's declaration in driver.h Fix some incorrect non-const declaration and remove redundant forward declarations. Change-Id: I5e41d094307aac4a57dfa9a70496ff3cf180bd92 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7662 Tested-by: jenkins
2023-05-18nand: move in driver.h the nand_flash_controller's declarationAntonio Borneo2-20/+15
The static analyser 'sparse' complains, while compiling a nand driver, that the struct nand_flash_controller is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of nand_flash_controller's declaration in driver.h While there, drop the unused/commented boundary scan controller. Change-Id: I7dc32cef55be13ba537abe0f4c47b135d837126c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7661 Tested-by: jenkins
2023-05-18rtos: move in rtos.h the rtos_type's declarationAntonio Borneo2-16/+15
The static analyser 'sparse' complains, while compiling a rtos' file, that the struct rtos_type is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of rtos_type's declaration in rtos.h Change-Id: Ia96dff077407a6653b11920519c1724e4c1167a3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7660 Tested-by: jenkins
2023-05-18target: move in target_type.h the target_type's declarationAntonio Borneo3-42/+41
The static analyser 'sparse' complains, while compiling a target's file, that the struct target_type is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of target_type's declaration in target_type.h While there, fix a name clash in stm8.c Change-Id: Ia9c681e0825cfd04d509616dbc04a0cf4944f379 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7659 Tested-by: jenkins
2023-05-13jtag: tcl: show error message when attempting manual "drscan" on a bypassed tapPaul Fertser1-0/+5
To perform any meaningful manipulations with DR the corresponding IR should be set to a relevant instruction, not BYPASS, so warn the user accordingly. Signed-off-by: Paul Fertser <fercerpav@gmail.com> Change-Id: I42580ecd75ae824a4145f6f17f0df9bcf825b50f Reviewed-on: https://review.openocd.org/c/openocd/+/7654 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-05-13jtag: tcl: change drscan usage to show at least one value is requiredPaul Fertser1-1/+1
It's customary to use [] brackets to mean the argument is optional, but drscan requires at least one pair of "num_bits value" so change it to (). In common regular expressions * means 0 or more, and + means 1 or more, so change that too. Signed-off-by: Paul Fertser <fercerpav@gmail.com> Change-Id: Ib15d833bda2aa398ad1345a042f97d91c98dbf66 Reviewed-on: https://review.openocd.org/c/openocd/+/7653 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-13target: rewrite command 'arp_reset' as COMMAND_HANDLERAntonio Borneo2-37/+26
While there, add the missing .usage field and move in target.c the enum nvp_assert. Change-Id: Ia4f2f962887b5a35faeaa4eae128fa2865569b24 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7559 Tested-by: jenkins
2023-05-13target: rewrite command 'arp_halt' as COMMAND_HANDLERAntonio Borneo1-12/+12
While there, add the missing .usage field. Change-Id: I748382cafe08443c458ff1d4e47819610cfbf85c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7558 Tested-by: jenkins
2023-05-13target: rewrite command 'arp_poll' as COMMAND_HANDLERAntonio Borneo1-17/+13
While there, add the missing .usage field. Change-Id: I16e0aeacdaaada09fa77ad29552fa4025eff0c45 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7557 Tested-by: jenkins
2023-05-13jtag: rewrite command 'pathmove' as COMMAND_HANDLERAntonio Borneo1-23/+20
Change-Id: I1f8c6722021f392b1f065484b63a19964db69ad5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7556 Tested-by: jenkins
2023-05-13jtag: rewrite command 'drscan' as COMMAND_HANDLERAntonio Borneo1-114/+65
Reorganize the code to parse the command line only once. Add check for successful memory allocation. Change-Id: Ibf6068e177c09e93150d11aecfcf079348c47c21 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7555 Tested-by: jenkins
2023-05-13openocd: trivial replace of jim-nvp with new nvpAntonio Borneo6-37/+43
For some trivial case only, replace calls to jim-nvp with calls to the new OpenOCD nvp. Change-Id: Ifd9aff32b67748af8ab808e6a6b6e64f5271b888 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7553 Tested-by: jenkins
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-06target: etm: fix check trace statusAntonio Borneo1-1/+1
Current code tests a function pointer against a numeric value that is the same enum type as returned by the pointed function. Clearly the author was willing to call the function and check its returned value. Fix the check by calling the function. Detected through 'sparse' tool. Change-Id: I27d18d26c2c797160a397daa32835c199014b70b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Checkpatch-ignore: GIT_COMMIT_ID Fixes: 237e894805dd ("reworked etm/etb into a generic etm part with trace capture") Reviewed-on: https://review.openocd.org/c/openocd/+/7599 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-05-06jtag: xds110: fix check on malloc() returned pointerAntonio Borneo1-1/+1
Commit 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL instead of 0") incorrectly inverts the check, making the driver's pathmove operation not functional and triggering two clang errors. Fix the check on malloc() returned pointer. Change-Id: If1f220aca67452adbcd3a1c9cf691fc984b16b27 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL instead of 0") Reviewed-on: https://review.openocd.org/c/openocd/+/7656 Tested-by: jenkins
2023-05-05pld/virtex2: add missing error checksDaniel Anselmi1-27/+94
Add error checks after allocating memory. Add error checks for calls to jtag_execute_queue(). Change-Id: I3b63b3d836170244ad3b0566d5bd9d9aabb8e238 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7633 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-05pld: gatemate: fix memory leakAntonio Borneo1-1/+3
When gatemate_set_instr() fails, the array pointed by bit_file.raw_file.data is not freed. Issue identified by OpenOCD Jenkins clang build. Free the array while propagating the error. Change-Id: I2f7fadee903f9c65cdc9ab9b52ccb5803b48a59d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 682f927f8e4e ("pld: add support for cologne chip gatemate fpgas") Reviewed-on: https://review.openocd.org/c/openocd/+/7632 Tested-by: jenkins Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
2023-05-05target: with pointers, use NULL instead of 0Antonio Borneo4-10/+10
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-05-05target: rtt: include rtt.hAntonio Borneo1-0/+1
Let source file to include its file .h to validate the exported prototypes. Detected through 'sparse' tool. Change-Id: I8ae2f8f1fdaea5683e157247463533b17237e464 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7602 Tested-by: jenkins
2023-05-05target: use 'ULL' suffix for long constantsAntonio Borneo4-102/+102
On 32 bit hosts, gcc should consider constants without suffix as 32 bits values. Use the suffix 'ULL' to guarantee it is a 64 bit. Detected through 'sparse' tool. Change-Id: I205ca986968fef9a536f87492d1f6c80e41829f3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7601 Tested-by: jenkins