mem_helper: add mrh command
authorSteven Stallion <stallion@squareup.com>
Tue, 27 Nov 2018 02:01:34 +0000 (20:01 -0600)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 6 Dec 2018 09:38:41 +0000 (09:38 +0000)
This patch adds support for reading halfword values from memory. This
command compliments existing support for writing halfwords (mwh).

Change-Id: I8ec628e65c05a7f00aa57e3af0f228eb8bd4d14e
Signed-off-by: Steven Stallion <stallion@squareup.com>
Reviewed-on: http://openocd.zylin.com/4781
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
tcl/mem_helper.tcl

index 86ad00f7ebb91672ff730c967d815d59eea75fd1..5955793e25692883a0ab974a900f205f61ff8045 100644 (file)
@@ -10,6 +10,17 @@ proc mrw {reg} {
 add_usage_text mrw "address"
 add_help_text mrw "Returns value of word in memory."
 
+# mrh: "memory read halfword", returns value of $reg
+proc mrh {reg} {
+       set value ""
+       mem2array value 16 $reg 1
+       return $value(0)
+}
+
+add_usage_text mrh "address"
+add_help_text mrh "Returns value of halfword in memory."
+
+# mrb: "memory read byte", returns value of $reg
 proc mrb {reg} {
        set value ""
        mem2array value 8 $reg 1