Just a summary of the direction(roughly) that external scripting
of OpenOCD is heading. This discussion is very much open
and alive. Nothing will be settled in stone in the immediate
future. All input most welcome!

An application written in any language(scripting or
compiled) talks to OpenOCD via some communication channel.

There are currently three communication channels available:
GDB monitor commands, Telnet and the Tcl server.

OpenOCD uses Jim Tcl internally, but this does not mean that OpenOCD
recommends or promotes any particular language. Externally all languages
are equal to OpenOCD and the goal is to support the users choice rather
than promoting any particular language.

It is of course unavoidable that some of the tcl'ness leaks out.

A program can send a command to OpenOCD and receive
a response. There is currently no mechanism for asynchronous
events.

What has not been defined yet is what is sent and what is received
back from OpenOCD.

Tentatitvely I suggest the following:

- input is tcl. This tcl is a single line and does not
have any length limit defined as such.
- output is the response from the same tcl command.


Typical scenario - script OpenOCD using e.g. Lua

- The user defines a tcl proc. This tcl procedure catches any exceptions
caused and packages the result in a Lua friendly manner. I'm not
sure what format Lua would prefer such a result in.
- *Generating* the tcl command from Lua is probably simple
- *Parsing* the result of the tcl command should be simple as
the tcl proc that processed the command would format the
result to fit the Lua client. The only nasty bit is that a bit
of Tcl code has to be written to convert Tcl friendly output
to e.g. Lua friendly output for *each* command executed.

Usage(very roughly):

openocd -f script/lua.tcl ....

Here "lua.tcl" definese the "lua" proc, which formats the result of
the command for Lua friendly parsing.

lua.tcl:

proc lua {a} {
    if {[catch {$a} result]} {
        # format error code here
        return "xxxx"
    } else {
       # format successful result here.
        return $result
    }
}

Usage from Lua:

anyone...? :-)

-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to