From 002e3fcbdbb22686278abf242668431ac653a449 Mon Sep 17 00:00:00 2001
From: oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Date: Fri, 4 Jul 2008 13:37:34 +0000
Subject: [PATCH] added echo command in tcl. Issues a LOG_USER() for the single
 argument.

git-svn-id: svn://svn.berlios.de/openocd/trunk@746 b42882b7-edfa-0310-969c-e2dbd0fdcd60
---
 src/openocd.c        | 12 ++++++++++++
 src/tcl/commands.tcl | 14 +++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/openocd.c b/src/openocd.c
index e24eb9a7c..99ee6527e 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -311,6 +311,17 @@ Jim_Command_find(Jim_Interp *interp,
 	return JIM_OK;
 }
 
+static int
+Jim_Command_echo(Jim_Interp *interp, 
+                                   int argc,
+                                   Jim_Obj *const *argv)
+{
+	if (argc!=2)
+		return JIM_ERR;
+	char *str = (char*)Jim_GetString(argv[1], NULL);
+	LOG_USER("%s", str);
+	return JIM_OK;
+}
 
 void initJim(void)
 {
@@ -323,6 +334,7 @@ void initJim(void)
     Jim_CreateCommand(interp, "openocd", Jim_Command_openocd, NULL, NULL);
     Jim_CreateCommand(interp, "openocd_throw", Jim_Command_openocd_throw, NULL, NULL);
     Jim_CreateCommand(interp, "find", Jim_Command_find, NULL, NULL);
+    Jim_CreateCommand(interp, "echo", Jim_Command_echo, NULL, NULL);
 }
 
 int main(int argc, char *argv[])
diff --git a/src/tcl/commands.tcl b/src/tcl/commands.tcl
index 0c5132a9b..f42047f7f 100644
--- a/src/tcl/commands.tcl
+++ b/src/tcl/commands.tcl
@@ -1,4 +1,16 @@
 # implements Tcl procedures/functions
 proc peek {address} {
 	return [openocd mdw $address]
-}
\ No newline at end of file
+}
+
+# Production command
+proc board_produce {filename serialnumber} {
+	openocd "reset init"
+	openocd "flash write_image erase $filename [flash] bin"]]
+	openocd "verify_image $filename [flash] bin"]]
+	echo "Successfully ran production procedure"
+}
+
+proc board_test {} {
+	echo "Production test not implemented"
+}
-- 
GitLab