aboutsummaryrefslogtreecommitdiff
path: root/tcl
diff options
context:
space:
mode:
authorMatthias Welwarsky <matthias.welwarsky@sysgo.com>2016-03-02 13:52:52 +0100
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2016-08-09 14:32:12 +0100
commit918de0be13b73e8e1d48726a91520b5e3589d66d (patch)
tree83587bd55cb02755265cd0850d91f51554b191e3 /tcl
parent6f8cf930bc015037e2ad4260c7d360d563644329 (diff)
downloadriscv-openocd-918de0be13b73e8e1d48726a91520b5e3589d66d.zip
riscv-openocd-918de0be13b73e8e1d48726a91520b5e3589d66d.tar.gz
riscv-openocd-918de0be13b73e8e1d48726a91520b5e3589d66d.tar.bz2
target: add "phys" argument to mem2array, array2mem
Allow using physical addresses with mem2array and array2mem. In order to minimize the impact on existing scripts, "phys" is added as an optional 5th parameter to both commands. This patch also adds "phys" variants to the memwrite/memread commands in memory.tcl. Change-Id: Ia6307f9d861789e7f3ccf1f98961d666bf8d85d6 Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/3387 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'tcl')
-rw-r--r--tcl/memory.tcl54
1 files changed, 54 insertions, 0 deletions
diff --git a/tcl/memory.tcl b/tcl/memory.tcl
index 2719d3f..83c96d6 100644
--- a/tcl/memory.tcl
+++ b/tcl/memory.tcl
@@ -131,3 +131,57 @@ proc memwrite8 {ADDR DATA} {
error "memwrite8: $msg"
}
}
+
+proc memread32_phys {ADDR} {
+ set foo(0) 0
+ if ![ catch { mem2array foo 32 $ADDR 1 phys } msg ] {
+ return $foo(0)
+ } else {
+ error "memread32: $msg"
+ }
+}
+
+proc memread16_phys {ADDR} {
+ set foo(0) 0
+ if ![ catch { mem2array foo 16 $ADDR 1 phys } msg ] {
+ return $foo(0)
+ } else {
+ error "memread16: $msg"
+ }
+}
+
+proc memread8_phys {ADDR} {
+ set foo(0) 0
+ if ![ catch { mem2array foo 8 $ADDR 1 phys } msg ] {
+ return $foo(0)
+ } else {
+ error "memread8: $msg"
+ }
+}
+
+proc memwrite32_phys {ADDR DATA} {
+ set foo(0) $DATA
+ if ![ catch { array2mem foo 32 $ADDR 1 phys } msg ] {
+ return $foo(0)
+ } else {
+ error "memwrite32: $msg"
+ }
+}
+
+proc memwrite16_phys {ADDR DATA} {
+ set foo(0) $DATA
+ if ![ catch { array2mem foo 16 $ADDR 1 phys } msg ] {
+ return $foo(0)
+ } else {
+ error "memwrite16: $msg"
+ }
+}
+
+proc memwrite8_phys {ADDR DATA} {
+ set foo(0) $DATA
+ if ![ catch { array2mem foo 8 $ADDR 1 phys } msg ] {
+ return $foo(0)
+ } else {
+ error "memwrite8: $msg"
+ }
+}