diff --git a/src/helper/jim.c b/src/helper/jim.c index 800db23406762d1b5ee6516643db4bcc8fe2216c..f4336ae244b2a15283f2fd716476ad04babf6155 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -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; } diff --git a/src/server/Makefile.am b/src/server/Makefile.am index 0e3a3a479076178e7c9512d8367898c89fe83b83..89b5e364236c90ee2dfaa4e9ee2c4e8cae265dfb 100644 --- a/src/server/Makefile.am +++ b/src/server/Makefile.am @@ -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 diff --git a/src/server/httpd.c b/src/server/httpd.c index 96e338244ba005398f04020adfc90b1eb5b00dd2..348a081b631fb5c8d434983c228749fc727af03c 100644 --- a/src/server/httpd.c +++ b/src/server/httpd.c @@ -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 index 0000000000000000000000000000000000000000..ffa08ce7e2a2f6cb8382bfcff3dc5c11727c6a2c 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 index 0000000000000000000000000000000000000000..3b8bee3ea50ef0721aa0f9f3ec40ab72d29407d9 --- /dev/null +++ b/src/server/httpd/Stylizer.java @@ -0,0 +1,114 @@ +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.xpath.XPathAPI; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +/** used to generate .tcl files from */ +public class Stylizer +{ + // Global value so it can be ref'd by the tree-adapter + static Document document; + public static void main(String argv[]) + { + if (argv.length != 3) + { + System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir"); + System.exit(1); + } + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + try + { + System.err.println("Starting conversion..."); + + File stylesheet = new File(argv[0]); + File datafile = new File(argv[1]); + DocumentBuilder builder = factory.newDocumentBuilder(); + document = builder.parse(datafile); + + NodeList list = XPathAPI.selectNodeList(document, "website/language/page"); + + for (int i=0; i<list.getLength(); i++) + { + Node node=list.item(i); + + // Use a Transformer for output + TransformerFactory tFactory = TransformerFactory.newInstance(); + StreamSource stylesource = new StreamSource(stylesheet); + Transformer transformer = tFactory.newTransformer(stylesource); + + Node fileName = XPathAPI.selectSingleNode(node, "outfile/text()"); + + System.err.println("Converting " + fileName.getNodeValue()); + DOMSource source = new DOMSource(document); + + OutputStream output=new FileOutputStream(new File(argv[2], fileName.getNodeValue())); + + + try + { + StreamResult result = new StreamResult(output); + + transformer.setParameter("pagetogenerate", fileName.getNodeValue()); + transformer.transform(source, result); + } + finally + { + output.close(); + } + } + } catch (TransformerConfigurationException tce) + { + // Error generated by the parser + System.out.println("\n** Transformer Factory error"); + System.out.println(" " + tce.getMessage()); + // Use the contained exception, if any + Throwable x = tce; + if (tce.getException() != null) + x = tce.getException(); + x.printStackTrace(); + } catch (TransformerException te) + { + // Error generated by the parser + System.out.println("\n** Transformation error"); + System.out.println(" " + te.getMessage()); + // Use the contained exception, if any + Throwable x = te; + if (te.getException() != null) + x = te.getException(); + x.printStackTrace(); + } catch (SAXException sxe) + { + // Error generated by this application + // (or a parser-initialization error) + Exception x = sxe; + if (sxe.getException() != null) + x = sxe.getException(); + x.printStackTrace(); + } catch (ParserConfigurationException pce) + { + // Parser with specified options can't be built + pce.printStackTrace(); + } catch (IOException ioe) + { + // I/O error + ioe.printStackTrace(); + } + } // main +} diff --git a/src/server/httpd/browsemem.tcl b/src/server/httpd/browsemem.tcl new file mode 100644 index 0000000000000000000000000000000000000000..b34ff692bb40068113e79f00b9b2d589303a9efe --- /dev/null +++ b/src/server/httpd/browsemem.tcl @@ -0,0 +1,456 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="browsemem.tcl" style="font-weight: bold;">Browse / Edit</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="downloadmem.tcl" style="">Download</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl" style="font-weight: bold;">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Browse / Edit Memory</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + + + } + + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_type [formfetch form_type] + set form_action [formfetch form_action] + set form_value [formfetch form_value] + + if {[string compare $form_length ""]==0} { + set form_length 0 + } + if {$form_length<=0} { + set form_length 0x80 + } + if {$form_length>0x1000} { + set form_length 0x1000 + } + + if {[string compare $form_type ""]==0} { + set form_type mdw + } + + if {[string compare $form_type "mdw"]==0} { + set wordsize 4 + set modify_cmd mww + } + if {[string compare $form_type "mdh"]==0} { + set wordsize 2 + set modify_cmd mwh + } + if {[string compare $form_type "mdb"]==0} { + set wordsize 1 + set modify_cmd mwb + } + + + + + if {[string compare $form_address ""]!=0} { + if {[string compare $form_action "Previous"]==0} { + # Kludge! Work around problems parsing hex in Jim Tcl expressions + incr form_address ; set form_address [expr $form_address-1] + if {$form_address-$form_length>0} { + set form_address "0x[tohex [expr $form_address-$form_length]]" + } else { + set form_address "0x0" + } + } + if {[string compare $form_action "Next"]==0} { + # Kludge! Work around problems parsing hex in Jim Tcl expressions + incr form_address ; set form_address [expr $form_address-1] + set form_address "0x[tohex [expr $form_address+$form_length]]" + } + if {[string compare $form_action "Modify"]==0} { + append console [capture_catch "$modify_cmd $form_address $form_value"] + } + if {[string compare $form_action "Fill"]==0} { + append console [capture_catch "$modify_cmd $form_address $form_value $form_length"] + } + } + + + +append buffer { + + <form action="browsemem.tcl" method="post"> + <table> + <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="} +append buffer $form_address +append buffer {"></td></tr> + <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="} +append buffer "0x[tohex $form_length]" +append buffer {"></td></tr> + <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="} +append buffer $form_value +append buffer {"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Modify"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Fill"></td></tr> + <tr><td class="formtext">Type</td><td style="padding-top:1px;"> + <select name="form_type"> + <option + } +if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} } +append buffer { value ="mdb">8 bit + </option> + <option + } +if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} } +append buffer { value ="mdh">16 bit + </option> + <option + } +if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} } +append buffer {value ="mdw">32 bit + </option> + </select> + + </td></tr> + </table> + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <table><tr> + <td><input type="submit" name="form_action" value="Refresh"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Previous" ></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Next" ></td> + </tr></table> + <br> + + </form> + <p> + <div class="fontbigger">Memory:</div><p> + <code style="white-space: nowrap; font-size:11px;font:courier new;"> + } + + if {[string compare $form_address ""]!=0} { + append console [encode [capture_catch halt]] + append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]] + } + +append buffer { + </code> + + + + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="browsemem.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Browse and edit target memory.<br> + Length is in bytes, maximum 4096 bytes.</p> + <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p> + <p>CPU will be halted if required.</p> + <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p> + <p><b>Fill</b> - Will fill the specified region with the specified value.</p> + <p><b>Refresh</b> - Display the content of the specified memory area.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/build.sh b/src/server/httpd/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..93831a50e1b46e884e73bdfe159397a926e2308f --- /dev/null +++ b/src/server/httpd/build.sh @@ -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 index 0000000000000000000000000000000000000000..035ff3d95ee993eb77dec4243104451fa802eefd --- /dev/null +++ b/src/server/httpd/downloadmem.tcl @@ -0,0 +1,368 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="browsemem.tcl" style="">Browse / Edit</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="downloadmem.tcl" style="font-weight: bold;">Download</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl" style="font-weight: bold;">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Download Memory Range</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + } + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_action [formfetch form_action] + +append buffer { + <form action="downloadmem.tcl" method="post"> + <table> + <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="} +append buffer $form_address +append buffer {"></td></tr> + <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="} +append buffer $form_length +append buffer {"></td></tr> + </td></tr> + </table> + + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <input type="submit" value="Download" name="form_action"> + + + </form> + } + + if {[string compare $form_action "Download"]==0} { + append console [encode [capture_catch "reset init"]] + append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]] + +append buffer { + <form action="../dump.bin" target="_blank"> + <input type="submit" name="form_action" value="Save downloaded memory"> + </form> + } + + } + + +append buffer { + + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="downloadmem.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Download memory to ZY1000 from target. <br> + <b>Note</b> that download memory can take + a long time(potentially minutes for megabytes at low JTAG clk speeds). + <p/> + Once the memory is downloaded a link is available on the page to download + the file from ZY1000 to your PC. + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/editconfigs.tcl b/src/server/httpd/editconfigs.tcl new file mode 100644 index 0000000000000000000000000000000000000000..13e39106287290ac8fcf1b7e55882135a5300e34 --- /dev/null +++ b/src/server/httpd/editconfigs.tcl @@ -0,0 +1,462 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>Zylin ZY1000 JTAG debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> +<img src="menu_cuts/logo_top.png" style="border:0px;"/> +</a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="index.tcl" style="">Target Status</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="preconfig.tcl" style="">Select Target Config</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="editconfigs.tcl" style="font-weight: bold;">Edit Configurations</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="reload.tcl" style="">Reload Config Scripts</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl" style="font-weight: bold;">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Edit Target Configurations</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + <form action="editconfigs.tcl" method="post"> + } + + set form_edittext [formfetch form_edittext] + set form_action [formfetch form_action] + set form_filename [formfetch form_filename] + set form_selected [formfetch form_selected] + + if {[string compare $form_action "Load"]==0} { + set form_filename $form_selected + } + + if {[string compare $form_action "Delete"]==0} { + capture_catch "rm /config/settings/$form_selected" + } + + if {[string compare $form_action "Save"]==0} { + save_var $form_filename [from_textarea $form_edittext] + append buffer "Wrote file $form_filename<br>" + } + + set form_edittext "" + + # load original or script saved on disk. + if {[string compare $form_action "Show default"]==0} { + set form_edittext [load_file "/rom/$form_selected"] + set form_filename $form_selected + } else { + set form_edittext [load_config $form_filename] + } + + set form_edittext_subst [to_textarea $form_edittext] + + + proc prepend { val list } { + set res "" + foreach value $list { + set t $val + append t $value + lappend res $t + } + return $res + } + + set files [prepend target/ [ls /rom/target]] + set files [lunion $files [prepend event/ [ls /config/settings/event]]] + set files [lunion $files [prepend target/ [ls /config/settings/target]]] + set files [lsort $files] + + +append buffer { + <table style="padding:0px;border-collapse:collapse;"><tr> + <td style="padding-top:1px;"><select name="form_selected"> + } + + set foundTarget 0 + foreach i $files { + +append buffer { + <option + } + + if {[string compare $form_filename $i]==0} { + set foundTarget 1 + append buffer {selected="selected"} + } + +append buffer { + value="} +append buffer $i +append buffer {">} +append buffer $i +append buffer {</option> + } + + } + if {$foundTarget==0} { + +append buffer { + <option selected="selected" value="">Select target config</option> + } + + } + +append buffer { + </select></td> + <td class="buttonspacesmall"> </td> + <td><input type="submit" value="Load" name="form_action"></td> + <td class="buttonspacesmall"> </td> + <td><input type="submit" value="Show default" name="form_action"></td> + <td class="buttonspacesmall"> </td> + <td><input type="submit" value="Delete" name="form_action"></td> + </tr></table> + <textarea style="overflow:auto;" rows="21" cols="65" name="form_edittext" wrap="off">} +append buffer $form_edittext_subst +append buffer {</textarea> + <table style="padding:0px;border-collapse:collapse;"><tr> + } + + append buffer {<td class="formtext">File</td><td><input type="text" name="form_filename" } "\n" + append buffer "value=\"$form_filename\" ></td>\n" + append buffer {<td class="buttonspacesmall"> </td><td><input type="submit" value="Save" name="form_action"></td><br>} "\n" + append buffer {</tr></table>} "\n" + +append buffer { + </form> + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="editconfigs.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Here you can edit predefined target configurations, restore predefined configurations to + default state and create new target configurations.<p/> + <p>Typically when creating a new target configuration, you would take an existing + configuration that resembles the most your needs and modify it for your + purposes and save it under a different name.</p> + <p><b>Load</b> - Loads a configuration file into the editor.</p> + <p><b>Show default</b> - Loads the firmware included version of the + configuration file (if any), into the editor.<br> + <b>Note</b> that the editor content is not saved.</p> + <p><b>Delete</b> - Deletes a custom created configuration file.<br> + <b>Note</b> that firmware included configuration files can not be deleted.</p> + <p><b>Save</b> - Save the edited file under the a new or the same name.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +<tr> +<td/> +<td> +<img border="0" src="menu_cuts/logo_bottom.png"/> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/editfile.tcl b/src/server/httpd/editfile.tcl new file mode 100644 index 0000000000000000000000000000000000000000..8838e69f76591d80990113b9c1f2871c4287acbb --- /dev/null +++ b/src/server/httpd/editfile.tcl @@ -0,0 +1,436 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>Zylin ZY1000 JTAG debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> +<img src="menu_cuts/logo_top.png" style="border:0px;"/> +</a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="zy1000.tcl" style="">Set IP Address</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="upgrade.tcl" style="">ZY1000 Firmware</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="editfile.tcl" style="font-weight: bold;">Edit File</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="support.tcl" style="">Support Request</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="log.tcl#tail" style="">View Tail of Log</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/openocd.tcl">OpenOCD</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/zy1000.tcl" style="font-weight: bold;">Setup ZY1000</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Edit File</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> +} + + + +#Read a text file, edit it and write it back. Useful for interactive debugging +#of tcl scripts + +set data "" +append buffer {<form action="editfile.tcl" method="post">} "\n" + +set err ""; + +set form_edittext [formfetch form_edittext]; +set form_action [formfetch form_action]; +set form_filename [formfetch form_filename]; + +puts Action $form_action + +if {[string compare $form_action "Load"]==0} { + + set form_edittext "" + catch { + set fp [aio.open $form_filename r]; + set form_edittext [$fp read]; + $fp close; + } err +} +if {[string compare $form_action "Delete"]==0} { + capture "rm $form_filename" +} + +set form_edittext_subst [to_textarea $form_edittext] + + +if {[string compare $form_action "Save"]==0} { + if {[catch { + set fp [aio.open $form_filename w]; + $fp puts [from_textarea $form_edittext] + $fp close + append buffer "Wrote file $form_filename<br>" + } err]} { + append buffer "Could not write $form_filename<br>" + } +} + + + + +append buffer {<table><tr><td class="formtext">File</td><td style="padding-top:1px;"><input type="text" name="form_filename" } "\n" +append buffer "value=\"$form_filename\" ></td>\n" +append buffer {<td class="buttonspacesmall"> </td><td><input type="submit" value="Load" name="form_action" ></td><td class="buttonspacesmall"> </td><td><input type="submit" value="Save" name="form_action"></td><td class="buttonspacesmall"> </td><td><input type="submit" value="Delete" name="form_action"></td>} "\n" +append buffer {</tr></table>} "\n" +append buffer {<br>} + +append buffer {<textarea style="overflow:auto;" rows="18" cols="65" name="form_edittext" wrap="off">} +append buffer $form_edittext_subst +append buffer {</textarea><br>} + +append buffer {</html> } "\n" + + + +append buffer { + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="/ram/cgi/editfile.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Edit any file on the ZY1000 by typing in the + filename and pressing Load. + </p> + <table style="line-height:17px;"><tr> + <td><a href="/ram" target="_blank">Browse files on /ram</a><br> + <a href="/config" target="_blank">Browse files on /config</a><br> + <a href="/rom" target="_blank">Browse files on /rom</a></td> + </tr></table> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +<tr> +<td/> +<td> +<img border="0" src="menu_cuts/logo_bottom.png"/> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/erase.tcl b/src/server/httpd/erase.tcl new file mode 100644 index 0000000000000000000000000000000000000000..b48197f150e5507c86e4befcf84d36e39e83702c --- /dev/null +++ b/src/server/httpd/erase.tcl @@ -0,0 +1,389 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flashinfo.tcl" style="">Info</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="erase.tcl" style="font-weight: bold;">Erase</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flash.tcl" style="">Program / Verify</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="production.tcl" style="">Production</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Erase Flash</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + + + } + + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_action [formfetch form_action] + + if {[string compare $form_length ""]==0} { + set form_length 0x10000 + } + if {[string compare $form_address ""]==0} { + if {[catch {[zy1000_flash]} result]==0} { + set form_address "0x[tohex $result]" + } + } + + + if {[string compare $form_address ""]!=0} { + if {[string compare $form_action "Erase"]==0} { + append buffer "<code style=\"white-space: nowrap;\">" + append console [encode [capture_catch { + reset init + flash erase_address $form_address $form_length}]] + append buffer </code> + } + } + + + +append buffer { + + <form action="erase.tcl" method="post"> + <table> + <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="} +append buffer $form_address +append buffer {"></td></tr> + <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="} +append buffer $form_length +append buffer {"></td></tr> + </td></tr> + </table> + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <input type="submit" name="form_action" value="Erase"><br> + + + </form> + + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="erase.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Note that flash programming will erase flash if required.<p/> + <p>Reset and init CPU, then erase address range.</p> + <p>The length field is specified in number of bytes.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/flash.tcl b/src/server/httpd/flash.tcl new file mode 100644 index 0000000000000000000000000000000000000000..f7c8547b81576e695f70a3afe56effe7d7ff02f3 --- /dev/null +++ b/src/server/httpd/flash.tcl @@ -0,0 +1,461 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flashinfo.tcl" style="">Info</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="erase.tcl" style="">Erase</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flash.tcl" style="font-weight: bold;">Program / Verify</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="production.tcl" style="">Production</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Program / Verify Flash</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + } + + + set form_offset [formfetch form_offset] + set form_action [formfetch form_action] + set form_type [formfetch form_type] + + + set post "" + catch {set post $post_data} err + + if {[string compare $form_offset ""]==0} { + set form_offset 0 + } + if {[string compare $form_type ""]==0} { + set form_type "" + } + + +append buffer {<code style="white-space: nowrap;">} + + + set data "" + append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">} + + set action_reset [expr {[string length $form_action]!=0}] + set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] + set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}] + + if {$action_reset} { + append console [encode [capture_catch "reset init"]] + } + +append buffer { + </code>} + + + append buffer {<table>} + append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>} + append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>" + + +append buffer { + <tr><td class="formtext" style="padding-top:1px;">Type</td><td> + <select name="form_type"> + <option + } +if {[string compare $form_type ""]==0} { append buffer {selected="selected"} } +append buffer { + value ="">auto</option> + <option + } +if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} } +append buffer { + value ="elf">elf</option> + <option + } +if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} } +append buffer { + value ="bin">binary</option> + <option + } +if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} } +append buffer { + value ="ihex">ihex</option> + <!-- broken <option value ="s19">s19</option> --> + </select> + </td> + + </tr> + + + </table> + + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <table><tr> + <td><input type="submit" name="form_action" value="Flash" ></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td> + </tr></table> + + <p> + } + + + if {$action_flash||$action_verify} { + catch {writeform form_filecontent $upload_filename} result + append console [encode $result] + } + append buffer "<br>" + if {$action_flash} { + append console [encode [capture_catch "halt"]] + append buffer "<b>" + if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} { + append buffer "Flash write failed<br>" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Flash write succeed<br>" + } + append buffer "</b>" + } + if {$action_verify} { + append console [encode [capture_catch "halt"]] + append buffer "<b>" + if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} { + append buffer "Verify failed<br>" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Verify succeed<br>" + } + append buffer "</b>" + } + +append buffer { + + </form> + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="flash.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Program and/or verify the flash on your target.</p> + <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p> + <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p> + <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p> + <p><b>Offset</b> - This value is added to the address of the image.<br> + Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> + Typically 0 for elf/ihex and the address to write the image to for binary files.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/flashinfo.tcl b/src/server/httpd/flashinfo.tcl new file mode 100644 index 0000000000000000000000000000000000000000..595c449d41182337fdbf1e184dc0b1d0e0d18190 --- /dev/null +++ b/src/server/httpd/flashinfo.tcl @@ -0,0 +1,384 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flashinfo.tcl" style="font-weight: bold;">Info</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="erase.tcl" style="">Erase</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flash.tcl" style="">Program / Verify</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="production.tcl" style="">Production</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Flash Information</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + <div style="font-size:14px;">Configured flash banks:</div> + <p> + <code style="white-space: nowrap;"> + } + + set flash_return [ocd_flash_banks] + if {[llength $flash_return]!=0} { + append buffer [encode [flash banks]] + + set form_action [formfetch form_action] + if {[string compare $form_action "Reset CPU and probe flash"]==0} { + append console [encode [capture_catch "reset init"]] + append buffer [encode [capture_catch "flash probe 0"]] + append buffer [encode [capture_catch "flash info 0"]] + } + } else { + append buffer "No flash bank configured." + } + +append buffer { + <p> + <form action="flashinfo.tcl" method="post"> + <input type="submit" name="form_action" value="Reset CPU and probe flash"> + </form> + } + + foreach a [ocd_flash_banks] { + append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: " + +append buffer { + <form action="downloadmem.tcl" method="post"> + <input type="hidden" name="form_address" value="} +append buffer [format "0x%08x" $a(base)] +append buffer {"> + <input type="hidden" name="form_length" value="} +append buffer [format "0x%08x" $a(size)] +append buffer {"> + + <input type="submit" value="Download" name="form_action"> + <br> + </form> + } + + } + +append buffer { + </code> + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="flashinfo.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Here you will find information about the flash chips that you have + in your configuration.<p/> + <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show + you more detailed information about your flash. This includes information about + the different sectors in the flash, and the flash driver used.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/guiupload.tcl b/src/server/httpd/guiupload.tcl new file mode 100644 index 0000000000000000000000000000000000000000..9b02c2aceb8746bec02f38e0884784b9125cd57e --- /dev/null +++ b/src/server/httpd/guiupload.tcl @@ -0,0 +1,374 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="openocd.tcl" style="">Run Command</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="guiupload.tcl" style="font-weight: bold;">Upload File to ZY1000</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl" style="font-weight: bold;">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Upload File to ZY1000</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + } + + set form_filename [formfetch form_filename]; + set form_action [formfetch form_action]; + #set form_filecontent [formfetch form_filecontent]; + + append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">} + append buffer <br> + if {[string compare $form_action "Upload"]==0} { + if {[catch {writeform form_filecontent $form_filename} result]==0} { + append buffer [encode $result] + } else { + append buffer Wrote $form_filename + } + } + + 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>} + append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>} + append buffer {<table><tr><td style="height:15px;width:535px;"> </td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;"> </td></tr></table>} + append buffer {<input type="submit" name="form_action" value="Upload" ><br> } + append buffer {</form>} + + +append buffer { + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="guiupload.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing + embedded into the firmware.</p> + + <p>Use "/ram" to store temporary files.<p/> + + <p> + You can browse filing systems and download files by pointing your web browser to: + <ul> + <li><a href="/ram" target="_blank">/ram</a> + <li><a href="/rom" target="_blank">/rom</a> + <li><a href="/config" target="_blank">/config</a> + </ul> + </p> + + <p> + You can also upload files using e.g. curl from the command line. Example: + </p> + <code> + curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf } +append buffer [ip] +append buffer {upload.tcl + </code> + <p> + If you have a tftp server installed on your development PC, you can access + files on your developer PC using a /tftp/ip/ prefix to the file to be accessed + on your developer PC. Note that if you do not increase the default packet + size for your tftp server, then the performance will be very poor. Normal + performance is about 500-600kBytes/s. + </p> + <code> + cp /tftp/10.0.0.106/build/src/openocd /ram/test + </code> + + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/html2tcl.sh b/src/server/httpd/html2tcl.sh new file mode 100644 index 0000000000000000000000000000000000000000..3eb5c3939dad7c00b716d88d4004a8951878a33b --- /dev/null +++ b/src/server/httpd/html2tcl.sh @@ -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 index 0000000000000000000000000000000000000000..b579411456d44655f71f397d11b75dc87ebd914f --- /dev/null +++ b/src/server/httpd/httpd.tcl @@ -0,0 +1,108 @@ +# some dummy proc's to get things going for test purposes + + + +proc ip {} { +return 10.0.0.55 +} + +proc start_chunked {a} { + global httpdata + global httpmime + set httpmime $a + set httpdata "" +} + +proc write_chunked {a} { + global httpdata + append httpdata $a +} + +proc end_chunked {} { +} + + + +#proc formfetch {a} { +# global httppostdata + #catch { +# echo "$a=$httppostdata($a)" + #return $httppostdata($a) + #} +# + #return "" +#} + + + + +proc tohex {a} { + set r "" + while 1 { + + set rem [expr $a%16] + set a [expr $a/16] + set r [string index "0123456789abcdef" $rem]$r + if ($a==0) then break + } + return $r +} + +# encode text +proc encode {a} { + return [string map {\n <br/> { } { } \t { } > > < < / /} $a] +} + +#stubs that can be overriden to save between sessions +proc load_var {a} { + global glob_var + catch { + return $glob_var($a) + } + return "" +} +#stubs that can be overriden to save between sessions +proc save_var {a b} { + catch { + set glob_var($a) $b + return "" + } err + set glob_var($a) "" + return "" +} + + + +proc to_textarea {a} { + return [string map {& & > > < < / /} $a] +} + +proc from_textarea {a} { + return [string map {> > < < & & / /} $a] +} + +proc lunion {a b} { + foreach e $a { + set x($e) {} + } + foreach e $b { + if {![info exists x($e)]} { + lappend a $e + } + } + return $a +} + + +# encode text +proc encode {a} { + return [string map {\n <br/> { } { } \t { } > > < < / /} $a] +} + +# catch any exceptions, capture output and return it +proc capture_catch {a} { + catch { + return [eval {capture $a}] + } result + return $result +} diff --git a/src/server/httpd/index.tcl b/src/server/httpd/index.tcl new file mode 100644 index 0000000000000000000000000000000000000000..91e7e3fb96b8a673f2060f359d6bdbd6c1309383 --- /dev/null +++ b/src/server/httpd/index.tcl @@ -0,0 +1,381 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="index.tcl" style="font-weight: bold;">Target Status</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl" style="font-weight: bold;">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>OpenOCD debugger</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + + <table> + <tr><td style="height:10px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:5px;width:535px;"> </td></tr> + </table> + + <H1>Target Status</H1> + + <table> + <tr> + <td class="fontbigger"> + } + + set form_address [formfetch form_address] + set form_action [formfetch form_action] + + if {[string compare $form_action "Halt"]==0} { + append console [encode [capture_catch "halt"]] + } + if {[string compare $form_action "Resume"]==0} { + append console [encode [capture_catch "resume"]] + } + + if {[string compare $form_action "Reset and run"]==0} { + append console [encode [capture_catch "reset run"]] + } + + if {[string compare $form_action "Power on"]==0} { + append console [encode [capture_catch "power on"]] + } + if {[string compare $form_action "Power off"]==0} { + append console [encode [capture_catch "power off"]] + } + +append buffer { + + } +append console [encode [capture_catch poll]] +append buffer { + </td> + </tr> + </table> + + <form action="index.tcl" method="post"> + <table><tr> + <td><input type="submit" name="form_action" value="Reset and run"></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td> + <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td> + </tr></table> + + <br> + <br> + + <p> + </form> + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="index.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Target status shows that status of the connected target. </p> + <p><b>Current target</b> - selected target configuration. <br> + <p><b>Startup</b> - whether or not the target script ran to completion. Note + that even if the target is disconnected, powered down or unresponsive, the + startup script will still run to completion. Startup - OK does not mean + that the target is fully operational, simply that the configuration script + did not contain syntax errors for instance. + See log for details. <br> + <p><b>Target power</b> - Detects power on target. <br> + If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p> + <p><b>Power on</b> - Turn on ZY1000 target power relay.</p> + <p><b>Power off</b> - Turn off ZY1000 target power relay.</p> + <p>Type "help power" in telnet for command to control power relay.</p> + <p><b>Reboot ZY1000</b> - Reboots ZY1000 unit. Type "help reboot" in telnet.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/log.tcl b/src/server/httpd/log.tcl new file mode 100644 index 0000000000000000000000000000000000000000..c5794512bd6530c2f483b0d4c3734d509ed90a04 --- /dev/null +++ b/src/server/httpd/log.tcl @@ -0,0 +1,343 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>Zylin ZY1000 JTAG debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> +<img src="menu_cuts/logo_top.png" style="border:0px;"/> +</a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="openocd.tcl" style="">Run Command</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="guiupload.tcl" style="">Upload File to ZY1000</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="log.tcl#tail" style="">View Tail of Log</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl" style="font-weight: bold;">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>View Tail of Log</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + } + + append buffer "<code style=\"white-space: nowrap;\">" + append buffer [encode [log]] + append buffer {<p><p><p><a name="tail"/>} + append buffer {<a href="log.tcl} + append buffer "?rnd=[rand]" + append buffer {#tail">Refresh</a>} + append buffer {<p>} + append buffer "</code>"; + +append buffer { + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="log.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"/> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +<tr> +<td/> +<td> +<img border="0" src="menu_cuts/logo_bottom.png"/> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/menu.xml b/src/server/httpd/menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..cf286e235b6a72a5b6126bfbf073591e016512fe --- /dev/null +++ b/src/server/httpd/menu.xml @@ -0,0 +1,1038 @@ +<?xml version = "1.0" encoding="iso-8859-1" standalone="yes"?> +<?xml-stylesheet type="text/xsl" href="plaintext.xsl"?> +<website> + + <language lang="Norsk"> + + <page lang="eng"> + <outfile>index.tcl</outfile> + <menutext>Config Target</menutext> + <menulink>index.tcl</menulink> + <pageheading>OpenOCD debugger</pageheading> + <level2parent>index.tcl</level2parent> + <level2menu href="index.tcl" title="Target Status" titlestyle="color:#4e6627;"> + </level2menu> + <!-- + <level2menu href="terminal.tcl" title="UART forwarding" titlestyle="color:#4e6627;"> + </level2menu> + --> + + <pagetext> + <markup_code><![CDATA[ + + + <table> + <tr><td style="height:10px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:5px;width:535px;"> </td></tr> + </table> + + <H1>Target Status</H1> + + <table> + <tr> + <td class="fontbigger"> + <tcl> + set form_address [formfetch form_address] + set form_action [formfetch form_action] + + if {[string compare $form_action "Halt"]==0} { + append console [encode [capture_catch "halt"]] + } + if {[string compare $form_action "Resume"]==0} { + append console [encode [capture_catch "resume"]] + } + + if {[string compare $form_action "Reset and run"]==0} { + append console [encode [capture_catch "reset run"]] + } + + if {[string compare $form_action "Power on"]==0} { + append console [encode [capture_catch "power on"]] + } + if {[string compare $form_action "Power off"]==0} { + append console [encode [capture_catch "power off"]] + } + </tcl> + + <tcl>append console [encode [capture_catch poll]]</tcl> + </td> + </tr> + </table> + + <form action="index.tcl" method="post"> + <table><tr> + <td><input type="submit" name="form_action" value="Reset and run"></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td> + <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td> + </tr></table> + + <br> + <br> + + <p> + </form> + ]]></markup_code> + <right_column> + <markup_code><![CDATA[ + <p>Target status shows that status of the connected target. </p> + <p><b>Current target</b> - selected target configuration. <br> + <p><b>Startup</b> - whether or not the target script ran to completion. Note + that even if the target is disconnected, powered down or unresponsive, the + startup script will still run to completion. Startup - OK does not mean + that the target is fully operational, simply that the configuration script + did not contain syntax errors for instance. + See log for details. <br> + <p><b>Target power</b> - Detects power on target. <br> + If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p> + <p><b>Power on</b> - Turn on ZY1000 target power relay.</p> + <p><b>Power off</b> - Turn off ZY1000 target power relay.</p> + <p>Type "help power" in telnet for command to control power relay.</p> + <p><b>Reboot ZY1000</b> - Reboots ZY1000 unit. Type "help reboot" in telnet.</p> + ]]></markup_code> + </right_column> + + </pagetext> + </page> + + + + + <page lang="eng"> + <outfile>targets.tcl</outfile> + <level2parent>documentation.tcl</level2parent> + <pageheading>Target config quick start guide</pageheading> + <pagetext> + <markup_code><![CDATA[ + + A target needs an openocd.cfg file. This config file sets up + the CPU, flash and reset init script. Either ZY1000 ships with an + openocd.cfg file for your target or you need to take an existing + config file and modify it for your needs. + <p> + The reset init script is crucial. It will set up e.g. MMU, chip + select registers, etc. after a reset. The init.cfg (reset init script) + is embedded into the openocd.cfg file in the sampls Zylin provides. + <p> + Writing an openocd.cfg from scratch is a non-trivial exercise, but + fortunally it only has to be done once for a target and afterwards it + rarely if ever needs to be changed. + + + ]]></markup_code> + <right_column> + + Quick start guide on how to configure a target. + </right_column> + </pagetext> + + + </page> + + + + <page lang="eng"> + <outfile>reload.tcl</outfile> + <level2parent>index.tcl</level2parent> + <pageheading>Reload Config Scripts</pageheading> + <pagetext> + <markup_code><![CDATA[ + + <tcl> + set form_action [formfetch form_action] + + if {[string compare $form_action "Reload"]==0} { + append buffer "Reloading Config Scripts...<p>" + reboot + } + </tcl> + <form enctype="multipart/form-data" action="reload.tcl" method="post"> + <input type="submit" name="form_action" value="Reload"> + </form> + + ]]></markup_code> + <right_column> + Restart ZY1000 to reload selected target config script. + </right_column> + </pagetext> + + </page> + + + <page lang="eng"> + <outfile>flashinfo.tcl</outfile> + <menutext>Flash</menutext> + <menulink>flashinfo.tcl</menulink> + <pageheading>Flash Information</pageheading> + <level2parent>flashinfo.tcl</level2parent> + <level2menu href="flashinfo.tcl" title="Info" titlestyle="color:#4e6627;"> + </level2menu> + <level2menu href="erase.tcl" title="Erase" titlestyle="color:#4e6627;"> + </level2menu> + <level2menu href="flash.tcl" title="Program / Verify" titlestyle="color:#4e6627;"> + </level2menu> + <level2menu href="production.tcl" title="Production" titlestyle="color:#4e6627;"> + </level2menu> + + <pagetext> + <markup_code><![CDATA[ + + <div style="font-size:14px;">Configured flash banks:</div> + <p> + <code style="white-space: nowrap;"> + <tcl> + set flash_return [ocd_flash_banks] + if {[llength $flash_return]!=0} { + append buffer [encode [flash banks]] + + set form_action [formfetch form_action] + if {[string compare $form_action "Reset CPU and probe flash"]==0} { + append console [encode [capture_catch "reset init"]] + append buffer [encode [capture_catch "flash probe 0"]] + append buffer [encode [capture_catch "flash info 0"]] + } + } else { + append buffer "No flash bank configured." + } + </tcl> + <p> + <form action="flashinfo.tcl" method="post"> + <input type="submit" name="form_action" value="Reset CPU and probe flash"> + </form> + <tcl> + foreach a [ocd_flash_banks] { + append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: " + </tcl> + <form action="downloadmem.tcl" method="post"> + <input type="hidden" name="form_address" value="<tcl>append buffer [format "0x%08x" $a(base)]</tcl>"> + <input type="hidden" name="form_length" value="<tcl>append buffer [format "0x%08x" $a(size)]</tcl>"> + + <input type="submit" value="Download" name="form_action"> + <br> + </form> + <tcl> + } + </tcl> + </code> + + + ]]></markup_code> + <right_column> + <![CDATA[ + <p>Here you will find information about the flash chips that you have + in your configuration.<p/> + <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show + you more detailed information about your flash. This includes information about + the different sectors in the flash, and the flash driver used.</p> + ]]> + </right_column> + + </pagetext> + </page> + + <page lang="eng"> + <outfile>flash.tcl</outfile> + <level2parent>flashinfo.tcl</level2parent> + <pageheading>Program / Verify Flash</pageheading> + <pagetext> + <markup_code><![CDATA[ + + <tcl> + + set form_offset [formfetch form_offset] + set form_action [formfetch form_action] + set form_type [formfetch form_type] + + + set post "" + catch {set post $post_data} err + + if {[string compare $form_offset ""]==0} { + set form_offset 0 + } + if {[string compare $form_type ""]==0} { + set form_type "" + } + + </tcl><code style="white-space: nowrap;"><tcl> + + set data "" + append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">} + + set action_reset [expr {[string length $form_action]!=0}] + set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] + set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}] + + if {$action_reset} { + append console [encode [capture_catch "reset init"]] + } + </tcl> + </code><tcl> + + append buffer {<table>} + append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>} + append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>" + + </tcl> + <tr><td class="formtext" style="padding-top:1px;">Type</td><td> + <select name="form_type"> + <option + <tcl>if {[string compare $form_type ""]==0} { append buffer {selected="selected"} } </tcl> + value ="">auto</option> + <option + <tcl>if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} } </tcl> + value ="elf">elf</option> + <option + <tcl>if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} } </tcl> + value ="bin">binary</option> + <option + <tcl>if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} } </tcl> + value ="ihex">ihex</option> + <!-- broken <option value ="s19">s19</option> --> + </select> + </td> + + </tr> + + + </table> + + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <table><tr> + <td><input type="submit" name="form_action" value="Flash" ></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td> + <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td> + </tr></table> + + <p> + <tcl> + + if {$action_flash||$action_verify} { + catch {writeform form_filecontent $upload_filename} result + append console [encode $result] + } + append buffer "<br>" + if {$action_flash} { + append console [encode [capture_catch "halt"]] + append buffer "<b>" + if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} { + append buffer "Flash write failed<br>" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Flash write succeed<br>" + } + append buffer "</b>" + } + if {$action_verify} { + append console [encode [capture_catch "halt"]] + append buffer "<b>" + if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} { + append buffer "Verify failed<br>" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Verify succeed<br>" + } + append buffer "</b>" + } + </tcl> + + </form> + + ]]></markup_code> + + <right_column> + <![CDATA[ + <p>Program and/or verify the flash on your target.</p> + <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p> + <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p> + <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p> + <p><b>Offset</b> - This value is added to the address of the image.<br> + Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> + Typically 0 for elf/ihex and the address to write the image to for binary files.</p> + ]]> + </right_column> + + + </pagetext> + + </page> + + + + + <page lang="eng"> + <outfile>production.tcl</outfile> + <level2parent>flashinfo.tcl</level2parent> + <pageheading>Production</pageheading> + <pagetext> + <markup_code><![CDATA[ + <tcl> + set form_action [formfetch form_action] + set form_serialnumber [formfetch form_serialnumber] + append buffer [production_info] + </tcl> + + <form enctype="multipart/form-data" action="production.tcl" method="post"> + <code style="white-space: nowrap;"> + <tcl> + if {[string compare $form_action "Upload firmware"]==0} { + set wrotedata [catch {writeform form_filecontent $upload_filename} result] + append buffer [encode $result] + if {$wrotedata==0} { + append buffer "<br>Running production procedure<p>" + append buffer "<br>Reset and init: <br>" + + append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]] + } + } + if {[string compare $form_action "Test"]==0} { + append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>" + + append console [encode [capture_catch {catch production_test}]] + } + if {[string compare $form_action "Power on"]==0} { + append console [encode [capture_catch "power on"]] + } + if {[string compare $form_action "Power off"]==0} { + append console [encode [capture_catch "power off"]] + } + </tcl> + </code> + <tcl> + append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>} + append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>} + </tcl> + + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <table><tr> + <td><input type="submit" name="form_action" value="Upload firmware" ></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Test"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Power on"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Power off"> + </tr></table> + </form> + + ]]></markup_code> + + <right_column> + <![CDATA[ + The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures + are used on this page. There are default implementations that do nothing. + + <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> + <p><b>Test</b> - Power up target, run 10 second target test. Output is provided via the DCC output channel. </p> + <p><b>Power on</b> - Power on target.</p> + <p><b>Power off</b> - Power off target.</p> + <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p> + ]]> + </right_column> + + + </pagetext> + + </page> + + + + <page lang="eng"> + <outfile>erase.tcl</outfile> + <menulink>erase.tcl</menulink> + <pageheading>Erase Flash</pageheading> + <level2parent>flashinfo.tcl</level2parent> + <pagetext> + <markup_code><![CDATA[ + + + + <tcl> + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_action [formfetch form_action] + + if {[string compare $form_length ""]==0} { + set form_length 0x10000 + } + if {[string compare $form_address ""]==0} { + if {[catch {[zy1000_flash]} result]==0} { + set form_address "0x[tohex $result]" + } + } + + + if {[string compare $form_address ""]!=0} { + if {[string compare $form_action "Erase"]==0} { + append buffer "<code style=\"white-space: nowrap;\">" + append console [encode [capture_catch { + reset init + flash erase_address $form_address $form_length}]] + append buffer </code> + } + } + + + </tcl> + + <form action="erase.tcl" method="post"> + <table> + <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> + <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr> + </td></tr> + </table> + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <input type="submit" name="form_action" value="Erase"><br> + + + </form> + + + + ]]></markup_code> + <right_column> + <![CDATA[ + <p>Note that flash programming will erase flash if required.<p/> + <p>Reset and init CPU, then erase address range.</p> + <p>The length field is specified in number of bytes.</p> + ]]> + </right_column> + + </pagetext> + </page> + + + <page lang="eng"> + <outfile>run.tcl</outfile> + <menulink>run.tcl</menulink> + <pageheading>Run program</pageheading> + <level2parent>flashinfo.tcl</level2parent> + <pagetext> + <markup_code><![CDATA[ + + + +<tcl> + +set form_address [formfetch form_address] +set form_action [formfetch form_action] + +if {[string compare $form_action "Run from address"]==0} { + append console [encode [capture_catch "halt"]] + append console [encode [capture_catch "wait_halt"]] + append console [encode [capture_catch "resume $form_address"]] +} + +if {[string compare $form_action "Halt"]==0} { + append console [encode [capture_catch "halt"]] + append console [encode [capture_catch "wait_halt"]] +} + +if {[string compare $form_action "Reset and run"]==0} { + append console [encode [capture_catch "reset run"]] +} + +if {[string compare $form_action "Reset and init"]==0} { + append console [encode [capture_catch "reset init"]] +} + +append console [encode [capture_catch poll]] + +</tcl> + +<form action="run.tcl" method="post"> + <table> + <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> + </td></tr> + </table> + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <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> +</form> + + + + ]]></markup_code> + <right_column> + <![CDATA[ + <p>Reset and run - reset CPU and let it run.</p> + <p>Halt - halt CPU.</p> + <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p> + <p>Reset and init - reset CPU and run init script.</p> + ]]> + </right_column> + + </pagetext> + </page> + + + <page lang="eng"> + <outfile>browsemem.tcl</outfile> + <menutext>Memory</menutext> + <menulink>browsemem.tcl</menulink> + <pageheading>Browse / Edit Memory</pageheading> + <level2parent>browsemem.tcl</level2parent> + <level2menu href="browsemem.tcl" title="Browse / Edit" titlestyle="color:#4e6627;"> + <![CDATA[ + Browse and edit memory. + ]]> + </level2menu> + <level2menu href="downloadmem.tcl" title="Download" titlestyle="color:#4e6627;"> + <![CDATA[ + Copy memory range to developer machine + ]]> + </level2menu> + + <pagetext> + <markup_code><![CDATA[ + + + + <tcl> + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_type [formfetch form_type] + set form_action [formfetch form_action] + set form_value [formfetch form_value] + + if {[string compare $form_length ""]==0} { + set form_length 0 + } + if {$form_length<=0} { + set form_length 0x80 + } + if {$form_length>0x1000} { + set form_length 0x1000 + } + + if {[string compare $form_type ""]==0} { + set form_type mdw + } + + if {[string compare $form_type "mdw"]==0} { + set wordsize 4 + set modify_cmd mww + } + if {[string compare $form_type "mdh"]==0} { + set wordsize 2 + set modify_cmd mwh + } + if {[string compare $form_type "mdb"]==0} { + set wordsize 1 + set modify_cmd mwb + } + + + + + if {[string compare $form_address ""]!=0} { + if {[string compare $form_action "Previous"]==0} { + # Kludge! Work around problems parsing hex in Jim Tcl expressions + incr form_address ; set form_address [expr $form_address-1] + if {$form_address-$form_length>0} { + set form_address "0x[tohex [expr $form_address-$form_length]]" + } else { + set form_address "0x0" + } + } + if {[string compare $form_action "Next"]==0} { + # Kludge! Work around problems parsing hex in Jim Tcl expressions + incr form_address ; set form_address [expr $form_address-1] + set form_address "0x[tohex [expr $form_address+$form_length]]" + } + if {[string compare $form_action "Modify"]==0} { + append console [capture_catch "$modify_cmd $form_address $form_value"] + } + if {[string compare $form_action "Fill"]==0} { + append console [capture_catch "$modify_cmd $form_address $form_value $form_length"] + } + } + + + </tcl> + + <form action="browsemem.tcl" method="post"> + <table> + <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr> + <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer "0x[tohex $form_length]"</tcl>"></td></tr> + <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="<tcl>append buffer $form_value</tcl>"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Modify"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Fill"></td></tr> + <tr><td class="formtext">Type</td><td style="padding-top:1px;"> + <select name="form_type"> + <option + <tcl>if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} } </tcl> value ="mdb">8 bit + </option> + <option + <tcl>if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} } </tcl> value ="mdh">16 bit + </option> + <option + <tcl>if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} } </tcl>value ="mdw">32 bit + </option> + </select> + + </td></tr> + </table> + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <table><tr> + <td><input type="submit" name="form_action" value="Refresh"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Previous" ></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Next" ></td> + </tr></table> + <br> + + </form> + <p> + <div class="fontbigger">Memory:</div><p> + <code style="white-space: nowrap; font-size:11px;font:courier new;"> + <tcl> + if {[string compare $form_address ""]!=0} { + append console [encode [capture_catch halt]] + append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]] + } + </tcl> + </code> + + + + + + ]]></markup_code> + <right_column> + <![CDATA[ + <p>Browse and edit target memory.<br> + Length is in bytes, maximum 4096 bytes.</p> + <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p> + <p>CPU will be halted if required.</p> + <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p> + <p><b>Fill</b> - Will fill the specified region with the specified value.</p> + <p><b>Refresh</b> - Display the content of the specified memory area.</p> + ]]> + </right_column> + + </pagetext> + </page> + + + + + <page lang="eng"> + <outfile>downloadmem.tcl</outfile> + <level2parent>browsemem.tcl</level2parent> + <pageheading>Download Memory Range</pageheading> + <pagetext> + <markup_code><![CDATA[ + <tcl> + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_action [formfetch form_action] + </tcl> + <form action="downloadmem.tcl" method="post"> + <table> + <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr> + <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr> + </td></tr> + </table> + + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <input type="submit" value="Download" name="form_action"> + + + </form> + <tcl> + if {[string compare $form_action "Download"]==0} { + append console [encode [capture_catch "reset init"]] + append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]] + </tcl> + <form action="../dump.bin" target="_blank"> + <input type="submit" name="form_action" value="Save downloaded memory"> + </form> + <tcl> + } + + </tcl> + + + + ]]></markup_code> + <right_column> + <![CDATA[ + Download memory to ZY1000 from target. <br> + <b>Note</b> that download memory can take + a long time(potentially minutes for megabytes at low JTAG clk speeds). + <p/> + Once the memory is downloaded a link is available on the page to download + the file from ZY1000 to your PC. + ]]> + </right_column> + </pagetext> + + </page> + + + + <page lang="eng"> + <outfile>openocd.tcl</outfile> + <menutext>OpenOCD</menutext> + <menulink>openocd.tcl</menulink> + <pageheading>Run Command</pageheading> + <level2parent>openocd.tcl</level2parent> + <level2menu href="openocd.tcl" title="Run Command" titlestyle="color:#4e6627;"> + </level2menu> + <level2menu href="guiupload.tcl" title="Upload File to ZY1000" titlestyle="color:#4e6627;"> + <![CDATA[ + Upload file to ZY1000 + ]]> + </level2menu> + + <pagetext> + <markup_code><![CDATA[ + + <tcl> + set form_command [formfetch form_command] + + set form_edittext "" + if {[string length $form_command]>0} { + catch {capture_catch {eval "$form_command"}} form_edittext + } + + append buffer {<form action="openocd.tcl" method="post">} "\n" + append buffer {Command<br>} + append buffer {<textarea style="overflow:auto;" rows="5" cols="65" name="form_command" wrap="off">} + append buffer [to_textarea $form_command] + append buffer {</textarea><br>} + append buffer {<input type="submit" value="Run" name="form_action" ><br>} + append buffer {<textarea style="overflow:auto;" rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">} + append buffer [to_textarea $form_edittext] + append buffer {</textarea><br>} + + append buffer {</form>} "\n" + + </tcl> + + ]]></markup_code> + + <right_column> + <![CDATA[ + <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise + there will be no output, e.g. "reset init" use "ocd_reset init". + <p/> + <p><a href="/ram/log">Click here to download log</a>.</p> + <p>To download log you can also use commands like "wget http://<tcl>append buffer [ip]</tcl>/ram/log", or + point your web browser to said address.</p> + <p> + You can also execute tcl commands using curl from your developer PC: + </p> + <code> + curl --form form_command=ocd_version <tcl>append buffer [ip]</tcl>runtcl.tcl + </code> + + ]]> + </right_column> + </pagetext> + </page> + + + + <page lang="eng"> + <outfile>guiupload.tcl</outfile> + <level2parent>openocd.tcl</level2parent> + <pageheading>Upload File to ZY1000</pageheading> + <pagetext> + <markup_code><![CDATA[ + + <tcl> + set form_filename [formfetch form_filename]; + set form_action [formfetch form_action]; + #set form_filecontent [formfetch form_filecontent]; + + append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">} + append buffer <br> + if {[string compare $form_action "Upload"]==0} { + if {[catch {writeform form_filecontent $form_filename} result]==0} { + append buffer [encode $result] + } else { + append buffer Wrote $form_filename + } + } + + 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>} + append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>} + append buffer {<table><tr><td style="height:15px;width:535px;"> </td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;"> </td></tr></table>} + append buffer {<input type="submit" name="form_action" value="Upload" ><br> } + append buffer {</form>} + + </tcl> + + ]]></markup_code> + <right_column> + <![CDATA[ + <p>The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing + embedded into the firmware.</p> + + <p>Use "/ram" to store temporary files.<p/> + + <p> + You can browse filing systems and download files by pointing your web browser to: + <ul> + <li><a href="/ram" target="_blank">/ram</a> + <li><a href="/rom" target="_blank">/rom</a> + <li><a href="/config" target="_blank">/config</a> + </ul> + </p> + + <p> + You can also upload files using e.g. curl from the command line. Example: + </p> + <code> + curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf <tcl>append buffer [ip]</tcl>upload.tcl + </code> + <p> + If you have a tftp server installed on your development PC, you can access + files on your developer PC using a /tftp/ip/ prefix to the file to be accessed + on your developer PC. Note that if you do not increase the default packet + size for your tftp server, then the performance will be very poor. Normal + performance is about 500-600kBytes/s. + </p> + <code> + cp /tftp/10.0.0.106/build/src/openocd /ram/test + </code> + + ]]> + </right_column> + </pagetext> + + </page> + + + + <page lang="eng"> + <outfile>targets.tcl</outfile> + <level2parent>documentation.tcl</level2parent> + <pageheading>Target config quick start guide</pageheading> + <pagetext> + <markup_code><![CDATA[ + + A target needs an openocd.cfg file. This config file sets up + the CPU, flash and reset init script. Either ZY1000 ships with an + openocd.cfg file for your target or you need to take an existing + config file and modify it for your needs. + <p> + The reset init script is crucial. It will set up e.g. MMU, chip + select registers, etc. after a reset. The init.cfg (reset init script) + is embedded into the openocd.cfg file in the sampls Zylin provides. + <p> + Writing an openocd.cfg from scratch is a non-trivial exercise, but + fortunally it only has to be done once for a target and afterwards it + rarely if ever needs to be changed. + + + ]]></markup_code> + <right_column> + + Quick start guide on how to configure a target. + </right_column> + </pagetext> + + + </page> + + + + + + <page lang="eng"> + <menulink>index.tcl</menulink> + <level2parent>index.tcl</level2parent> + <outfile>terminal.tcl</outfile> + <pageheading>UART forwarding</pageheading> + <pagetext> + <markup_code><![CDATA[ + <tcl> + set form_baudrate [formfetch form_baudrate] + if {[string length $form_baudrate]==0} { + set form_baudrate [ocd_uart] + set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]] + } + set form_action [formfetch form_action] + </tcl> + <form action="terminal.tcl" method="post"> + Target baudrate: + <select name="form_baudrate"> + <tcl> + foreach i {9600 19200 38400 57600 115200} { + </tcl> + <option <tcl>if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} } </tcl> + value ="<tcl>append buffer $i</tcl>"><tcl>append buffer $i</tcl></option> + <tcl> + } + </tcl> + </select> + + <p> + <input type="submit" name="form_action" value="Set baudrate" > + </form> + <tcl> + if {[string compare $form_action "Set baudrate"]==0} { + append console [encode [ocd_uart $form_baudrate]] + } + </tcl> + + <h2>Simple UART</h2> + This terminal window is purely for illustrative purposes. Use telnet or a terminal program + to talk to the target over TCP/IP for anything but trivial case of reading/writing a few + lines of texts in simple tests. + <p> + ]]></markup_code> + <right_column> + <![CDATA[ + Serial port data to target is forwarded(both directions) in the simple terminal window + to the left. Alternatively you can <b>telnet <tcl>append buffer [ip]</tcl> 5555</b> + or connect via TCP/IP from e.g. HyperTerminal. + <p> + Type "help uart" in telnet for information on how to set uart speed for target. Normally + the uart speed is set from the target configuration script by adding an "uart N", where + N is the baudrate. + ]]> + </right_column> + </pagetext> + + </page> + + + + </language> + +</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 index 0000000000000000000000000000000000000000..320d5e248307e30e8072c5c462f8e11709a91af2 --- /dev/null +++ b/src/server/httpd/menu.xsl @@ -0,0 +1,298 @@ +<?xml version="1.0"?> +<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp " ">]> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/REC-html40" version="1.0"> + <xsl:output method="html" version="4.0" indent="yes" encoding="UTF-8" + + media-type="text/plain; charset=UTF-8"/> + + <xsl:param name="pagetogenerate" select="UNDEFINED"/> + <xsl:template match="page[outfile!=$pagetogenerate]"> + </xsl:template> + + <xsl:template match="page[outfile=$pagetogenerate]"> + <xsl:variable name="Xlevel2parent" select="level2parent"/> + <xsl:variable name="Xlevel3parent" select="level3parent"/> + + <html> + <head> + <title>OpenOCD debugger</title> + <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/> + <link href="menuweb.css" rel="stylesheet" type="text/css"/> + + </head> + + + <tcl> + set console "" + set upload_filename /ram/upload + </tcl> + + <body style="margin:0px;"> + <div style="width:974px;height:85px;"> + <div style="float:left;position:relative;left:32px;width:478px;"> + <a href="/"> + OpenOCD + </a> + </div> + <div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> + <div class="textlight" style="position:relative;left:15px;top:4px;"> + <tcl>append buffer [capture version]</tcl> + </div> + </div> + </div> + <table style="padding:0px;border-collapse:collapse;"> + <tr> + <td style="width:33px;"> + <div style="width:20px;height:510px;"> + + </div> + </td> + <!-- level 2 menu bar on left --> + <td style="vertical-align:top;height:100%;width:140px;padding:0px;"> + <table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> + <tr style="height:59px;"> + <td></td> + </tr> + <xsl:for-each select="parent::language/page[outfile = $Xlevel2parent]/level2menu"> + <tr> + <td> + <xsl:choose> + <xsl:when test="contains(@href, $pagetogenerate)"> + <xsl:attribute name="style">width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style">width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <div style="position:relative;left:10px;top:10px;font-weight:bold;"> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="@href"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="(@href = $pagetogenerate)"> + <xsl:attribute name="style">font-weight: bold;</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="(@href = $Xlevel3parent)"> + <xsl:attribute name="style">font-weight: bold;</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style"></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="@title"/> + </a> + </div> + </td> + </tr> + </xsl:for-each> + <tr> + <td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"> + + </td> + </tr> + <tr> + <td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"> + + </td> + </tr> + <tr> + <td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"> + + </td> + </tr> + </table> + </td> + <!-- top level menu --> + <td style="vertical-align:top;padding:0px;height:100%"> + <table style="padding:0px;border-collapse:collapse;height:100%;"> + <tr> + <td> + <table style="padding:0px;border-collapse:collapse;"> + <tr> + <xsl:for-each select="parent::language/page"> + <xsl:if test="menutext"> + <td> + <xsl:choose> + <xsl:when test="(outfile = $pagetogenerate) or (outfile = $Xlevel2parent)"> + <xsl:attribute name="style">width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style">width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> + <a> + <xsl:attribute name="href"><xsl:value-of select="menulink"/></xsl:attribute> + <xsl:if test="(outfile = $pagetogenerate)"> + <xsl:attribute name="style">font-weight: bold;</xsl:attribute> + </xsl:if> + <xsl:if test="(outfile = $Xlevel2parent)"> + <xsl:attribute name="style">font-weight: bold;</xsl:attribute> + </xsl:if> + <xsl:value-of select="menutext"/> + </a> + </div> + </td> + </xsl:if> + </xsl:for-each> + </tr> + </table> + </td> + </tr> + <tr> + <td colspan="6" style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;"> + <div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> + </td> + </tr> + <tr> + <td colspan="6" style="background-color:#ffffff;text-indent:30px;height:40px;"> + <H1><xsl:value-of select="pageheading"/></H1> + </td> + </tr> + <tr style="height:100%;"> + <td colspan="6" style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;"> + <xsl:value-of disable-output-escaping="yes" select="pagetext/markup_code"/> + </td> + </tr> + <tcl> + <!-- This is the output from any OpenOCD commands --> + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + </tcl> + <tr style="height:100%;"> + <td colspan="6" style="height:100%;background-color:red;"> + <table class="textgray" style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%"> + <td style="width:25px;"> </td> + <tcl> + if {$show_details==1} { + append buffer <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text> + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text> + } else { + append buffer <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text> + 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;"} + append buffer <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text> + } + </tcl> + <a class="openocd"> + <xsl:attribute name="href"><xsl:value-of select="$pagetogenerate"/>?toggle_details=1</xsl:attribute> + <tcl> + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + </tcl> + </a> + <tcl> + if {$show_details==1} { + append buffer $console + } + </tcl> + <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text>/td<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text> + <tcl> + if {$show_details!=1} { + append buffer {<td> </td>} + } + </tcl> + <td style="width:25px;"> </td> + </table> + </td> + </tr> + <tcl> + } + </tcl> + <tr> + <td colspan="6" style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;"> + <div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> + </td> + </tr> + </table> + </td> + <td style="width:6px;"> + </td> + <td style="width:245px;height:100%"> + <table style="padding:0px;border-collapse:collapse;height:100%;"> + <tr> + <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> + <div class="textgray" style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;"> + Documentation + </div> + </td> + <td width="40px"> + + </td> + <td> + </td> + </tr> + <tr> + <td colspan="3" style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');"></td> + </tr> + <tr> + <td colspan="3" style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;"> + <a href="http://openocd.berlios.de/doc/openocd.pdf" target="_blank">OpenOCD Manual</a><br/> + </td> + </tr> + <tr><td colspan="3" style="background-color:#d8d7d7;height:15px;"></td></tr> + <tr> + <td colspan="3"> + <table style="padding:0px;border-collapse:collapse;"> + <td style="background-color:#d8d7d7;width:10px;height:1px"></td> + <td style="background-color:#999999;width:225px; height:1px;"></td> + <td style="background-color:#d8d7d7;width:10px;height:1px"></td> + </table> + </td> + </tr> + <tr><td colspan="3" style="background-color:#d8d7d7;height:15px;"></td></tr> + <tr style="height:100%;"> + <td class="textgray" colspan="3" style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;"> + <xsl:choose> + <xsl:when test="(pagetext/right_column)"> + <xsl:value-of disable-output-escaping="yes" select="pagetext/right_column"/> + </xsl:when> + <xsl:otherwise> + + </xsl:otherwise> + </xsl:choose> + </td> + </tr> + <tr> + <td colspan="3" style="height:30px;background-image:url('menu_cuts/right_bottom.png');"> + + </td> + </tr> + </table> + + </td> + </tr> + + </table> + </body> + </html> + + </xsl:template> +</xsl:stylesheet> diff --git a/src/server/httpd/menuweb.css b/src/server/httpd/menuweb.css new file mode 100644 index 0000000000000000000000000000000000000000..0a812a7a9b28b24668edde4e36e41ee85a271628 --- /dev/null +++ b/src/server/httpd/menuweb.css @@ -0,0 +1,132 @@ +a:link +{ + font-size: 12px; + color : #024d67; + font-weight:bold; + text-decoration : none; +} + +a:visited +{ + font-size: 12px; + color : #024d67; + font-weight:bold; + text-decoration : none; +} + +a:active +{ + font-size: 12px; + color : #024d67; + font-weight:bold; + text-decoration : none; +} + +a:hover +{ + font-size: 12px; + color : #555555; + font-weight:bold; + text-decoration : none; +} + +a.openocd:link +{ + font-size: 12px; + color : #555555; + font-weight:bold; + text-decoration : none; +} + +a.openocd:visited +{ + font-size: 12px; + color : #555555; + font-weight:bold; + text-decoration : none; +} + +a.openocd:active +{ + font-size: 12px; + color : #555555; + font-weight:bold; + text-decoration : none; +} + +a.openocd:hover +{ + font-size: 12px; + color : #024d67; + font-weight:bold; + text-decoration : none; +} + +body +{ + background-color : green; + background-color : #176e8c; + font-family : Arial; + font-size: 12px; + line-height: 15px; + color : #024d67; + +} + +h1 +{ + padding: 0px; + font-size: 18px; + font-weight:bold; + text-decoration : none; + margin-bottom: 8px; +} + +td +{ + padding: 0px; + font-size: 12px; + vertical-align:top; + +} + +.textlight +{ + color: #cccccc; + padding: 0px; + font-size: 12px; + vertical-align:top; + +} + +.fontbigger +{ + font-size:14px; +} + +.textgray +{ + color: #555555; +} + +.formtext +{ + padding-top: 4px; + font-size: 14px; + padding-right:10px; +} + +input +{ + font-size: 14px; +} + +.buttonspacelarge +{ + width:20px; +} + +.buttonspacesmall +{ + width:8px; +} diff --git a/src/server/httpd/openocd.tcl b/src/server/httpd/openocd.tcl new file mode 100644 index 0000000000000000000000000000000000000000..fe1d195dd18a738662e0635302acba67e65169a8 --- /dev/null +++ b/src/server/httpd/openocd.tcl @@ -0,0 +1,357 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="openocd.tcl" style="font-weight: bold;">Run Command</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="guiupload.tcl" style="">Upload File to ZY1000</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl" style="font-weight: bold;">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Run Command</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + } + + set form_command [formfetch form_command] + + set form_edittext "" + if {[string length $form_command]>0} { + catch {capture_catch {eval "$form_command"}} form_edittext + } + + append buffer {<form action="openocd.tcl" method="post">} "\n" + append buffer {Command<br>} + append buffer {<textarea style="overflow:auto;" rows="5" cols="65" name="form_command" wrap="off">} + append buffer [to_textarea $form_command] + append buffer {</textarea><br>} + append buffer {<input type="submit" value="Run" name="form_action" ><br>} + append buffer {<textarea style="overflow:auto;" rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">} + append buffer [to_textarea $form_edittext] + append buffer {</textarea><br>} + + append buffer {</form>} "\n" + + +append buffer { + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="openocd.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise + there will be no output, e.g. "reset init" use "ocd_reset init". + <p/> + <p><a href="/ram/log">Click here to download log</a>.</p> + <p>To download log you can also use commands like "wget http://} +append buffer [ip] +append buffer {/ram/log", or + point your web browser to said address.</p> + <p> + You can also execute tcl commands using curl from your developer PC: + </p> + <code> + curl --form form_command=ocd_version } +append buffer [ip] +append buffer {runtcl.tcl + </code> + + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/preconfig.tcl b/src/server/httpd/preconfig.tcl new file mode 100644 index 0000000000000000000000000000000000000000..eaa184217a54db2e38fc4cf74f98043d81053a97 --- /dev/null +++ b/src/server/httpd/preconfig.tcl @@ -0,0 +1,429 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>Zylin ZY1000 JTAG debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> +<img src="menu_cuts/logo_top.png" style="border:0px;"/> +</a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="index.tcl" style="">Target Status</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="preconfig.tcl" style="font-weight: bold;">Select Target Config</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="editconfigs.tcl" style="">Edit Configurations</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="reload.tcl" style="">Reload Config Scripts</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl" style="font-weight: bold;">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Select Preconfigured Target</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + } + + + set form_target [formfetch form_target] + set form_action [formfetch form_action] + + append buffer {<form enctype="multipart/form-data" action="preconfig.tcl" method="post">} + if {[string compare $form_action "Select and reload"]==0} { + capture_catch "trunc /config/settings/openocd.cfg" + capture_catch "append_file /config/settings/openocd.cfg script target/$form_target" + reboot + } + + set form_target [load_target] + + set files [ls /rom/target] + set files [lunion $files [ls /config/settings/target]] + set files [lsort $files] + + if {[string compare $form_action "Select and reload"]!=0} { + +append buffer { + <table><tr> + <td style="padding-top:1px;"> + <select name="form_target"> + } + + set foundTarget 0 + foreach i $files { + if {[string match *.cfg $i]} { + +append buffer { + <option + } + + if {[string compare $form_target $i]==0} { + set foundTarget 1 + append buffer {selected="selected"} + } +append buffer { + value="} +append buffer $i +append buffer {">} +append buffer $i +append buffer {</option> + } + + } + } + + if {$foundTarget==0} { + +append buffer { + <option selected="selected" value="">Preconfigured target not active</option> + } + + } + +append buffer { + </select> + </td> + <td class="buttonspacesmall"> </td> + <td> + <input type="submit" name="form_action" value="Select and reload"> + + + <a href="editconfigs.tcl?form_action=Load&form_selected=} +append buffer "target/$form_target" +append buffer {">Edit target configuration</a> + </td> + </tr></table> + } + + } else { + append buffer "Reloading setting(ca. 30 seconds)..." + } + +append buffer { + + </form> + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="preconfig.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>ZY1000 comes with complete configurations for various targets.</p> + <p>These predefined configurations include reset init scripts and flash configuration.</p> + <p><b>Select and reload</b> - Select configuration and reboot ZY1000 unit.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +<tr> +<td/> +<td> +<img border="0" src="menu_cuts/logo_bottom.png"/> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/production.tcl b/src/server/httpd/production.tcl new file mode 100644 index 0000000000000000000000000000000000000000..654c6311a3acc1040d0f8342b97bf5d8051c0aac --- /dev/null +++ b/src/server/httpd/production.tcl @@ -0,0 +1,394 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flashinfo.tcl" style="">Info</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="erase.tcl" style="">Erase</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flash.tcl" style="">Program / Verify</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="production.tcl" style="font-weight: bold;">Production</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Production</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + } + + set form_action [formfetch form_action] + set form_serialnumber [formfetch form_serialnumber] + append buffer [production_info] + +append buffer { + + <form enctype="multipart/form-data" action="production.tcl" method="post"> + <code style="white-space: nowrap;"> + } + + if {[string compare $form_action "Upload firmware"]==0} { + set wrotedata [catch {writeform form_filecontent $upload_filename} result] + append buffer [encode $result] + if {$wrotedata==0} { + append buffer "<br>Running production procedure<p>" + append buffer "<br>Reset and init: <br>" + + append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]] + } + } + if {[string compare $form_action "Test"]==0} { + append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>" + + append console [encode [capture_catch {catch production_test}]] + } + if {[string compare $form_action "Power on"]==0} { + append console [encode [capture_catch "power on"]] + } + if {[string compare $form_action "Power off"]==0} { + append console [encode [capture_catch "power off"]] + } + +append buffer { + </code> + } + + append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>} + append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>} + +append buffer { + + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <table><tr> + <td><input type="submit" name="form_action" value="Upload firmware" ></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Test"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Power on"></td> + <td class="buttonspacesmall"> </td><td><input type="submit" name="form_action" value="Power off"> + </tr></table> + </form> + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="production.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures + are used on this page. There are default implementations that do nothing. + + <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> + <p><b>Test</b> - Power up target, run 10 second target test. Output is provided via the DCC output channel. </p> + <p><b>Power on</b> - Power on target.</p> + <p><b>Power off</b> - Power off target.</p> + <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/readme.txt b/src/server/httpd/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..91ed625c1345d79bf2e211b5fcea5e0177af84b9 --- /dev/null +++ b/src/server/httpd/readme.txt @@ -0,0 +1,24 @@ +work in progress... stay tuned.... + + +1. To build .tcl pages. This will convert menu.xml and menu.xsl into +lots of .html pages w/embedded tcl, which are then inverted into +tcl with embedded html. + +sh build.sh + +xalan.jar can be gotten from apache.org. + + +2. libmicrohttpd is a bit tricky to build under Cygwin: + +https://gnunet.org/mantis/view.php?id=1440 + +3. To test: + +../openocd/configure --enable-httpd --enable-dummy --enable-ioutil +make +make install +openocd -c "interface dummy" -f target/at91eb40a.cfg + +4. Point browser to: http://localhost:8888 diff --git a/src/server/httpd/reload.tcl b/src/server/httpd/reload.tcl new file mode 100644 index 0000000000000000000000000000000000000000..07c9198381a0a5ebafc7431b525b6177abac8de2 --- /dev/null +++ b/src/server/httpd/reload.tcl @@ -0,0 +1,322 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="index.tcl" style="">Target Status</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl" style="font-weight: bold;">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Reload Config Scripts</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + } + + set form_action [formfetch form_action] + + if {[string compare $form_action "Reload"]==0} { + append buffer "Reloading Config Scripts...<p>" + reboot + } + +append buffer { + <form enctype="multipart/form-data" action="reload.tcl" method="post"> + <input type="submit" name="form_action" value="Reload"> + </form> + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="reload.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + Restart ZY1000 to reload selected target config script. + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/run.tcl b/src/server/httpd/run.tcl new file mode 100644 index 0000000000000000000000000000000000000000..1a00eb974a0534d3035ac117a72bf6bb63f993d2 --- /dev/null +++ b/src/server/httpd/run.tcl @@ -0,0 +1,384 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flashinfo.tcl" style="">Info</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="erase.tcl" style="">Erase</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="flash.tcl" style="">Program / Verify</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="production.tcl" style="">Production</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl" style="font-weight: bold;">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Run program</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + + +} + + +set form_address [formfetch form_address] +set form_action [formfetch form_action] + +if {[string compare $form_action "Run from address"]==0} { + append console [encode [capture_catch "halt"]] + append console [encode [capture_catch "wait_halt"]] + append console [encode [capture_catch "resume $form_address"]] +} + +if {[string compare $form_action "Halt"]==0} { + append console [encode [capture_catch "halt"]] + append console [encode [capture_catch "wait_halt"]] +} + +if {[string compare $form_action "Reset and run"]==0} { + append console [encode [capture_catch "reset run"]] +} + +if {[string compare $form_action "Reset and init"]==0} { + append console [encode [capture_catch "reset init"]] +} + +append console [encode [capture_catch poll]] + + +append buffer { + +<form action="run.tcl" method="post"> + <table> + <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="} +append buffer $form_address +append buffer {"></td></tr> + </td></tr> + </table> + <table> + <tr><td style="height:15px;width:535px;"> </td></tr> + <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr> + <tr><td style="height:15px;width:535px;"> </td></tr> + </table> + + <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> +</form> + + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="run.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + <p>Reset and run - reset CPU and let it run.</p> + <p>Halt - halt CPU.</p> + <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p> + <p>Reset and init - reset CPU and run init script.</p> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/support.tcl b/src/server/httpd/support.tcl new file mode 100644 index 0000000000000000000000000000000000000000..cf7a2b4464adfa77ef48d479c5a200ab5ccb2163 --- /dev/null +++ b/src/server/httpd/support.tcl @@ -0,0 +1,431 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>Zylin ZY1000 JTAG debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="/ram/cgi/zylweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> +<img src="/rom/menu_cuts/logo_top.png" style="border:0px;"/> +</a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('/rom/menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture zy1000_version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="zy1000.tcl" style="">Set IP Address</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="upgrade.tcl" style="">ZY1000 Firmware</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="editfile.tcl" style="">Edit File</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="support.tcl" style="font-weight: bold;">Support Request</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('/rom/menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="log.tcl#tail" style="">View Tail of Log</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('/rom/menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('/rom/menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('/rom/menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/openocd.tcl">OpenOCD</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/zy1000.tcl" style="font-weight: bold;">Setup ZY1000</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<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"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Submit Support Request</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + Before contacting Zylin, please submit a support request with relevant information. + } + + + set form_config [load_config "target/[load_target]"] + set support_id [string range [rand] 0 7] + set form_log "" + append form_log "Version: [capture "zy1000_version zy1000"]" + append form_log "OpenOCD version: [capture "zy1000_version openocd"]" + append form_log "Version date: [capture "zy1000_version date"]" + append form_log [log] + +append buffer { + + <form action="supportrequest.tcl" method="POST" target="_blank"> + <input TYPE="hidden" NAME="id" VALUE="} +append buffer $support_id +append buffer {"> + <input TYPE="hidden" NAME="success" VALUE="http://www.zylin.com/zy1000_support.html"> + <input size="50" name="subject" type="hidden" value="ZY1000 support request"> + <table cellspacing="5"> + <tr><td>Support ID</td><td>} +append buffer $support_id +append buffer {</td></tr> + <tr><td>Contact person</td><td><input size="50" name="name" type="text"></td></tr> + <tr><td>Phone</td><td><input size="50" name="phone" type="text"></td></tr> + <tr><td>email</td><td><input size="50" name="email" type="text"></td></tr> + <tr><td>MAC address</td><td><input size="50" name="serial" type="text" value="} +append buffer [mac] +append buffer {"></td></tr> + </td></tr> + </table> + <p> + Summary: + <p> + <input name="summary" size="50"> + <p> + Description: + <p> + <textarea style="overflow:auto;font-size:11px;" name="description" cols="50" rows="4" type="textarea" wrap="off"></textarea> + + <p> + Log:<p> + <textarea style="overflow:auto;font-size:11px;" name="log" cols="50" rows="5" type="textarea" wrap="off">} +append buffer $form_log +append buffer {</textarea> + <p> + Config:<p> + <textarea style="overflow:auto;font-size:11px;" name="config" cols="50" rows="5" type="textarea" wrap="off">} +append buffer $form_config +append buffer {</textarea> + <p> + </form> + <p> + <input value="Creates support request" type="submit"/></td></tr> + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="/ram/cgi/support.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('/rom/menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('/rom/menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('/rom/menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Before contacting Zylin with questions, please fill in and submit this form + and allow us time to review the information and answer by email if possible. + <p/> + Note that you can see precisely what information is submitted to Zylin in the + form: the log and your config files. + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('/rom/menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +<tr> +<td/> +<td> +<img border="0" src="/rom/menu_cuts/logo_bottom.png"/> +</td> +<td style="padding-top:10px;padding-left:10px;margin-top:10px;" class="textlight"> + Zylin AS, Auglendsdalen 78, N-4017 Stavanger, Norway - www.zylin.com + </td> +</tr> +</table> +</body> +</html> + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/targets.tcl b/src/server/httpd/targets.tcl new file mode 100644 index 0000000000000000000000000000000000000000..3df16367f2c84445877ec43cf25a33c2dcb09171 --- /dev/null +++ b/src/server/httpd/targets.tcl @@ -0,0 +1,562 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Target config quick start guide</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + A target needs an openocd.cfg file. This config file sets up + the CPU, flash and reset init script. Either ZY1000 ships with an + openocd.cfg file for your target or you need to take an existing + config file and modify it for your needs. + <p> + The reset init script is crucial. It will set up e.g. MMU, chip + select registers, etc. after a reset. The init.cfg (reset init script) + is embedded into the openocd.cfg file in the sampls Zylin provides. + <p> + Writing an openocd.cfg from scratch is a non-trivial exercise, but + fortunally it only has to be done once for a target and afterwards it + rarely if ever needs to be changed. + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="targets.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Quick start guide on how to configure a target. + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Target config quick start guide</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + A target needs an openocd.cfg file. This config file sets up + the CPU, flash and reset init script. Either ZY1000 ships with an + openocd.cfg file for your target or you need to take an existing + config file and modify it for your needs. + <p> + The reset init script is crucial. It will set up e.g. MMU, chip + select registers, etc. after a reset. The init.cfg (reset init script) + is embedded into the openocd.cfg file in the sampls Zylin provides. + <p> + Writing an openocd.cfg from scratch is a non-trivial exercise, but + fortunally it only has to be done once for a target and afterwards it + rarely if ever needs to be changed. + + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="targets.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Quick start guide on how to configure a target. + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/terminal.tcl b/src/server/httpd/terminal.tcl new file mode 100644 index 0000000000000000000000000000000000000000..707ddd0fffcc69c7ca854ed069212a397e7bf499 --- /dev/null +++ b/src/server/httpd/terminal.tcl @@ -0,0 +1,366 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>OpenOCD debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> + OpenOCD + </a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="index.tcl" style="">Target Status</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="index.tcl" style="font-weight: bold;">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="openocd.tcl">OpenOCD</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>UART forwarding</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + } + + set form_baudrate [formfetch form_baudrate] + if {[string length $form_baudrate]==0} { + set form_baudrate [ocd_uart] + set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]] + } + set form_action [formfetch form_action] + +append buffer { + <form action="terminal.tcl" method="post"> + Target baudrate: + <select name="form_baudrate"> + } + + foreach i {9600 19200 38400 57600 115200} { + +append buffer { + <option } +if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} } +append buffer { + value ="} +append buffer $i +append buffer {">} +append buffer $i +append buffer {</option> + } + + } + +append buffer { + </select> + + <p> + <input type="submit" name="form_action" value="Set baudrate" > + </form> + } + + if {[string compare $form_action "Set baudrate"]==0} { + append console [encode [ocd_uart $form_baudrate]] + } + +append buffer { + + <h2>Simple UART</h2> + This terminal window is purely for illustrative purposes. Use telnet or a terminal program + to talk to the target over TCP/IP for anything but trivial case of reading/writing a few + lines of texts in simple tests. + <p> + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="terminal.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a> +<br/> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Serial port data to target is forwarded(both directions) in the simple terminal window + to the left. Alternatively you can <b>telnet } +append buffer [ip] +append buffer { 5555</b> + or connect via TCP/IP from e.g. HyperTerminal. + <p> + Type "help uart" in telnet for information on how to set uart speed for target. Normally + the uart speed is set from the target configuration script by adding an "uart N", where + N is the baudrate. + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +</table> +</body> +</html> + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + diff --git a/src/server/httpd/upgrade.tcl b/src/server/httpd/upgrade.tcl new file mode 100644 index 0000000000000000000000000000000000000000..c09cc8c18464ac857abedcb6d3f73cb2a7a5742f --- /dev/null +++ b/src/server/httpd/upgrade.tcl @@ -0,0 +1,418 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <html xmlns="http://www.w3.org/TR/REC-html40"> +<head> +<title>Zylin ZY1000 JTAG debugger</title> +<meta charset="utf-8" content="text/html" http-equiv="Content-Type"/> +<link type="text/css" rel="stylesheet" href="menuweb.css"/> +</head> +} + + set console "" + set upload_filename /ram/upload + +append buffer { +<body style="margin:0px;"> +<div style="width:974px;height:85px;"> +<div style="float:left;position:relative;left:32px;width:478px;"> +<a href="/"> +<img src="menu_cuts/logo_top.png" style="border:0px;"/> +</a> +</div> +<div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');"> +<div style="position:relative;left:15px;top:4px;" class="textlight"> +} +append buffer [capture version] +append buffer { +</div> +</div> +</div> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:33px;"> +<div style="width:20px;height:510px;"> + + </div> +</td> +<td style="vertical-align:top;height:100%;width:140px;padding:0px;"> +<table style="padding:0px;border-collapse:collapse;height:100%;width:140px;"> +<tr style="height:59px;"> +<td/> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="zy1000.tcl" style="">Set IP Address</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="upgrade.tcl" style="font-weight: bold;">ZY1000 Firmware</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="editfile.tcl" style="">Edit File</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="support.tcl" style="">Support Request</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;"> +<div style="position:relative;left:10px;top:10px;font-weight:bold;"> +<a href="log.tcl#tail" style="">View Tail of Log</a> +</div> +</td> +</tr> +<tr> +<td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/> +</tr> +<tr> +<td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/> +</tr> +<tr> +<td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/> +</tr> +</table> +</td> +<td style="vertical-align:top;padding:0px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td> +<table style="padding:0px;border-collapse:collapse;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/index.tcl">Config Target</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/flashinfo.tcl">Flash</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/browsemem.tcl">Memory</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/openocd.tcl">OpenOCD</a> +</div> +</td> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;"> +<a href="/ram/cgi/zy1000.tcl" style="font-weight: bold;">Setup ZY1000</a> +</div> +</td> +</tr> +</table> +</td> +</tr> +<tr> +<td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +<tr> +<td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6"> +<H1>Upgrade ZY1000 Firmware</H1> +</td> +</tr> +<tr style="height:100%;"> +<td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6"> + + } + + set form_action [formfetch form_action]; + set form_filecontent [formfetch form_filecontent]; + + append buffer {<form enctype="multipart/form-data" action="upgrade.tcl" method="post">} + if {[string compare $form_action "Upload"]==0} { + + if [string match ZylinPhiFirmware* $form_filecontent]==1 { + set form_filename /config/firmware.phi + puts "Writing firmware to $form_filename" + set fp [aio.open $form_filename w]; + $fp puts -nonewline $form_filecontent + $fp close + puts "Done writing firmware to $form_filename" + append buffer "<br><div style='font-size:14px;'>Upgraded Zylin JTAG, rebooting (wait ca. 30 seconds)...</div><br>" + reboot + } else { + append buffer "<br>Not a valid Zylin JTAG firmware file.<br>" + } + } elseif {[string compare $form_action "Restore factory settings"]==0} { + proc rmdir { dir } { + set entries {} + catch {set entries [ls $dir]} err + foreach { entry } $entries { + rmdir $dir/$entry + rm $dir/$entry + } + } + rmdir /config/settings + reboot + append buffer "Restoring factory settings (wait ca. 30 seconds)...<br>" + } else { + append buffer {<div style="font-size:14px;">Upgrade Zylin JTAG firmware + reboot. </div><p>} + append buffer {<input type="file" name="form_filecontent"> <br>} + append buffer {<table><tr><td style="height:15px;width:535px;"> </td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;"> </td></tr></table>} + append buffer {<input type="submit" name="form_action" value="Upload" ><br> } + append buffer {<input type="submit" name="form_action" value="Restore factory settings" ><br> } + append buffer {</form> } + } + +append buffer { + + </td> +</tr> +} + + + set toggle_details [formfetch toggle_details] + if {[string length $toggle_details]==0} { + set toggle_details 0 + } + set show_details [load_var show_details] + if {[string length $show_details]==0} { + set show_details 0 + } + if {$toggle_details==1} { + set show_details [expr 1-$show_details] + save_var show_details $show_details + } + + if {[string length $console]!=0} { + +append buffer { +<tr style="height:100%;"> +<td style="height:100%;background-color:red;" colspan="6"> +<table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray"> +<td style="width:25px;"> </td> +} + + if {$show_details==1} { + append buffer < + append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"} + append buffer > + } else { + append buffer < + 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;"} + append buffer > + } + +append buffer { +<a class="openocd" href="/ram/cgi/upgrade.tcl?toggle_details=1"> +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer <br/> + } else { + append buffer {<div style="position:relative;top:7px;text-align:center;">} + append buffer "Show details" + append buffer {</div>} + } + +append buffer { +</a> +} + + if {$show_details==1} { + append buffer $console + } + +append buffer {</td>} + + if {$show_details!=1} { + append buffer {<td> </td>} + } + +append buffer { +<td style="width:25px;"> </td> +</table> +</td> +</tr> +} + + } + +append buffer { +<tr> +<td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6"> +<div style="width:500px;background-color:#ffffff;height:100%;"> + + </div> +</td> +</tr> +</table> +</td> +<td style="width:6px;"/> +<td style="width:245px;height:100%"> +<table style="padding:0px;border-collapse:collapse;height:100%;"> +<tr> +<td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;"> +<div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray"> + Documentation + </div> +</td> +<td width="40px"> + + </td> +<td/> +</tr> +<tr> +<td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/> +</tr> +<tr> +<td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3"> +<a target="_blank" href="http://www.zylin.com/zy1000/ZY1000_Quick_Start_Guide.pdf">Quick Start Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000/openocd.pdf">OpenOCD Manual</a> +<br/> +<a target="_blank" href="http://www.zylin.com/zy1000_contact.html">Contact Zylin AS</a> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr> +<td colspan="3"> +<table style="padding:0px;border-collapse:collapse;"> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +<td style="background-color:#999999;width:225px; height:1px;"/> +<td style="background-color:#d8d7d7;width:10px;height:1px"/> +</table> +</td> +</tr> +<tr> +<td style="background-color:#d8d7d7;height:15px;" colspan="3"/> +</tr> +<tr style="height:100%;"> +<td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray"> + + Upload new firmware file to ZY1000, verify that it is a valid ZY1000 firmware + file, and upgrade flash. + <p/> + Restore factory settings restores all factory settings except the TCP/IP settings. + <p/> + The current version of the firmware is visible at the top of the web page. + <p/> + ZY1000 firmware can also be upgraded using serial port YModem upload. + <p/> + Check for new firmware at <a target="_blank" href="http://www.zylin.com/zy1000.html">http://www.zylin.com/zy1000.html<a> + + </td> +</tr> +<tr> +<td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3"> + + </td> +</tr> +</table> +</td> +</tr> +<tr> +<td/> +<td> +<img border="0" src="menu_cuts/logo_bottom.png"/> +</td> +</tr> +</table> +</body> +</html> + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked +