the c part of your code was very useful. i'm was the telnet port, and ignoring the output i did not care about. now with the gdb port i get: - "0" for success - "1" for fail - a message "invalid command name ...." if the cmd name is invalid - whatever the command would normally output to the telnet console if i run "capture command_name \x1a" or "capture {command_name command_arguments} \x1a".
thanks! regarding the tcl part: i don't know much about tcl, and i couldn't get answers from you tcl script. examples: > mdh 0x0 Sending "mdh 0x0" ... OK. > asdsf Sending "asdsf" ... OK. > sdfsdf Sending "sdfsdf" ... OK. > sdfsd Sending "sdfsd" ... OK. > flash Sending "flash" ... OK. > capture flash Sending "capture flash" ... OK. > capture flash Sending "capture flash" ... OK. > capture asdfs Sending "capture asdfs" ... OK. the debug console show the output from openocd (warnings, errors, etc) but nothing on the tcl script. On Thu, Jul 7, 2011 at 10:53 AM, Rodrigo Rosa <rodrigorosa...@gmail.com> wrote: > thanks! > :) > > On Thu, Jul 7, 2011 at 7:52 AM, Maxim Cournoyer > <maxim.courno...@gmail.com> wrote: >> Le mercredi 06 juillet 2011 à 18:50 -0700, Rodrigo Rosa a écrit : >> >> On Mon, Jul 4, 2011 at 4:13 PM, Maxim Cournoyer >> <maxim.courno...@gmail.com> wrote: >>> On Jul 2, 2011 6:15 PM +0200, Øyvind Harboe wrote: >>> >>> Use the Source Luke. The end of the command is not linefeed but 0x??. >>> There >>> ought to be updated docs. Patch? >>> >>> Great tip! I found it inside the tcl_server.c file; the end of character >>> used by the openocd tcl server is 0x1a. >>> I managed to get the result I was looking for, a simple application which >>> usage goes like: >>> >>> program </path/to/romfile.bin> >>> >>> The objective was to automate the ROM flashing procedure from Eclipse IDE >>> when working with the LM3S8962 kit. The app can be configured as an >>> "external tool" and launched at the touch of a button. It could also be >>> called inside a custom makefile. The use of the tcl_server is a great >>> feature to me, because an openocd daemon is already running most of the >>> time, to provide debugging facility. >>> >>> I have made a C version and a BASH (w/ netcat) version of such a small >>> app. >>> I also toyed with tcl to make a telnet-like utility to test openocd's tcl >>> server. >>> >>> I also gathered a LM3S8962.cfg file on the internet and refactored it in >>> to >>> a similar way to what could be seen inside the /usr/share/openocd/scripts >>> folder. I can post all that stuff if anyone is interested. >>> >> >> i'm working on something similar. >> would you mind posting your stuff? >> thanks! >> >> Hello Rodrigo! I'm happy to share the small tools I made with you and the >> openocd community. >> The following scripts/program are tailored for flashing an LM3S8962 target >> (except the tcl one), although they should be quite simple to adapt to do >> anything. >> >> Here's a general telnet like utility written in tcl, for quick testing >> (tclnet.tcl): >> >> #!/usr/bin/tclsh >> # Simple tcl client to test OpenOCD tcl_server >> # >> # Based on a script written by Charles Hardin >> # >> <http://lists.berlios.de/pipermail/openocd-development/2008-July/002368.html> >> # >> # Author: Maxim Cournoyer, 2011 >> >> # OpenOCD server settings >> set server localhost >> set port 6666 >> set EOC \x1a >> set BUFSIZE 256 >> >> puts "Use empty line to exit." >> >> # Open TCP socket >> set fo [socket $server $port] >> # The following tells the 'read' command to return on EOC. >> fconfigure $fo -eofchar $EOC >> >> puts -nonewline stdout "> " >> flush stdout >> >> while { [gets stdin line] > 0 } { >> puts -nonewline "Sending \"$line\" ... " >> puts -nonewline $fo "$line$EOC" >> flush $fo >> >> # Server reply reception >> set line {} >> >> if { [catch {set line [read $fo $BUFSIZE]}] } { >> close $fo >> puts "\nConnection or server error." >> exit 1 >> } >> >> # Server returns empty string (only EOC received) if OK. Longer output is >> # returned in case of wrong command name or if the user specified the >> command name >> # with the capture parameter, e.g.: capture { halt } >> if { [string equal $line {}] } { >> puts "OK." >> } else { >> puts "\nServer: $line" >> } >> >> puts -nonewline stdout "> " >> flush stdout >> } >> >> # We need to reconfigure the channel to normal before closing, >> # else we'd get a TCP RST fault. >> fconfigure $fo -eofchar \n >> close $fo >> exit 0 >> -- Rodrigo _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development