aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/aice/aice_transport.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-15nds32: drop it, together with aice adapter driverAntonio Borneo1-432/+0
The target nds32 and its companion adapter aice have not received any real improvement since 2013. It has been hard to keep them aligned during the evolution of OpenOCD code, with no way for maintainers to really check if they are still working. No real documentation is present for them in OpenOCD. The nds32 code triggers ~50 errors/warnings with scan-build. The arch nds32 has been dropped from Linux kernel v5.18-rc1. For all the reasons above, this code has been deprecated with commit 2e5df83de7f2 ("nds32: deprecate it, together with aice adapter driver") and tagged to be dropped before v0.13.0. Let it r.i.p. in OpenOCD git history. While there, drop from checkpatch list the camelcase symbols that where only used in this code. Change-Id: Ide52a217f2228e9da2f1cc5036c48f3536f26952 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7382 Tested-by: jenkins
2022-09-18openocd: fix SPDX tag format for files .cAntonio Borneo1-1/+1
With the old checkpatch we cannot use the correct format for the SPDX tags in the file .c, in fact the C99 comments are not allowed and we had to use the block comment. With the new checkpatch, let's switch to the correct SPDX format. Change created automatically through the command: sed -i \ 's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \ $(find src/ contrib/ -name \*.c) Change-Id: I6da16506baa7af718947562505dd49606d124171 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7153 Tested-by: jenkins
2022-07-23openocd: src/jtag: replace the GPL-2.0-or-later license tagAntonio Borneo1-13/+2
Replace the FSF boilerplate with the SPDX tag. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: Ie873d12bb0fb838d0d6252e6b9ca3c2118853e9a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7069 Tested-by: jenkins
2021-11-23openocd: declare struct command_registration in a single lineAntonio Borneo1-2/+1
To simplify scripts to compare documentation and registered commands. Change-Id: I3bed5ba80ea8be1fd615697e80d66b42d7b45fd1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6718 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23openocd: use single line for register_commands*()Antonio Borneo1-2/+1
Do not split in multiple lines the calls to register_commands*(). No change in code behaviour, just make it easy to grep in the code and identify the commands that can be registered. This would help detecting undocumented commands. Change-Id: Id654e107cdabf7ee31fc3d227c1d2a59acc5669e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6716 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-07-24openocd: fix simple cases of NULL comparisonAntonio Borneo1-1/+1
There are more than 1000 NULL comparisons to be aligned to the coding style. For recurrent NULL comparison it's preferable using trivial scripts in order to minimize the review effort. Patch generated automatically with the command: sed -i PATTERN $(find src/ -type f) where PATTERN is in the list: 's/(\([a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(\1)/g' Change-Id: Ida103e325d6d0600fb69c0b7a1557ee969db4417 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6350 Tested-by: jenkins
2021-07-20openocd: fix simple cases of Yoda conditionAntonio Borneo1-1/+1
There are ~900 Yoda conditions to be aligned to the coding style. For recurrent Yoda conditions it's preferable using a trivial script in order to minimize the review effort. E.g. comparison of uppercase macro/enum with lowercase variable: - ...(ERROR_OK == retval)... + ...(retval == ERROR_OK)... Patch generated automatically with the command: sed -i \ 's/(\([A-Z][A-Z0-9_]*\) \([=!]=\) \([a-z][a-z0-9_]*\))/(\3 \2 \1)/g' \ $(find src/ -type f) While there, remove the braces {} around a single statement block to prevent warning from checkpatch. Change-Id: If585b0a4b4578879c87b2dd74d9e0025e275ec6b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6354 Tested-by: jenkins Reviewed-by: Xiang W <wxjstz@126.com>
2021-07-02jtag: rename CamelCase symbolsAntonio Borneo1-23/+23
No major cross dependency, just changes internal to each file or function. Change-Id: Ie6258a090ce53de5db65df6a77d57ac6bb899488 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6301 Tested-by: jenkins
2021-06-04helper/jim-nvp: comply with coding style [2/2]Antonio Borneo1-15/+15
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-05-01Cleanup of config/includes.Tim Newsome1-0/+1
Remove a use of AH_BOTTOM from configure.ac. This macro is used by autoheader to add '#include' of some include file to the end of config.h.in and then to config.h. OpenOCD can be built with a custom config.h, so it's preferable to move these '#include' statement directly in the C files that need them dropping this unneeded dependency. It also causes problems when I want to use the gnulib library (which comes with its own Makefile, and does not have the same include path as the top-level Makefile). So this change touches a lot of files, but is actually really simple. It does not affect functionality at all. Change-Id: I52c70bf15eb2edc1dd10e0fde23b2bcd4caec000 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/6171 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-01jtag: simplify the calls to Jim_SetResultFormatted()Antonio Borneo1-3/+2
The documentation of Jim_SetResultFormatted() reports that the jim objects passed as arguments would be freed if have zero refcount. Remove the useless Jim_IncrRefCount()/Jim_DecrRefCount(). Remove the dangerous Jim_FreeNewObj() that should trigger a double free(). Not tested due to lack of aice adapter. While there, rename some CamelCase symbol. Change-Id: Ic56704c83d6391c38f6b0efa6566784d453bc0fb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6190 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-09coding style: add parenthesis around the argument of sizeofAntonio Borneo1-2/+2
The script checkpatch available in new Linux kernel offers an experimental feature for automatically fix the code in place. While still experimental, the feature works quite well for simple fixes, like parenthesis. This patch has been created automatically with the script under review for inclusion in OpenOCD, using the command: find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types SIZEOF_PARENTHESIS --fix-inplace -f {} \; Change-Id: I8adb325bdb0e13211f8bae8b4770ec1979c176bf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5618 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-02coding style: src: remove empty lines at end of text filesAntonio Borneo1-1/+0
Empty lines at end of text files are useless. Remove them. Change-Id: Ibac9b36682d58f81e34ca2b51e6260e7d472fb0e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5172 Tested-by: jenkins
2020-03-07jtag/aice: fix clang static analyzer warningsTomas Vanek1-0/+1
Change-Id: I6c801c2406cd117f2bcf930a5b329c441ab5f1ff Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5368 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2019-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo1-4/+4
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-02-07command: fix the mode for command "jtag configure"Antonio Borneo1-1/+1
Before commit 877cec20dca6e78f9f029f0f173879cda101a6c2 ("command: check command mode for native jim commands") all the jim commands were erroneously treated as they had mode COMMAND_ANY. The commit above fixes the code in order to check the mode and permit running the commands only if the mode is respected. Those jim commands that have incorrect mode were not detected nor fixes because the wrong mode was masked by the missing mode check. After the commit above, the wrong mode triggers error in several existing configuration scripts. A complete list of commands that now does not run anymore as CONFIG_ANY is reported in ticket 225, but most of them have the mode set correctly. At least two instances of command "jtag configure" have the wrong mode. Fix the mode to CONFIG_ANY for command "jtag configure" in files src/jtag/aice/aice_transport.c and src/jtag/tcl.c Change-Id: I3f96c5fd24d7d463712cbaf1295284fe0dc56b23 Ticket: https://sourceforge.net/p/openocd/tickets/225/ Reported-by: Bill Paul <wpaul@users.sourceforge.net> Fixes: 877cec20dca6 ("command: check command mode for native jim commands") Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4886 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2018-03-12nds32: Add jtag scan_chain commandHellosun Wu1-0/+60
Create new command to refresh idcode list during runtime and update Tap idcode. Change-Id: Ie889a39a6f57cea207b2b9c9e42c51c97cfe4d8e Signed-off-by: Hellosun Wu <wujiheng.tw@gmail.com> Reviewed-on: http://openocd.zylin.com/4133 Tested-by: jenkins Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-by: penny chen <penny6610231@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-05-24Remove FSF address from GPL noticesMarc Schink1-3/+1
Also make GPL notices consistent according to: https://www.gnu.org/licenses/gpl-howto.html Change-Id: I84c9df40a774958a7ed91460c5d931cfab9f45ba Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3488 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-02-29jim-nvp: Make Jim_GetOpt_String const-correctAndreas Fritiofson1-4/+6
Change-Id: Iae9824f6ff47a1944e674e59bfaa970904645082 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3178 Tested-by: jenkins
2013-10-31Clean up const usage to avoid excessive castingAndreas Fritiofson1-2/+2
Don't use const on pointers that hold heap allocated data, because that means functions that free them must cast away the const. Do use const on pointer parameters or fields that needn't be modified. Remove pointer casts that are no longer needed after fixing the constness. Change-Id: I5d206f5019982fd1950bc6d6d07b6062dc24e886 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1668 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: support multi-target debuggingHsiangkai Wang1-1/+1
Change-Id: If767f646b234dbcdb01946e5d13a3a6a29df2d78 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1581 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-06-05aice: add Andes AICE supportHsiangkai Wang1-0/+385
Andes AICE uses USB to transfer packets between OpenOCD and AICE. It uses high-level USB commands to control targets instead of using JTAG signals. I define an interface as aice_port_api_s. It contains all basic operations needed by target-dependent code. Change-Id: I117bc4f938fab2732e44c509ea68b30172d6fdb9 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1256 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>