aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nand
AgeCommit message (Collapse)AuthorFilesLines
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-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-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-05flash: with pointers, use NULL instead of 0Antonio Borneo1-1/+1
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
2022-09-18openocd: fix SPDX tag format for files .cAntonio Borneo22-22/+22
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/flash: replace the GPL-2.0-or-later license tagAntonio Borneo32-416/+64
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: Ic7db91fe37d1139d42c99e303b3243b6c8fe3ea2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7067 Tested-by: jenkins
2022-07-23openocd: src: replace the GPL-2.0-only license tagAntonio Borneo1-12/+2
Replace the FSF boilerplate with the SPDX tag. Change-Id: I29f51caa5ae9854d05ce7e150d168a7002607cd1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7064 Tested-by: jenkins
2022-07-23openocd: src: replace the GPL with eCos exception 2.0 license tagAntonio Borneo1-24/+2
Add the license exception text in the license pool. Add the exception chapter in license-rules.txt Replace the 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: Ied513b7c9c0722ed2a9c11dbdff3fbf59f1b41ce Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7061 Tested-by: jenkins
2022-07-23openocd: build: add SPDX tagAntonio Borneo1-0/+2
Add the SPDX tag to makefiles, configuration scripts and tcl files present in the folders under src/ Change-Id: I1e4552aafe46ef4893d510da9d732c5f181784a4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7051 Tested-by: jenkins
2022-05-21flash: fix clang static analyzer build errorsErhan Kurubas1-2/+0
Fixes "variable set but not used" errors. Tested with Homebrew clang version 13.0.1 Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Ia90baf5b4857db2b5569ebe6adbbb832de772aad Reviewed-on: https://review.openocd.org/c/openocd/+/6971 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
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 Yoda conditions with checkpatchAntonio Borneo1-2/+2
The new checkpatch can automatically fix the code, but this feature is still error prone and not complete. Patch generated automatically through the new checkpatch with flags "--types CONSTANT_COMPARISON --fix-inplace". Some Yoda condition is detected by checkpatch but not fixed; it will be fixed manually in a following commit. Change-Id: Ifaaa1159e63dbd1db6aa3c017125df9874fa9703 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6355 Tested-by: jenkins
2021-07-24openocd: remove NULL comparisons with checkpatch [2/2]Antonio Borneo2-2/+2
Patch generated automatically through a modified checkpatch that detects the patterns if (NULL == symbol) if (NULL != symbol) and through flags "--types COMPARISON_TO_NULL --fix-inplace". The unmodified checkpatch detects this pattern as Yoda condition, but it's odd fixing it as Yoda condition and then again as NULL comparison. This triggered the modification to the script. Change-Id: I5fe984a85e9c4fc799f049211797aef891ebce18 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6352 Tested-by: jenkins
2021-07-24openocd: remove NULL comparisons with checkpatch [1/2]Antonio Borneo1-4/+4
Patch generated automatically through the new checkpatch with flags "--types COMPARISON_TO_NULL --fix-inplace". This only fixes the comparisons if (symbol == NULL) if (symbol != NULL) The case of NULL on the left side of the comparison is not tested. Some automatic fix is incorrect and has been massaged by hands: - if (*psig == NULL) + if (*!psig) changed as + if (!*psig) Change-Id: If4a1e2b4e547e223532e8e3d9da89bf9cb382ce6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6351 Tested-by: jenkins
2021-07-24openocd: fix simple cases of NULL comparisonAntonio Borneo6-16/+16
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: manually fix Yoda conditionsAntonio Borneo1-1/+1
Fix the remaining Yoda conditions, detected by checkpatch but not fixed automatically. While there, apply minor style changes. Change-Id: I6e1978b89c4d56a20aceaeb2b52968eb6384432a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6356 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Xiang W <wxjstz@126.com>
2021-07-20openocd: fix simple cases of Yoda conditionAntonio Borneo8-129/+129
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-20flash: use lowercase for C variablesAntonio Borneo1-24/+24
Change-Id: I1c3cb5d1c8c0d73adb3c7320a1b8e3940183cd17 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6347 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Xiang W <wxjstz@126.com>
2021-07-02flash: rename CamelCase symbolsAntonio Borneo4-60/+60
Each driver is almost self-contained, with no cross dependency. Changing symbol names in one drive does not impact the other. Change-Id: Ic09f844f922a35cf0a9dc23fcd61d035b38308b3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6299 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2021-06-18target/arm: optimize architecture flagsTarek BOCHKATI1-2/+2
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-04Avoid non-standard conditionals with omitted operands.R. Diez3-7/+7
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-05-22flash: fix some minor typoAntonio Borneo1-1/+1
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-04-18helper/command: pass command prefix to command registrationAntonio Borneo1-2/+2
Replace the "struct command *parent" parameter with a string that contains the command prefix. This abstracts the openocd code from the knowledge of the tree of struct command. This also makes unused the function command_find_in_context(), so remove it. Change-Id: I598d60719cfdc1811ee6f6edfff8a116f82c7ed6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5668 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2021-03-10flash/nand/lpc32xx: Remove typedef'd structMarc Schink1-10/+10
The C style guide forbids typedef'd structs, see 'Naming Rules'. Change-Id: I983dd52307136d1b5adb58d8c44c0c14422d31e2 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6032 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-01-13openocd: fix doxygen parameters of functionsAntonio Borneo1-2/+2
Add to doxygen comment the missing parameters. Remove from doxygen comment any non-existing parameter. Fix the parameter names in doxygen comment to match the one in the function prototype. Where the parameter name in the doxygen description seems better than the one in the code, change the code. Escape the character '<' to prevent doxygen to interpret it as an xml tag. Change-Id: I22da723339ac7d7a7a64ac4c1cc4336e2416c2cc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6002 Tested-by: jenkins
2020-11-04flash: declare local symbols as staticAntonio Borneo1-2/+2
Functions and variables that are not used outside the file should be declared as static. Change-Id: I52d46ed6d4c9b98a7152eb23274c836416f409a3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5893 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-09-05flash: use proper format with uint32_tAntonio Borneo3-3/+3
Modify the format strings to properly handle uint32_t data types. Change the type of variable retval in 'nor/ambiqmicro.c' to match both the value to carry and the returned type of the function. Fix the prototype mismatch of function lpc2900_address2sector() between the header and the C file. Change-Id: I68ffba9bd83eec8132f83bff3af993861fd09d84 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5816 Tested-by: jenkins
2020-09-05flash: avoid checking for non NULL pointer to free itAntonio Borneo1-8/+5
The function free() can be called with a NULL pointer as argument, no need to check the argument before. If the pointer is NULL, no operation is performed by free(). Remove the occurrences of pattern: if (ptr) free(ptr); There are cases where the pointer is set to NULL after free(), but then re-assigned within few lines. Drop the setting to NULL when this is evident. Anyway, the compiler will remove the useless assignment so no reason to be too much aggressive in this change. Change-Id: I55b2ce7cbe201410016398933e34d33a4b66e30b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5811 Tested-by: jenkins
2020-07-26flash: fix typos and duplicated wordsAntonio Borneo6-29/+29
Fix typos and duplicated words in comments and strings. Change-Id: I64282c7018462deefeeb8e5f4d0d81942425b3fc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5758 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Christopher Head <chead@zaber.com>
2020-05-09coding style: add parenthesis around the argument of sizeofAntonio Borneo1-1/+1
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-09coding style: remove useless break after a goto or returnAntonio Borneo2-4/+0
In a switch/case statement, a break placed after a goto or return is never executed. The script checkpatch available in Linux kernel v5.1 issues a warning for such unused break statements. In the process of reviewing the new checkpatch for its inclusion in OpenOCD, let's get rid of these warnings. The script checkpatch is unable to fixup automatically this case. Thanks to having "break" command using a single code line, this patch has been generated using the script below: find src/ -type f -exec ./tools/scripts/checkpatch.pl -q \ --types UNNECESSARY_BREAK -f {} \; \ | sed -n '/^#/{s/^.*FILE: //;s/:$//;s/:/ /;p}' \ | awk 'function P() {print "sed -i '\''"b"'\'' "a}; { if ($1!=a) { if (a) {P()}; a=$1; b=$2"{d}"; } else { b=b";"$2"{d}" } }; END {P()}' Change-Id: I56ca098faa5fe8d1e3f712dc0a029a3f10559d99 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5617 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-04-20flash/nand/core: fix clang static analyzer warningTomas Vanek1-7/+24
core.c:446: The left operand of '>>' is a garbage value There are many places where an error code returned from nand->controller operations are ignored. To keep the change minimal, the error checks are added only to reading of extended nand info as it was suspected to be the cause of the warning. Addition of the error checks did not fix the warning. scan-build-9 report was inspected and IMHO the warning is bogus: the term (nand->device->erase_size == 0) cannot give false at line 395 and then evaluate true at line 462. Fixed by zeroing id_buff. Change-Id: I97ed7ce0fdf1aa23d746d5fb898bacd050e20ae8 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5518 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2019-09-08src/flash/nand: Fix some operator precedence bugs.Seth LaForge2-2/+2
Fix two expressions where precedence of operator | vs ?: was clearly confused. Untested - was clearly not expressing the intent of the author by inspection. Found by automated tooling and rtrieu@google.com. Change-Id: I46f190154797f8affc761caf3a15a1a9db53d702 Signed-off-by: Seth LaForge <sethml@google.com> Reviewed-on: http://openocd.zylin.com/5281 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2019-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo7-41/+41
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-05-14nand/tcl: pass CMD to nand_list_walker()Paul Fertser1-3/+3
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should be ready to switch to CMD as first parameter. Pass CMD instead of CMD_CTX as parameter to nand_list_walker(). This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: Ia11887dfc6dc58d5458a88ba84780cd895b8c253 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5053 Tested-by: jenkins
2019-05-14nand/fileio: change prototype of nand_fileio_start()Paul Fertser3-6/+6
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should be ready to switch to CMD as first parameter. Change prototype of nand_fileio_start() to pass CMD instead of CMD_CTX. This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: I7993f6aba997a2d2917949563651c8d0c213730d Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5052 Tested-by: jenkins
2019-04-07Set empty usage field for commands that do not need parametersAntonio Borneo1-0/+1
The missing field causes runtime debug message BUG: command '%s' does not have the '.usage' field filled out While there, fix some minor typo in the help messages: s/deasert/deassert/ s/Deasert/Deassert/ Change-Id: If3dd18265cda103ca0d05609f67f4ca58e7cbb27 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5024 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07command_registration: add empty usage field to chained commandsAntonio Borneo1-1/+2
Chained command require a subcommand as first argument. The usage field for chained commands is not really important because the "help" command will list all the subcommands with their respective usage. Add a empty usage field on all chained command. The command "jlink config" can be either followed by a subcommand or used alone, so use a dedicated usage string. Change-Id: I43c3f8a766f96a9bdab4e709e3c90713be41fcef Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5017 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-01-27command: initialize the command mode for every commandAntonio Borneo1-0/+1
All the commands in OpenOCD have been inspected and have the command mode initialize, apart for two of them. This is not critical, because the uninitialized value (0) is equivalent to the enum COMMAND_EXEC, that is also the correct value for the two mentioned commands. To keep the code consistent, initialize the command mode to COMMAND_EXEC. Change-Id: Iaf043364cbd1005418d787ed045a3ec653612382 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4861 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-10-23Fix GCC7 warnings about switch-case fallthroughsFreddie Chopin1-0/+1
GCC7 with -Wextra warns about switch-case blocks which fallthrough with "this statement may fall through [-Werror=implicit-fallthrough=]". This can be fixed by adding "special" comments: "/* fallthrough */". See https://gcc.gnu.org/gcc-7/changes.html Change-Id: Iba0be791dbdd86984489b2d9a0592bb59828da1e Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-on: http://openocd.zylin.com/4174 Tested-by: jenkins
2016-12-08Convert to non-recursive makeAndreas Fritiofson1-41/+38
Change-Id: I11f8bc8553957e2ff083c09e72e16881e4d3bb6f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3865 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-11-04Tcl commands: Fix improper return status in flash commands and load_image.HarishKumar1-2/+4
Nand write command : nand_fileio_cleanup() always returns ERROR_OK. Due to this, handle_nand_write_command() retuns ERROR_OK in the case of nand failure. ERROR_FAIL should be returned. Flash erase_sector command : handle_flash_erase_command() always returns ERROR_OK even if the erase functionality of actual driver implementation fails. retval value should be returned. Flash write_bank command : handle_flash_write_bank_command() returns ERROR_OK even if fileio_open() and fileio_read fails. ERROR_FAIL should be returned. Load_image command : handle_load_image_command() retuns ERROR_OK even if image_open() fails. ERROR_FAIL should be returned. When the buffer is null, breaking the loop without setting retval = ERROR_FAIL would cause load_image to return ERROR_OK. Change-Id: Ice32f6036971ab5e8e4dd65edf54b394b001c80c Signed-off-by: HarishKumar <harishpresent@gmail.com> Reviewed-on: http://openocd.zylin.com/2431 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2016-05-24Make #include guard naming consistentMarc Schink12-33/+40
Change-Id: Ie13e8af0bb74ed290f811dcad64ad06c9d8cb4fa Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2956 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-05-24Remove FSF address from GPL noticesMarc Schink34-99/+37
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-05-20nand: change use_raw to booleanIvo Manca2-2/+2
Change type of use_raw to boolean. This parameter was already assigned a boolean variable (in COMMAND_PARSE_ENABLE) and used as a boolean. Change-Id: I22f8308246cb25ec9ec2395599e406160410a2a8 Signed-off-by: Ivo Manca <pinkel@gmail.com> Reviewed-on: http://openocd.zylin.com/3496 Reviewed-by: Andreas Färber <afaerber@suse.de> Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-05-20nand: fix return valueIvo Manca1-1/+1
Return ERROR_NAND_DEVICE_NOT_PROBED to prevent calling functions from segfaulting when nand device has not yet been probed (ie nand verify) Change-Id: Ibc4da0aad00e6cc6c83008882b054d981453dc36 Signed-off-by: Ivo Manca <pinkel@gmail.com> Reviewed-on: http://openocd.zylin.com/3495 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-02-29helper/fileio: Remove nested structMarc Schink3-8/+8
Change-Id: I1a3afbddcf950689da58e0df8850a05f558d7879 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3222 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-11-03helper/fileio: Use size_t for file size.Marc Schink2-4/+4
Change-Id: Ie116b44ba15e8ae41ca9ed4a354a82b2c4a92233 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2997 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-06flash: declare fixed arrays constSpencer Oliver1-4/+4
Change-Id: Id06b8b53ec59a7b3182f60f51dde5b16563aaeef Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1887 Tested-by: jenkins
2013-11-07target: use target_buffer_set_u32_arraySpencer Oliver1-3/+1
Attempt to use target_buffer_set_u32_array to convert to target endian arrays rather reimplementing code. This also removed cfi_fix_code_endian as its functionality is also repeated. Change-Id: I7c359dbe46ea791cd5f6fb18d8b0fb6895c599d3 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1783 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>