On 16/11/2010, at 11:36 AM, Andrew Leech wrote: > On Tue, Nov 16, 2010 at 12:19 PM, Steve Bennett <ste...@workware.net.au> > wrote: >> >> On 16/11/2010, at 11:15 AM, Øyvind Harboe wrote: >> >>> On Tue, Nov 16, 2010 at 2:06 AM, Steve Bennett <ste...@workware.net.au> >>> wrote: >>>> On 16/11/2010, at 9:27 AM, Andrew Leech wrote: >>>> >>>>> Hi all, >>>>> I've just found a compiling/usage difficulty with the git version on >>>>> cygwin. Apparently somewhere between 0.4.0 and mainline (possibly >>>>> jimtcl?) openocd no longer handles dos line endings on config files. >>>>> Apparently all my config files of my existing 0.4.0 installation have >>>>> dos line endings and I'd never realised or cared, but I compiled git >>>>> on cygwin and tried to use it with my existing openocd.cfg and was >>>>> treated to this error: >>>>> >>>>> Open On-Chip Debugger 0.5.0-dev-00589-gfdae512-dirty (2010-11-16-10:00) >>>>> Licensed under GNU GPL v2 >>>>> For bug reports, read >>>>> http://openocd.berlios.de/doc/doxygen/bugs.html >>>>> Runtime Error: embedded:startup.tcl:57: >>>>> in procedure 'script' >>>>> at file "embedded:startup.tcl", line 57 >>>>> >>>>> This is a very un-user-friendly error message and had me stumped, I >>>>> though my build was broken or something. It took me a lot of stuffing >>>>> around with config files to realise it was just a dos2unix on my >>>>> config file away from working, and now I'm all good. >>>>> I personally don't have an issue with requiring unix line endings, >>>>> it's just that this is a nasty way to fail, a cleaner error message >>>>> would have been useful. >>>> >>>> I suspect the problem is here in src/helper/startup.tcl >>>> >>>> set errmsg [format "%s: command requires more arguments" \ >>>> [concat $name " " $args]] >>>> >>>> The backslash newline sequence will likely have a carriage return inserted. >>>> The easy solution is to ensure that these startup files are read in text >>>> mode >>>> or have the \r\n translated to \n before creating startup_tcl.c >>>> >>>> But it would also be nice if each startup script were evaluated >>>> independently >>>> with the original filename, and any error message shown. >>> >>> A large startup.tcl is generated by the makefiles from many smaller >>> startup.tcl scripts around the source tree. This startup.tcl is then >>> converted >>> to .c and linked into openocd. Why? Because it was felt that it was an >>> important >>> feature to be able to launch openocd without a dependency on the files that >>> openocd ships with. >> >> Nothing wrong with that. Jim Tcl does something similar to allow Tcl >> extensions >> to be linked in. For example, stdlib.tcl, tclcompat.tcl and glob.tcl >> >> The trick is to invoke Jim_Eval_Named() once for each file so that the >> original >> source file can be identified, and also to display any error which is >> generated. >> > > I don't know that the line ending problem is with (the compiled in) > startup.tcl. I only did the dos2unix on my openocd.cfg and associated > cfg text files, and then they worked fine with the same openocd > binary. > > Is openocd supposed to still work with dos format .cfg files? > > Andrew
Perhaps you could try the attached patch to Jim Tcl. It should allow for cfg files with dos line endings. -- µWeb: Embedded Web Framework - http://uweb.workware.net.au/ WorkWare Systems Pty Ltd W: www.workware.net.au P: 0434 921 300 E: ste...@workware.net.au F: 07 3102 9221
0001--source-now-opens-the-script-file-in-text-mode.patch
Description: Binary data
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development