aboutsummaryrefslogtreecommitdiff
path: root/src/helper
AgeCommit message (Collapse)AuthorFilesLines
2012-01-04Change return value on error.Mathias K1-6/+1
On wrong parameters a error is signalized to the calling function. Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960 Signed-off-by: Mathias K <kesmtp@freenet.de> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/282 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-04retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERRORØyvind Harboe5-21/+20
Change-Id: I6dee51e1fab1944085391f274a343cdb9014c7a4 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/300 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-01-04command: print BUG warning when usage is missingMathias K1-0/+16
These error messages will prompt patches to be submitted for missing .usage or empty fields. All of the below must be resolved before next release. The Jim defined commands are excluded from this checklist because the help text can be set later than during command registration. strlen(.usage) == 0 means that the command expects no arguments. Updates to this patch in Gerrit to fix problems below are most welcome. Anyone can push updated versions of a patch to Gerrit. If there are no further updates to this patch within a week, it will be pushed to the master branch to prompt more fixes. These were caught by launching OpenOCD. Error: BUG: command 'command' does not have the '.usage' field filled out Error: BUG: command 'script' does not have the '.usage' field filled out Error: BUG: command 'power_restore' does not have the '.usage' field filled out Error: BUG: command 'srst_deasserted' does not have the '.usage' field filled out Error: BUG: command 'measure_clk' does not have the '.usage' field filled out Error: BUG: command 'exit' does not have the '.usage' field filled out Error: BUG: command 'shutdown' does not have the '.usage' field filled out Error: BUG: command 'gdb_sync' does not have the '.usage' field filled out Error: BUG: command 'interface_list' does not have the '.usage' field filled out Error: BUG: command 'target' does not have the '.usage' field filled out Error: BUG: command 'target init' does not have the '.usage' field filled out Error: BUG: command 'flash' does not have the '.usage' field filled out Error: BUG: command 'flash init' does not have the '.usage' field filled out Error: BUG: command 'flash banks' does not have the '.usage' field filled out Error: BUG: command 'nand' does not have the '.usage' field filled out Error: BUG: command 'nand drivers' does not have the '.usage' field filled out Error: BUG: command 'nand init' does not have the '.usage' field filled out Error: BUG: command 'pld' does not have the '.usage' field filled out Error: BUG: command 'pld init' does not have the '.usage' field filled out Error: BUG: command 'mflash' does not have the '.usage' field filled out Error: BUG: command 'mflash init' does not have the '.usage' field filled out Error: BUG: command 'dummy' does not have the '.usage' field filled out Error: BUG: command 'dummy foo' does not have the '.usage' field filled out Error: BUG: command 'scan_chain' does not have the '.usage' field filled out Error: BUG: command 'jtag' does not have the '.usage' field filled out Error: BUG: command 'jtag init' does not have the '.usage' field filled out Error: BUG: command 'arm' does not have the '.usage' field filled out Error: BUG: command 'arm reg' does not have the '.usage' field filled out Error: BUG: command 'etm' does not have the '.usage' field filled out Error: BUG: command 'arm7_9' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu arm' does not have the '.usage' field filled out Error: BUG: command 'arm reg' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu etm' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu arm7_9' does not have the '.usage' field filled out Error: BUG: command 'target_request' does not have the '.usage' field filled out ^C oyvind@fierce:~/openocd$ openocd -c "interface dummy" -f board/at91eb40a.cfg 2>&1 | grep -w BUG Error: BUG: command 'command' does not have the '.usage' field filled out Error: BUG: command 'script' does not have the '.usage' field filled out Error: BUG: command 'power_restore' does not have the '.usage' field filled out Error: BUG: command 'srst_deasserted' does not have the '.usage' field filled out Error: BUG: command 'measure_clk' does not have the '.usage' field filled out Error: BUG: command 'exit' does not have the '.usage' field filled out Error: BUG: command 'shutdown' does not have the '.usage' field filled out Error: BUG: command 'gdb_sync' does not have the '.usage' field filled out Error: BUG: command 'interface_list' does not have the '.usage' field filled out Error: BUG: command 'target' does not have the '.usage' field filled out Error: BUG: command 'target init' does not have the '.usage' field filled out Error: BUG: command 'flash' does not have the '.usage' field filled out Error: BUG: command 'flash init' does not have the '.usage' field filled out Error: BUG: command 'flash banks' does not have the '.usage' field filled out Error: BUG: command 'nand' does not have the '.usage' field filled out Error: BUG: command 'nand drivers' does not have the '.usage' field filled out Error: BUG: command 'nand init' does not have the '.usage' field filled out Error: BUG: command 'pld' does not have the '.usage' field filled out Error: BUG: command 'pld init' does not have the '.usage' field filled out Error: BUG: command 'mflash' does not have the '.usage' field filled out Error: BUG: command 'mflash init' does not have the '.usage' field filled out Error: BUG: command 'dummy' does not have the '.usage' field filled out Error: BUG: command 'dummy foo' does not have the '.usage' field filled out Error: BUG: command 'scan_chain' does not have the '.usage' field filled out Error: BUG: command 'jtag' does not have the '.usage' field filled out Error: BUG: command 'jtag init' does not have the '.usage' field filled out Error: BUG: command 'arm' does not have the '.usage' field filled out Error: BUG: command 'arm reg' does not have the '.usage' field filled out Error: BUG: command 'etm' does not have the '.usage' field filled out Error: BUG: command 'arm7_9' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu arm' does not have the '.usage' field filled out Error: BUG: command 'arm reg' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu etm' does not have the '.usage' field filled out Error: BUG: command 'at91eb40a.cpu arm7_9' does not have the '.usage' field filled out Error: BUG: command 'target_request' does not have the '.usage' field filled out Change-Id: I2c3e529530a15d2295a1950ffc59e8f2fc661012 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/299 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-01-03helper: fix arm11 help textSpencer Oliver1-3/+5
This fixes a long standing bug: see Trac #4 Increased help text recursion limit and added LOG_DEBUG so we can catch future errors like this. Change-Id: I5fac95c4486eaddaf1e88a27ecb1835168f87711 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/291 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-12-31build: fix mingw build issuesSpencer Oliver1-0/+3
8901fca0270fec41b12c30c7dbd806d460548c5b broke the build under mingw, this fixes that. Change-Id: I22b91e220dac3b68cc576b65a9f1b8711e64263a Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/298 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-12-01binarybuffer: use strndup to allocate stringSpencer Oliver1-4/+2
Change-Id: I65d8f37b18d5b5a798406b956f50ab7bb550e172 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/246 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-24Fix "Evaluate 'script' in the global scope"Freddie Chopin1-1/+1
This fixes commit Evaluate 'script' in the global scope. It caused Windows builds behave differently than before because path was evaluated twice and backslashes from Windows' paths got unescaped and effectively wiped out. Configs could only be passed with "-f ../dir/config.cfg" or "-f ..\\dir\\config.cfg" instead of usual "-f dir/config.cfg" (or using backslash) as previously. Change-Id: I13b4abac6dbe6d770cc11a4e61c9421ef340da83 Author: Steve Bennett <steveb@workware.net.au> Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-on: http://openocd.zylin.com/40 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-21jim: add missing jim licenseSpencer Oliver2-0/+86
Change-Id: Ib8e34739d92cd54655b9b47d07b856a82ff25f3c Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/39 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-09-30jim-nvp is moving from jimtcl to openocdSteve Bennett3-2/+617
The jim-nvp code is specific to openocd, so it belongs in openocd, not in the core jimtcl. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-08-11Evaluate 'script' in the global scopeSteve Bennett1-2/+2
Scripts sourced via 'script' should evaluate in the global scope to make it easy to set and reference global variables. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-04-28ecos: add 64 bit types for sprintf/sscanfØyvind Harboe1-0/+2
2011-03-27command: fix leak when executing commandsØyvind Harboe1-0/+1
found via valgrind, not observed/reported. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-02-25log: debug level is between silent and debug output levelsØyvind Harboe1-9/+8
It wasn't previously possible to silence the output. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-02-08performance: committed wrong version of buf_set_buf optimizationMathias K1-4/+18
oops... Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-02-08buf_set_buf around 30% speed increaseMathias K1-7/+22
Also i have checked the input of this function and in many cases a simple byte copy is possible. I have added this check now and is it possible the buffer is copied byte by byte and not bit by bit. With byte boundary input the test looks like this: buf_set_buf 0x02000000 iteration test: runtime (seconds): old: 6.828559 new: 0.436191 diff: 6.392368 runtime (seconds): old: 6.853636 new: 0.430389 diff: 6.423247 runtime (seconds): old: 6.794985 new: 0.423065 diff: 6.371920 Without: buf_set_buf 0x02000000 iteration test: runtime (seconds): old: 6.370869 new: 5.552624 diff: 0.818245 runtime (seconds): old: 6.420730 new: 5.665887 diff: 0.754843 runtime (seconds): old: 6.583306 new: 5.599021 diff: 0.984285 Regards, Mathias
2011-02-0324bit buffer supportMathias K1-0/+24
Hello, this patch add 24bit support to the target buffer functions and little/big endian functions. Regards, Mathias
2011-01-31error: remove debug output when reporting errorsØyvind Harboe1-1/+2
The user does not need to know or care about "command handlers". Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-01-09nit: more LOG_* \n fixesEric Wetzel2-7/+3
Remove extra \n from LOG_DEBUG, LOG_INFO, and LOG_WARNING messages Remove LOG_INFO_N LOG_INFO_N was only used once and had a \n at the end Change LOG_USER_N calls that end with \n to LOG_USER
2011-01-05nit: do not add \n at end of LOG_ERROREric Wetzel1-6/+6
Fixed in many other places, and submitted in response to Øyvind's invitation.
2011-01-03error handling: the error number is not part of the user interfaceØyvind Harboe1-2/+2
Do not propagate error number to user. This is for internal programming purposes only. Error messages to the user is reported as text via LOG_ERROR(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29Compilation Warnings on OS X 10.5Andrew MacIsaac1-1/+1
I received a number of "-Wshadow" related warnings (treated as errors) while trying to build on OS X Leopard. In addition, there were two miscellaneous other warnings in the flash drivers. Attached are two patches which correct these issues and the commit messages to accompany them. My system has the following configuration (taken from uname -a): Darwin 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 === Werror_patch.txt Commit Message === compilation: fixes for -Wshadow warnings on OS X These changes fix -Wshadow compilation warnings on OS X 10.5.8 Compiled with the following configure command: ../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink --enable-ft2232_libftdi === flash_patch.txt Commit Message === compilation: fixes for flash driver warnings on OS X These changes fix two compilation warnings on OS X 10.5.8: ../../../../src/flash/nor/at91sam3.c:2767: warning: redundant redeclaration of 'at91sam3_flash' ../../../../src/flash/nor/at91sam3.c:101: warning: previous declaration of 'at91sam3_flash' was here and ../../../../src/flash/nor/stmsmi.c:205: warning: format not a string literal and no format arguments Compiled with the following configure command: ../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink --enable-ft2232_libftdi === Andrew
2010-12-29warnings: use more 'const' for char *Øyvind Harboe3-3/+3
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-18script: support only Tcl commentsØyvind Harboe1-9/+0
Only Tcl comments are now supported. For classic style commands comments were supported at the end of the line. Move in the direction of letting the script language decide syntax, rather than have special rules for some commands. Before this patch goes in, the scripts should be updated to use ;# instead of # for end of line comments. > mdw 0 1 2 mdw ['phys'] address [count] zy1000.cpu mdw address [count] Command handler execution failed in procedure 'mdw' > mdw 0 1 #2 mdw ['phys'] address [count] zy1000.cpu mdw address [count] Command handler execution failed in procedure 'mdw' > mdw 0 1 ;#2 0x00000000: ffffffff > mdw 0 1 0x00000000: ffffffff > mdw 0 0x00000000: ffffffff Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-18build: add common.mkSpencer Oliver1-4/+1
Rather than specifying common makefile variables move them all to a common.mk. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-11-09JIM: document "echo" commandAntonio Borneo1-9/+14
Document "-n" option in manual; Modify "echo" command definition as COMMAND_HANDLER to easily add help message Add help message aligned with manual. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-11-09JIM: Add "-n" option to "echo"Antonio Borneo1-1/+8
With the new JIMTCL, "puts" only writes to stdout. To write on telnet port too, "echo" must be used. This patch gives to "echo" similar commandline option of "puts". Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-10-29jim tests: use installedØyvind Harboe7-14857/+9
Delete obsolete jim that comes with OpenOCD.
2010-10-27help: help now works on configuration commandsØyvind Harboe1-3/+0
help would not show help for commands when the command interpreter was in the wrong mode, which means that e.g. "help newtap" didn't work, it wouldn't show the "jtag newtap" help as it was a configuration command. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-05gdbderver: fix gdb pipe startup overflowSpencer Oliver1-3/+5
When usng gdb pipes we need to keep openocd output at a minimum, otherwise the gdb stdin will overflow and fail. Make the calls to gdb_port and log_output synchronous to stop this. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-10-01server: add support for pipesØyvind Harboe1-9/+4
-p/--pipe is now deprecated. Use '-c "gdb_port pipe;log_output openocd.log"' instead. Warning logged. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-10-01log: remove hack to redirect logs when pipes are in useØyvind Harboe1-17/+2
There is an explicit command "log_output" that can be used to redirect log output to a file, no need for a hack in the first place. Before enabling pipes, use "log_output foo" to redirect log output to the "foo" files. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29fileio: fileio_size() can now failØyvind Harboe2-3/+13
Part of making the fileio API more robust. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29fileio: refactor struct fileio to be an opaque structureØyvind Harboe2-22/+47
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-20startup: removed capture_catchØyvind Harboe1-7/+0
not used. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-20helper: fix flaky capture commandØyvind Harboe1-0/+16
capture of progress output would get polling results. This will break in the example below where polling output would override the tcl return value. capture {sleep 10000; set abc def} Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-20warnings: fix alignment warningsØyvind Harboe1-1/+1
These warnings are for architectures that do not support non-aligned word access. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-12jim: fix crash when using Jim_ListInsertElementsØyvind Harboe1-0/+1
Jim_ListInsertElements was simply forgotten from the fn that registered all the APIs. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-11command: capture command now handles both types commandsØyvind Harboe1-2/+24
Commands that output progress output and no return value will have the progress output captured. Commands that do not output progress output(tcl commands) will return the tcl return value instead. The advantage here is that it is no longer necessary to consider which command one is capturing, it works for either. Example #1: capture progress output: set foo [capture help] Example #2: capture tcl return value set foo [capture {set abc def}] Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-08-02ioutil: fix internal fn namesØyvind Harboe1-15/+11
prefix w/ioutil_ Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-08-01util: ms command to calculate length of operationsØyvind Harboe3-1/+92
This can be used to calculate approximate RTCK frequency for instance. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-21helper/jim-eventloop.h: review unused definitionsAntonio Borneo1-14/+1
Remove unused typedef and define Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-21helper/jim-eventloop: review unused symbolsAntonio Borneo1-10/+0
Remove unused functions: - Jim_CreateSignalHandler - Jim_DeleteSignalHandler Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-21helper/jim-eventloop: review scope of symbolsAntonio Borneo2-22/+9
Add "static" qualifier to private functions. Remove private prototypes from include file. Remove empty definition of JIM_STATIC. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-18reverse order of Jim stack trace outputAndreas Fritiofson1-1/+1
The stack traces makes much more sense this way. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2010-06-18don't add confusing source info to JimAndreas Fritiofson1-2/+2
When an interactive command fails, the Jim stack trace prints references to the line in "command.c" where the interpreter was invoked. Since that location has no relation to the actual command that failed, the information serves only to add confusion. By not adding the useless source info to Jim the noise can be reduced, while still printing a useful trace for nested commands. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-18helper/jim: review unused symbolsAntonio Borneo1-24/+0
Remove unused functions: - Jim_IdentityHashFunction - StringAppendObj - JimReferencesHTDoubleHashFunction Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-18helper/jim: review scope of symbolsAntonio Borneo1-39/+40
Add "static" qualifier to private functions. Function Jim_InterpolateTokens() is private, but has not been changed to "static". This function is called only once, so compiler inlines it. After inline, there is a warning for variable uninitialized. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-17mingw32: -Wshadow fixesFreddie Chopin1-9/+9
in jim.c (error: declaration of ‘boolean’ shadows a global declaration; /usr/local/lib/gcc/i686-w64-mingw32/4.4.2/../../../../i686-w64-mingw32/include/rpcndr.h:52: error: shadowed declaration is here) Signed-off-by: Freddie Chopin <freddie_chopin@op.pl>
2010-06-17helper: remove helper membufAntonio Borneo3-380/+1
Helper is now unused. Can be removed. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-16oops... backup file snuck in, remove it.Øyvind Harboe1-12823/+0
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>