]> git.sur5r.net Git - openocd/commitdiff
httpd wip
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 22 Dec 2008 15:02:09 +0000 (15:02 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 22 Dec 2008 15:02:09 +0000 (15:02 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1268 b42882b7-edfa-0310-969c-e2dbd0fdcd60

31 files changed:
src/helper/jim.c
src/server/Makefile.am
src/server/httpd.c
src/server/httpd/Stylizer.class [new file with mode: 0644]
src/server/httpd/Stylizer.java [new file with mode: 0644]
src/server/httpd/browsemem.tcl [new file with mode: 0644]
src/server/httpd/build.sh [new file with mode: 0644]
src/server/httpd/downloadmem.tcl [new file with mode: 0644]
src/server/httpd/editconfigs.tcl [new file with mode: 0644]
src/server/httpd/editfile.tcl [new file with mode: 0644]
src/server/httpd/erase.tcl [new file with mode: 0644]
src/server/httpd/flash.tcl [new file with mode: 0644]
src/server/httpd/flashinfo.tcl [new file with mode: 0644]
src/server/httpd/guiupload.tcl [new file with mode: 0644]
src/server/httpd/html2tcl.sh [new file with mode: 0644]
src/server/httpd/httpd.tcl [new file with mode: 0644]
src/server/httpd/index.tcl [new file with mode: 0644]
src/server/httpd/log.tcl [new file with mode: 0644]
src/server/httpd/menu.xml [new file with mode: 0644]
src/server/httpd/menu.xsl [new file with mode: 0644]
src/server/httpd/menuweb.css [new file with mode: 0644]
src/server/httpd/openocd.tcl [new file with mode: 0644]
src/server/httpd/preconfig.tcl [new file with mode: 0644]
src/server/httpd/production.tcl [new file with mode: 0644]
src/server/httpd/readme.txt [new file with mode: 0644]
src/server/httpd/reload.tcl [new file with mode: 0644]
src/server/httpd/run.tcl [new file with mode: 0644]
src/server/httpd/support.tcl [new file with mode: 0644]
src/server/httpd/targets.tcl [new file with mode: 0644]
src/server/httpd/terminal.tcl [new file with mode: 0644]
src/server/httpd/upgrade.tcl [new file with mode: 0644]

index 800db23406762d1b5ee6516643db4bcc8fe2216c..f4336ae244b2a15283f2fd716476ad04babf6155 100644 (file)
@@ -8695,7 +8695,7 @@ int Jim_EvalObj(Jim_Interp *interp, Jim_Obj *scriptObjPtr)
             if (cmd->cmdProc) {
                 interp->cmdPrivData = cmd->privData;
                 retcode = cmd->cmdProc(interp, argc, argv);
-                if (retcode == JIM_ERR_ADDSTACK) {
+                if ((retcode == JIM_ERR)||(retcode == JIM_ERR_ADDSTACK)) {
                     JimAppendStackTrace(interp, "", script->fileName, token[i-argc*2].linenr);
                     retcode = JIM_ERR;
                 }
index 0e3a3a479076178e7c9512d8367898c89fe83b83..89b5e364236c90ee2dfaa4e9ee2c4e8cae265dfb 100644 (file)
@@ -12,3 +12,10 @@ endif
 # tcl server addons
 noinst_HEADERS += tcl_server.h
 libserver_a_SOURCES += tcl_server.c
+
+if HTTPD
+nobase_dist_pkglib_DATA = $(wildcard $(srcdir)/httpd/*.tcl)
+nobase_dist_pkglib_DATA += $(wildcard $(srcdir)/httpd/*.css)
+nobase_dist_pkglib_DATA += $(wildcard $(srcdir)/httpd/menu_cuts/*.png)
+endif
+AM_CPPFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\" @CPPFLAGS@
\ No newline at end of file
index 96e338244ba005398f04020adfc90b1eb5b00dd2..348a081b631fb5c8d434983c228749fc727af03c 100644 (file)
@@ -261,13 +261,89 @@ static int record_arg(void *cls, enum MHD_ValueKind kind, const char *key,
        return MHD_YES;
 }
 
-static int ahc_echo(void * cls, struct MHD_Connection * connection,
-               const char * url, const char * method, const char * version,
-               const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+
+int handle_request(struct MHD_Connection * connection, const char * url)
 {
        struct MHD_Response * response;
+
        int ret;
+       const char *suffix;
+       suffix = strrchr(url, '.');
+       if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
+       {
+               printf("Run tcl %s\n", url);
+
+               int retcode;
+
+               const char *script = alloc_printf(
+                               "global httpdata; source {%s}; set httpdata", url);
+               retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
+               free((void *) script);
+
+               if (retcode == JIM_ERR)
+               {
+                       printf("Tcl failed\n");
+                       const char *t = httpd_exec_cgi_tcl_error(interp);
+                       if (t == NULL)
+                               return MHD_NO;
+
+                       response = MHD_create_response_from_data(strlen(t), (void *) t,
+                                       MHD_YES, MHD_NO);
+                       ret = MHD_queue_response(connection,
+                                       MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+                       MHD_destroy_response(response);
+                       return ret;
+               }
+               else
+               {
+                       printf("Tcl OK\n");
+                       /* FIX!!! how to handle mime types??? */
+                       const char *result;
+                       int reslen;
+                       result = Jim_GetString(Jim_GetResult(interp), &reslen);
 
+                       response = MHD_create_response_from_data(reslen, (void *) result,
+                                       MHD_NO, MHD_YES);
+                       ret = MHD_queue_response(connection,
+                                       MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+                       MHD_destroy_response(response);
+                       return ret;
+               }
+       }
+       else
+       {
+               void *data;
+               int len;
+
+               int retval = loadFile(url, &data, &len);
+               if (retval != ERROR_OK)
+               {
+                       printf("Did not find %s\n", url);
+
+                       response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
+                                       (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
+                       ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
+                       MHD_destroy_response(response);
+                       return ret;
+               }
+
+               LOG_DEBUG("Serving %s length=%d", url, len);
+               /* serve file directly */
+               response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
+               MHD_add_response_header(response, "Content-Type", "image/png");
+
+               ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+               MHD_destroy_response(response);
+
+               //free(data);
+               return ret;
+       }
+}
+
+static int ahc_echo(void * cls, struct MHD_Connection * connection,
+               const char * url, const char * method, const char * version,
+               const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+{
        int post = 0;
 
        if (0 == strcmp(method, "POST"))
@@ -337,79 +413,19 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection,
         * being subverted to evil purposes
         */
 
-       url++; /* skip '/' */
+       const char *httpd_dir=PKGLIBDIR "/httpd";
 
-       const char *suffix;
-       suffix = strrchr(url, '.');
-       if ((suffix != NULL) && (strcmp(suffix, ".tcl") == 0))
+       if (*url=='/')
        {
-               printf("Run tcl %s\n", url);
-
-               int retcode;
-
-               const char *script = alloc_printf(
-                               "global httpdata; source {%s}; set httpdata", url);
-               retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__ );
-               free((void *) script);
-
-               if (retcode == JIM_ERR)
-               {
-                       printf("Tcl failed\n");
-                       const char *t = httpd_exec_cgi_tcl_error(interp);
-                       if (t == NULL)
-                               return MHD_NO;
-
-                       response = MHD_create_response_from_data(strlen(t), (void *) t,
-                                       MHD_YES, MHD_NO);
-                       ret = MHD_queue_response(connection,
-                                       MHD_HTTP_INTERNAL_SERVER_ERROR, response);
-                       MHD_destroy_response(response);
-                       return ret;
-               }
-               else
-               {
-                       printf("Tcl OK\n");
-                       /* FIX!!! how to handle mime types??? */
-                       const char *result;
-                       int reslen;
-                       result = Jim_GetString(Jim_GetResult(interp), &reslen);
-
-                       response = MHD_create_response_from_data(reslen, (void *) result,
-                                       MHD_NO, MHD_YES);
-                       ret = MHD_queue_response(connection,
-                                       MHD_HTTP_INTERNAL_SERVER_ERROR, response);
-                       MHD_destroy_response(response);
-                       return ret;
-               }
+               url++; /* skip '/' */
        }
-       else
-       {
-               void *data;
-               int len;
-
-               int retval = loadFile(url, &data, &len);
-               if (retval != ERROR_OK)
-               {
-                       printf("Did not find %s\n", url);
-
-                       response = MHD_create_response_from_data(strlen(PAGE_NOT_FOUND),
-                                       (void *) PAGE_NOT_FOUND, MHD_NO, MHD_NO);
-                       ret = MHD_queue_response(connection, MHD_HTTP_NOT_FOUND, response);
-                       MHD_destroy_response(response);
-                       return ret;
-               }
-
-               printf("Serving %s length=%d\n", url, len);
-               /* serve file directly */
-               response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
-               MHD_add_response_header(response, "Content-Type", "image/png");
+       if (!*url)
+               url="index.tcl";
 
-               ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
-               MHD_destroy_response(response);
-
-               //free(data);
-               return ret;
-       }
+       const char *file_name=alloc_printf("%s/%s", httpd_dir, url);
+       int result = handle_request(connection, file_name);
+       free((void *)file_name);
+       return result;
 }
 
 static struct MHD_Daemon * d;
diff --git a/src/server/httpd/Stylizer.class b/src/server/httpd/Stylizer.class
new file mode 100644 (file)
index 0000000..ffa08ce
Binary files /dev/null and b/src/server/httpd/Stylizer.class differ
diff --git a/src/server/httpd/Stylizer.java b/src/server/httpd/Stylizer.java
new file mode 100644 (file)
index 0000000..3b8bee3
--- /dev/null
@@ -0,0 +1,114 @@
+import java.io.File;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+\r
+import javax.xml.parsers.DocumentBuilder;\r
+import javax.xml.parsers.DocumentBuilderFactory;\r
+import javax.xml.parsers.ParserConfigurationException;\r
+import javax.xml.transform.Transformer;\r
+import javax.xml.transform.TransformerConfigurationException;\r
+import javax.xml.transform.TransformerException;\r
+import javax.xml.transform.TransformerFactory;\r
+import javax.xml.transform.dom.DOMSource;\r
+import javax.xml.transform.stream.StreamResult;\r
+import javax.xml.transform.stream.StreamSource;\r
+\r
+import org.apache.xpath.XPathAPI;\r
+import org.w3c.dom.Document;\r
+import org.w3c.dom.Node;\r
+import org.w3c.dom.NodeList;\r
+import org.xml.sax.SAXException;\r
+\r
+/** used to generate .tcl files from */\r
+public class Stylizer\r
+{\r
+       // Global value so it can be ref'd by the tree-adapter\r
+       static Document document;\r
+       public static void main(String argv[])\r
+       {\r
+               if (argv.length != 3)\r
+               {\r
+                       System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir");\r
+                       System.exit(1);\r
+               }\r
+               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\r
+               try\r
+               {\r
+                       System.err.println("Starting conversion...");\r
+                       \r
+                       File stylesheet = new File(argv[0]);\r
+                       File datafile = new File(argv[1]);\r
+                       DocumentBuilder builder = factory.newDocumentBuilder();\r
+                       document = builder.parse(datafile);\r
+                       \r
+                       NodeList list = XPathAPI.selectNodeList(document, "website/language/page");\r
+\r
+                       for (int i=0; i<list.getLength(); i++)\r
+                       {\r
+                               Node node=list.item(i);\r
+                               \r
+                               // Use a Transformer for output\r
+                               TransformerFactory tFactory = TransformerFactory.newInstance();\r
+                               StreamSource stylesource = new StreamSource(stylesheet);\r
+                               Transformer transformer = tFactory.newTransformer(stylesource);\r
+                               \r
+                               Node fileName = XPathAPI.selectSingleNode(node, "outfile/text()");\r
+                               \r
+                               System.err.println("Converting " + fileName.getNodeValue());\r
+                               DOMSource source = new DOMSource(document);\r
+                               \r
+                               OutputStream output=new FileOutputStream(new File(argv[2], fileName.getNodeValue()));\r
+                               \r
+                               \r
+                               try\r
+                               {\r
+                                       StreamResult result = new StreamResult(output);\r
+                                       \r
+                                       transformer.setParameter("pagetogenerate", fileName.getNodeValue());\r
+                                       transformer.transform(source, result);\r
+                               } \r
+                               finally\r
+                               {\r
+                                       output.close();\r
+                               }\r
+                       }\r
+               } catch (TransformerConfigurationException tce)\r
+               {\r
+                       // Error generated by the parser\r
+                       System.out.println("\n** Transformer Factory error");\r
+                       System.out.println("   " + tce.getMessage());\r
+                       // Use the contained exception, if any\r
+                       Throwable x = tce;\r
+                       if (tce.getException() != null)\r
+                               x = tce.getException();\r
+                       x.printStackTrace();\r
+               } catch (TransformerException te)\r
+               {\r
+                       // Error generated by the parser\r
+                       System.out.println("\n** Transformation error");\r
+                       System.out.println("   " + te.getMessage());\r
+                       // Use the contained exception, if any\r
+                       Throwable x = te;\r
+                       if (te.getException() != null)\r
+                               x = te.getException();\r
+                       x.printStackTrace();\r
+               } catch (SAXException sxe)\r
+               {\r
+                       // Error generated by this application\r
+                       // (or a parser-initialization error)\r
+                       Exception x = sxe;\r
+                       if (sxe.getException() != null)\r
+                               x = sxe.getException();\r
+                       x.printStackTrace();\r
+               } catch (ParserConfigurationException pce)\r
+               {\r
+                       // Parser with specified options can't be built\r
+                       pce.printStackTrace();\r
+               } catch (IOException ioe)\r
+               {\r
+                       // I/O error\r
+                       ioe.printStackTrace();\r
+               }\r
+       } // main\r
+}\r
diff --git a/src/server/httpd/browsemem.tcl b/src/server/httpd/browsemem.tcl
new file mode 100644 (file)
index 0000000..b34ff69
--- /dev/null
@@ -0,0 +1,456 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="browsemem.tcl" style="font-weight: bold;">Browse / Edit</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="downloadmem.tcl" style="">Download</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl" style="font-weight: bold;">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Browse / Edit Memory</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+\r
+\r
+                       \r
+                       }\r
+\r
+                       \r
+                       set form_address [formfetch form_address]\r
+                       set form_length [formfetch form_length]\r
+                       set form_type [formfetch form_type]\r
+                       set form_action [formfetch form_action]\r
+                       set form_value [formfetch form_value]\r
+                       \r
+                       if {[string compare $form_length ""]==0} {\r
+                               set form_length 0\r
+                       }  \r
+                       if {$form_length<=0} {\r
+                               set form_length 0x80\r
+                       } \r
+                       if {$form_length>0x1000} {\r
+                               set form_length 0x1000\r
+                       } \r
+                       \r
+                       if {[string compare $form_type ""]==0} {\r
+                               set form_type mdw\r
+                       }\r
+                       \r
+                       if {[string compare $form_type "mdw"]==0} {\r
+                               set wordsize 4\r
+                               set modify_cmd mww \r
+                       }\r
+                       if {[string compare $form_type "mdh"]==0} {\r
+                               set wordsize 2\r
+                               set modify_cmd mwh \r
+                       }\r
+                       if {[string compare $form_type "mdb"]==0} {\r
+                               set wordsize 1\r
+                               set modify_cmd mwb \r
+                       }\r
+                       \r
+                       \r
+                       \r
+                       \r
+                       if {[string compare $form_address ""]!=0} {\r
+                               if {[string compare $form_action "Previous"]==0} {\r
+                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions\r
+                                       incr form_address ; set form_address [expr $form_address-1]\r
+                                       if {$form_address-$form_length>0} {\r
+                                               set form_address "0x[tohex [expr $form_address-$form_length]]"\r
+                                       } else {\r
+                                               set form_address "0x0"\r
+                                       }\r
+                               }  \r
+                               if {[string compare $form_action "Next"]==0} {\r
+                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions\r
+                                       incr form_address ; set form_address [expr $form_address-1]\r
+                                       set form_address "0x[tohex [expr $form_address+$form_length]]"\r
+                               }  \r
+                               if {[string compare $form_action "Modify"]==0} {\r
+                                       append console [capture_catch "$modify_cmd $form_address $form_value"]\r
+                               }  \r
+                               if {[string compare $form_action "Fill"]==0} {\r
+                                       append console [capture_catch "$modify_cmd $form_address $form_value $form_length"]\r
+                               }  \r
+                       }\r
+                       \r
+                       \r
+                       \r
+append buffer {\r
+                       \r
+                       <form action="browsemem.tcl" method="post"> \r
+                               <table>\r
+                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="}\r
+append buffer $form_address\r
+append buffer {"></td></tr>\r
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="}\r
+append buffer "0x[tohex $form_length]"\r
+append buffer {"></td></tr>\r
+                               <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="}\r
+append buffer $form_value\r
+append buffer {"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Modify"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Fill"></td></tr>\r
+                               <tr><td class="formtext">Type</td><td style="padding-top:1px;">\r
+                               <select name="form_type">\r
+                                 <option \r
+                                   }\r
+if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} }  \r
+append buffer { value ="mdb">8 bit\r
+                                 </option>\r
+                                 <option \r
+                                  }\r
+if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} }  \r
+append buffer { value ="mdh">16 bit\r
+                                 </option>\r
+                                       <option\r
+                                          }\r
+if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} }  \r
+append buffer {value ="mdw">32 bit\r
+                                       </option>\r
+                               </select>\r
+                               \r
+                               </td></tr>\r
+                               </table>\r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <table><tr>\r
+                                       <td><input type="submit" name="form_action" value="Refresh"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Previous" ></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Next" ></td>\r
+                               </tr></table>\r
+                               <br>\r
+                               \r
+                       </form>\r
+                       <p>\r
+                       <div class="fontbigger">Memory:</div><p>\r
+                       <code style="white-space: nowrap; font-size:11px;font:courier new;">\r
+                               }\r
+\r
+                               if {[string compare $form_address ""]!=0} {\r
+                                       append console [encode [capture_catch halt]]\r
+                                       append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]]\r
+                               } \r
+                               \r
+append buffer {\r
+                       </code>\r
+\r
+\r
+                       \r
+\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="browsemem.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Browse and edit target memory.<br>\r
+                                  Length is in bytes, maximum 4096 bytes.</p> \r
+                               <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p>\r
+                               <p>CPU will be halted if required.</p>\r
+                               <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p>\r
+                               <p><b>Fill</b> - Will fill the specified region with the specified value.</p>\r
+                               <p><b>Refresh</b> - Display the content of the specified memory area.</p>\r
+                                       \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/build.sh b/src/server/httpd/build.sh
new file mode 100644 (file)
index 0000000..93831a5
--- /dev/null
@@ -0,0 +1,3 @@
+set e
+java -classpath ../../../../zy1000/build/xalan.jar\;. Stylizer menu.xsl menu.xml .
+find . -regex ".*\.tcl" -type f -exec sh html2tcl.sh {} {} \;
diff --git a/src/server/httpd/downloadmem.tcl b/src/server/httpd/downloadmem.tcl
new file mode 100644 (file)
index 0000000..035ff3d
--- /dev/null
@@ -0,0 +1,368 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="browsemem.tcl" style="">Browse / Edit</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="downloadmem.tcl" style="font-weight: bold;">Download</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl" style="font-weight: bold;">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Download Memory Range</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       }\r
+\r
+                               set form_address [formfetch form_address]\r
+                               set form_length [formfetch form_length]\r
+                               set form_action [formfetch form_action]\r
+                       \r
+append buffer {                        \r
+                       <form action="downloadmem.tcl" method="post"> \r
+                               <table>\r
+                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="}\r
+append buffer $form_address\r
+append buffer {"></td></tr>\r
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="}\r
+append buffer $form_length\r
+append buffer {"></td></tr>\r
+                               </td></tr>\r
+                               </table>\r
+\r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <input type="submit" value="Download" name="form_action">\r
+                               \r
+                               \r
+                       </form>\r
+                       }\r
+\r
+                               if {[string compare $form_action "Download"]==0} {\r
+                                       append console [encode [capture_catch "reset init"]]\r
+                                       append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]]\r
+                                       \r
+append buffer {\r
+                                       <form action="../dump.bin" target="_blank"> \r
+                                               <input type="submit" name="form_action" value="Save downloaded memory">\r
+                                       </form>\r
+                                       }\r
\r
+                               }\r
+                               \r
+                       \r
+append buffer {\r
+\r
+\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="downloadmem.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                                       \r
+                               Download memory to ZY1000 from target. <br>\r
+                               <b>Note</b> that download memory can take\r
+                               a long time(potentially minutes for megabytes at low JTAG clk speeds).\r
+                               <p/>\r
+                               Once the memory is downloaded a link is available on the page to download\r
+                               the file from ZY1000 to your PC.\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/editconfigs.tcl b/src/server/httpd/editconfigs.tcl
new file mode 100644 (file)
index 0000000..13e3910
--- /dev/null
@@ -0,0 +1,462 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>Zylin ZY1000 JTAG debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+<img src="menu_cuts/logo_top.png" style="border:0px;"/>\r
+</a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="index.tcl" style="">Target Status</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="preconfig.tcl" style="">Select Target Config</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="editconfigs.tcl" style="font-weight: bold;">Edit Configurations</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="reload.tcl" style="">Reload Config Scripts</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl" style="font-weight: bold;">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Edit Target Configurations</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       <form action="editconfigs.tcl" method="post">\r
+                       }\r
+\r
+                               set form_edittext [formfetch form_edittext]\r
+                               set form_action [formfetch form_action]\r
+                               set form_filename [formfetch form_filename]\r
+                               set form_selected [formfetch form_selected] \r
+                               \r
+                               if {[string compare $form_action "Load"]==0} {\r
+                                       set form_filename $form_selected\r
+                               }\r
+                               \r
+                               if {[string compare $form_action "Delete"]==0} {\r
+                                       capture_catch "rm /config/settings/$form_selected"\r
+                               }\r
+                               \r
+                               if {[string compare $form_action "Save"]==0} {\r
+                                       save_var $form_filename [from_textarea $form_edittext] \r
+                                       append buffer "Wrote file $form_filename<br>"\r
+                               }\r
+                       \r
+                               set form_edittext ""\r
+                               \r
+                               # load original or script saved on disk.\r
+                               if {[string compare $form_action "Show default"]==0} {\r
+                                       set form_edittext [load_file "/rom/$form_selected"]\r
+                                       set form_filename $form_selected\r
+                               } else {\r
+                                   set form_edittext [load_config $form_filename]\r
+                               }\r
+                       \r
+                               set form_edittext_subst [to_textarea $form_edittext]\r
+                       \r
+                               \r
+                               proc prepend { val list } {\r
+                                       set res ""                              \r
+                               foreach value $list {\r
+                                       set t $val\r
+                                       append t $value\r
+                                   lappend res $t\r
+                               }\r
+                               return $res\r
+                                }                              \r
+                               \r
+                               set files [prepend target/ [ls /rom/target]]\r
+                               set files [lunion $files [prepend event/ [ls /config/settings/event]]]\r
+                               set files [lunion $files [prepend target/ [ls /config/settings/target]]]\r
+                               set files [lsort $files]\r
+                               \r
+                               \r
+append buffer {\r
+                               <table style="padding:0px;border-collapse:collapse;"><tr>\r
+                                       <td style="padding-top:1px;"><select name="form_selected">\r
+                                               }\r
+\r
+                                                       set foundTarget 0\r
+                                                       foreach i $files {\r
+                                                               \r
+append buffer {\r
+                                                                       <option \r
+                                                                       }\r
+\r
+                                                                               if {[string compare $form_filename $i]==0} { \r
+                                                                                       set foundTarget 1\r
+                                                                                       append buffer {selected="selected"} \r
+                                                                               }\r
+                                                                       \r
+append buffer {\r
+                                                               value="}\r
+append buffer $i\r
+append buffer {">}\r
+append buffer $i\r
+append buffer {</option>\r
+                                                               }\r
+\r
+                                                       }\r
+                                                       if {$foundTarget==0} {\r
+                                                               \r
+append buffer {\r
+                                                                       <option selected="selected" value="">Select target config</option>\r
+                                                               }\r
+\r
+                                                       }\r
+                                               \r
+append buffer {\r
+                                       </select></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td>\r
+                                       <td><input type="submit" value="Load" name="form_action"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td>\r
+                                       <td><input type="submit" value="Show default" name="form_action"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td>\r
+                                       <td><input type="submit" value="Delete" name="form_action"></td>\r
+                               </tr></table>\r
+                               <textarea  style="overflow:auto;"  rows="21" cols="65" name="form_edittext" wrap="off">}\r
+append buffer $form_edittext_subst\r
+append buffer {</textarea>\r
+                               <table style="padding:0px;border-collapse:collapse;"><tr>\r
+                               }\r
+\r
+                                       append buffer {<td class="formtext">File</td><td><input type="text" name="form_filename" } "\n"\r
+                                       append buffer "value=\"$form_filename\" ></td>\n"\r
+                                       append buffer {<td class="buttonspacesmall">&nbsp</td><td><input type="submit" value="Save" name="form_action"></td><br>} "\n"\r
+                                       append buffer {</tr></table>} "\n"\r
+                               \r
+append buffer {\r
+                       </form>                 \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="editconfigs.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Here you can edit predefined target configurations, restore predefined configurations to\r
+                               default state and create new target configurations.<p/>\r
+                               <p>Typically when creating a new target configuration, you would take an existing\r
+                               configuration that resembles the most your needs and modify it for your\r
+                               purposes and save it under a different name.</p>\r
+                               <p><b>Load</b> - Loads a configuration file into the editor.</p>\r
+                               <p><b>Show default</b> - Loads the firmware included version of the\r
+                               configuration file (if any), into the editor.<br>\r
+                               <b>Note</b> that the editor content is not saved.</p>\r
+                               <p><b>Delete</b> - Deletes a custom created configuration file.<br>\r
+                               <b>Note</b> that firmware included configuration files can not be deleted.</p>\r
+                               <p><b>Save</b> - Save the edited file under the a new or the same name.</p>\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td/>\r
+<td>\r
+<img border="0" src="menu_cuts/logo_bottom.png"/>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/editfile.tcl b/src/server/httpd/editfile.tcl
new file mode 100644 (file)
index 0000000..8838e69
--- /dev/null
@@ -0,0 +1,436 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+               \r
+               \r
+\r
+               \r
+               \r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>Zylin ZY1000 JTAG debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+<img src="menu_cuts/logo_top.png" style="border:0px;"/>\r
+</a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="zy1000.tcl" style="">Set IP Address</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="upgrade.tcl" style="">ZY1000 Firmware</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="editfile.tcl" style="font-weight: bold;">Edit File</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="support.tcl" style="">Support Request</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="log.tcl#tail" style="">View Tail of Log</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/zy1000.tcl" style="font-weight: bold;">Setup ZY1000</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Edit File</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+}\r
+\r
+                       \r
+\r
+#Read a text file, edit it and write it back. Useful for interactive debugging\r
+#of tcl scripts\r
+\r
+set data ""\r
+append buffer {<form action="editfile.tcl" method="post">} "\n"\r
+\r
+set err "";\r
+\r
+set form_edittext [formfetch form_edittext];\r
+set form_action [formfetch form_action];\r
+set form_filename [formfetch form_filename];\r
+\r
+puts Action $form_action\r
+\r
+if {[string compare $form_action "Load"]==0} {\r
+\r
+       set form_edittext ""\r
+       catch {\r
+               set fp [aio.open $form_filename r];\r
+               set form_edittext [$fp read];\r
+               $fp close;\r
+       } err\r
+}\r
+if {[string compare $form_action "Delete"]==0} {\r
+       capture "rm $form_filename"\r
+}\r
+\r
+set form_edittext_subst [to_textarea $form_edittext]\r
+\r
+\r
+if {[string compare $form_action "Save"]==0} {\r
+       if {[catch {\r
+               set fp [aio.open $form_filename w];\r
+               $fp puts [from_textarea $form_edittext]\r
+               $fp close\r
+               append buffer "Wrote file $form_filename<br>"\r
+       } err]} {\r
+               append buffer "Could not write $form_filename<br>"\r
+       } \r
+}\r
+\r
+\r
+\r
+\r
+append buffer {<table><tr><td class="formtext">File</td><td style="padding-top:1px;"><input type="text" name="form_filename" } "\n"\r
+append buffer "value=\"$form_filename\" ></td>\n"\r
+append buffer {<td class="buttonspacesmall">&nbsp</td><td><input type="submit" value="Load" name="form_action" ></td><td class="buttonspacesmall">&nbsp</td><td><input type="submit" value="Save" name="form_action"></td><td class="buttonspacesmall">&nbsp</td><td><input type="submit" value="Delete" name="form_action"></td>} "\n"\r
+append buffer {</tr></table>} "\n"\r
+append buffer {<br>}   \r
+\r
+append buffer {<textarea  style="overflow:auto;"  rows="18" cols="65" name="form_edittext" wrap="off">}\r
+append buffer $form_edittext_subst\r
+append buffer {</textarea><br>}\r
+\r
+append buffer {</html> } "\n"\r
+\r
+\r
+       \r
+append buffer {\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="/ram/cgi/editfile.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               Edit any file on the ZY1000 by typing in the\r
+                               filename and pressing Load.\r
+                               </p>\r
+                               <table style="line-height:17px;"><tr>\r
+                                       <td><a href="/ram" target="_blank">Browse files on /ram</a><br>\r
+                                       <a href="/config" target="_blank">Browse files on /config</a><br>\r
+                                       <a href="/rom" target="_blank">Browse files on /rom</a></td>\r
+                               </tr></table>\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td/>\r
+<td>\r
+<img border="0" src="menu_cuts/logo_bottom.png"/>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/erase.tcl b/src/server/httpd/erase.tcl
new file mode 100644 (file)
index 0000000..b48197f
--- /dev/null
@@ -0,0 +1,389 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flashinfo.tcl" style="">Info</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="erase.tcl" style="font-weight: bold;">Erase</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flash.tcl" style="">Program / Verify</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="production.tcl" style="">Production</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Erase Flash</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+\r
+\r
+                       \r
+                       }\r
+\r
+                       \r
+                       set form_address [formfetch form_address]\r
+                       set form_length [formfetch form_length]\r
+                       set form_action [formfetch form_action]\r
+                       \r
+                       if {[string compare $form_length ""]==0} {\r
+                               set form_length 0x10000\r
+                       }  \r
+                       if {[string compare $form_address ""]==0} {\r
+                               if {[catch {[zy1000_flash]} result]==0} {\r
+                                               set form_address "0x[tohex $result]"\r
+                                       }                       \r
+                       }  \r
+                       \r
+                       \r
+                       if {[string compare $form_address ""]!=0} {\r
+                               if {[string compare $form_action "Erase"]==0} {\r
+                                               append buffer "<code style=\"white-space: nowrap;\">"\r
+                                               append console [encode [capture_catch {\r
+                                               reset init\r
+                                               flash erase_address $form_address $form_length}]]\r
+                                               append buffer </code>\r
+                               }  \r
+                       }\r
+                       \r
+                       \r
+                       \r
+append buffer {\r
+                       \r
+                       <form action="erase.tcl" method="post"> \r
+                               <table>\r
+                               <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="}\r
+append buffer $form_address\r
+append buffer {"></td></tr>\r
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="}\r
+append buffer $form_length\r
+append buffer {"></td></tr>\r
+                               </td></tr>\r
+                               </table>\r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <input type="submit" name="form_action" value="Erase"><br>\r
+                               \r
+                               \r
+                       </form>\r
+                       \r
+\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="erase.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Note that flash programming will erase flash if required.<p/>\r
+                               <p>Reset and init CPU, then erase address range.</p>\r
+                               <p>The length field is specified in number of bytes.</p>\r
+                                       \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/flash.tcl b/src/server/httpd/flash.tcl
new file mode 100644 (file)
index 0000000..f7c8547
--- /dev/null
@@ -0,0 +1,461 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flashinfo.tcl" style="">Info</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="erase.tcl" style="">Erase</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flash.tcl" style="font-weight: bold;">Program / Verify</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="production.tcl" style="">Production</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Program / Verify Flash</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       \r
+                       }\r
+\r
+                       \r
+                       set form_offset [formfetch form_offset]\r
+                       set form_action [formfetch form_action]\r
+                       set form_type [formfetch form_type]\r
+                       \r
+                       \r
+                       set post ""\r
+                       catch {set post $post_data} err\r
+                       \r
+                       if {[string compare $form_offset ""]==0} {\r
+                               set form_offset 0\r
+                       }\r
+                       if {[string compare $form_type ""]==0} {\r
+                               set form_type ""\r
+                       }\r
+                       \r
+                       \r
+append buffer {<code style="white-space: nowrap;">}\r
+\r
+                       \r
+                       set data ""\r
+                       append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">}\r
+                       \r
+                       set action_reset [expr {[string length $form_action]!=0}] \r
+                       set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] \r
+                       set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]\r
+                       \r
+                       if {$action_reset} {\r
+                               append console [encode [capture_catch "reset init"]]\r
+                       }\r
+                       \r
+append buffer {\r
+                       </code>}\r
+\r
+                               \r
+                       append buffer {<table>}\r
+                       append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>}\r
+                       append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>"\r
+                       \r
+                       \r
+append buffer {\r
+                       <tr><td class="formtext" style="padding-top:1px;">Type</td><td>\r
+                       <select name="form_type">\r
+                                       <option\r
+                          }\r
+if {[string compare $form_type ""]==0} { append buffer {selected="selected"} }  \r
+append buffer {\r
+                                       value ="">auto</option>\r
+                         <option \r
+                          }\r
+if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} }  \r
+append buffer {\r
+                         value ="elf">elf</option>\r
+                         <option \r
+                          }\r
+if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} }  \r
+append buffer {\r
+                         value ="bin">binary</option>\r
+                         <option \r
+                          }\r
+if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} }  \r
+append buffer {\r
+                         value ="ihex">ihex</option>\r
+                         <!-- broken <option value ="s19">s19</option> -->\r
+                       </select>\r
+                       </td>\r
+                       \r
+                       </tr>\r
+                       \r
+                       \r
+                       </table>\r
+                       \r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                       <table><tr>\r
+                               <td><input type="submit" name="form_action" value="Flash" ></td>\r
+                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td>\r
+                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td>\r
+                       </tr></table>\r
+               \r
+                       <p>\r
+                       }\r
+\r
+                       \r
+                       if {$action_flash||$action_verify} {\r
+                               catch {writeform form_filecontent $upload_filename} result\r
+                               append console [encode $result]\r
+                       }\r
+                       append buffer "<br>"\r
+                       if {$action_flash} {\r
+                               append console [encode [capture_catch "halt"]]\r
+                               append buffer "<b>"\r
+                               if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {\r
+                                       append buffer "Flash write failed<br>"\r
+                                       append console [encode $result]\r
+                               } else {\r
+                                       append buffer [encode $result]\r
+                                       append buffer "Flash write succeed<br>"\r
+                               }\r
+                               append buffer "</b>"\r
+                       }\r
+                       if {$action_verify} {\r
+                               append console [encode [capture_catch "halt"]]\r
+                               append buffer "<b>"\r
+                               if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {\r
+                                       append buffer "Verify failed<br>"\r
+                                       append console [encode $result]\r
+                               } else {\r
+                                       append buffer [encode $result]\r
+                                       append buffer "Verify succeed<br>"\r
+                               }\r
+                               append buffer "</b>"\r
+                       }\r
+                       \r
+append buffer {                \r
+                               \r
+                       </form>\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="flash.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Program and/or verify the flash on your target.</p>\r
+                               <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p>\r
+                               <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p>\r
+                               <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p>\r
+                               <p><b>Offset</b> - This value is added to the address of the image.<br> \r
+                                       Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> \r
+                                       Typically 0 for elf/ihex and the address to     write the image to for binary files.</p>\r
+                                        \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/flashinfo.tcl b/src/server/httpd/flashinfo.tcl
new file mode 100644 (file)
index 0000000..595c449
--- /dev/null
@@ -0,0 +1,384 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flashinfo.tcl" style="font-weight: bold;">Info</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="erase.tcl" style="">Erase</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flash.tcl" style="">Program / Verify</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="production.tcl" style="">Production</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Flash Information</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+\r
+                       <div style="font-size:14px;">Configured flash banks:</div>\r
+                       <p>                     \r
+                       <code style="white-space: nowrap;">\r
+                               }\r
+\r
+                                       set flash_return [ocd_flash_banks]\r
+                                       if {[llength $flash_return]!=0} {\r
+                                               append buffer [encode [flash banks]]\r
+                                       \r
+                                               set form_action [formfetch form_action]\r
+                                               if {[string compare $form_action "Reset CPU and probe flash"]==0} {\r
+                                                       append console [encode [capture_catch "reset init"]]\r
+                                                       append buffer [encode [capture_catch "flash probe 0"]]\r
+                                                       append buffer [encode [capture_catch "flash info 0"]]\r
+                                               }\r
+                                       } else {\r
+                                               append buffer "No flash bank configured."\r
+                                       }\r
+                               \r
+append buffer {\r
+                               <p>\r
+                               <form action="flashinfo.tcl" method="post"> \r
+                                       <input type="submit" name="form_action" value="Reset CPU and probe flash">\r
+                               </form>\r
+                               }\r
+\r
+                                       foreach a [ocd_flash_banks] {\r
+                                               append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: "\r
+                                               \r
+append buffer {\r
+                                                       <form action="downloadmem.tcl" method="post"> \r
+                                                               <input type="hidden" name="form_address" value="}\r
+append buffer [format "0x%08x" $a(base)]\r
+append buffer {">\r
+                                                               <input type="hidden" name="form_length" value="}\r
+append buffer [format "0x%08x" $a(size)]\r
+append buffer {">\r
+               \r
+                                                               <input type="submit" value="Download" name="form_action">\r
+                                                               <br>\r
+                                                       </form>\r
+                                               }\r
+\r
+                                       }\r
+                               \r
+append buffer {\r
+                       </code>\r
+                       \r
+\r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="flashinfo.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Here you will find information about the flash chips that you have\r
+                               in your configuration.<p/>\r
+                               <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show\r
+                               you more detailed information about your flash. This includes information about\r
+                               the different sectors in the flash, and the flash driver used.</p>\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/guiupload.tcl b/src/server/httpd/guiupload.tcl
new file mode 100644 (file)
index 0000000..9b02c2a
--- /dev/null
@@ -0,0 +1,374 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="openocd.tcl" style="">Run Command</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="guiupload.tcl" style="font-weight: bold;">Upload File to ZY1000</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl" style="font-weight: bold;">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Upload File to ZY1000</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       \r
+                       }\r
+\r
+                               set form_filename [formfetch form_filename];\r
+                               set form_action [formfetch form_action];\r
+                               #set form_filecontent [formfetch form_filecontent];\r
+                               \r
+                               append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">}\r
+                               append buffer <br> \r
+                               if {[string compare $form_action "Upload"]==0} {\r
+                                       if {[catch {writeform form_filecontent $form_filename} result]==0} {\r
+                                               append buffer [encode $result]\r
+                                       } else {\r
+                                               append buffer Wrote $form_filename\r
+                                       }\r
+                               }\r
+                               \r
+                               append buffer {<table style="padding:0px;border-collapse:collapse;"><tr><td class="formtext">Filename on ZY1000</td><td><input type="text" name="form_filename"></td></tr>}\r
+                               append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>}\r
+                               append buffer {<table><tr><td style="height:15px;width:535px;">&nbsp</td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;">&nbsp</td></tr></table>}\r
+                               append buffer {<input type="submit" name="form_action" value="Upload" ><br> }\r
+                               append buffer {</form>}\r
+                       \r
+                       \r
+append buffer {\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="guiupload.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">   \r
+                               \r
+                                 <p>The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing\r
+                                 embedded into the firmware.</p>\r
+\r
+                                 <p>Use "/ram" to store temporary files.<p/>\r
+                                 \r
+                                 <p>\r
+                                 You can browse filing systems and download files by pointing your web browser to:\r
+                                 <ul> \r
+                                 <li><a href="/ram" target="_blank">/ram</a>\r
+                                 <li><a href="/rom" target="_blank">/rom</a>\r
+                                 <li><a href="/config" target="_blank">/config</a>\r
+                                 </ul>\r
+                                 </p> \r
+                                 \r
+                                 <p>\r
+                                 You can also upload files using e.g. curl from the command line. Example:\r
+                                 </p>\r
+                                 <code>\r
+                                 curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf }\r
+append buffer [ip]\r
+append buffer {upload.tcl\r
+                                 </code>\r
+                                 <p> \r
+                                 If you have a tftp server installed on your development PC, you can access\r
+                                 files on your developer PC using a /tftp/ip/ prefix to the file to be accessed\r
+                                 on your developer PC. Note that if you do not increase the default packet\r
+                                 size for your tftp server, then the performance will be very poor. Normal\r
+                                 performance is about 500-600kBytes/s.\r
+                                 </p>\r
+                                 <code> \r
+                                 cp /tftp/10.0.0.106/build/src/openocd /ram/test\r
+                                 </code>\r
+                                 \r
+                                 \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/html2tcl.sh b/src/server/httpd/html2tcl.sh
new file mode 100644 (file)
index 0000000..3eb5c39
--- /dev/null
@@ -0,0 +1,128 @@
+#!/bin/bash
+# restart using a Tcl shell \
+       exec sh -c 'for tclshell in tclsh tclsh83 cygtclsh80 ; do \
+                       ( echo | $tclshell ) 2> /dev/null && exec $tclshell "`( cygpath -w \"$0\" ) 2> /dev/null || echo $0`" "$@" ; \
+               done ; \
+               echo "file2c.tcl: cannot find Tcl shell" ; exit 1' "$0" "$@"
+
+#===============================================================================
+#
+#    file2c.tcl
+#
+#    Convert a file into a header that can be #included from C.
+#
+#===============================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+#===============================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):   jlarmour,bartv
+# Contact(s):  
+# Date:                2001-07-20
+# Purpose:      
+# Description:
+# Usage:        file2c.tcl <file to encode> <output C header file>
+#
+#####DESCRIPTIONEND####
+#===============================================================================
+
+if { $argc != 2 } {
+       puts "Usage: html2tcl.tcl <infile> <outfile>"
+       exit 1
+}
+set infile [lindex $argv 0]
+set outfile [lindex $argv 1]
+                               
+set infilefd [open $infile "r"]
+set data [read $infilefd]
+close $infilefd
+
+
+
+
+if [string match *\.tcl $infile]==0 {
+       puts "Not .tcl file, skipping $infile"
+       exit 0
+}
+
+set outfilefd [ open $outfile "w" ]
+if [regexp -start 0 {^\s*<html.*} $data]==0 {
+       puts "copy $infile"
+       puts -nonewline $outfilefd $data
+       close $outfilefd
+       exit 0
+}
+
+puts "converting $infile"
+
+set result ""
+append result "# converted to .tcl by html2tcl.tcl\n"
+append result "set buffer \"\"\n"
+
+set pos 0
+set done 0
+while {$done==0} {
+       set start [string first <tcl> $data $pos]
+       if $start==-1 {
+               # We're done...
+               set done 1
+               set start [string length $data]
+               set end $start
+       } else {
+               set end [string first </tcl> $data $start]
+               if $end==-1 {
+                       # uh-oh, not closed
+                       puts "<tcl> not closed!"
+                       exit 1
+               }
+       }
+       #puts "done $done start $start end $end"
+       # Dump HTML into resulting file.
+       append result "append buffer {"
+       append result [string range $data $pos [expr $start-1]]
+       #puts [string range $data $pos $start]
+       append result "}\n"
+       
+       # Dump TCL into resulting file.
+       append result "[string range $data [expr $start+5] [expr $end-1]]\n"
+       
+       set pos [expr $end+6]
+}
+
+append result "start_chunked \"html\"\n"
+append result {write_chunked $buffer} "\n"
+append result "end_chunked\n"
+
+puts $outfilefd $result
+close $outfilefd
diff --git a/src/server/httpd/httpd.tcl b/src/server/httpd/httpd.tcl
new file mode 100644 (file)
index 0000000..b579411
--- /dev/null
@@ -0,0 +1,108 @@
+# some dummy proc's to get things going for test purposes\r
+\r
+\r
+\r
+proc ip {} {\r
+return 10.0.0.55\r
+}\r
+\r
+proc start_chunked {a} {\r
+       global httpdata\r
+       global httpmime\r
+       set httpmime $a\r
+       set httpdata ""\r
+}\r
+\r
+proc write_chunked {a} {\r
+       global httpdata\r
+       append httpdata $a\r
+}\r
+\r
+proc end_chunked {} {\r
+}\r
+\r
+\r
+\r
+#proc formfetch {a} {\r
+#      global httppostdata\r
+       #catch { \r
+#      echo "$a=$httppostdata($a)"\r
+       #return $httppostdata($a) \r
+       #}\r
+#      \r
+       #return ""  \r
+#}\r
+\r
+\r
+\r
+\r
+proc tohex {a} {\r
+   set r ""\r
+   while 1 {\r
+\r
+      set rem [expr $a%16]\r
+      set a [expr $a/16]\r
+      set r [string index "0123456789abcdef" $rem]$r\r
+      if ($a==0) then break\r
+   }  \r
+   return $r \r
+}\r
+\r
+# encode text\r
+proc encode {a} {\r
+       return [string map {\n <br/> { } {&nbsp;} \t {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} > &gt; < &lt; / &#47;} $a]\r
+}\r
+\r
+#stubs that can be overriden to save between sessions\r
+proc load_var {a} {\r
+       global glob_var\r
+       catch {\r
+               return $glob_var($a)\r
+       }\r
+       return ""\r
+}\r
+#stubs that can be overriden to save between sessions\r
+proc save_var {a b} {\r
+       catch { \r
+       set glob_var($a) $b\r
+       return ""\r
+       } err\r
+       set glob_var($a) ""\r
+       return ""\r
+}\r
+\r
+\r
+\r
+proc to_textarea {a} {\r
+       return [string map {& &#38; > &gt; < &lt; / &#47;} $a]\r
+}      \r
+\r
+proc from_textarea {a} {\r
+       return [string map {&gt; > &lt; < &#38; & &#47; /} $a]\r
+}\r
+       \r
+proc lunion {a b} {\r
+       foreach e $a {\r
+               set x($e) {}\r
+       }\r
+       foreach e $b {\r
+               if {![info exists x($e)]} {\r
+               lappend a $e\r
+               }\r
+       }\r
+       return $a\r
+}\r
\r
+\r
+# encode text\r
+proc encode {a} {\r
+       return [string map {\n <br/> { } {&nbsp;} \t {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} > &gt; < &lt; / &#47;} $a]\r
+}\r
+\r
+# catch any exceptions, capture output and return it \r
+proc capture_catch {a} {\r
+       catch {\r
+               return [eval {capture $a}]\r
+       } result\r
+       return $result\r
+}\r
diff --git a/src/server/httpd/index.tcl b/src/server/httpd/index.tcl
new file mode 100644 (file)
index 0000000..91e7e3f
--- /dev/null
@@ -0,0 +1,381 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="index.tcl" style="font-weight: bold;">Target Status</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl" style="font-weight: bold;">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>OpenOCD debugger</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+\r
+                       \r
+                       <table>\r
+                               <tr><td style="height:10px;width:535px;">&nbsp</td></tr>\r
+                               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                               <tr><td style="height:5px;width:535px;">&nbsp</td></tr>\r
+                       </table>\r
+\r
+                       <H1>Target Status</H1>\r
+\r
+                       <table>\r
+                               <tr>\r
+                                       <td class="fontbigger">\r
+                                               }\r
+\r
+                                                       set form_address [formfetch form_address]\r
+                                                       set form_action [formfetch form_action]\r
+                                                       \r
+                                                       if {[string compare $form_action "Halt"]==0} {\r
+                                                               append console [encode [capture_catch "halt"]]\r
+                                                       }\r
+                                                       if {[string compare $form_action "Resume"]==0} {\r
+                                                               append console [encode [capture_catch "resume"]]\r
+                                                       }\r
+                                                         \r
+                                                       if {[string compare $form_action "Reset and run"]==0} {\r
+                                                               append console [encode [capture_catch "reset run"]]\r
+                                                       }\r
+                                                       \r
+                                                       if {[string compare $form_action "Power on"]==0} {\r
+                                                               append console [encode [capture_catch "power on"]]\r
+                                                       }\r
+                                                       if {[string compare $form_action "Power off"]==0} {\r
+                                                               append console [encode [capture_catch "power off"]]\r
+                                                       }\r
+                                               \r
+append buffer {\r
+                                       \r
+                                               }\r
+append console [encode [capture_catch poll]]\r
+append buffer {\r
+                                       </td>\r
+                               </tr>\r
+                       </table>\r
+\r
+                       <form action="index.tcl" method="post"> \r
+                               <table><tr>\r
+                                       <td><input type="submit" name="form_action" value="Reset and run"></td>\r
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td>\r
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td>\r
+                                       <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td>\r
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td>\r
+                               </tr></table>\r
+\r
+                               <br>                                            \r
+                               <br>                                            \r
+                                                                               \r
+                               <p>\r
+                       </form>\r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="index.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                                       <p>Target status shows that status of the connected target. </p> \r
+                                       <p><b>Current target</b> - selected target configuration. <br>\r
+                                       <p><b>Startup</b> - whether or not the target script ran to completion. Note\r
+                                       that even if the target is disconnected, powered down or unresponsive, the\r
+                                       startup script will still run to completion. Startup - OK does not mean\r
+                                       that the target is fully operational, simply that the configuration script\r
+                                       did not contain syntax errors for instance. \r
+                                       See log for details. <br>\r
+                                       <p><b>Target power</b> - Detects power on target. <br>\r
+                                       If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p>\r
+                                       <p><b>Power on</b> - Turn on ZY1000 target power relay.</p>\r
+                                       <p><b>Power off</b> - Turn off ZY1000  target power relay.</p>\r
+                                       <p>Type "help power" in telnet for command to control power relay.</p>\r
+                                       <p><b>Reboot ZY1000</b> - Reboots ZY1000 unit. Type "help reboot" in telnet.</p>\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/log.tcl b/src/server/httpd/log.tcl
new file mode 100644 (file)
index 0000000..c579451
--- /dev/null
@@ -0,0 +1,343 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>Zylin ZY1000 JTAG debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+<img src="menu_cuts/logo_top.png" style="border:0px;"/>\r
+</a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="openocd.tcl" style="">Run Command</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="guiupload.tcl" style="">Upload File to ZY1000</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="log.tcl#tail" style="">View Tail of Log</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl" style="font-weight: bold;">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>View Tail of Log</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       }\r
+\r
+                               append buffer "<code style=\"white-space: nowrap;\">"\r
+                               append buffer [encode [log]]\r
+                               append buffer {<p><p><p><a name="tail"/>} \r
+                               append buffer {<a href="log.tcl}\r
+                               append buffer "?rnd=[rand]"\r
+                               append buffer {#tail">Refresh</a>} \r
+                               append buffer {<p>} \r
+                               append buffer "</code>";\r
+                       \r
+append buffer {\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="log.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"/>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td/>\r
+<td>\r
+<img border="0" src="menu_cuts/logo_bottom.png"/>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/menu.xml b/src/server/httpd/menu.xml
new file mode 100644 (file)
index 0000000..cf286e2
--- /dev/null
@@ -0,0 +1,1038 @@
+<?xml version = "1.0" encoding="iso-8859-1" standalone="yes"?>\r
+<?xml-stylesheet type="text/xsl" href="plaintext.xsl"?>\r
+<website>\r
+       \r
+       <language lang="Norsk">\r
+\r
+               <page lang="eng">\r
+                       <outfile>index.tcl</outfile>\r
+                       <menutext>Config Target</menutext> \r
+                       <menulink>index.tcl</menulink> \r
+                       <pageheading>OpenOCD debugger</pageheading>\r
+                       <level2parent>index.tcl</level2parent>\r
+                       <level2menu href="index.tcl" title="Target Status" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+                       <!-- \r
+                       <level2menu href="terminal.tcl" title="UART forwarding" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+                        -->\r
+               \r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+\r
+                       \r
+                       <table>\r
+                               <tr><td style="height:10px;width:535px;">&nbsp</td></tr>\r
+                               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                               <tr><td style="height:5px;width:535px;">&nbsp</td></tr>\r
+                       </table>\r
+\r
+                       <H1>Target Status</H1>\r
+\r
+                       <table>\r
+                               <tr>\r
+                                       <td class="fontbigger">\r
+                                               <tcl>\r
+                                                       set form_address [formfetch form_address]\r
+                                                       set form_action [formfetch form_action]\r
+                                                       \r
+                                                       if {[string compare $form_action "Halt"]==0} {\r
+                                                               append console [encode [capture_catch "halt"]]\r
+                                                       }\r
+                                                       if {[string compare $form_action "Resume"]==0} {\r
+                                                               append console [encode [capture_catch "resume"]]\r
+                                                       }\r
+                                                         \r
+                                                       if {[string compare $form_action "Reset and run"]==0} {\r
+                                                               append console [encode [capture_catch "reset run"]]\r
+                                                       }\r
+                                                       \r
+                                                       if {[string compare $form_action "Power on"]==0} {\r
+                                                               append console [encode [capture_catch "power on"]]\r
+                                                       }\r
+                                                       if {[string compare $form_action "Power off"]==0} {\r
+                                                               append console [encode [capture_catch "power off"]]\r
+                                                       }\r
+                                               </tcl>\r
+                                       \r
+                                               <tcl>append console [encode [capture_catch poll]]</tcl>\r
+                                       </td>\r
+                               </tr>\r
+                       </table>\r
+\r
+                       <form action="index.tcl" method="post"> \r
+                               <table><tr>\r
+                                       <td><input type="submit" name="form_action" value="Reset and run"></td>\r
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td>\r
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td>\r
+                                       <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td>\r
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td>\r
+                               </tr></table>\r
+\r
+                               <br>                                            \r
+                               <br>                                            \r
+                                                                               \r
+                               <p>\r
+                       </form>\r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <markup_code><![CDATA[\r
+                                       <p>Target status shows that status of the connected target. </p> \r
+                                       <p><b>Current target</b> - selected target configuration. <br>\r
+                                       <p><b>Startup</b> - whether or not the target script ran to completion. Note\r
+                                       that even if the target is disconnected, powered down or unresponsive, the\r
+                                       startup script will still run to completion. Startup - OK does not mean\r
+                                       that the target is fully operational, simply that the configuration script\r
+                                       did not contain syntax errors for instance. \r
+                                       See log for details. <br>\r
+                                       <p><b>Target power</b> - Detects power on target. <br>\r
+                                       If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p>\r
+                                       <p><b>Power on</b> - Turn on ZY1000 target power relay.</p>\r
+                                       <p><b>Power off</b> - Turn off ZY1000  target power relay.</p>\r
+                                       <p>Type "help power" in telnet for command to control power relay.</p>\r
+                                       <p><b>Reboot ZY1000</b> - Reboots ZY1000 unit. Type "help reboot" in telnet.</p>\r
+                               ]]></markup_code>\r
+                       </right_column>\r
+                       \r
+                       </pagetext>\r
+               </page>\r
+               \r
+               \r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>targets.tcl</outfile>\r
+                       <level2parent>documentation.tcl</level2parent>\r
+                       <pageheading>Target config quick start guide</pageheading>\r
+                       <pagetext>\r
+                               <markup_code><![CDATA[\r
+                               \r
+                               A target needs an openocd.cfg file. This config file sets up\r
+                               the CPU, flash and reset init script. Either ZY1000 ships with an\r
+                               openocd.cfg file for your target or you need to take an existing\r
+                               config file and modify it for your needs.\r
+                               <p> \r
+                               The reset init script is crucial. It will set up e.g. MMU, chip\r
+                               select registers, etc. after a reset. The init.cfg (reset init script)\r
+                               is embedded into the openocd.cfg file in the sampls Zylin provides.\r
+                               <p>\r
+                               Writing an openocd.cfg from scratch is a non-trivial exercise, but\r
+                               fortunally it only has to be done once for a target and afterwards it\r
+                               rarely if ever needs to be changed.\r
+                               \r
+                               \r
+                               ]]></markup_code>\r
+                               <right_column>\r
+                                       \r
+                                         Quick start guide on how to configure a target.\r
+                               </right_column>\r
+                       </pagetext>\r
+                       \r
+                       \r
+               </page>\r
+\r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>reload.tcl</outfile>\r
+                       <level2parent>index.tcl</level2parent>\r
+                       <pageheading>Reload Config Scripts</pageheading>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+                       \r
+                       <tcl>\r
+                               set form_action [formfetch form_action]\r
+       \r
+                               if {[string compare $form_action "Reload"]==0} {\r
+                                       append buffer "Reloading Config Scripts...<p>"\r
+                                       reboot\r
+                               }\r
+                       </tcl>\r
+                       <form enctype="multipart/form-data" action="reload.tcl" method="post">\r
+                               <input type="submit" name="form_action" value="Reload">\r
+                       </form>\r
+                       \r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               Restart ZY1000 to reload selected target config script.                         \r
+                       </right_column>\r
+                       </pagetext>\r
+                       \r
+               </page>\r
+\r
+               \r
+               <page lang="eng">\r
+                       <outfile>flashinfo.tcl</outfile>\r
+                       <menutext>Flash</menutext> \r
+                       <menulink>flashinfo.tcl</menulink> \r
+                       <pageheading>Flash Information</pageheading>\r
+                       <level2parent>flashinfo.tcl</level2parent>\r
+                       <level2menu href="flashinfo.tcl" title="Info" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+                       <level2menu href="erase.tcl" title="Erase" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+                       <level2menu href="flash.tcl" title="Program / Verify" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+                       <level2menu href="production.tcl" title="Production" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+\r
+                       <div style="font-size:14px;">Configured flash banks:</div>\r
+                       <p>                     \r
+                       <code style="white-space: nowrap;">\r
+                               <tcl>\r
+                                       set flash_return [ocd_flash_banks]\r
+                                       if {[llength $flash_return]!=0} {\r
+                                               append buffer [encode [flash banks]]\r
+                                       \r
+                                               set form_action [formfetch form_action]\r
+                                               if {[string compare $form_action "Reset CPU and probe flash"]==0} {\r
+                                                       append console [encode [capture_catch "reset init"]]\r
+                                                       append buffer [encode [capture_catch "flash probe 0"]]\r
+                                                       append buffer [encode [capture_catch "flash info 0"]]\r
+                                               }\r
+                                       } else {\r
+                                               append buffer "No flash bank configured."\r
+                                       }\r
+                               </tcl>\r
+                               <p>\r
+                               <form action="flashinfo.tcl" method="post"> \r
+                                       <input type="submit" name="form_action" value="Reset CPU and probe flash">\r
+                               </form>\r
+                               <tcl>\r
+                                       foreach a [ocd_flash_banks] {\r
+                                               append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: "\r
+                                               </tcl>\r
+                                                       <form action="downloadmem.tcl" method="post"> \r
+                                                               <input type="hidden" name="form_address" value="<tcl>append buffer [format "0x%08x" $a(base)]</tcl>">\r
+                                                               <input type="hidden" name="form_length" value="<tcl>append buffer [format "0x%08x" $a(size)]</tcl>">\r
+               \r
+                                                               <input type="submit" value="Download" name="form_action">\r
+                                                               <br>\r
+                                                       </form>\r
+                                               <tcl>\r
+                                       }\r
+                               </tcl>\r
+                       </code>\r
+                       \r
+\r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <![CDATA[\r
+                               <p>Here you will find information about the flash chips that you have\r
+                               in your configuration.<p/>\r
+                               <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show\r
+                               you more detailed information about your flash. This includes information about\r
+                               the different sectors in the flash, and the flash driver used.</p>\r
+                               ]]>\r
+                       </right_column>\r
+                       \r
+                       </pagetext>\r
+               </page>\r
+\r
+               <page lang="eng">\r
+                       <outfile>flash.tcl</outfile>\r
+                       <level2parent>flashinfo.tcl</level2parent>\r
+                       <pageheading>Program / Verify Flash</pageheading>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+                       \r
+                       <tcl>\r
+                       \r
+                       set form_offset [formfetch form_offset]\r
+                       set form_action [formfetch form_action]\r
+                       set form_type [formfetch form_type]\r
+                       \r
+                       \r
+                       set post ""\r
+                       catch {set post $post_data} err\r
+                       \r
+                       if {[string compare $form_offset ""]==0} {\r
+                               set form_offset 0\r
+                       }\r
+                       if {[string compare $form_type ""]==0} {\r
+                               set form_type ""\r
+                       }\r
+                       \r
+                       </tcl><code style="white-space: nowrap;"><tcl>\r
+                       \r
+                       set data ""\r
+                       append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">}\r
+                       \r
+                       set action_reset [expr {[string length $form_action]!=0}] \r
+                       set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] \r
+                       set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]\r
+                       \r
+                       if {$action_reset} {\r
+                               append console [encode [capture_catch "reset init"]]\r
+                       }\r
+                       </tcl>\r
+                       </code><tcl>\r
+                               \r
+                       append buffer {<table>}\r
+                       append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>}\r
+                       append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>"\r
+                       \r
+                       </tcl>\r
+                       <tr><td class="formtext" style="padding-top:1px;">Type</td><td>\r
+                       <select name="form_type">\r
+                                       <option\r
+                          <tcl>if {[string compare $form_type ""]==0} { append buffer {selected="selected"} }  </tcl>\r
+                                       value ="">auto</option>\r
+                         <option \r
+                          <tcl>if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} }  </tcl>\r
+                         value ="elf">elf</option>\r
+                         <option \r
+                          <tcl>if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} }  </tcl>\r
+                         value ="bin">binary</option>\r
+                         <option \r
+                          <tcl>if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} }  </tcl>\r
+                         value ="ihex">ihex</option>\r
+                         <!-- broken <option value ="s19">s19</option> -->\r
+                       </select>\r
+                       </td>\r
+                       \r
+                       </tr>\r
+                       \r
+                       \r
+                       </table>\r
+                       \r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                       <table><tr>\r
+                               <td><input type="submit" name="form_action" value="Flash" ></td>\r
+                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td>\r
+                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td>\r
+                       </tr></table>\r
+               \r
+                       <p>\r
+                       <tcl>\r
+                       \r
+                       if {$action_flash||$action_verify} {\r
+                               catch {writeform form_filecontent $upload_filename} result\r
+                               append console [encode $result]\r
+                       }\r
+                       append buffer "<br>"\r
+                       if {$action_flash} {\r
+                               append console [encode [capture_catch "halt"]]\r
+                               append buffer "<b>"\r
+                               if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {\r
+                                       append buffer "Flash write failed<br>"\r
+                                       append console [encode $result]\r
+                               } else {\r
+                                       append buffer [encode $result]\r
+                                       append buffer "Flash write succeed<br>"\r
+                               }\r
+                               append buffer "</b>"\r
+                       }\r
+                       if {$action_verify} {\r
+                               append console [encode [capture_catch "halt"]]\r
+                               append buffer "<b>"\r
+                               if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {\r
+                                       append buffer "Verify failed<br>"\r
+                                       append console [encode $result]\r
+                               } else {\r
+                                       append buffer [encode $result]\r
+                                       append buffer "Verify succeed<br>"\r
+                               }\r
+                               append buffer "</b>"\r
+                       }\r
+                       </tcl>          \r
+                               \r
+                       </form>\r
+                       \r
+                       ]]></markup_code>\r
+                       \r
+                       <right_column>\r
+                               <![CDATA[\r
+                               <p>Program and/or verify the flash on your target.</p>\r
+                               <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p>\r
+                               <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p>\r
+                               <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p>\r
+                               <p><b>Offset</b> - This value is added to the address of the image.<br> \r
+                                       Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> \r
+                                       Typically 0 for elf/ihex and the address to     write the image to for binary files.</p>\r
+                                       ]]> \r
+                       </right_column>\r
+                       \r
+                       \r
+                       </pagetext>\r
+                       \r
+               </page>\r
+\r
+\r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>production.tcl</outfile>\r
+                       <level2parent>flashinfo.tcl</level2parent>\r
+                       <pageheading>Production</pageheading>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+                       <tcl>\r
+                               set form_action [formfetch form_action]\r
+                               set form_serialnumber [formfetch form_serialnumber]\r
+                               append buffer [production_info]\r
+                       </tcl>\r
+                               \r
+                       <form enctype="multipart/form-data" action="production.tcl" method="post">\r
+                               <code style="white-space: nowrap;">\r
+                                       <tcl>   \r
+                                               if {[string compare $form_action "Upload firmware"]==0} {\r
+                                                       set wrotedata [catch {writeform form_filecontent $upload_filename} result]  \r
+                                                       append buffer [encode $result]\r
+                                                       if {$wrotedata==0} {\r
+                                                               append buffer "<br>Running production procedure<p>"\r
+                                                               append buffer "<br>Reset and init: <br>"\r
+                                                               \r
+                                                               append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]]\r
+                                                       }\r
+                                               }\r
+                                               if {[string compare $form_action "Test"]==0} {\r
+                                                       append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>"\r
+                                                       \r
+                                                       append console [encode [capture_catch {catch production_test}]]\r
+                                               }\r
+                                               if {[string compare $form_action "Power on"]==0} {\r
+                                                       append console [encode [capture_catch "power on"]]\r
+                                               }\r
+                                               if {[string compare $form_action "Power off"]==0} {\r
+                                                       append console [encode [capture_catch "power off"]]\r
+                                               }\r
+                                       </tcl>\r
+                               </code>\r
+                               <tcl>\r
+                                       append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>}\r
+                                       append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>}\r
+                               </tcl>\r
+                               \r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <table><tr>\r
+                                       <td><input type="submit" name="form_action" value="Upload firmware" ></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Test"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power on"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power off">\r
+                               </tr></table>\r
+                       </form>\r
+                       \r
+                       ]]></markup_code>\r
+                       \r
+                       <right_column>\r
+                               <![CDATA[\r
+                               The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures\r
+                               are used on this page. There are default implementations that do nothing.\r
+                               \r
+                               <p><b>Upload firmware</b> - Power cycle target, reset target and program raw binary file to flash bank 0, offset 0 and verify flash programming. Leave target powered on.</p>\r
+                               <p><b>Test</b> -  Power up target, run 10 second target test. Output is provided via the DCC output channel. </p>\r
+                               <p><b>Power on</b> - Power on target.</p>\r
+                               <p><b>Power off</b> - Power off target.</p>\r
+                               <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p>\r
+                                       ]]> \r
+                       </right_column>\r
+                       \r
+                       \r
+                       </pagetext>\r
+                       \r
+               </page>\r
+\r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>erase.tcl</outfile>\r
+                       <menulink>erase.tcl</menulink> \r
+                       <pageheading>Erase Flash</pageheading>\r
+                       <level2parent>flashinfo.tcl</level2parent>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+\r
+\r
+                       \r
+                       <tcl>\r
+                       \r
+                       set form_address [formfetch form_address]\r
+                       set form_length [formfetch form_length]\r
+                       set form_action [formfetch form_action]\r
+                       \r
+                       if {[string compare $form_length ""]==0} {\r
+                               set form_length 0x10000\r
+                       }  \r
+                       if {[string compare $form_address ""]==0} {\r
+                               if {[catch {[zy1000_flash]} result]==0} {\r
+                                               set form_address "0x[tohex $result]"\r
+                                       }                       \r
+                       }  \r
+                       \r
+                       \r
+                       if {[string compare $form_address ""]!=0} {\r
+                               if {[string compare $form_action "Erase"]==0} {\r
+                                               append buffer "<code style=\"white-space: nowrap;\">"\r
+                                               append console [encode [capture_catch {\r
+                                               reset init\r
+                                               flash erase_address $form_address $form_length}]]\r
+                                               append buffer </code>\r
+                               }  \r
+                       }\r
+                       \r
+                       \r
+                       </tcl>\r
+                       \r
+                       <form action="erase.tcl" method="post"> \r
+                               <table>\r
+                               <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>\r
+                               </td></tr>\r
+                               </table>\r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <input type="submit" name="form_action" value="Erase"><br>\r
+                               \r
+                               \r
+                       </form>\r
+                       \r
+\r
+                       \r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <![CDATA[\r
+                               <p>Note that flash programming will erase flash if required.<p/>\r
+                               <p>Reset and init CPU, then erase address range.</p>\r
+                               <p>The length field is specified in number of bytes.</p>\r
+                                       ]]>\r
+                       </right_column>\r
+                       \r
+                       </pagetext>\r
+               </page>\r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>run.tcl</outfile>\r
+                       <menulink>run.tcl</menulink> \r
+                       <pageheading>Run program</pageheading>\r
+                       <level2parent>flashinfo.tcl</level2parent>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+\r
+\r
+                       \r
+<tcl>\r
+\r
+set form_address [formfetch form_address]\r
+set form_action [formfetch form_action]\r
+\r
+if {[string compare $form_action "Run from address"]==0} {\r
+       append console [encode [capture_catch "halt"]]\r
+       append console [encode [capture_catch "wait_halt"]]\r
+       append console [encode [capture_catch "resume $form_address"]]\r
+}  \r
+\r
+if {[string compare $form_action "Halt"]==0} {\r
+       append console [encode [capture_catch "halt"]]\r
+       append console [encode [capture_catch "wait_halt"]]\r
+}\r
+  \r
+if {[string compare $form_action "Reset and run"]==0} {\r
+       append console [encode [capture_catch "reset run"]]\r
+}\r
+  \r
+if {[string compare $form_action "Reset and init"]==0} {\r
+       append console [encode [capture_catch "reset init"]]\r
+}  \r
+\r
+append console [encode [capture_catch poll]]\r
+\r
+</tcl>\r
+\r
+<form action="run.tcl" method="post"> \r
+       <table>\r
+       <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
+       </td></tr>\r
+       </table>\r
+       <table>\r
+               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+       </table>\r
+       \r
+       <input type="submit" name="form_action" value="Reset and run"> <input type="submit" name="form_action" value="Run from address"> <input type="submit" name="form_action" value="Halt"><input type="submit" name="form_action" value="Reset and init"><br>\r
+</form>\r
+                       \r
+\r
+                       \r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <![CDATA[\r
+                               <p>Reset and run - reset CPU and let it run.</p>\r
+                               <p>Halt - halt CPU.</p>\r
+                               <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p>\r
+                               <p>Reset and init - reset CPU and run init script.</p>\r
+                               ]]>\r
+                       </right_column>\r
+                       \r
+                       </pagetext>\r
+               </page>\r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>browsemem.tcl</outfile>\r
+                       <menutext>Memory</menutext> \r
+                       <menulink>browsemem.tcl</menulink> \r
+                       <pageheading>Browse / Edit Memory</pageheading>\r
+                       <level2parent>browsemem.tcl</level2parent>\r
+                       <level2menu href="browsemem.tcl" title="Browse / Edit" titlestyle="color:#4e6627;">\r
+                       <![CDATA[\r
+                               Browse and edit memory.\r
+                       ]]>\r
+                       </level2menu>\r
+                       <level2menu href="downloadmem.tcl" title="Download" titlestyle="color:#4e6627;">\r
+                       <![CDATA[\r
+                           Copy memory range to developer machine\r
+                       ]]>\r
+                       </level2menu>\r
+                       \r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+\r
+\r
+                       \r
+                       <tcl>\r
+                       \r
+                       set form_address [formfetch form_address]\r
+                       set form_length [formfetch form_length]\r
+                       set form_type [formfetch form_type]\r
+                       set form_action [formfetch form_action]\r
+                       set form_value [formfetch form_value]\r
+                       \r
+                       if {[string compare $form_length ""]==0} {\r
+                               set form_length 0\r
+                       }  \r
+                       if {$form_length<=0} {\r
+                               set form_length 0x80\r
+                       } \r
+                       if {$form_length>0x1000} {\r
+                               set form_length 0x1000\r
+                       } \r
+                       \r
+                       if {[string compare $form_type ""]==0} {\r
+                               set form_type mdw\r
+                       }\r
+                       \r
+                       if {[string compare $form_type "mdw"]==0} {\r
+                               set wordsize 4\r
+                               set modify_cmd mww \r
+                       }\r
+                       if {[string compare $form_type "mdh"]==0} {\r
+                               set wordsize 2\r
+                               set modify_cmd mwh \r
+                       }\r
+                       if {[string compare $form_type "mdb"]==0} {\r
+                               set wordsize 1\r
+                               set modify_cmd mwb \r
+                       }\r
+                       \r
+                       \r
+                       \r
+                       \r
+                       if {[string compare $form_address ""]!=0} {\r
+                               if {[string compare $form_action "Previous"]==0} {\r
+                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions\r
+                                       incr form_address ; set form_address [expr $form_address-1]\r
+                                       if {$form_address-$form_length>0} {\r
+                                               set form_address "0x[tohex [expr $form_address-$form_length]]"\r
+                                       } else {\r
+                                               set form_address "0x0"\r
+                                       }\r
+                               }  \r
+                               if {[string compare $form_action "Next"]==0} {\r
+                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions\r
+                                       incr form_address ; set form_address [expr $form_address-1]\r
+                                       set form_address "0x[tohex [expr $form_address+$form_length]]"\r
+                               }  \r
+                               if {[string compare $form_action "Modify"]==0} {\r
+                                       append console [capture_catch "$modify_cmd $form_address $form_value"]\r
+                               }  \r
+                               if {[string compare $form_action "Fill"]==0} {\r
+                                       append console [capture_catch "$modify_cmd $form_address $form_value $form_length"]\r
+                               }  \r
+                       }\r
+                       \r
+                       \r
+                       </tcl>\r
+                       \r
+                       <form action="browsemem.tcl" method="post"> \r
+                               <table>\r
+                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer "0x[tohex $form_length]"</tcl>"></td></tr>\r
+                               <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="<tcl>append buffer $form_value</tcl>"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Modify"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Fill"></td></tr>\r
+                               <tr><td class="formtext">Type</td><td style="padding-top:1px;">\r
+                               <select name="form_type">\r
+                                 <option \r
+                                   <tcl>if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} }  </tcl> value ="mdb">8 bit\r
+                                 </option>\r
+                                 <option \r
+                                  <tcl>if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} }  </tcl> value ="mdh">16 bit\r
+                                 </option>\r
+                                       <option\r
+                                          <tcl>if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} }  </tcl>value ="mdw">32 bit\r
+                                       </option>\r
+                               </select>\r
+                               \r
+                               </td></tr>\r
+                               </table>\r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <table><tr>\r
+                                       <td><input type="submit" name="form_action" value="Refresh"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Previous" ></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Next" ></td>\r
+                               </tr></table>\r
+                               <br>\r
+                               \r
+                       </form>\r
+                       <p>\r
+                       <div class="fontbigger">Memory:</div><p>\r
+                       <code style="white-space: nowrap; font-size:11px;font:courier new;">\r
+                               <tcl>\r
+                               if {[string compare $form_address ""]!=0} {\r
+                                       append console [encode [capture_catch halt]]\r
+                                       append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]]\r
+                               } \r
+                               </tcl>\r
+                       </code>\r
+\r
+\r
+                       \r
+\r
+                       \r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <![CDATA[\r
+                               <p>Browse and edit target memory.<br>\r
+                                  Length is in bytes, maximum 4096 bytes.</p> \r
+                               <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p>\r
+                               <p>CPU will be halted if required.</p>\r
+                               <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p>\r
+                               <p><b>Fill</b> - Will fill the specified region with the specified value.</p>\r
+                               <p><b>Refresh</b> - Display the content of the specified memory area.</p>\r
+                                       ]]>\r
+                       </right_column>\r
+                       \r
+                       </pagetext>\r
+               </page>\r
+\r
+               \r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>downloadmem.tcl</outfile>\r
+                       <level2parent>browsemem.tcl</level2parent>\r
+                       <pageheading>Download Memory Range</pageheading>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+                       <tcl>\r
+                               set form_address [formfetch form_address]\r
+                               set form_length [formfetch form_length]\r
+                               set form_action [formfetch form_action]\r
+                       </tcl>                  \r
+                       <form action="downloadmem.tcl" method="post"> \r
+                               <table>\r
+                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>\r
+                               </td></tr>\r
+                               </table>\r
+\r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <input type="submit" value="Download" name="form_action">\r
+                               \r
+                               \r
+                       </form>\r
+                       <tcl>\r
+                               if {[string compare $form_action "Download"]==0} {\r
+                                       append console [encode [capture_catch "reset init"]]\r
+                                       append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]]\r
+                                       </tcl>\r
+                                       <form action="../dump.bin" target="_blank"> \r
+                                               <input type="submit" name="form_action" value="Save downloaded memory">\r
+                                       </form>\r
+                                       <tcl> \r
+                               }\r
+                               \r
+                       </tcl>\r
+\r
+\r
+                       \r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <![CDATA[       \r
+                               Download memory to ZY1000 from target. <br>\r
+                               <b>Note</b> that download memory can take\r
+                               a long time(potentially minutes for megabytes at low JTAG clk speeds).\r
+                               <p/>\r
+                               Once the memory is downloaded a link is available on the page to download\r
+                               the file from ZY1000 to your PC.\r
+                               ]]>\r
+                       </right_column>\r
+                       </pagetext>\r
+                       \r
+               </page>\r
+\r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>openocd.tcl</outfile>\r
+                       <menutext>OpenOCD</menutext> \r
+                       <menulink>openocd.tcl</menulink> \r
+                       <pageheading>Run Command</pageheading>\r
+                       <level2parent>openocd.tcl</level2parent>\r
+                       <level2menu href="openocd.tcl" title="Run Command" titlestyle="color:#4e6627;">\r
+                       </level2menu>\r
+                       <level2menu href="guiupload.tcl" title="Upload File to ZY1000" titlestyle="color:#4e6627;">\r
+                       <![CDATA[\r
+                           Upload file to ZY1000\r
+                       ]]>\r
+                       </level2menu>\r
+                       \r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+\r
+                       <tcl>\r
+                               set form_command [formfetch form_command]\r
+\r
+                               set form_edittext ""\r
+                               if {[string length $form_command]>0} {                          \r
+                                       catch {capture_catch {eval "$form_command"}} form_edittext\r
+                               }\r
+                               \r
+                               append buffer {<form action="openocd.tcl" method="post">} "\n"\r
+                               append buffer {Command<br>}\r
+                               append buffer {<textarea  style="overflow:auto;"  rows="5" cols="65" name="form_command" wrap="off">}\r
+                               append buffer [to_textarea $form_command]\r
+                               append buffer {</textarea><br>}\r
+                               append buffer {<input type="submit" value="Run" name="form_action" ><br>}\r
+                               append buffer {<textarea  style="overflow:auto;"  rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">}\r
+                               append buffer [to_textarea $form_edittext]\r
+                               append buffer {</textarea><br>}\r
+                               \r
+                               append buffer {</form>} "\n"\r
+                       \r
+                       </tcl>\r
+\r
+                       ]]></markup_code>\r
+                       \r
+                       <right_column>\r
+                               <![CDATA[\r
+                               <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise\r
+                               there will be no output, e.g. "reset init" use "ocd_reset init".\r
+                               <p/>\r
+                               <p><a href="/ram/log">Click here to download log</a>.</p>\r
+                               <p>To download log you can also use commands like "wget http://<tcl>append buffer [ip]</tcl>/ram/log", or\r
+                               point your web browser to said address.</p>\r
+                               <p>\r
+                               You can also execute tcl commands using curl from your developer PC:\r
+                               </p>\r
+                               <code>\r
+                               curl --form form_command=ocd_version <tcl>append buffer [ip]</tcl>runtcl.tcl\r
+                               </code>\r
+                               \r
+                               ]]>\r
+                       </right_column>\r
+                       </pagetext>\r
+               </page>\r
+\r
+               \r
+               \r
+               <page lang="eng">\r
+                       <outfile>guiupload.tcl</outfile>\r
+                       <level2parent>openocd.tcl</level2parent>\r
+                       <pageheading>Upload File to ZY1000</pageheading>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+                       \r
+                       <tcl>\r
+                               set form_filename [formfetch form_filename];\r
+                               set form_action [formfetch form_action];\r
+                               #set form_filecontent [formfetch form_filecontent];\r
+                               \r
+                               append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">}\r
+                               append buffer <br> \r
+                               if {[string compare $form_action "Upload"]==0} {\r
+                                       if {[catch {writeform form_filecontent $form_filename} result]==0} {\r
+                                               append buffer [encode $result]\r
+                                       } else {\r
+                                               append buffer Wrote $form_filename\r
+                                       }\r
+                               }\r
+                               \r
+                               append buffer {<table style="padding:0px;border-collapse:collapse;"><tr><td class="formtext">Filename on ZY1000</td><td><input type="text" name="form_filename"></td></tr>}\r
+                               append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>}\r
+                               append buffer {<table><tr><td style="height:15px;width:535px;">&nbsp</td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;">&nbsp</td></tr></table>}\r
+                               append buffer {<input type="submit" name="form_action" value="Upload" ><br> }\r
+                               append buffer {</form>}\r
+                       \r
+                       </tcl>\r
+                       \r
+                       ]]></markup_code>\r
+                       <right_column>  \r
+                               <![CDATA[\r
+                                 <p>The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing\r
+                                 embedded into the firmware.</p>\r
+\r
+                                 <p>Use "/ram" to store temporary files.<p/>\r
+                                 \r
+                                 <p>\r
+                                 You can browse filing systems and download files by pointing your web browser to:\r
+                                 <ul> \r
+                                 <li><a href="/ram" target="_blank">/ram</a>\r
+                                 <li><a href="/rom" target="_blank">/rom</a>\r
+                                 <li><a href="/config" target="_blank">/config</a>\r
+                                 </ul>\r
+                                 </p> \r
+                                 \r
+                                 <p>\r
+                                 You can also upload files using e.g. curl from the command line. Example:\r
+                                 </p>\r
+                                 <code>\r
+                                 curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf <tcl>append buffer [ip]</tcl>upload.tcl\r
+                                 </code>\r
+                                 <p> \r
+                                 If you have a tftp server installed on your development PC, you can access\r
+                                 files on your developer PC using a /tftp/ip/ prefix to the file to be accessed\r
+                                 on your developer PC. Note that if you do not increase the default packet\r
+                                 size for your tftp server, then the performance will be very poor. Normal\r
+                                 performance is about 500-600kBytes/s.\r
+                                 </p>\r
+                                 <code> \r
+                                 cp /tftp/10.0.0.106/build/src/openocd /ram/test\r
+                                 </code>\r
+                                 \r
+                                 ]]>\r
+                       </right_column>\r
+                       </pagetext>\r
+                       \r
+               </page>\r
+               \r
+\r
+\r
+               <page lang="eng">\r
+                       <outfile>targets.tcl</outfile>\r
+                       <level2parent>documentation.tcl</level2parent>\r
+                       <pageheading>Target config quick start guide</pageheading>\r
+                       <pagetext>\r
+                               <markup_code><![CDATA[\r
+                               \r
+                               A target needs an openocd.cfg file. This config file sets up\r
+                               the CPU, flash and reset init script. Either ZY1000 ships with an\r
+                               openocd.cfg file for your target or you need to take an existing\r
+                               config file and modify it for your needs.\r
+                               <p> \r
+                               The reset init script is crucial. It will set up e.g. MMU, chip\r
+                               select registers, etc. after a reset. The init.cfg (reset init script)\r
+                               is embedded into the openocd.cfg file in the sampls Zylin provides.\r
+                               <p>\r
+                               Writing an openocd.cfg from scratch is a non-trivial exercise, but\r
+                               fortunally it only has to be done once for a target and afterwards it\r
+                               rarely if ever needs to be changed.\r
+                               \r
+                               \r
+                               ]]></markup_code>\r
+                               <right_column>\r
+                                       \r
+                                         Quick start guide on how to configure a target.\r
+                               </right_column>\r
+                       </pagetext>\r
+                       \r
+                       \r
+               </page>\r
+\r
+\r
+               \r
+\r
+\r
+               <page lang="eng">\r
+                       <menulink>index.tcl</menulink> \r
+                       <level2parent>index.tcl</level2parent>\r
+                       <outfile>terminal.tcl</outfile>\r
+                       <pageheading>UART forwarding</pageheading>\r
+                       <pagetext>\r
+                       <markup_code><![CDATA[\r
+                       <tcl>\r
+                               set form_baudrate [formfetch form_baudrate]\r
+                               if {[string length $form_baudrate]==0} {\r
+                                       set form_baudrate [ocd_uart]\r
+                                       set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]]\r
+                               }\r
+                               set form_action [formfetch form_action]\r
+                       </tcl>\r
+                       <form action="terminal.tcl" method="post">\r
+                               Target baudrate: \r
+                                       <select name="form_baudrate">\r
+                                               <tcl>\r
+                                                       foreach i {9600 19200 38400 57600 115200} { \r
+                                                       </tcl>\r
+                                                               <option <tcl>if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} }  </tcl>\r
+                                                               value ="<tcl>append buffer $i</tcl>"><tcl>append buffer $i</tcl></option>\r
+                                                       <tcl>\r
+                                                       }\r
+                                                       </tcl>\r
+                                               </select>\r
+\r
+                                       <p>     \r
+                                       <input type="submit" name="form_action" value="Set baudrate" >\r
+                               </form>                 \r
+                       <tcl>\r
+                               if {[string compare $form_action "Set baudrate"]==0} {\r
+                                       append console [encode [ocd_uart $form_baudrate]]\r
+                               }\r
+                       </tcl>\r
+                       \r
+                       <h2>Simple UART</h2>\r
+                       This terminal window is purely for illustrative purposes. Use telnet or a terminal program\r
+                       to talk to the target over TCP/IP for anything but trivial case of reading/writing a few\r
+                       lines of texts in simple tests.\r
+                       <p>\r
+                       ]]></markup_code>\r
+                       <right_column>\r
+                               <![CDATA[\r
+                               Serial port data to target is forwarded(both directions) in the simple terminal window\r
+                               to the left. Alternatively you can <b>telnet <tcl>append buffer [ip]</tcl> 5555</b>\r
+                               or connect via TCP/IP from e.g. HyperTerminal.\r
+                               <p>\r
+                               Type "help uart" in telnet for information on how to set uart speed for target. Normally\r
+                               the uart speed is set from the target configuration script by adding an "uart N", where\r
+                               N is the baudrate.\r
+                               ]]>\r
+                       </right_column>\r
+                       </pagetext>\r
+                       \r
+               </page>\r
+\r
+\r
+               \r
+       </language>\r
+       \r
+</website>
\ No newline at end of file
diff --git a/src/server/httpd/menu.xsl b/src/server/httpd/menu.xsl
new file mode 100644 (file)
index 0000000..320d5e2
--- /dev/null
@@ -0,0 +1,298 @@
+<?xml version="1.0"?>\r
+<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>\r
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40" version="1.0">\r
+       <xsl:output method="html" version="4.0" indent="yes" encoding="UTF-8"\r
+       \r
+        media-type="text/plain; charset=UTF-8"/>\r
+\r
+       <xsl:param name="pagetogenerate" select="UNDEFINED"/>\r
+       <xsl:template match="page[outfile!=$pagetogenerate]">\r
+       </xsl:template>\r
+\r
+       <xsl:template match="page[outfile=$pagetogenerate]">\r
+               <xsl:variable name="Xlevel2parent" select="level2parent"/>\r
+               <xsl:variable name="Xlevel3parent" select="level3parent"/>\r
+\r
+               <html>\r
+                       <head>\r
+                               <title>OpenOCD debugger</title>\r
+                               <meta http-equiv="Content-Type" content="text/html"  charset="utf-8"/>\r
+                               <link href="menuweb.css" rel="stylesheet" type="text/css"/>                             \r
+                               \r
+                       </head>\r
+       \r
+                       \r
+                       <tcl>\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       </tcl>\r
+                       \r
+                       <body style="margin:0px;">\r
+                               <div style="width:974px;height:85px;">\r
+                                       <div style="float:left;position:relative;left:32px;width:478px;">\r
+                                               <a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+                                       </div>\r
+                                       <div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+                                               <div class="textlight" style="position:relative;left:15px;top:4px;">\r
+                                                       <tcl>append buffer [capture version]</tcl>\r
+                                               </div>\r
+                                       </div>\r
+                               </div>\r
+                               <table style="padding:0px;border-collapse:collapse;">\r
+                                       <tr>\r
+                                               <td style="width:33px;">\r
+                                                       <div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+                                               </td>\r
+                                               <!-- level 2 menu bar on left -->\r
+                                               <td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+                                                       <table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+                                                               <tr style="height:59px;">\r
+                                                                       <td></td>\r
+                                                               </tr>\r
+                                                               <xsl:for-each select="parent::language/page[outfile = $Xlevel2parent]/level2menu">\r
+                                                                       <tr>\r
+                                                                               <td>\r
+                                                                                       <xsl:choose>\r
+                                                                                               <xsl:when test="contains(@href, $pagetogenerate)">\r
+                                                                                                       <xsl:attribute name="style">width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;</xsl:attribute>\r
+                                                                                               </xsl:when>\r
+                                                                                               <xsl:otherwise>\r
+                                                                                                       <xsl:attribute name="style">width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;</xsl:attribute>\r
+                                                                                               </xsl:otherwise>\r
+                                                                                       </xsl:choose>\r
+                                                                                       <div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+                                                                                               <a>\r
+                                                                                                       <xsl:attribute name="href">\r
+                                                                                                               <xsl:value-of select="@href"/>\r
+                                                                                                       </xsl:attribute>\r
+                                                                                                       <xsl:choose>\r
+                                                                                                               <xsl:when test="(@href = $pagetogenerate)">\r
+                                                                                                                       <xsl:attribute name="style">font-weight: bold;</xsl:attribute>\r
+                                                                                                               </xsl:when>\r
+                                                                                                               <xsl:otherwise>\r
+                                                                                                                       <xsl:choose>\r
+                                                                                                                               <xsl:when test="(@href = $Xlevel3parent)">\r
+                                                                                                                                       <xsl:attribute name="style">font-weight: bold;</xsl:attribute>\r
+                                                                                                                               </xsl:when>\r
+                                                                                                                               <xsl:otherwise>\r
+                                                                                                                                       <xsl:attribute name="style"></xsl:attribute>\r
+                                                                                                                               </xsl:otherwise>\r
+                                                                                                                       </xsl:choose>\r
+                                                                                                               </xsl:otherwise>\r
+                                                                                                       </xsl:choose>\r
+                                                                                                       <xsl:value-of select="@title"/>\r
+                                                                                               </a>\r
+                                                                                       </div>\r
+                                                                               </td>\r
+                                                                       </tr>\r
+                                                               </xsl:for-each>\r
+                                                               <tr>\r
+                                                                       <td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')">\r
+                                                                       \r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')">\r
+                                                                       \r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')">\r
+                                                                       \r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                       </table>\r
+                                               </td>\r
+                                               <!-- top level menu -->\r
+                                               <td style="vertical-align:top;padding:0px;height:100%">\r
+                                                       <table style="padding:0px;border-collapse:collapse;height:100%;">\r
+                                                               <tr>\r
+                                                                       <td>\r
+                                                                               <table style="padding:0px;border-collapse:collapse;">\r
+                                                                                       <tr>\r
+                                                                                               <xsl:for-each select="parent::language/page">\r
+                                                                                                       <xsl:if test="menutext">\r
+                                                                                                               <td>\r
+                                                                                                                       <xsl:choose>\r
+                                                                                                                               <xsl:when test="(outfile = $pagetogenerate) or (outfile = $Xlevel2parent)">\r
+                                                                                                                                       <xsl:attribute name="style">width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;</xsl:attribute>\r
+                                                                                                                               </xsl:when>\r
+                                                                                                                               <xsl:otherwise>\r
+                                                                                                                                       <xsl:attribute name="style">width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;</xsl:attribute>\r
+                                                                                                                               </xsl:otherwise>\r
+                                                                                                                       </xsl:choose>\r
+                                                                                                                       <div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+                                                                                                                               <a>\r
+                                                                                                                                       <xsl:attribute name="href"><xsl:value-of select="menulink"/></xsl:attribute>\r
+                                                                                                                                       <xsl:if test="(outfile = $pagetogenerate)">\r
+                                                                                                                                               <xsl:attribute name="style">font-weight: bold;</xsl:attribute>\r
+                                                                                                                                       </xsl:if>\r
+                                                                                                                                       <xsl:if test="(outfile = $Xlevel2parent)">\r
+                                                                                                                                               <xsl:attribute name="style">font-weight: bold;</xsl:attribute>\r
+                                                                                                                                       </xsl:if>\r
+                                                                                                                                       <xsl:value-of select="menutext"/>\r
+                                                                                                                               </a>\r
+                                                                                                                        </div>\r
+                                                                                                                </td>\r
+                                                                                                       </xsl:if>\r
+                                                                                               </xsl:for-each>\r
+                                                                                       </tr>\r
+                                                                               </table>\r
+                                                                       </td>\r
+                                                               </tr>                   \r
+                                                               <tr>\r
+                                                                       <td colspan="6" style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;">\r
+                                                                               <div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td colspan="6" style="background-color:#ffffff;text-indent:30px;height:40px;">\r
+                                                                               <H1><xsl:value-of select="pageheading"/></H1>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr style="height:100%;">\r
+                                                                       <td colspan="6" style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;">\r
+                                                                               <xsl:value-of disable-output-escaping="yes" select="pagetext/markup_code"/>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tcl>\r
+                                                                       <!-- This is the output from any OpenOCD commands -->\r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               </tcl>\r
+                                                                               <tr style="height:100%;">\r
+                                                                                       <td colspan="6" style="height:100%;background-color:red;">\r
+                                                                                               <table class="textgray" style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%">\r
+                                                                                                       <td style="width:25px;">&nbsp;</td>\r
+                                                                                                       <tcl>\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text>\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text>\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>\r
+                                                                                                               }\r
+                                                                                                       </tcl>\r
+                                                                                                               <a class="openocd">\r
+                                                                                                                       <xsl:attribute name="href"><xsl:value-of select="$pagetogenerate"/>?toggle_details=1</xsl:attribute>\r
+                                                                                                                       <tcl>\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       </tcl>\r
+                                                                                                               </a>\r
+                                                                                                               <tcl>\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               </tcl>\r
+                                                                                                        <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text>/td<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>\r
+                                                                                                        <tcl>\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        </tcl>\r
+                                                                                                       <td style="width:25px;">&nbsp;</td>\r
+                                                                                               </table>\r
+                                                                                       </td>\r
+                                                                                </tr>\r
+                                                                               <tcl>\r
+                                                                        }\r
+                                                               </tcl>\r
+                                                               <tr>\r
+                                                                       <td colspan="6" style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;">\r
+                                                                               <div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                       </table>\r
+                                               </td>\r
+                                               <td style="width:6px;">\r
+                                               </td>\r
+                                               <td style="width:245px;height:100%">\r
+                                                       <table style="padding:0px;border-collapse:collapse;height:100%;">\r
+                                                               <tr>\r
+                                                                       <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+                                                                               <div class="textgray" style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+                                                                       </td>\r
+                                                                       <td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>           \r
+                                                                       <td>\r
+                                                                       </td>   \r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td colspan="3" style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');"></td>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td colspan="3" style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;">\r
+                                                                               <a href="http://openocd.berlios.de/doc/openocd.pdf" target="_blank">OpenOCD Manual</a><br/>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr><td colspan="3" style="background-color:#d8d7d7;height:15px;"></td></tr>\r
+                                                               <tr>\r
+                                                                       <td colspan="3">\r
+                                                                               <table style="padding:0px;border-collapse:collapse;">\r
+                                                                                       <td style="background-color:#d8d7d7;width:10px;height:1px"></td>\r
+                                                                                       <td style="background-color:#999999;width:225px; height:1px;"></td>\r
+                                                                                       <td style="background-color:#d8d7d7;width:10px;height:1px"></td>\r
+                                                                               </table>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr><td colspan="3" style="background-color:#d8d7d7;height:15px;"></td></tr>\r
+                                                               <tr style="height:100%;">\r
+                                                                       <td class="textgray" colspan="3"  style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;">\r
+                                                                               <xsl:choose>\r
+                                                                                       <xsl:when test="(pagetext/right_column)">\r
+                                                                                               <xsl:value-of disable-output-escaping="yes" select="pagetext/right_column"/>\r
+                                                                                       </xsl:when>\r
+                                                                                       <xsl:otherwise>\r
+               \r
+                                                                                       </xsl:otherwise>\r
+                                                                               </xsl:choose>\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td colspan="3" style="height:30px;background-image:url('menu_cuts/right_bottom.png');">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+                                                               </tr>\r
+                                                        </table>\r
+                               \r
+                                               </td>\r
+                                       </tr>\r
+                                       \r
+                               </table>\r
+                       </body>\r
+               </html>\r
+\r
+       </xsl:template>\r
+</xsl:stylesheet>\r
diff --git a/src/server/httpd/menuweb.css b/src/server/httpd/menuweb.css
new file mode 100644 (file)
index 0000000..0a812a7
--- /dev/null
@@ -0,0 +1,132 @@
+a:link\r
+{\r
+       font-size: 12px;\r
+       color : #024d67;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a:visited\r
+{\r
+       font-size: 12px;\r
+       color : #024d67;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a:active\r
+{\r
+       font-size: 12px;\r
+       color : #024d67;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a:hover\r
+{\r
+       font-size: 12px;\r
+       color : #555555;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a.openocd:link\r
+{\r
+       font-size: 12px;\r
+       color : #555555;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a.openocd:visited\r
+{\r
+       font-size: 12px;\r
+       color : #555555;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a.openocd:active\r
+{\r
+       font-size: 12px;\r
+       color : #555555;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+a.openocd:hover\r
+{\r
+       font-size: 12px;\r
+       color : #024d67;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+}\r
+\r
+body\r
+{\r
+       background-color : green;\r
+       background-color : #176e8c;\r
+       font-family : Arial;\r
+       font-size: 12px;\r
+       line-height: 15px;\r
+       color : #024d67;\r
+       \r
+}\r
+\r
+h1\r
+{\r
+       padding: 0px;\r
+       font-size: 18px;\r
+       font-weight:bold;\r
+       text-decoration : none;\r
+       margin-bottom: 8px;\r
+}\r
+\r
+td\r
+{\r
+       padding: 0px;\r
+       font-size: 12px;\r
+       vertical-align:top;\r
+\r
+}\r
+\r
+.textlight\r
+{\r
+       color: #cccccc;\r
+       padding: 0px;\r
+       font-size: 12px;\r
+       vertical-align:top;\r
+\r
+}\r
+\r
+.fontbigger\r
+{\r
+       font-size:14px;\r
+}\r
+\r
+.textgray\r
+{\r
+       color: #555555;\r
+}\r
+\r
+.formtext\r
+{\r
+       padding-top: 4px;\r
+       font-size: 14px;\r
+       padding-right:10px;\r
+}\r
+\r
+input\r
+{\r
+       font-size: 14px;\r
+}\r
+\r
+.buttonspacelarge\r
+{\r
+       width:20px;\r
+}\r
+\r
+.buttonspacesmall\r
+{\r
+       width:8px;\r
+}\r
diff --git a/src/server/httpd/openocd.tcl b/src/server/httpd/openocd.tcl
new file mode 100644 (file)
index 0000000..fe1d195
--- /dev/null
@@ -0,0 +1,357 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="openocd.tcl" style="font-weight: bold;">Run Command</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="guiupload.tcl" style="">Upload File to ZY1000</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl" style="font-weight: bold;">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Run Command</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+\r
+                       }\r
+\r
+                               set form_command [formfetch form_command]\r
+\r
+                               set form_edittext ""\r
+                               if {[string length $form_command]>0} {                          \r
+                                       catch {capture_catch {eval "$form_command"}} form_edittext\r
+                               }\r
+                               \r
+                               append buffer {<form action="openocd.tcl" method="post">} "\n"\r
+                               append buffer {Command<br>}\r
+                               append buffer {<textarea  style="overflow:auto;"  rows="5" cols="65" name="form_command" wrap="off">}\r
+                               append buffer [to_textarea $form_command]\r
+                               append buffer {</textarea><br>}\r
+                               append buffer {<input type="submit" value="Run" name="form_action" ><br>}\r
+                               append buffer {<textarea  style="overflow:auto;"  rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">}\r
+                               append buffer [to_textarea $form_edittext]\r
+                               append buffer {</textarea><br>}\r
+                               \r
+                               append buffer {</form>} "\n"\r
+                       \r
+                       \r
+append buffer {\r
+\r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="openocd.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise\r
+                               there will be no output, e.g. "reset init" use "ocd_reset init".\r
+                               <p/>\r
+                               <p><a href="/ram/log">Click here to download log</a>.</p>\r
+                               <p>To download log you can also use commands like "wget http://}\r
+append buffer [ip]\r
+append buffer {/ram/log", or\r
+                               point your web browser to said address.</p>\r
+                               <p>\r
+                               You can also execute tcl commands using curl from your developer PC:\r
+                               </p>\r
+                               <code>\r
+                               curl --form form_command=ocd_version }\r
+append buffer [ip]\r
+append buffer {runtcl.tcl\r
+                               </code>\r
+                               \r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/preconfig.tcl b/src/server/httpd/preconfig.tcl
new file mode 100644 (file)
index 0000000..eaa1842
--- /dev/null
@@ -0,0 +1,429 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>Zylin ZY1000 JTAG debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+<img src="menu_cuts/logo_top.png" style="border:0px;"/>\r
+</a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="index.tcl" style="">Target Status</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="preconfig.tcl" style="font-weight: bold;">Select Target Config</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="editconfigs.tcl" style="">Edit Configurations</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="reload.tcl" style="">Reload Config Scripts</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl" style="font-weight: bold;">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Select Preconfigured Target</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       \r
+                       }\r
+\r
+                       \r
+                       set form_target [formfetch form_target]\r
+                       set form_action [formfetch form_action]\r
+                       \r
+                       append buffer {<form enctype="multipart/form-data" action="preconfig.tcl" method="post">}\r
+                       if {[string compare $form_action "Select and reload"]==0} {\r
+                               capture_catch "trunc /config/settings/openocd.cfg"\r
+                               capture_catch "append_file /config/settings/openocd.cfg script target/$form_target"\r
+                               reboot \r
+                       }\r
+                       \r
+                       set form_target [load_target] \r
+                       \r
+                       set files [ls /rom/target]\r
+                       set files [lunion $files [ls /config/settings/target]]\r
+                       set files [lsort $files]\r
+                        \r
+                       if {[string compare $form_action "Select and reload"]!=0} {\r
+                               \r
+append buffer {\r
+                               <table><tr>\r
+                               <td style="padding-top:1px;">\r
+                                       <select name="form_target">\r
+                                               }\r
+\r
+                                                       set foundTarget 0\r
+                                                       foreach i $files {\r
+                                                               if {[string match *.cfg $i]} {\r
+                                                                       \r
+append buffer {\r
+                                                                               <option \r
+                                                                               }\r
+\r
+                                                                                       if {[string compare $form_target $i]==0} { \r
+                                                                                       set foundTarget 1\r
+                                                                                       append buffer {selected="selected"} \r
+                                                                       }\r
+append buffer {\r
+                                                                       value="}\r
+append buffer $i\r
+append buffer {">}\r
+append buffer $i\r
+append buffer {</option>\r
+                                                                       }\r
+\r
+                                                               }\r
+                                                       }\r
+                                                       \r
+                                                       if {$foundTarget==0} {\r
+                                                               \r
+append buffer {\r
+                                                                       <option selected="selected" value="">Preconfigured target not active</option>\r
+                                                               }\r
+\r
+                                                       }\r
+                                               \r
+append buffer {\r
+                                       </select>\r
+                               </td>\r
+                               <td class="buttonspacesmall">&nbsp</td>\r
+                               <td>\r
+                                       <input type="submit" name="form_action" value="Select and reload">\r
+                                       \r
+                                       &nbsp;&nbsp;&nbsp;&nbsp;\r
+                                       <a href="editconfigs.tcl?form_action=Load&form_selected=}\r
+append buffer "target/$form_target"\r
+append buffer {">Edit target configuration</a>\r
+                               </td>\r
+                               </tr></table>\r
+                       }\r
+\r
+                       } else {\r
+                           append buffer "Reloading setting(ca. 30 seconds)..."\r
+                       }\r
+                       \r
+append buffer {\r
+                               \r
+                       </form>\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="preconfig.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                                                       \r
+                               <p>ZY1000 comes with complete configurations for various targets.</p>\r
+                               <p>These predefined configurations include reset init scripts and flash configuration.</p>\r
+                               <p><b>Select and reload</b> - Select configuration and reboot ZY1000 unit.</p>\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td/>\r
+<td>\r
+<img border="0" src="menu_cuts/logo_bottom.png"/>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/production.tcl b/src/server/httpd/production.tcl
new file mode 100644 (file)
index 0000000..654c631
--- /dev/null
@@ -0,0 +1,394 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flashinfo.tcl" style="">Info</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="erase.tcl" style="">Erase</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flash.tcl" style="">Program / Verify</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="production.tcl" style="font-weight: bold;">Production</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Production</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       }\r
+\r
+                               set form_action [formfetch form_action]\r
+                               set form_serialnumber [formfetch form_serialnumber]\r
+                               append buffer [production_info]\r
+                       \r
+append buffer {\r
+                               \r
+                       <form enctype="multipart/form-data" action="production.tcl" method="post">\r
+                               <code style="white-space: nowrap;">\r
+                                       }\r
+       \r
+                                               if {[string compare $form_action "Upload firmware"]==0} {\r
+                                                       set wrotedata [catch {writeform form_filecontent $upload_filename} result]  \r
+                                                       append buffer [encode $result]\r
+                                                       if {$wrotedata==0} {\r
+                                                               append buffer "<br>Running production procedure<p>"\r
+                                                               append buffer "<br>Reset and init: <br>"\r
+                                                               \r
+                                                               append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]]\r
+                                                       }\r
+                                               }\r
+                                               if {[string compare $form_action "Test"]==0} {\r
+                                                       append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>"\r
+                                                       \r
+                                                       append console [encode [capture_catch {catch production_test}]]\r
+                                               }\r
+                                               if {[string compare $form_action "Power on"]==0} {\r
+                                                       append console [encode [capture_catch "power on"]]\r
+                                               }\r
+                                               if {[string compare $form_action "Power off"]==0} {\r
+                                                       append console [encode [capture_catch "power off"]]\r
+                                               }\r
+                                       \r
+append buffer {\r
+                               </code>\r
+                               }\r
+\r
+                                       append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>}\r
+                                       append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>}\r
+                               \r
+append buffer {\r
+                               \r
+                               <table>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+                               </table>\r
+                       \r
+                               <table><tr>\r
+                                       <td><input type="submit" name="form_action" value="Upload firmware" ></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Test"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power on"></td>\r
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power off">\r
+                               </tr></table>\r
+                       </form>\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="production.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures\r
+                               are used on this page. There are default implementations that do nothing.\r
+                               \r
+                               <p><b>Upload firmware</b> - Power cycle target, reset target and program raw binary file to flash bank 0, offset 0 and verify flash programming. Leave target powered on.</p>\r
+                               <p><b>Test</b> -  Power up target, run 10 second target test. Output is provided via the DCC output channel. </p>\r
+                               <p><b>Power on</b> - Power on target.</p>\r
+                               <p><b>Power off</b> - Power off target.</p>\r
+                               <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p>\r
+                                        \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/readme.txt b/src/server/httpd/readme.txt
new file mode 100644 (file)
index 0000000..91ed625
--- /dev/null
@@ -0,0 +1,24 @@
+work in progress... stay tuned....\r
+\r
+\r
+1. To build .tcl pages. This will convert menu.xml and menu.xsl into\r
+lots of .html pages w/embedded tcl, which are then inverted into\r
+tcl with embedded html.\r
+\r
+sh build.sh\r
+\r
+xalan.jar can be gotten from apache.org. \r
+\r
+\r
+2. libmicrohttpd is a bit tricky to build under Cygwin:\r
+\r
+https://gnunet.org/mantis/view.php?id=1440\r
+\r
+3. To test:\r
+\r
+../openocd/configure --enable-httpd --enable-dummy  --enable-ioutil\r
+make\r
+make install\r
+openocd -c "interface dummy" -f target/at91eb40a.cfg\r
+\r
+4. Point browser to: http://localhost:8888\r
diff --git a/src/server/httpd/reload.tcl b/src/server/httpd/reload.tcl
new file mode 100644 (file)
index 0000000..07c9198
--- /dev/null
@@ -0,0 +1,322 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="index.tcl" style="">Target Status</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl" style="font-weight: bold;">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Reload Config Scripts</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       \r
+                       }\r
+\r
+                               set form_action [formfetch form_action]\r
+       \r
+                               if {[string compare $form_action "Reload"]==0} {\r
+                                       append buffer "Reloading Config Scripts...<p>"\r
+                                       reboot\r
+                               }\r
+                       \r
+append buffer {\r
+                       <form enctype="multipart/form-data" action="reload.tcl" method="post">\r
+                               <input type="submit" name="form_action" value="Reload">\r
+                       </form>\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="reload.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               Restart ZY1000 to reload selected target config script.                         \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/run.tcl b/src/server/httpd/run.tcl
new file mode 100644 (file)
index 0000000..1a00eb9
--- /dev/null
@@ -0,0 +1,384 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flashinfo.tcl" style="">Info</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="erase.tcl" style="">Erase</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="flash.tcl" style="">Program / Verify</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="production.tcl" style="">Production</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Run program</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+\r
+\r
+                       \r
+}\r
+\r
+\r
+set form_address [formfetch form_address]\r
+set form_action [formfetch form_action]\r
+\r
+if {[string compare $form_action "Run from address"]==0} {\r
+       append console [encode [capture_catch "halt"]]\r
+       append console [encode [capture_catch "wait_halt"]]\r
+       append console [encode [capture_catch "resume $form_address"]]\r
+}  \r
+\r
+if {[string compare $form_action "Halt"]==0} {\r
+       append console [encode [capture_catch "halt"]]\r
+       append console [encode [capture_catch "wait_halt"]]\r
+}\r
+  \r
+if {[string compare $form_action "Reset and run"]==0} {\r
+       append console [encode [capture_catch "reset run"]]\r
+}\r
+  \r
+if {[string compare $form_action "Reset and init"]==0} {\r
+       append console [encode [capture_catch "reset init"]]\r
+}  \r
+\r
+append console [encode [capture_catch poll]]\r
+\r
+\r
+append buffer {\r
+\r
+<form action="run.tcl" method="post"> \r
+       <table>\r
+       <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="}\r
+append buffer $form_address\r
+append buffer {"></td></tr>\r
+       </td></tr>\r
+       </table>\r
+       <table>\r
+               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
+               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
+       </table>\r
+       \r
+       <input type="submit" name="form_action" value="Reset and run"> <input type="submit" name="form_action" value="Run from address"> <input type="submit" name="form_action" value="Halt"><input type="submit" name="form_action" value="Reset and init"><br>\r
+</form>\r
+                       \r
+\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="run.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               <p>Reset and run - reset CPU and let it run.</p>\r
+                               <p>Halt - halt CPU.</p>\r
+                               <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p>\r
+                               <p>Reset and init - reset CPU and run init script.</p>\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/support.tcl b/src/server/httpd/support.tcl
new file mode 100644 (file)
index 0000000..cf7a2b4
--- /dev/null
@@ -0,0 +1,431 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+               \r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>Zylin ZY1000 JTAG debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="/ram/cgi/zylweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+<img src="/rom/menu_cuts/logo_top.png" style="border:0px;"/>\r
+</a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('/rom/menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture zy1000_version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="zy1000.tcl" style="">Set IP Address</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="upgrade.tcl" style="">ZY1000 Firmware</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="editfile.tcl" style="">Edit File</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="support.tcl" style="font-weight: bold;">Support Request</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="log.tcl#tail" style="">View Tail of Log</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('/rom/menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('/rom/menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('/rom/menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/zy1000.tcl" style="font-weight: bold;">Setup ZY1000</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('/rom/menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Submit Support Request</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       Before contacting Zylin, please submit a support request with relevant information. \r
+                       }\r
+\r
+                       \r
+                       set form_config [load_config "target/[load_target]"]\r
+                       set support_id [string range [rand] 0 7]\r
+                       set form_log ""\r
+                       append form_log "Version: [capture "zy1000_version zy1000"]"\r
+                       append form_log "OpenOCD version: [capture "zy1000_version openocd"]"\r
+                       append form_log "Version date: [capture "zy1000_version date"]"\r
+                       append form_log [log]\r
+                       \r
+append buffer {\r
+\r
+                       <form action="supportrequest.tcl" method="POST" target="_blank">\r
+                               <input TYPE="hidden" NAME="id" VALUE="}\r
+append buffer $support_id\r
+append buffer {">\r
+                               <input TYPE="hidden" NAME="success" VALUE="http://www.zylin.com/zy1000_support.html">\r
+                               <input size="50" name="subject" type="hidden" value="ZY1000 support request">\r
+                               <table cellspacing="5">\r
+                               <tr><td>Support ID</td><td>}\r
+append buffer $support_id\r
+append buffer {</td></tr>\r
+                               <tr><td>Contact person</td><td><input size="50" name="name" type="text"></td></tr>\r
+                               <tr><td>Phone</td><td><input size="50" name="phone" type="text"></td></tr>\r
+                               <tr><td>email</td><td><input size="50" name="email" type="text"></td></tr>\r
+                               <tr><td>MAC address</td><td><input size="50" name="serial" type="text" value="}\r
+append buffer [mac]\r
+append buffer {"></td></tr>\r
+                               </td></tr>\r
+                               </table>\r
+                               <p>\r
+                               Summary:\r
+                               <p>\r
+                               <input name="summary" size="50">\r
+                               <p>\r
+                               Description:\r
+                               <p>\r
+                               <textarea  style="overflow:auto;font-size:11px;"  name="description" cols="50" rows="4" type="textarea" wrap="off"></textarea>\r
+                               \r
+                               <p>                             \r
+                               Log:<p>\r
+                               <textarea  style="overflow:auto;font-size:11px;"  name="log" cols="50" rows="5" type="textarea" wrap="off">}\r
+append buffer $form_log\r
+append buffer {</textarea>\r
+                               <p>                             \r
+                               Config:<p>\r
+                               <textarea  style="overflow:auto;font-size:11px;"  name="config" cols="50" rows="5" type="textarea" wrap="off">}\r
+append buffer $form_config\r
+append buffer {</textarea>\r
+                               <p>\r
+                       </form>\r
+                       <p>\r
+                       <input value="Creates support request" type="submit"/></td></tr>\r
+\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('/rom/menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="/ram/cgi/support.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('/rom/menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('/rom/menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               Before contacting Zylin with questions, please fill in and submit this form\r
+                               and allow us time to review the information and answer by email if possible.\r
+                               <p/> \r
+                               Note that you can see precisely what information is submitted to Zylin in the\r
+                               form: the log and your config files.\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('/rom/menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td/>\r
+<td>\r
+<img border="0" src="/rom/menu_cuts/logo_bottom.png"/>\r
+</td>\r
+<td style="padding-top:10px;padding-left:10px;margin-top:10px;" class="textlight">\r
+                                                       Zylin AS, Auglendsdalen 78, N-4017 Stavanger, Norway - www.zylin.com\r
+                                               </td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/targets.tcl b/src/server/httpd/targets.tcl
new file mode 100644 (file)
index 0000000..3df1636
--- /dev/null
@@ -0,0 +1,562 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Target config quick start guide</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                               \r
+                               A target needs an openocd.cfg file. This config file sets up\r
+                               the CPU, flash and reset init script. Either ZY1000 ships with an\r
+                               openocd.cfg file for your target or you need to take an existing\r
+                               config file and modify it for your needs.\r
+                               <p> \r
+                               The reset init script is crucial. It will set up e.g. MMU, chip\r
+                               select registers, etc. after a reset. The init.cfg (reset init script)\r
+                               is embedded into the openocd.cfg file in the sampls Zylin provides.\r
+                               <p>\r
+                               Writing an openocd.cfg from scratch is a non-trivial exercise, but\r
+                               fortunally it only has to be done once for a target and afterwards it\r
+                               rarely if ever needs to be changed.\r
+                               \r
+                               \r
+                               </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="targets.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                                       \r
+                                         Quick start guide on how to configure a target.\r
+                               </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Target config quick start guide</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                               \r
+                               A target needs an openocd.cfg file. This config file sets up\r
+                               the CPU, flash and reset init script. Either ZY1000 ships with an\r
+                               openocd.cfg file for your target or you need to take an existing\r
+                               config file and modify it for your needs.\r
+                               <p> \r
+                               The reset init script is crucial. It will set up e.g. MMU, chip\r
+                               select registers, etc. after a reset. The init.cfg (reset init script)\r
+                               is embedded into the openocd.cfg file in the sampls Zylin provides.\r
+                               <p>\r
+                               Writing an openocd.cfg from scratch is a non-trivial exercise, but\r
+                               fortunally it only has to be done once for a target and afterwards it\r
+                               rarely if ever needs to be changed.\r
+                               \r
+                               \r
+                               </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="targets.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                                       \r
+                                         Quick start guide on how to configure a target.\r
+                               </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/terminal.tcl b/src/server/httpd/terminal.tcl
new file mode 100644 (file)
index 0000000..707ddd0
--- /dev/null
@@ -0,0 +1,366 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>OpenOCD debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+                                                       OpenOCD\r
+                                               </a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="index.tcl" style="">Target Status</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="index.tcl" style="font-weight: bold;">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>UART forwarding</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       }\r
+\r
+                               set form_baudrate [formfetch form_baudrate]\r
+                               if {[string length $form_baudrate]==0} {\r
+                                       set form_baudrate [ocd_uart]\r
+                                       set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]]\r
+                               }\r
+                               set form_action [formfetch form_action]\r
+                       \r
+append buffer {\r
+                       <form action="terminal.tcl" method="post">\r
+                               Target baudrate: \r
+                                       <select name="form_baudrate">\r
+                                               }\r
+\r
+                                                       foreach i {9600 19200 38400 57600 115200} { \r
+                                                       \r
+append buffer {\r
+                                                               <option }\r
+if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} }  \r
+append buffer {\r
+                                                               value ="}\r
+append buffer $i\r
+append buffer {">}\r
+append buffer $i\r
+append buffer {</option>\r
+                                                       }\r
+\r
+                                                       }\r
+                                                       \r
+append buffer {\r
+                                               </select>\r
+\r
+                                       <p>     \r
+                                       <input type="submit" name="form_action" value="Set baudrate" >\r
+                               </form>                 \r
+                       }\r
+\r
+                               if {[string compare $form_action "Set baudrate"]==0} {\r
+                                       append console [encode [ocd_uart $form_baudrate]]\r
+                               }\r
+                       \r
+append buffer {\r
+                       \r
+                       <h2>Simple UART</h2>\r
+                       This terminal window is purely for illustrative purposes. Use telnet or a terminal program\r
+                       to talk to the target over TCP/IP for anything but trivial case of reading/writing a few\r
+                       lines of texts in simple tests.\r
+                       <p>\r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="terminal.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">\r
+                               \r
+                               Serial port data to target is forwarded(both directions) in the simple terminal window\r
+                               to the left. Alternatively you can <b>telnet }\r
+append buffer [ip]\r
+append buffer { 5555</b>\r
+                               or connect via TCP/IP from e.g. HyperTerminal.\r
+                               <p>\r
+                               Type "help uart" in telnet for information on how to set uart speed for target. Normally\r
+                               the uart speed is set from the target configuration script by adding an "uart N", where\r
+                               N is the baudrate.\r
+                               \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r
diff --git a/src/server/httpd/upgrade.tcl b/src/server/httpd/upgrade.tcl
new file mode 100644 (file)
index 0000000..c09cc8c
--- /dev/null
@@ -0,0 +1,418 @@
+# converted to .tcl by html2tcl.tcl\r
+set buffer ""\r
+append buffer {\r
+       \r
+       \r
+\r
+               \r
+               \r
+               \r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+\r
+               \r
+\r
+\r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+               \r
+               \r
+               \r
+               \r
+               \r
+\r
+               <html xmlns="http://www.w3.org/TR/REC-html40">\r
+<head>\r
+<title>Zylin ZY1000 JTAG debugger</title>\r
+<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>\r
+<link type="text/css" rel="stylesheet" href="menuweb.css"/>\r
+</head>\r
+}\r
+\r
+                               set console ""\r
+                               set upload_filename /ram/upload\r
+                       \r
+append buffer {\r
+<body style="margin:0px;">\r
+<div style="width:974px;height:85px;">\r
+<div style="float:left;position:relative;left:32px;width:478px;">\r
+<a href="/">\r
+<img src="menu_cuts/logo_top.png" style="border:0px;"/>\r
+</a>\r
+</div>\r
+<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">\r
+<div style="position:relative;left:15px;top:4px;" class="textlight">\r
+}\r
+append buffer [capture version]\r
+append buffer {\r
+</div>\r
+</div>\r
+</div>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:33px;">\r
+<div style="width:20px;height:510px;">\r
+                                                               &nbsp;\r
+                                                       </div>\r
+</td>\r
+<td style="vertical-align:top;height:100%;width:140px;padding:0px;">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">\r
+<tr style="height:59px;">\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="zy1000.tcl" style="">Set IP Address</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="upgrade.tcl" style="font-weight: bold;">ZY1000 Firmware</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="editfile.tcl" style="">Edit File</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="support.tcl" style="">Support Request</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">\r
+<div style="position:relative;left:10px;top:10px;font-weight:bold;">\r
+<a href="log.tcl#tail" style="">View Tail of Log</a>\r
+</div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>\r
+</tr>\r
+<tr>\r
+<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="vertical-align:top;padding:0px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td>\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/index.tcl">Config Target</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/flashinfo.tcl">Flash</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/browsemem.tcl">Memory</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/openocd.tcl">OpenOCD</a>\r
+</div>\r
+</td>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">\r
+<a href="/ram/cgi/zy1000.tcl" style="font-weight: bold;">Setup ZY1000</a>\r
+</div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">\r
+<H1>Upgrade ZY1000 Firmware</H1>\r
+</td>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">\r
+                       \r
+                       }\r
+\r
+                               set form_action [formfetch form_action];\r
+                               set form_filecontent [formfetch form_filecontent];\r
+                               \r
+                               append buffer {<form enctype="multipart/form-data" action="upgrade.tcl" method="post">}\r
+                               if {[string compare $form_action "Upload"]==0} {\r
+                                       \r
+                                       if [string match ZylinPhiFirmware* $form_filecontent]==1 {\r
+                                               set form_filename /config/firmware.phi \r
+                                               puts "Writing firmware to $form_filename"\r
+                                               set fp [aio.open $form_filename w];\r
+                                               $fp puts -nonewline $form_filecontent\r
+                                               $fp close\r
+                                               puts "Done writing firmware to $form_filename"\r
+                                               append buffer "<br><div style='font-size:14px;'>Upgraded Zylin JTAG, rebooting (wait ca. 30 seconds)...</div><br>"\r
+                                               reboot\r
+                                       } else {\r
+                                               append buffer "<br>Not a valid Zylin JTAG firmware file.<br>"\r
+                                       }\r
+                               } elseif {[string compare $form_action "Restore factory settings"]==0} {\r
+                                       proc rmdir { dir } {\r
+                                               set entries {}\r
+                                               catch {set entries [ls $dir]} err\r
+                                               foreach { entry } $entries {\r
+                                                       rmdir $dir/$entry\r
+                                                       rm $dir/$entry\r
+                                               }\r
+                                       }                               \r
+                                       rmdir /config/settings\r
+                                       reboot\r
+                                       append buffer "Restoring factory settings (wait ca. 30 seconds)...<br>"\r
+                               } else {\r
+                                       append buffer {<div style="font-size:14px;">Upgrade Zylin JTAG firmware + reboot. </div><p>}\r
+                                       append buffer {<input type="file" name="form_filecontent"> <br>}\r
+                                       append buffer {<table><tr><td style="height:15px;width:535px;">&nbsp</td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;">&nbsp</td></tr></table>}\r
+                                       append buffer {<input type="submit" name="form_action" value="Upload" ><br> }\r
+                                       append buffer {<input type="submit" name="form_action" value="Restore factory settings" ><br> }\r
+                                       append buffer {</form> }\r
+                               }\r
+                       \r
+append buffer {\r
+                       \r
+                       </td>\r
+</tr>\r
+}\r
+\r
+                                                                       \r
+                                                                       set toggle_details [formfetch toggle_details]\r
+                                                                       if {[string length $toggle_details]==0} {\r
+                                                                               set toggle_details 0\r
+                                                                       }\r
+                                                                       set show_details [load_var show_details]\r
+                                                                       if {[string length $show_details]==0} {\r
+                                                                               set show_details 0\r
+                                                                       }\r
+                                                                       if {$toggle_details==1} {\r
+                                                                               set show_details [expr 1-$show_details]\r
+                                                                               save_var show_details $show_details\r
+                                                                       }\r
+                                                                       \r
+                                                                       if {[string length $console]!=0} {\r
+                                                                               \r
+append buffer {\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:red;" colspan="6">\r
+<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">\r
+<td style="width:25px;">&nbsp;</td>\r
+}\r
+\r
+                                                                                                               if {$show_details==1} {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               } else {\r
+                                                                                                                       append buffer <\r
+                                                                                                                       append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}\r
+                                                                                                                       append buffer >\r
+                                                                                                               }\r
+                                                                                                       \r
+append buffer {\r
+<a class="openocd" href="/ram/cgi/upgrade.tcl?toggle_details=1">\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer "Hide details"\r
+                                                                                                                               append buffer <br/>\r
+                                                                                                                       } else {\r
+                                                                                                                               append buffer {<div style="position:relative;top:7px;text-align:center;">}\r
+                                                                                                                               append buffer "Show details"\r
+                                                                                                                               append buffer {</div>}\r
+                                                                                                                       }\r
+                                                                                                                       \r
+append buffer {\r
+</a>\r
+}\r
+\r
+                                                                                                                       if {$show_details==1} {\r
+                                                                                                                               append buffer $console\r
+                                                                                                                       }\r
+                                                                                                               \r
+append buffer {</td>}\r
+\r
+                                                                                                               if {$show_details!=1} {\r
+                                                                                                                       append buffer {<td>&nbsp;</td>}\r
+                                                                                                               }\r
+                                                                                                        \r
+append buffer {\r
+<td style="width:25px;">&nbsp;</td>\r
+</table>\r
+</td>\r
+</tr>\r
+}\r
+\r
+                                                                        }\r
+                                                               \r
+append buffer {\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">\r
+<div style="width:500px;background-color:#ffffff;height:100%;">\r
+                                                                                       &nbsp;\r
+                                                                               </div>\r
+</td>\r
+</tr>\r
+</table>\r
+</td>\r
+<td style="width:6px;"/>\r
+<td style="width:245px;height:100%">\r
+<table style="padding:0px;border-collapse:collapse;height:100%;">\r
+<tr>\r
+<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">\r
+<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">\r
+                                                                                   Documentation\r
+                                                                                </div>\r
+</td>\r
+<td width="40px">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+<td/>\r
+</tr>\r
+<tr>\r
+<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">\r
+<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a>\r
+<br/>\r
+<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr>\r
+<td colspan="3">\r
+<table style="padding:0px;border-collapse:collapse;">\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+<td style="background-color:#999999;width:225px; height:1px;"/>\r
+<td style="background-color:#d8d7d7;width:10px;height:1px"/>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td style="background-color:#d8d7d7;height:15px;" colspan="3"/>\r
+</tr>\r
+<tr style="height:100%;">\r
+<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">   \r
+                               \r
+                                       Upload new firmware file to ZY1000, verify that it is a valid ZY1000 firmware\r
+                                       file, and upgrade flash.\r
+                                       <p/>\r
+                                       Restore factory settings restores all factory settings except the TCP/IP settings.\r
+                                       <p/>\r
+                                       The current version of the firmware is visible at the top of the web page.\r
+                                       <p/>\r
+                                       ZY1000 firmware can also be upgraded using serial port YModem upload.\r
+                                       <p/>\r
+                                       Check for new firmware at <a target="_blank" href="http://www.zylin.com/zy1000.html">http://www.zylin.com/zy1000.html<a> \r
+                                 \r
+                       </td>\r
+</tr>\r
+<tr>\r
+<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">\r
+                                                                               &nbsp;\r
+                                                                       </td>\r
+</tr>\r
+</table>\r
+</td>\r
+</tr>\r
+<tr>\r
+<td/>\r
+<td>\r
+<img border="0" src="menu_cuts/logo_bottom.png"/>\r
+</td>\r
+</tr>\r
+</table>\r
+</body>\r
+</html>\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+\r
+               \r
+\r
+               \r
+\r
+\r
+               \r
+\r
+\r
+               \r
+       \r
+       \r
+}\r
+\r
+start_chunked "html"\r
+write_chunked $buffer\r
+end_chunked\r
+\r