Hi,

On Fri, Feb 20, 2015 at 04:31:13PM +0000, Kent Brinkley wrote:
> I want to do something every simple in a tcl script, is there a way to extract
> the contents of register. If I do
...
> >reg r1 [expr [reg pc]] - to assign the contents of the pc to r1 it fails to 
> >do
> so.

Here's the trick:

reg r1 [lindex [ocd_reg pc] 2]

ocd_reg is needed because of a silly wrapper around all of OpenOCD
commands, lindex just extracts the third element of the list as
returned by reg (list elements separated by spaces, the third element
is the value).

Just tried it on hardware, seems to work just fine.

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:[email protected]

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to