aboutsummaryrefslogtreecommitdiff
path: root/src/svf
AgeCommit message (Collapse)AuthorFilesLines
2019-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo1-5/+5
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>
2018-03-13svf: improve robustness when processing invalid SVF filesPaul Fertser1-1/+4
Uninitialized argument value warnings reported by clang static analizer. Change-Id: I30af4900f517ffc0a7282689b58c7a224cdc080a Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4356 Tested-by: jenkins
2017-10-23Fix GCC7 warnings about switch-case fallthroughsFreddie Chopin1-0/+2
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-8/+2
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-07-19Fix usage of timeval_ms()Andreas Färber1-2/+2
First, fix the timeval_ms() implementation to not have K&R but ANSI argument semantics by adding a missing void. timeval_ms() returns an int64_t, not uint64_t or long long. Consistently use int64_t for variables and PRI*64 as format string. While at it, change a few related variables to bool for clarity. Note that timeval_ms() may return a negative error code, but not a single caller checks for that. Change-Id: I27cf83e75b3e9a8913f6c43e98a281bea77aac13 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3499 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-05-24Make #include guard naming consistentMarc Schink1-3/+3
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 Schink2-6/+2
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>
2015-11-20svf: fix progress reporting switch behaviourPaul Fertser1-0/+1
The svf_progress_enabled variable is global, hence its lifetime is not limited and it retains the value from the previous run. Fix this by explicit assignment. Change-Id: Id6f4fa88f39521606342a37f6876a0948ac5406e Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/3111 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-11-20svf: fix off-by-one error in line numbers as output to userPaul Fertser1-2/+2
This makes SVF error output match actual line numbers in the file processed. Change-Id: I1fa4b9d0891e4358b7beada516945d5331ebe182 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2945 Tested-by: jenkins
2015-09-30svf: fix segfaults exposed by some SVFPaul Fertser1-1/+14
The problem was reported by jstefanop on IRC, the SVF was generated with Xilinx ISE 14.7. Found and investigated with Valgrind's vgdb service. Change-Id: I32b0e77e0380ce4a391661f97449f9c2a5f83625 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2933 Tested-by: jenkins
2015-08-06svf: flush the queue before reallocing memoryPaul Fertser1-0/+4
During reallocation a new memory region might be allocated and the old one freed. If jtag queue is holding a pointer to the old memory, it will segfault during the execution. Avoid this by flushing the queue before a reallocation attempt is made. This should fix ticket #102. Change-Id: I737fc3f1ebf6d76413a475beb8bf20184fe0233f Reported-by: Alex Forencich <aforencich@users.sf.net> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2899 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-07-03Openocd: svf: Add ability to ignore svf_check_tdo errorsKamal Dasu1-4/+16
Added Openocd commandline argument to ignore_error when the read back TDO does not match to expected value specified with TDO after masking with what is specified in MASK. This allows to continue to play entire SVF file ignoring errors. Error logs clearly show the failure reason and prints read back TDO value. Change-Id: I324f476fc16a003b35e6f2c5b63976431f49d54a Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Reviewed-on: http://openocd.zylin.com/2129 Tested-by: jenkins Reviewed-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-06-22svf: Only read TDO back from the device if we actually need to look at the bits.Joshua Wise1-2/+2
This results in a 90% speedup on USB-Blaster, which serializes repeated TDI input against TDO readback; program time on an 5CGXFC5C6F27 part was dropped from 2m30s to 9s. Signed-off-by: Joshua Wise <joshua@joshuawise.com> Change-Id: I92d5a8b800492283d619328549235b610528c338 Reviewed-on: http://openocd.zylin.com/2145 Reviewed-by: Paul Fertser <fercerpav@gmail.com> Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-05-05svf: Fix debug and error messages that print hex bufferKamal Dasu1-32/+36
Added SVF_BUF_LOG macro to properly print the hex buffer of parsed string for SIR, SDR, TDI, TDO and MASK. The original debug and error logs with respect to printing real values were misleading and also had endianess issues. All the bits are printed now instead of just u32 values. Change-Id: Ie89902403bdb61ff458418446c2ca1253ea2a63f Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Reviewed-on: http://openocd.zylin.com/1964 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2014-04-14svf: try to reallocate buffers if they're not enoughPaul Fertser1-91/+27
On larger FPGAs the default buffer size is not nearly enough; automatically reallocate it as needed. Change-Id: Ic8071e8cceddeef897ce76996c029250fd22662b Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2099 Tested-by: jenkins Reviewed-by: Kenneth Lorthioir <ibelimb@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-30Don't cast return value of [cm]allocAndreas Fritiofson1-12/+12
Change-Id: I0028a5b6757b1ba00031893d9a2a1725f915a0d5 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2069 Tested-by: jenkins Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13svf: off-by-one error; do not access after the allocated memoryPaul Fertser1-2/+3
Keep the promise and ensure there're at least 3 bytes available after the current position. This eliminates the errors reported by Valgrind. Change-Id: I1d0640e904c750eed808b2b4caf419b4d7619845 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1615 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
2013-06-05update files to correct FSF addressSpencer Oliver2-2/+2
Change-Id: I429f7fd51f77b0e7c86d7a7f110ca31afd76c173 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1426 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2012-02-06build: cleanup src/svf directorySpencer Oliver2-1059/+924
Change-Id: If9186964e2597f8ca1f01885fc28418df7d92964 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/409 Tested-by: jenkins
2011-11-10svf: fix warningsØyvind Harboe1-4/+4
Change-Id: Ib7f67612db3a865f9acc5ae349455da7ddcd3348 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/177 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-06-04Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - trivial fixesFreddie Chopin1-5/+3
2011-04-01types: write memory now uses constØyvind Harboe1-1/+1
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-17Fix a bunch of typos.Uwe Hermann1-1/+1
Fix a bunch of typos. Most are in code comments, so nothing should break. UNKOWN_COMMAND and CMD_UNKOWN are not used elsewhere, so correcting the spelling should also not break anything.
2011-02-28svf: add nil option that just runs through the svf fileØyvind Harboe1-18/+49
useful for debugging without access to hardware to e.g. regression test, reproduce memory corruption problems, etc. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-01-02svf: implement sleep for RUNTEST min_timeJon Povey1-30/+28
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk> min_time was effectively ignored, I needed it to program a Lattice MachXO which uses a RUNTEST to wait for an erase operation, amongst other things. With this patch pauses happen and I can program the device with an SVF generated in LSC ispVM (with "Rev D Standard" checked to suppress nonstandard LOOP statements)
2011-01-02svf: fix USAGE and related error reportingJon Povey1-9/+4
Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
2010-12-07svf: various improvementsAndrew Leech1-78/+292
* added support for targeting particular tap * improved file reading * improved command line parsing * added progress meter * more readable time measurement output
2010-11-18build: add common.mkSpencer Oliver1-3/+1
Rather than specifying common makefile variables move them all to a common.mk. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-06-16svf: -Wshadow warning fixesØyvind Harboe1-15/+15
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-15rename jtag_khz as adapter_khzDavid Brownell1-1/+1
Globally rename "jtag_khz" as "adapter_khz", and move it out of the "jtag" command group ... it needs to be used with non-JTAG transports Includes a migration aid (in jtag/startup.tcl) so that old user scripts won't break. That aid should Sunset in about a year. (We may want to update it to include a nag message too.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-08jtag: simplify jtag_add_plain_ir/dr_scanØyvind Harboe1-2/+3
These fn's now clearly just clock out/in bits. No mystical fields are involved. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08jtag: retire tap fieldØyvind Harboe1-4/+0
jtag_add_dr/ir_scan() now takes the tap as the first argument, rather than for each of the fields passed in. The code never exercised the path where there was more than one tap being scanned, who knows if it even worked. This simplifies the implementation and reduces clutter in the calling code. use jtag_add_ir/dr_plain_scan() for more fancy situations. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-26cygwin buildfixDavid Brownell1-2/+2
isspace() parameter must be an integer, else a 'char' gets used as an array index (sigh). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-25SVF: all content between parentheses is one parametersimon qian1-14/+29
More SVF fixes: * Treat all content between parentheses as part of the same parameter; don't (wrongly) treat whitespace as a delimiter. * Use isspace() to catch that whitespace; it's not all single spaces, newlines etc are also valid. * When parsing bitstrings, strip leading whitespace too. So for example, these are equivalent and should (now) be OK: "TDI( 1234 )" "TDI( 1 2 3 4 )" "TDI(00 12 34 )" "TDI( 00 12 34)" [dbrownell@users.sourceforge.net: comment updates; trivial cleanup] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-23SVF: insert space before '(' and after ')'simon qian1-7/+29
See http://forum.sparkfun.com/viewtopic.php?p=90983#90983 for discussion; basically, the SVF parser wrongly expects "TDI (123)" but the space is optional and it should accept "TDI(123)" too. In the same way, "TDI(123)TDO(456)" should work too. Rather than update the command parsing, this just makes sure the expected spaces are present. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08*SVF: help/usage updatesDavid Brownell1-2/+2
Usage messages should use the same EBNF as the User's Guide; no angle brackets. Be more complete too ... some params were missing. Don't use "&function"; its name is its address. Unrelated: fix typo in one "target.c" usage message. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-26cygwin 1.7 build fixesDavid Brownell1-1/+2
It's less accepting of signed char ... insisting that e.g. tolower() not receive one as a parameter. It's probably good to phase out such usage, given the number of bugs that lurk in the vicinity (assumptions that char is unsigned), so fix these even though such usage is actually legal. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-08build: add build/src to include pathØyvind Harboe1-1/+2
This allows including generated include files. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-05misc code review updatesDavid Brownell1-6/+3
More updates from the code review by Steve Grubb <sgrubb@redhat.com>. The Jim float-comparision bug just gets a comment not a fix, though. Cc: Steve Grubb <sgrubb@redhat.com>. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03remove tertiary include pathsZachary T Welch1-4/+1
With all #include directives converted, we only need to have the top-level src/ directory in the search path.
2009-12-03change #include "jtag.h" to <jtag/jtag.h>Zachary T Welch2-2/+2
Changes from the flat namespace to heirarchical one. Instead of writing: #include "jtag.h" the following form should be used. #include <jtag/jtag.h> The exception is from .c files in the same directory.
2009-12-03change #include "time_support.h" to <helper/time_support.h>Zachary T Welch1-1/+1
Changes from the flat namespace to heirarchical one. Instead of writing: #include "time_support.h" the following form should be used. #include <helper/time_support.h> The exception is from .c files in the same directory.
2009-12-03normalize headers to make changing easierZachary T Welch1-1/+1
These headers need minor tweaks to paves the way for wholesale scripted coversion of the header files.
2009-12-03allow #include directives to use module nameZachary T Welch1-0/+1
Includes the src directory in the search path, so header files may be migrated from: #include "foo.h" to #include <module/foo.h> which is more conducive for installation.
2009-11-24{,x}svf: use register_commands()Zachary T Welch1-5/+12
Use register_commands() for registering {,x}svf commands.
2009-11-24use COMMAND_REGISTER macroZachary T Welch1-1/+1
Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
2009-11-17command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch1-6/+6
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
2009-11-17command_handler: change 'args' to CMD_ARGVZachary T Welch1-5/+5
This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
2009-11-17command_handler: change to 'argc' to CMD_ARGCZachary T Welch1-2/+2
This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
2009-11-16move ARRAY_SIZE macro to types.hZachary T Welch1-3/+3
The ARRAY_SIZE macro was defined in several target files, so move it to types.h. This patch also removes two other identical macros: DIM (from jtag.h) and asizeof (from arm11.h).