Good script support for OpenOCD

Hi everyone

:idea:

It seems many people want to automate OpenOCD operations and are trying to create sofisticated scripts with many problems.

The OpenOCD scripting does not have conditionals, loops, error checking or high level variable support, and IMHO it should not have.

There are very powerful scripting systems that can be used, I would use Python from old habit, but Ruby, tcl, perl and a lot of others can be used.

One read pipe to the OpenOCD instance and its terminal output and one full duplex port 3333 connection to the telnet server in OpenOCD.

A handful of functions in the scripting language corresponding to OpenOCD commands and for parsing of output.

Now we can write a smart script to control OpenOCD operations. This method will probably give much better script support with much less work and problems.

Comments, suggestions or examples ?

Regards,

Magnus

mlu:
Hi everyone

:idea:

It seems many people want to automate OpenOCD operations and are trying to create sofisticated scripts with many problems.

The OpenOCD scripting does not have conditionals, loops, error checking or high level variable support, and IMHO it should not have.

There are very powerful scripting systems that can be used, I would use Python from old habit, but Ruby, tcl, perl and a lot of others can be used.

I'm not sure starting with perl/Ruby/Python is the best idea. Controlling embedded systems has some special requirements like reading debug/symbol informations from arbitrary executable formats, loading specific sections, relocating. I doubt perl/ruby/python have libraries for such specific things.

Comments, suggestions or examples ?

I'd rather see a library that exports all the operations that are needed to control the target. reading/setting registers, reading setting memory, setting/removing breakpoints, resetting/stepping/running/stopping/waiting target and so on. With this, it would be possible to write a pretty fancy scripting tool. There would be even possible to integrate such a library into a perl/ruby/python/whatever library.

So IMHO, a libocd should be the first step on this path.

jw:
I’m not sure starting with perl/Ruby/Python is the best idea. Controlling embedded systems has some special requirements like reading debug/symbol informations from arbitrary executable formats, loading specific sections, relocating. I doubt perl/ruby/python have libraries for such specific things.

I disagree - It would seem to make more sense to have whatever scripting language call out to binutils programs to do the ‘embedded specific’ stuff. Objcopy, Objdump, nm, ar, etc already do this stuff, why try to suck it into openocd?