aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2021-06-18target/register: Minor code cleanupMarc Schink1-14/+12
Change-Id: Ie02a112c0339ae5d3b3763483e493370b487be98 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6294 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-18flash/stm32fxx.c: do not read CPUID as this info is stored in cortex_m_commonTarek BOCHKATI2-44/+37
In these drivers we read CPUID to check the Cortex-M PARTNO, but now the PARTNO is stored in struct cortex_m_common.core_info. Change-Id: I5bb3b95210ab6e23b8e1252686dd81015740bf68 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6240 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-18cortex_m: enhance core and arch detectionTarek BOCHKATI2-41/+108
Rework core detection by adding cortex_m_partno enum to detect all CPUs using the same method. Instead of checking the core PARTNO then assign the arch, use the stored information within cortex_m parts[] with the flags inside which can help simplifying a bit the cortex_m_examine code. This change fixes: - the Cortex-M1 detection as ARMv6-M Core (was managed as ARMv7-M) - the displayed CPU name for Cortex-M0+ (was displayed Cortex-M0) Change-Id: I40b6e03f7cf3664c85e297adfc25323196dfe90b Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6233 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-18target/arm: optimize architecture flagsTarek BOCHKATI9-26/+29
In target/arm.h the struct arm do contain 3 flags to retain architecture version for some tweaks. The proposal is to have only one enumerated flag 'arch' for the same purpose. Change-Id: Ia5d5accfed8158ca21eb54af2fdea8e36f0266ae Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6229 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-18target: Rename 'linked_BRP' to 'linked_brp'Marc Schink4-8/+8
Change-Id: I9dd67ac3e8cd5dd9cdeffce56020b387a8f298fa Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6316 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-13armv4_5: do not read/write non-existent registersTarek BOCHKATI1-1/+1
Change-Id: I4a0c401a325e57ba5d4d93d83b7e6b71a4d0865e Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6064 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-13arm_dpm: do not read/write non-existent registersTarek BOCHKATI1-2/+2
Change-Id: I6a991899bb178ee0c6b41870a45d0a9439d9dc1e Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6063 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-06-13armv8_dpm: do not read/write non-existent registersTarek BOCHKATI1-2/+5
Change-Id: I0f3fffa8cf1746569f6acce0233e9544d3862f51 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6062 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-13flash/nor: improved API of flash_driver.info & fixed buffer overrunsJan Matyas51-444/+292
1) The API of "info" callback in "struct flash_driver" has been improved. Fixed buffers for strings 2) Removed the calls to snprintf() from the flash_driver.info implementations. Many of them were used in an unsafe manner (buffer overruns were possible). Change-Id: I42ab8a8018d01f9af43c5ba49f650c3cb5d31dcb Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: http://openocd.zylin.com/6182 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-06-13Add remote bitbang write buffer.Tim Newsome1-37/+86
Change 7dd323b26 reduced remote bitbang performance a lot. This change gets most of that performance back again, by reintroducing a write buffer. Performance numbers collected using DebugBreakpoint test from riscv-tests/debug against a single 64-bit spike (RISC-V simulator) instance. (Ubuntu 20.04.2, AMD Ryzen 5 3600) Before Windows support was added: 3.09s After Windows support was added: 12.67s After this change: 4.69s Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: I72ff4912cbbf316a30ef065e5b8f461a555f06cc Reviewed-on: http://openocd.zylin.com/6283 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-13target/cortex_a: Use bool data typeMarc Schink2-13/+13
Change-Id: Ieea3dc05809263aa0eba5125d52fef3fe77e9c5a Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6289 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04target/startup.tcl: Do not use 'Yoda conditions'Marc Schink1-14/+13
Change-Id: I5e1bbaf032659dda1b365ef4ec6ea4a635d921ce Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6284 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04Avoid non-standard conditionals with omitted operands.R. Diez8-14/+14
Fixes bug #257. Change-Id: I05fc6468306d46399e769098e031e7e588798afc Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de> Reviewed-on: http://openocd.zylin.com/6271 Tested-by: jenkins Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04Add target_data_bits().Tim Newsome4-4/+38
This is used to compute memory block read alignment, and specifically allows 64-bit targets to ensure that memory block reads are only requested on 64-bit boundaries. Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: Idb1a27b9fc02c46245556bb0f3d6d94b368c4817 Reviewed-on: http://openocd.zylin.com/6249 Reviewed-by: Marc Schink <dev@zapb.de> Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04cmsis_dap: add support for swo commandsAdrian Negreanu2-94/+440
Replaced mixed snake_case_CamelCase with snake_case. Define variables at first-use location. CMSIS-DAP SWO specification: https://arm-software.github.io/CMSIS_5/DAP/html/group__DAP__swo__gr.html Change-Id: Ieba79b16efd445143f964b614673d041aae74f92 Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com> Reviewed-on: http://openocd.zylin.com/5820 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04target: Use 'bool' for 'reset_halt'Marc Schink2-2/+2
Change-Id: I974a6360ea7467067511541ac212f2e9d3de7895 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6262 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04drivers/jlink: Remove trailing dotsMarc Schink1-120/+117
This makes the messages consistent with most of the rest of the OpenOCD output. Change-Id: I915a01187e7fc317e02483ac0bbd39ec077d6321 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6274 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04gdb_server: Log both incoming and outgoing GDB packetsJan Matyas3-20/+56
- Made sure that also outgoing GDB packets are logged, not only the incoming ones. - Improved the treatment of non-printable characters in the packets to make it more robust. Prior to this change: - Outgoing packets were not printed unless OpenOCD was re-compiled with _DEBUG_GDB_IO_. - Non-prinable characters were only treated in incoming 'X' packets. After this change: - Both incoming and outgoing GDB packets are logged on debug_level >= 3, so that both directions of the GDB channel are visible. - Non-printable characters are checked for in every packet so that hey do not interfere with the terminal. Change-Id: I0613e57ae5059b3279b0abcb71276cf5719a8699 Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: http://openocd.zylin.com/6269 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04helper/list.h: add mention to the example in contribAntonio Borneo1-0/+2
Without such reference, it could be difficult to find the example. Change-Id: Ia9ffb06bc1a45446c2c7b53197ab3400e1d8a9e9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6281 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2021-06-04helper/list.h: align file to Linux v5.12Antonio Borneo1-137/+431
Main improvement is in the doxygen comments. Minimize the delta with kernel file. Skip the functions hlist_unhashed_lockless() and __list_del_clearprev() that are relevant only in kernel. Remove gcc extension "omitted conditional operand". Change-Id: I2e9ddb54cfe2fa5f7cf18f44726acd144e1f98b9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6276 Reviewed-by: <rdiezmail-openocd@yahoo.de> Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2021-06-04server/telnet: fix autocomplete for jimtcl commandsAntonio Borneo3-19/+26
Current autocomplete filters-out some command reported by "info commands". One of the filter rule concerns the command's private data. Every command registered by OpenOCD has its 'struct command' as private data. By ignoring commands without private data, we loose several TCL commands registered by jimtcl, e.g. 'foreach', 'llength'. By assuming that every command with non-NULL private data has 'struct command' as private data, we risk at best to access inconsistent data, at worst to trigger a segmentation fault. Export the already available functions: - to check if a command has been registered by OpenOCD and - to get the private data. While there, rename jimcmd_is_ocd_command() as jimcmd_is_oocd_command(). Don't filter-out jimtcl commands with no private data. Check the private data only on OpenOCD commands. Change-Id: Ib5bf8d2bc5c12440c0cfae438f637c38724a79b7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6282 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-06-04helper/jim-nvp: comply with coding style [2/2]Antonio Borneo21-316/+316
With the API fixed to comply with OpenOCD coding style, fix all the references in the code. Patch generated automatically with the script below. The list is in reverse order to replace a common prefix after the replacement of the symbols with the same prefix. %<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<--- (cat << EOF Jim_SetResult_NvpUnknown jim_set_result_nvp_unknown Jim_Nvp_value2name_simple jim_nvp_value2name_simple Jim_Nvp_value2name_obj jim_nvp_value2name_obj Jim_Nvp_value2name jim_nvp_value2name Jim_Nvp_name2value_simple jim_nvp_name2value_simple Jim_Nvp_name2value_obj_nocase jim_nvp_name2value_obj_nocase Jim_Nvp_name2value_obj jim_nvp_name2value_obj Jim_Nvp_name2value_nocase_simple jim_nvp_name2value_nocase_simple Jim_Nvp_name2value_nocase jim_nvp_name2value_nocase Jim_Nvp_name2value jim_nvp_name2value Jim_Nvp struct jim_nvp Jim_GetOpt_Wide jim_getopt_wide Jim_GetOpt_String jim_getopt_string Jim_GetOpt_Setup jim_getopt_setup Jim_GetOpt_Obj jim_getopt_obj Jim_GetOpt_NvpUnknown jim_getopt_nvp_unknown Jim_GetOpt_Nvp jim_getopt_nvp Jim_GetOpt_Enum jim_getopt_enum Jim_GetOpt_Double jim_getopt_double Jim_GetOpt_Debug jim_getopt_debug Jim_GetOptInfo struct jim_getopt_info Jim_GetNvp jim_get_nvp Jim_Debug_ArgvString jim_debug_argv_string EOF ) | while read a b; do sed -i "s/$a/$b/g" $(find src -type f ! -name jim-nvp.\? ) done %<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<--- Change-Id: I10a12bd64bb8b17575fd9150482c989c92b298a2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6184 Reviewed-by: Marc Schink <dev@zapb.de> Tested-by: jenkins
2021-06-04helper/jim-nvp: comply with coding style [1/2]Antonio Borneo2-110/+250
The helper jim-nvp does not comply with OpenOCD coding style due to typedef of struct and CamelCase symbol names. While it's trivial fixing the helper and all its current use in the code, changing these APIs will potentially break a number of patches pending in gerrit. Gerrit will not trigger any alert, but the code will generate compile error after the merge. Add the compile flag "-Wno-error=deprecated-declarations" to keep as warning (not as error) the use of "deprecated" functions and types. Rename all the CamelCase symbols is lowercase and provide struct prototypes in place of the typedef. Add a DEPRECATED section to 'jim-nvp.h' where the old CamelCase symbols and the old typedef are re-declared with compile attribute 'deprecated'. With this change OpenOCD compiles, but generates warnings. The remaining changes allover OpenOCD code will be fixed in a separate patch for easier review. The patches merged later that still use the old deprecated API will compile with warnings. This will permit to identify and fix these cases. Change-Id: I786385d0f662dbb1be5be313ae42623156d68ce5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6183 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2021-06-03target/cortex_a: fix memory leak on watchpointsAntonio Borneo1-0/+1
The memory allocated to hold the watchpoints is not freed at OpenOCD exit. Free the watchpoint memory at OpenOCD exit. Change-Id: I518c9ce0dc901cde2913d752e3154734f878b854 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6210 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2021-06-03target/cortex_a: add support for watchpoint length of 1, 2 and 4 bytesAntonio Borneo1-5/+41
Use byte address select for 1 and 2 bytes length. Use normal mode for 4 bytes length. Change-Id: I28d182f25145d0635de64d0361d456f1ad96640e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6197 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2021-06-03target/cortex_a: fix number of watchpointsAntonio Borneo1-2/+6
Decrement the available watchpoints only when succeed setting it. Initialize the available watchpoint with the correct value. Change-Id: I0f93b347300b8ebedbcd9e718d4ba32b26cf6846 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6196 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2021-06-03target/cortex_a: add support for watchpointsChengyu Zheng4-9/+201
The current implementation of OpenOCD does not support watchpoints for cortex_a architecture. So, I replaced the add_watchpoint and remove_watchpoint with the specific implementation for the cortex a and using the breakpoint implementation and the arm documentation [1] as reference. In particular, I have made the following changes: * added the following functions - cortex_a_add_watchpoint This wrapper function check whether there are any watchpoint available on the target device by calling cortex_a_set_watchpoint. - cortex_a_set_watchpoint This function is responsible for settings the watchpoint register pair. In particular, it sets the WVR and the WCR registers with the cortex_a_dap command. - cortex_a_remove_watchpoint This wrapper function the selected watchpoint on the target device by calling cortex_a_unset_watchpoint. - cortex_a_unset_watchpoint This function sets both the WVR and the WCR registers to zero, thus unsetting the watchpoint. [1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464f/BCGDHIEJ.html Change-Id: I86611dab474cb84836662af572b17636dc68e282 Signed-off-by: Chengyu Zheng <chengyu.zheng@polimi.it> Reviewed-on: http://openocd.zylin.com/3913 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Marc Schink <dev@zapb.de> Tested-by: jenkins
2021-05-31target/arm_adi_v5: Fix clear sticky overrun flag during replay of commandsmicbis1-0/+7
When a WAIT occurs the commands after the WAIT are replayed and the STICKYORUN is cleared. However if another WAIT occurs during the command replay, the command itself is resent but the STICKYORUN bit shall also be cleared. If this is not done, the MEM-AP hangs. Change-Id: I14e8340cd5d8f58f4de31509da96cfa2ecb630d1 Signed-off-by: micbis <michele.bisogno.ct@renesas.com> Reviewed-on: http://openocd.zylin.com/6278 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2021-05-29stlink: reorder the flag macro by firmware releaseAntonio Borneo1-11/+11
The corresponding bit for each macro is changed, but this is not relevant in the code. Change-Id: I7039464f5a3d55d008208f44952aadeb815bd5a3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6212 Tested-by: jenkins
2021-05-29stlink: add comment of firmware version for each flag bitAntonio Borneo1-11/+11
Change-Id: I7f7c7b9c9cfd88125f82662ed864a2c0715140b1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6211 Tested-by: jenkins
2021-05-29help: fix line size in 'usage' outputAntonio Borneo1-7/+6
The implementation of command 'usage' is broken while checking the line limit of 76 chars per line (e.g. 'usage load_image') and the line wrapping is not correct. The same broken code is used for the first output line of command 'help' too. When call command_help_show_wrap(), include the command's name in the string so the whole text would be wrapped. Change-Id: Idece01ce54994db7e851d8522435ff764b11f3ac Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6223 Tested-by: jenkins
2021-05-29help text: remove trailing spaceAntonio Borneo10-13/+13
Some help text end with a useless space character. Remove it. Change-Id: I397e1194fac8042f0fab694222f925f906716de3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6222 Tested-by: jenkins
2021-05-29rtos: use ARRAY_SIZE() and simplify rtos_type.create()Antonio Borneo4-59/+36
Use the existing macro ARRAY_SIZE(). Rewrite the functions rtos_type.create() to simplify the logic. Change-Id: I8833354767045d1642801d26944c9087a77add00 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6261 Tested-by: jenkins
2021-05-29openocd: use macro ARRAY_SIZE()Antonio Borneo5-10/+8
There are still few cases where the macro ARRAY_SIZE() should be used in place of custom code. Use ARRAY_SIZE() whenever possible. Change-Id: Iba0127a02357bc704fe639e08562a4f9aa7011df Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6260 Reviewed-by: Xiang W <wxjstz@126.com> Tested-by: jenkins
2021-05-29drivers/versaloon: use ARRAY_SIZE()Antonio Borneo2-2/+1
Replace the custom macro dimof() with the OpenOCD macro ARRAY_SIZE(). Change-Id: I2fe638444f6c16f2a78c1fd558b21550f76282d6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6259 Tested-by: jenkins Reviewed-by: Xiang W <wxjstz@126.com>
2021-05-22riscv: replace macro DIM() with ARRAY_SIZE()Antonio Borneo3-15/+9
OpenOCD already defines the macro ARRAY_SIZE, while riscv code uses a local macro DIM. Prefer using the macro ARRAY_SIZE() instead of DIM(). Not all the riscv code has been upstreamed, yes; this patch only covers the code already upstreamed. Change-Id: I89a58a6d91916d85c53ba5e4091b558271f8d618 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6258 Reviewed-by: Xiang W <wxjstz@126.com> Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2021-05-22riscv: drop unused variableAntonio Borneo1-3/+0
The array newly_halted[] is assigned but its value is never used. Drop it! Change-Id: I678812a31c45a3ec03716e3eee6a30b8e8947926 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6257 Tested-by: jenkins Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Tim Newsome <tim@sifive.com>
2021-05-22mem_ap: fix target arch_info typeAntonio Borneo1-5/+7
The target mem_ap appears as an ARM target, thus it allows the execution of ARM specific commands causing the crash of OpenOCD. E.g. 'arm mrc ...' can be executed and segfaults. Replace the incorrect ARM magic number with a dedicated one. While there, remove the 'struct arm', that is now holding only the mem_ap's dap, and replace it with a pointer to the dap. Change-Id: I881332d3fdf8d8f8271b8711607737b052a5699b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6213 Tested-by: jenkins
2021-05-22helper/command: silent debug msg on command register/unregisterAntonio Borneo1-2/+4
Commit e216186fab59 ("helper/command: register full-name commands in jim") and commit a7d68878e4ba ("helper/command: unregister commands through their full-name") introduce a LOG_DEBUG() message each for command registration and unregistration. The messages above are quite noisy and pollute the log when debug_level is 3 or higher. They can be useful to debug the command registration logic, but for the other debug activities on OpenOCD are just noisy. Already commit a03ac1ba3087 ("helper/command: disable logging of registered commands [RFC]") was merged to silent the first case that is now back with additional logs. Silent both log messages. Use 'if (false)' to silent them, making easy to re-enable it when or if someone needs it. Change-Id: Id8a067e60e822d4ecbddcb036d081298f7e6181f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6220 Tested-by: jenkins
2021-05-22openocd: fix some minor typoAntonio Borneo3-3/+3
Minor typos found by the new checkpatch boosted by the dictionary provided by 'codespell'. Change-Id: I7b4cae1798ff5ea048fcbc671a397af763fdc605 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6218 Tested-by: jenkins
2021-05-22target: fix some minor typoAntonio Borneo7-8/+8
Minor typos found by the new checkpatch boosted by the dictionary provided by 'codespell'. Change-Id: I548581247db72e683249749d1b8725035530b06e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6217 Tested-by: jenkins
2021-05-22jtag: fix some minor typoAntonio Borneo8-13/+13
Minor typos found by the new checkpatch boosted by the dictionary provided by 'codespell'. Change-Id: I101c76a638805d77c1ff356cf0f027552389e5d3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6216 Tested-by: jenkins
2021-05-22flash: fix some minor typoAntonio Borneo6-6/+6
Minor typos found by the new checkpatch boosted by the dictionary provided by 'codespell'. Change-Id: Ia5f134c91beb483fd865df9e4877e0ec3e789478 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6215 Tested-by: jenkins
2021-05-22flash/stm32l4x: add missing break statementTarek BOCHKATI1-1/+3
this is not a bug fix, this for loop will issue only one match adding the break will save unnecessary more loops. Change-Id: Ic1484ea8cdea1b284eb570f9e3e7818e07daf5cd Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6248 Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Tested-by: jenkins
2021-05-22target/aarch64: fix watchpoint managementAntonio Borneo5-56/+22
The early documentation for armv8a report the debug register WFAR as containing the address of the instruction that triggered the watchpoint. More recent documentation report the register EDWAR as containing the data memory address that triggered the watchpoint. The name of macros CPUV8_DBG_WFAR0 and CPUV8_DBG_WFAR1 is not correct as they point to the debug register EDWAR, so reading such register returns directly the data memory address that triggered the watchpoint. The code incorrectly passes this address value to the function armv8_dpm_report_wfar(); this function is supposed to adjust the PC value, decrementing it to remove the effects of the CPU pipeline. This pipeline offset, that has no meaning on the value in EDWAR, caused commit 651b861d5d5f ("target/aarch64: Add watchpoint support") to add back the offset while comparing the address with the watchpoint enabled. The upper 32 bits of EDWAR are not valid in aarch32 mode and have to be ignored. Rename CPUV8_DBG_WFAR0/1 as CPUV8_DBG_EDWAR0/1. Remove the function armv8_dpm_report_wfar(). Remove the offset while searching the matching watchpoint. Ignore the upper 32 bits of EDWAR in aarch32 mode. Fix a comment and the LOG text. Change-Id: I7cbdbeb766fa18e31cc72be098ca2bc501877ed1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6205 Tested-by: jenkins Reviewed-by: Liming Sun <limings@nvidia.com>
2021-05-22target/arm_dpm: rename 'wp_pc' as 'wp_addr'Antonio Borneo7-13/+14
The field 'wp_pc' was originally introduced in commit 55eeea7fceb6 ("ARMv7a/Cortex-A8: report watchpoint trigger insn") in end 2009 to contain the address of the instruction which triggered a watchpoint. Later on with commit 651b861d5d5f ("target/aarch64: Add watchpoint support") it has been reused in to hold directly the memory address that triggered a watchpoint. Rename 'wp_pc' as 'wp_addr' and change its doxygen description. While there, fix the format string to print the field. Change-Id: I2e5ced1497e4a6fb6b38f91e881807512e8d8c47 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6204 Tested-by: jenkins Reviewed-by: Liming Sun <limings@nvidia.com>
2021-05-20cortex_m: fix VECTRESET detection for ARMv6-M coresTarek BOCHKATI1-3/+3
VECTRESET check should be done after verifying if the core is an ARMv6-M core, and not before that. Fixes: 2dc9c1df81b6 ("cortex_m: [FIX] ARMv8-M does not support VECTRESET") Change-Id: I8306affd332b3a35cea69bba39ef24ca71244273 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6232 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-20cortex_m: do not perform soft_reset_halt on targets without VECTRESETTarek BOCHKATI1-0/+5
Change-Id: Ib3df457e0afe4e342c82ad1af25e03aad6979d87 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6209 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-18cmsis_dap: fix build on macOSAntonio Borneo1-2/+2
Compile fails with error: src/jtag/drivers/cmsis_dap.c:683:28: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat] " received 0x%" PRIx8, CMD_DAP_TFER, resp[0]); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ Fix the format specifier. Change-Id: I0a5a1a35452d634019989d14d849501fb8a7e93a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6255 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-18target/armv7m: fix static analyzer warningTomas Vanek1-4/+16
Despite of assert(is_packed) clang static analyser complains on use of the uninitialized offset variable. Cross compiling with latest x86_64-w64-mingw32-gcc hits warnings src/target/armv7m.c: In function ‘armv7m_read_core_reg’: src/target/armv7m.c:337:54: error: ‘reg32_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized] It happens because mingw32 defines assert() without the attribute "noreturn", whatever NDEBUG is defined or not. Replace assert(is_packed) by if (is_packed) conditional and call assert(false) in the else branch. Change-Id: Id3c7dcccb65106e28be200b9a4d2b642f4d31019 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6256 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>