aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
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
2023-05-05rtos: with pointers, use NULL instead of 0Antonio Borneo1-4/+4
Don't compare pointers with 0, use NULL when needed. Don't assign pointer to 0, use NULL. Detected through 'sparse' tool. Change-Id: Ifa81ba961c0d490cc74880b4a46b620e6358f779 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7598 Tested-by: jenkins
2023-05-05helper: with pointers, use NULL instead of 0Antonio Borneo3-8/+8
Don't compare pointers with 0, use NULL when needed. Don't assign pointer to 0, use NULL. Don't pass 0 ad pointer argument, pass NULL. Detected through 'sparse' tool. Change-Id: I3f867cb9c0903f6e396311e7b3970ee5fb3a4231 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7597 Tested-by: jenkins
2023-05-05helper: util: include util.hAntonio Borneo1-0/+1
Let source file to include its file .h to validate the exported prototypes. Detected through 'sparse' tool. Change-Id: I5de107b4f8a468f0e37f06171f5f0c3c0546db1a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7596 Tested-by: jenkins
2023-05-05flash: with pointers, use NULL instead of 0Antonio Borneo3-3/+3
Don't compare pointers with 0, use NULL when needed. Don't pass 0 ad pointer argument, pass NULL. Detected through 'sparse' tool. Change-Id: I118554fffde41c94cea9e1201ea941ff3c1ee762 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7595 Tested-by: jenkins
2023-05-05flash: nor: add static to local symbolsAntonio Borneo2-3/+3
Add static type to symbols that are not used elsewhere. Detected through 'sparse' tool. Change-Id: I2bdac5d2b06a6dbed5c27bfdb1cf36eee90ad823 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7594 Tested-by: jenkins
2023-05-05flash: nor: use 'ULL' suffix for long constantsAntonio Borneo2-11/+11
On 32 bit hosts, gcc should consider constants without suffix as 32 bits values. Adding a cast to convert it to 64 bits should not be enough. Use the suffix 'ULL' to guarantee it is a 64 bit. Detected through 'sparse' tool. Change-Id: If6be35bd3cbbc7c3a83e0da1407e611f07ff6e06 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7593 Tested-by: jenkins
2023-05-05jtag: drivers: with pointers, use NULL instead of 0Antonio Borneo14-32/+40
Don't compare pointers with 0, use NULL when needed. Don't assign pointer to 0, use NULL. Don't pass 0 ad pointer argument, pass NULL. While there, check for return value from malloc(), replace an assert() with a LOG_ERROR(), drop a useless cast. Detected through 'sparse' tool. Change-Id: Ia7cf52221b12198aba1a07ebdfaf57ce341d5699 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7592 Tested-by: jenkins
2023-05-05jtag: drivers: add static to local symbolsAntonio Borneo3-4/+4
Add static type to symbols that are not used elsewhere. Detected through 'sparse' tool. Change-Id: I00e151d2466868a5dce028444d326defb80d4826 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7591 Tested-by: jenkins
2023-04-30pld: add support for cologne chip gatemate fpgasDaniel Anselmi6-0/+282
Change-Id: I0bf5a52ee6a7f0287524619114eba0cfccf6ac81 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7565 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30pld: add support for gowin devicesDaniel Anselmi6-0/+639
Change-Id: Idd1a09514bbbbe0a7b54d69010f6c2f91215fd1d Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7368 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30pld: add support for altera/intel devicesDaniel Anselmi17-49/+809
Change-Id: I7977d39c9037ae71139f78c8d381f5f925dc3489 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7355 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30pld: add support for efinix devicesDaniel Anselmi7-0/+291
Change-Id: Ie520e761c255ba1335d5aab9c6825f160a6151d9 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7288 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-04-30pld: add support for lattice certus devicesDaniel Anselmi9-10/+383
Change-Id: Ic50a724e5793000fca11f35ba848c2d317c3cbab Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7398 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30pld: add support for lattice ecp5 devicesDaniel Anselmi8-3/+297
Change-Id: Ib2f0933da3abe7429abca86d6aaa50ad85ce72c7 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7397 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-04-30pld: add support for lattice ecp2 and ecp3 devicesDaniel Anselmi13-1/+1044
Change-Id: I29c227c37be464f7ecc97a30d9cf3da1442e2b7f Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7396 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-04-30target/espressif: fix clang report on list useAntonio Borneo1-10/+6
It looks like a false positive. Scan-build considers as possible to: - have list_empty() return false; - list_for_each_safe() to not execute any loop, thus not assigning a non-NULL value to 'block'; - the NULL pointer 'block' is passed to list_del(). This is not possible because with list_empty(), the loop runs at least once. Rewrite the function to simplify the code and making it easier for scan-build to check it. This also drops an incorrect use of list_for_each_safe(), where the 'safe' version was not required. Change-Id: Ia8b1d221cf9df73db1196e3f51986023dcaf78eb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 8d1dcf293a0c ("target/espressif: add application tracing functionality over JTAG") Reviewed-on: https://review.openocd.org/c/openocd/+/7608 Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com> Tested-by: jenkins
2023-04-30target/espressif: fix clang report on use of garbage valueAntonio Borneo1-2/+4
When the function xtensa_queue_dbg_reg_read() returns error, the array 'tmp' remains not initialized and scan-build complains while computing buf_get_u32() that: Result of operation is garbage or undefined Check the returned value of xtensa_queue_dbg_reg_read() and propagate it. Change-Id: If0aaad068b97ef0a76560e262d16429afd469585 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 8d1dcf293a0c ("target/espressif: add application tracing functionality over JTAG") Reviewed-on: https://review.openocd.org/c/openocd/+/7607 Tested-by: jenkins Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2023-04-30src: fix clang15 compiler warningsErhan Kurubas4-12/+4
Below warnings are fixed. 1- A function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] 2- error: variable set but not used [-Werror,-Wunused-but-set-variable] Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I1cf14b8e5e3e732ebc9cacc4b1cb9009276a8ea9 Reviewed-on: https://review.openocd.org/c/openocd/+/7569 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-04-30server/ipdbg: add error checks after allocating memoryDaniel Anselmi1-1/+22
Change-Id: Icf18a855eb66d2b09789a9ee27f5fbc4cd9afc89 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7605 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30tcl/target: renesas gen3 Set target to armv8r for Cortex-R52Julien Massot1-8/+13
Cortex-R52 is an ARMv8-R processor supporting only AArch32 Profile. Signed-off-by: Julien Massot <julien.massot@iot.bzh> Change-Id: I663ae4bf1d3026d7c9e4c5950a79e7ddf1bd6564 Reviewed-on: https://review.openocd.org/c/openocd/+/6805 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30aarch64: Add support for ARMv8-RJulien Massot3-4/+71
ARMv8-R platforms are similar to ARMv8-A regarding JTAG and most cpu registers. ARMv8-R doesn't has MMU but has MPU instead. ARMv8-R platforms can be AArch32 only such as Cortex-R52, or AArch64 capable like Cortex-R82. Signed-off-by: Julien Massot <julien.massot@iot.bzh> Change-Id: Ib086f71685d1e3704b396d478ae9399dd8a391e1 Reviewed-on: https://review.openocd.org/c/openocd/+/6843 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-30target:armv8: aarch32 do not try to restore same ELJulien Massot1-0/+3
While debugging a Cortex-R52 OpenOCD fail to restore context on line retval = dpm->instr_write_data_r0(dpm, ARMV8_MSR_GP_xPSR_T1(1, 0, 15), cpsr); which trigger this exception: aarch64.c:1206 aarch64_restore_context(): r8a779a0.r52 armv8_dpm.c:560 armv8_dpm_modeswitch(): restoring mode, cpsr = 0x0000011f 1262753 armv8_dpm.c:598 armv8_dpm_modeswitch(): target_el = 1, last_el = 1 armv8_dpm.c:611 armv8_dpm_modeswitch(): SPSR = 0x0000011f armv8_dpm.c:260 dpmv8_exec_opcode(): Opcode 0x8f00f390, DSCR.ERR=1, DSCR.EL=1 and finally OpenOCD doesn't succeed to restore the processor. This check 'dpm->last_el != target_el' exist for aarch64, so might be correct for aarch32 too. Signed-off-by: Julien Massot <julien.massot@iot.bzh> Change-Id: I41d1006233251dcaf6d69bda580488b204b7eb63 Reviewed-on: https://review.openocd.org/c/openocd/+/6807 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>