From 6d3c1cd9728981919f2ff1bc1f48b2bbbcbc5224 Mon Sep 17 00:00:00 2001 From: oharboe Date: Mon, 22 Dec 2008 15:02:09 +0000 Subject: [PATCH] httpd wip git-svn-id: svn://svn.berlios.de/openocd/trunk@1268 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/jim.c | 2 +- src/server/Makefile.am | 7 + src/server/httpd.c | 160 ++--- src/server/httpd/Stylizer.class | Bin 0 -> 4493 bytes src/server/httpd/Stylizer.java | 114 ++++ src/server/httpd/browsemem.tcl | 456 +++++++++++++ src/server/httpd/build.sh | 3 + src/server/httpd/downloadmem.tcl | 368 +++++++++++ src/server/httpd/editconfigs.tcl | 462 +++++++++++++ src/server/httpd/editfile.tcl | 436 +++++++++++++ src/server/httpd/erase.tcl | 389 +++++++++++ src/server/httpd/flash.tcl | 461 +++++++++++++ src/server/httpd/flashinfo.tcl | 384 +++++++++++ src/server/httpd/guiupload.tcl | 374 +++++++++++ src/server/httpd/html2tcl.sh | 128 ++++ src/server/httpd/httpd.tcl | 108 ++++ src/server/httpd/index.tcl | 381 +++++++++++ src/server/httpd/log.tcl | 343 ++++++++++ src/server/httpd/menu.xml | 1038 ++++++++++++++++++++++++++++++ src/server/httpd/menu.xsl | 298 +++++++++ src/server/httpd/menuweb.css | 132 ++++ src/server/httpd/openocd.tcl | 357 ++++++++++ src/server/httpd/preconfig.tcl | 429 ++++++++++++ src/server/httpd/production.tcl | 394 ++++++++++++ src/server/httpd/readme.txt | 24 + src/server/httpd/reload.tcl | 322 +++++++++ src/server/httpd/run.tcl | 384 +++++++++++ src/server/httpd/support.tcl | 431 +++++++++++++ src/server/httpd/targets.tcl | 562 ++++++++++++++++ src/server/httpd/terminal.tcl | 366 +++++++++++ src/server/httpd/upgrade.tcl | 418 ++++++++++++ 31 files changed, 9658 insertions(+), 73 deletions(-) create mode 100644 src/server/httpd/Stylizer.class create mode 100644 src/server/httpd/Stylizer.java create mode 100644 src/server/httpd/browsemem.tcl create mode 100644 src/server/httpd/build.sh create mode 100644 src/server/httpd/downloadmem.tcl create mode 100644 src/server/httpd/editconfigs.tcl create mode 100644 src/server/httpd/editfile.tcl create mode 100644 src/server/httpd/erase.tcl create mode 100644 src/server/httpd/flash.tcl create mode 100644 src/server/httpd/flashinfo.tcl create mode 100644 src/server/httpd/guiupload.tcl create mode 100644 src/server/httpd/html2tcl.sh create mode 100644 src/server/httpd/httpd.tcl create mode 100644 src/server/httpd/index.tcl create mode 100644 src/server/httpd/log.tcl create mode 100644 src/server/httpd/menu.xml create mode 100644 src/server/httpd/menu.xsl create mode 100644 src/server/httpd/menuweb.css create mode 100644 src/server/httpd/openocd.tcl create mode 100644 src/server/httpd/preconfig.tcl create mode 100644 src/server/httpd/production.tcl create mode 100644 src/server/httpd/readme.txt create mode 100644 src/server/httpd/reload.tcl create mode 100644 src/server/httpd/run.tcl create mode 100644 src/server/httpd/support.tcl create mode 100644 src/server/httpd/targets.tcl create mode 100644 src/server/httpd/terminal.tcl create mode 100644 src/server/httpd/upgrade.tcl diff --git a/src/helper/jim.c b/src/helper/jim.c index 800db23406..f4336ae244 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 0e3a3a4790..89b5e36423 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 96e338244b..348a081b63 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 GIT binary patch literal 4493 zcmbVQYj_k_8GcW)$!sQ*kOl%>l(JY0NeEdWw6q%pDHM$4)+9tCZQ99ZvKiQ$GqcIk zs;Hn=i?%z>J%**gC(v+2pVC7yJrND{jU6!}4lj%+Bk8!2;N!~f zq!kTKcSJ(t$#`gQcE3}gdWV@Xot*-e%`L+MzCFotLq#QOH7M{4EbBHCMsGSkW>`b| zSj-S;>`q4X*syMy@;$rhb0$q&K<&<9B5PkrSgoBcMFef-@(<+8NX&6p0 z6OT=pF(a5vJE^oYZdxi{hBXRaF0kB%RLWJubyzE)q@zIaSvSJf&#skV zw`kak4tkX0b0Lw%Cvd~npy*U_BepBJNnqWQI%~KYw+K|ZCJ|VlH7?*D578P3 zbZV$VwI8pdOQwx6+jI;!($jQ5EgYp@yRciqs|5lw&h?ZYnKVL~l41pTLUZ1j}*P@EUY6JP0^0 z!>OxONmrJN1L#rEO^Xyv=vaEfo=95p&`|EFBxrgCT1y;sC4x=`{Q?`xakt%c3VB&I zm`qy{+OiJ=GDZdku379O2KfOT)G&ELn*iWo4MN63}g zDzi4^7#XLzMY{H|hC6U4D~0E~K}LGakj4|Z`Tz7DZE}~uDv8J|nqFbbhQA*=vvQA{ zOm1GO7)7WS^jlY5DOeX@kL_ijU$k1s@Z* zaS8h|JtoX(nnq{4xh)ehQu0B=$7NWmgw$i$vO!CZPiXiAKItV${wnjYBteEIt>m;E zDj49O#*+$Wa(&tzYx2h$KI4uiZl7lBiyWm|5yOwqF>Xt=bfI|)s`!G`>x(7bIq$dP zGMmRINuE$~2G1xsOV%=1WKXx*+Xr_a%HNZ^J-b+${3(^0mCDSOD3d={aZa9|7icfo zJ2y2jE;&7vH?)c`OTw?@*fLkU`toeqbaX4qL|$HI`r?c;;SC^cBSj&Z6T4^_$OZ~W zI<+udG4Z@q&-HIPZ|aUNOE>wCd2^1y^-J@YvtrEc#ie6vu8Z*In-wVq0D>k}y7qwLGOBr(t*hD-;r76m@ z3WuzVqpP6ZP+_LY2P`Qn?F>m)yS^=#XS`A@tb{Zr71>;*NG_JIltNObnIvK1BcmvV zc&d6mQ_iOXb-7OrH&L;UgJ~r{$LLl$o${%I&-`fOZw=oxJsau)kvF#az&m!EoV;(!hRh2hY&)~^GRa5mj?5#jpna69x z{sr`nw9Vo6a81A;sF}r3SPdwRhvxD6a4iKbV05JM?m3JFYR@4eSj@~>#9iU35%Qjc z71kDz9&r&=ZOvYr!}J{P3D+&)-jP7v9NrYJ52%fA$uoIdKn-Yt`dQpJgSzmtK;0}( z1(rSMt|zNSQ+1%~96liM_rQPeVBmSX7Q0cnzmlPKK=sya_Ob& zpPIp)F4<=5HO;mm*ZW!C<@zA2bp;&`yo3(^t|9$eIzEU-eo3z6*VuK~fEIoaZsTtl zt=Pjss|W2E#AZ&69f4B(HSeHhe$Bs^Y-B?H2ERomHSQp; r-*ay)zc)oc`~iRDUdG+~6YrfO#y{gP+&j&uztXxg!~aeVD{$$5;$<07 literal 0 HcmV?d00001 diff --git a/src/server/httpd/Stylizer.java b/src/server/httpd/Stylizer.java new file mode 100644 index 0000000000..3b8bee3ea5 --- /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 + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Browse / Edit Memory

+
+ + + + } + + + 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 { + +
+ + + + + + + +
Address
Length
Value  
Type + + +
+ + + + +
 
 
+ + + + + +
  
+
+ +
+

+

Memory:

+ + } + + 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 { + + + + + + +

+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Browse and edit target memory.
+ Length is in bytes, maximum 4096 bytes.

+

An error message is shown when trying to browse or edit memory which cases a CPU fault.

+

CPU will be halted if required.

+

Modify - Will modify only one byte, half-word or word starting at Address.

+

Fill - Will fill the specified region with the specified value.

+

Refresh - Display the content of the specified memory area.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..93831a50e1 --- /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 0000000000..035ff3d95e --- /dev/null +++ b/src/server/httpd/downloadmem.tcl @@ -0,0 +1,368 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Download Memory Range

+
+ } + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_action [formfetch form_action] + +append buffer { +
+ + + + +
Address
Length
+ + + + + +
 
 
+ + + + +
+ } + + 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 { +
+ +
+ } + + } + + +append buffer { + + + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ + Download memory to ZY1000 from target.
+ Note that download memory can take + a long time(potentially minutes for megabytes at low JTAG clk speeds). +

+ Once the memory is downloaded a link is available on the page to download + the file from ZY1000 to your PC. + +

+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..13e3910628 --- /dev/null +++ b/src/server/httpd/editconfigs.tcl @@ -0,0 +1,462 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + +Zylin ZY1000 JTAG debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+
+ + + +
+
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Edit Target Configurations

+
+
+ } + + 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
" + } + + 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 { + + + + + + + + +
   
+ + + } + + append buffer {\n" + append buffer {
} "\n" + append buffer {
File 
} "\n" + +append buffer { +
+
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+Quick Start Manual +
+OpenOCD Manual +
+Contact Zylin AS +
+
+ +
+ + +
+
+
+ +

Here you can edit predefined target configurations, restore predefined configurations to + default state and create new target configurations.

+

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.

+

Load - Loads a configuration file into the editor.

+

Show default - Loads the firmware included version of the + configuration file (if any), into the editor.
+ Note that the editor content is not saved.

+

Delete - Deletes a custom created configuration file.
+ Note that firmware included configuration files can not be deleted.

+

Save - Save the edited file under the a new or the same name.

+ +
+   +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..8838e69f76 --- /dev/null +++ b/src/server/httpd/editfile.tcl @@ -0,0 +1,436 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zylin ZY1000 JTAG debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+
+ + + +
+
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ + + +
+
+
+   +
+
+

Edit File

+
+} + + + +#Read a text file, edit it and write it back. Useful for interactive debugging +#of tcl scripts + +set data "" +append buffer {
} "\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
" + } err]} { + append buffer "Could not write $form_filename
" + } +} + + + + +append buffer {\n" +append buffer {} "\n" +append buffer {
File   
} "\n" +append buffer {
} + +append buffer {
} + +append buffer { } "\n" + + + +append buffer { + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+Quick Start Manual +
+OpenOCD Manual +
+Contact Zylin AS +
+
+ +
+ + +
+
+
+ + Edit any file on the ZY1000 by typing in the + filename and pressing Load. +

+ + +
Browse files on /ram
+ Browse files on /config
+ Browse files on /rom
+ +
+   +
+
+ + +
+ + + + + + + + + + + + + + + + + + + +} + +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 0000000000..b48197f150 --- /dev/null +++ b/src/server/httpd/erase.tcl @@ -0,0 +1,389 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+Info +
+
+
+Erase +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Erase Flash

+
+ + + + } + + + 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 "" + append console [encode [capture_catch { + reset init + flash erase_address $form_address $form_length}]] + append buffer + } + } + + + +append buffer { + + + + + + +
Address
Length
+ + + + +
 
 
+ +
+ + + + + + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Note that flash programming will erase flash if required.

+

Reset and init CPU, then erase address range.

+

The length field is specified in number of bytes.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..f7c8547b81 --- /dev/null +++ b/src/server/httpd/flash.tcl @@ -0,0 +1,461 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+Info +
+
+
+Erase +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Program / Verify Flash

+
+ + } + + + 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 {} + + + set data "" + append buffer {
} + + 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 { + } + + + append buffer {} + append buffer {} + append buffer "" + + +append buffer { + + + + + +
File
Offset
Type + +
+ + + + + +
 
 
+ + + + + +
+ +

+ } + + + if {$action_flash||$action_verify} { + catch {writeform form_filecontent $upload_filename} result + append console [encode $result] + } + append buffer "
" + if {$action_flash} { + append console [encode [capture_catch "halt"]] + append buffer "" + if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} { + append buffer "Flash write failed
" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Flash write succeed
" + } + append buffer "
" + } + if {$action_verify} { + append console [encode [capture_catch "halt"]] + append buffer "" + if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} { + append buffer "Verify failed
" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Verify succeed
" + } + append buffer "
" + } + +append buffer { + +

+ +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Program and/or verify the flash on your target.

+

Flash - Halt CPU, automatically erase flash if required and program flash with image.

+

Flash and verify - Programs the flash and verifies the programmed flash content is correct.

+

Verify - Halt CPU and verify image in flash or RAM.

+

Offset - This value is added to the address of the image.
+ Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.
+ Typically 0 for elf/ihex and the address to write the image to for binary files.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..595c449d41 --- /dev/null +++ b/src/server/httpd/flashinfo.tcl @@ -0,0 +1,384 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+Info +
+
+
+Erase +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Flash Information

+
+ +
Configured flash banks:
+

+ + } + + 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 { +

+

+ + + } + + foreach a [ocd_flash_banks] { + append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: " + +append buffer { +
+ + + + +
+
+ } + + } + +append buffer { +
+ + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Here you will find information about the flash chips that you have + in your configuration.

+

Reset CPU and probe flash - 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.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..9b02c2aceb --- /dev/null +++ b/src/server/httpd/guiupload.tcl @@ -0,0 +1,374 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Upload File to ZY1000

+
+ + } + + set form_filename [formfetch form_filename]; + set form_action [formfetch form_action]; + #set form_filecontent [formfetch form_filecontent]; + + append buffer {
} + append buffer
+ 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 {} + append buffer {
Filename on ZY1000
File to upload
} + append buffer {
 
 
} + append buffer {
} + append buffer {
} + + +append buffer { + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing + embedded into the firmware.

+ +

Use "/ram" to store temporary files.

+ +

+ You can browse filing systems and download files by pointing your web browser to: +

+

+ +

+ You can also upload files using e.g. curl from the command line. Example: +

+ + curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf } +append buffer [ip] +append buffer {upload.tcl + +

+ 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. +

+ + cp /tftp/10.0.0.106/build/src/openocd /ram/test + + + +
+   +
+
+ + + + + + + + + + + + + + + + + +} + +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 0000000000..3eb5c3939d --- /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 +# +#####DESCRIPTIONEND#### +#=============================================================================== + +if { $argc != 2 } { + puts "Usage: html2tcl.tcl " + 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* $data $pos] + if $start==-1 { + # We're done... + set done 1 + set start [string length $data] + set end $start + } else { + set end [string first $data $start] + if $end==-1 { + # uh-oh, not closed + puts " 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 0000000000..b579411456 --- /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
{ } { } \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
{ } { } \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 0000000000..91e7e3fb96 --- /dev/null +++ b/src/server/httpd/index.tcl @@ -0,0 +1,381 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + +
+
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

OpenOCD debugger

+
+ + + + + + +
 
 
+ +

Target Status

+ + + + + +
+ } + + 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 { +
+ +
+ + + + + + +
+ +
+
+ +

+

+
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Target status shows that status of the connected target.

+

Current target - selected target configuration.
+

Startup - 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.
+

Target power - Detects power on target.
+ If the JTAG cable is not connected, or the target has no power, then no target power will be detected.

+

Power on - Turn on ZY1000 target power relay.

+

Power off - Turn off ZY1000 target power relay.

+

Type "help power" in telnet for command to control power relay.

+

Reboot ZY1000 - Reboots ZY1000 unit. Type "help reboot" in telnet.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..c5794512bd --- /dev/null +++ b/src/server/httpd/log.tcl @@ -0,0 +1,343 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zylin ZY1000 JTAG debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+
+ + + +
+
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

View Tail of Log

+
+ } + + append buffer "" + append buffer [encode [log]] + append buffer {

} + append buffer {Refresh} + append buffer {

} + append buffer ""; + +append buffer { + +

+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+Quick Start Manual +
+OpenOCD Manual +
+Contact Zylin AS +
+
+ +
+ + +
+
+
+
+   +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..cf286e235b --- /dev/null +++ b/src/server/httpd/menu.xml @@ -0,0 +1,1038 @@ + + + + + + + + index.tcl + Config Target + index.tcl + OpenOCD debugger + index.tcl + + + + + + +   + +   + + +

Target Status

+ + + + + +
+ + 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 console [encode [capture_catch poll]] +
+ +
+ + + + + + +
+ +
+
+ +

+

+ ]]>
+ + Target status shows that status of the connected target.

+

Current target - selected target configuration.
+

Startup - 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.
+

Target power - Detects power on target.
+ If the JTAG cable is not connected, or the target has no power, then no target power will be detected.

+

Power on - Turn on ZY1000 target power relay.

+

Power off - Turn off ZY1000 target power relay.

+

Type "help power" in telnet for command to control power relay.

+

Reboot ZY1000 - Reboots ZY1000 unit. Type "help reboot" in telnet.

+ ]]>
+
+ +
+
+ + + + + + targets.tcl + documentation.tcl + Target config quick start guide + + + 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. +

+ 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. + + + ]]> + + + Quick start guide on how to configure a target. + + + + + + + + + + reload.tcl + index.tcl + Reload Config Scripts + + + set form_action [formfetch form_action] + + if {[string compare $form_action "Reload"]==0} { + append buffer "Reloading Config Scripts...

" + reboot + } + +

+ +
+ + ]]>
+ + Restart ZY1000 to reload selected target config script. + +
+ +
+ + + + flashinfo.tcl + Flash + flashinfo.tcl + Flash Information + flashinfo.tcl + + + + + + + + + + + Configured flash banks: +

+ + + 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." + } + +

+

+ + + + foreach a [ocd_flash_banks] { + append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: " + +
+ "> + "> + + +
+
+ + } + +
+ + + ]]>
+ + Here you will find information about the flash chips that you have + in your configuration.

+

Reset CPU and probe flash - 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.

+ ]]> +
+ +
+
+ + + flash.tcl + flashinfo.tcl + Program / Verify Flash + + + + 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 "" + } + +
+ + set data "" + append buffer {
} + + 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 {} + append buffer {} + append buffer "" + + + + + + + +
File
Offset
Type + +
+ + + + + +
 
 
+ + + + + +
+ +

+ + + if {$action_flash||$action_verify} { + catch {writeform form_filecontent $upload_filename} result + append console [encode $result] + } + append buffer "
" + if {$action_flash} { + append console [encode [capture_catch "halt"]] + append buffer "" + if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} { + append buffer "Flash write failed
" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Flash write succeed
" + } + append buffer "
" + } + if {$action_verify} { + append console [encode [capture_catch "halt"]] + append buffer "" + if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} { + append buffer "Verify failed
" + append console [encode $result] + } else { + append buffer [encode $result] + append buffer "Verify succeed
" + } + append buffer "
" + } +
+ +

+ + ]]> + + + Program and/or verify the flash on your target.

+

Flash - Halt CPU, automatically erase flash if required and program flash with image.

+

Flash and verify - Programs the flash and verifies the programmed flash content is correct.

+

Verify - Halt CPU and verify image in flash or RAM.

+

Offset - This value is added to the address of the image.
+ Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.
+ Typically 0 for elf/ihex and the address to write the image to for binary files.

+ ]]> +
+ + + + + + + + + + + production.tcl + flashinfo.tcl + Production + + + set form_action [formfetch form_action] + set form_serialnumber [formfetch form_serialnumber] + append buffer [production_info] +
+ +
+ + + 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 "
Running production procedure

" + append buffer "
Reset and init:
" + + append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]] + } + } + if {[string compare $form_action "Test"]==0} { + append buffer "
Running production test. Output from first 10 seconds printed below.

" + + 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 {

Firmware file(raw binary)

} + append buffer {

Serial number

} + + + + + + +
 
 
+ + + + + +
    +
+

+ + ]]> + + + Upload firmware - Power cycle target, reset target and program raw binary file to flash bank 0, offset 0 and verify flash programming. Leave target powered on.

+

Test - Power up target, run 10 second target test. Output is provided via the DCC output channel.

+

Power on - Power on target.

+

Power off - Power off target.

+

Serial number - A target script can use this string in the production procedure. Type "help production" for more info.

+ ]]> +
+ + + + + + + + + + erase.tcl + erase.tcl + Erase Flash + flashinfo.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 "" + append console [encode [capture_catch { + reset init + flash erase_address $form_address $form_length}]] + append buffer + } + } + + + + +
+ + + + +
Address
Length
+ + + + +
 
 
+ +
+ + +
+ + + + ]]>
+ + Note that flash programming will erase flash if required.

+

Reset and init CPU, then erase address range.

+

The length field is specified in number of bytes.

+ ]]> +
+ +
+
+ + + + run.tcl + run.tcl + Run program + flashinfo.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]] + + + +
+ + + +
Address
+ + + + +
 
 
+ +
+
+ + + + ]]>
+ + Reset and run - reset CPU and let it run.

+

Halt - halt CPU.

+

Run from address - halt CPU and resume from address. Default is resume from current address.

+

Reset and init - reset CPU and run init script.

+ ]]> +
+ +
+
+ + + + browsemem.tcl + Memory + browsemem.tcl + Browse / Edit Memory + browsemem.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"] + } + } + + + + +
+ + + + + + + +
Address
Length">
Value  
Type + + +
+ + + + +
 
 
+ + + + + +
  
+
+ +
+

+

Memory:

+ + + if {[string compare $form_address ""]!=0} { + append console [encode [capture_catch halt]] + append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]] + } + + + + + + + + ]]> + + Browse and edit target memory.
+ Length is in bytes, maximum 4096 bytes.

+

An error message is shown when trying to browse or edit memory which cases a CPU fault.

+

CPU will be halted if required.

+

Modify - Will modify only one byte, half-word or word starting at Address.

+

Fill - Will fill the specified region with the specified value.

+

Refresh - Display the content of the specified memory area.

+ ]]> + + +
+
+ + + + + + downloadmem.tcl + browsemem.tcl + Download Memory Range + + + set form_address [formfetch form_address] + set form_length [formfetch form_length] + set form_action [formfetch form_action] + +
+ + + + +
Address
Length
+ + + + + +
 
 
+ + + + +
+ + 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"]] + +
+ +
+ + } + + + + + + ]]>
+ + + Note that download memory can take + a long time(potentially minutes for megabytes at low JTAG clk speeds). +

+ Once the memory is downloaded a link is available on the page to download + the file from ZY1000 to your PC. + ]]> + + + + + + + + + openocd.tcl + OpenOCD + openocd.tcl + Run Command + openocd.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 {

} "\n" + append buffer {Command
} + append buffer {
} + append buffer {
} + append buffer {
} + + append buffer {
} "\n" + + + + ]]> + + + Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise + there will be no output, e.g. "reset init" use "ocd_reset init". +

+

Click here to download log.

+

To download log you can also use commands like "wget http://append buffer [ip]/ram/log", or + point your web browser to said address.

+

+ You can also execute tcl commands using curl from your developer PC: +

+ + curl --form form_command=ocd_version append buffer [ip]runtcl.tcl + + + ]]> +
+
+
+ + + + + guiupload.tcl + openocd.tcl + Upload File to ZY1000 + + + set form_filename [formfetch form_filename]; + set form_action [formfetch form_action]; + #set form_filecontent [formfetch form_filecontent]; + + append buffer {
} + append buffer
+ 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 {} + append buffer {
Filename on ZY1000
File to upload
} + append buffer {
 
 
} + append buffer {
} + append buffer {
} + + + + ]]>
+ + The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing + embedded into the firmware.

+ +

Use "/ram" to store temporary files.

+ +

+ You can browse filing systems and download files by pointing your web browser to: +

+

+ +

+ You can also upload files using e.g. curl from the command line. Example: +

+ + curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf append buffer [ip]upload.tcl + +

+ 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. +

+ + cp /tftp/10.0.0.106/build/src/openocd /ram/test + + + ]]> +
+
+ +
+ + + + + targets.tcl + documentation.tcl + Target config quick start guide + + + 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. +

+ 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. + + + ]]> + + + Quick start guide on how to configure a target. + + + + + + + + + + + + index.tcl + index.tcl + terminal.tcl + UART forwarding + + + 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] + +

+ Target baudrate: + + +

+ +

+ + if {[string compare $form_action "Set baudrate"]==0} { + append console [encode [ocd_uart $form_baudrate]] + } + + +

Simple UART

+ 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. +

+ ]]> + + telnet append buffer [ip] 5555 + or connect via TCP/IP from e.g. HyperTerminal. +

+ 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. + ]]> + + + + + + + + + + \ 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 0000000000..320d5e2483 --- /dev/null +++ b/src/server/httpd/menu.xsl @@ -0,0 +1,298 @@ + +]> + + + + + + + + + + + + + + OpenOCD debugger + + + + + + + + set console "" + set upload_filename /ram/upload + + + +

+ +
+
+ append buffer [capture version] +
+
+
+ + + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + +
+ + + width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat; + + + width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat; + + + +
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + 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} { + + + + + + } + + + + +
+ + + + + + + + +
+ + + width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat; + + + width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat; + + + +
+
+
+   +
+
+

+
+ +
+ + + + 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 ]]> + } + + + ?toggle_details=1 + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } +
+
+ + if {$show_details==1} { + append buffer $console + } + + /td]]> + + if {$show_details!=1} { + append buffer {} + } + + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+ OpenOCD Manual
+
+ + + + +
+
+ + + + + + + + +
+   +
+ +
+ + + + + diff --git a/src/server/httpd/menuweb.css b/src/server/httpd/menuweb.css new file mode 100644 index 0000000000..0a812a7a9b --- /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 0000000000..fe1d195dd1 --- /dev/null +++ b/src/server/httpd/openocd.tcl @@ -0,0 +1,357 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Run Command

+
+ + } + + 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 {
} "\n" + append buffer {Command
} + append buffer {
} + append buffer {
} + append buffer {
} + + append buffer {
} "\n" + + +append buffer { + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise + there will be no output, e.g. "reset init" use "ocd_reset init". +

+

Click here to download log.

+

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.

+

+ You can also execute tcl commands using curl from your developer PC: +

+ + curl --form form_command=ocd_version } +append buffer [ip] +append buffer {runtcl.tcl + + + +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..eaa184217a --- /dev/null +++ b/src/server/httpd/preconfig.tcl @@ -0,0 +1,429 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + +Zylin ZY1000 JTAG debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+
+ + + +
+
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Select Preconfigured Target

+
+ + } + + + set form_target [formfetch form_target] + set form_action [formfetch form_action] + + append buffer {
} + 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 { + + + + +
+ +   + + +      + Edit target configuration +
+ } + + } else { + append buffer "Reloading setting(ca. 30 seconds)..." + } + +append buffer { + +
+ +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+Quick Start Manual +
+OpenOCD Manual +
+Contact Zylin AS +
+
+ +
+ + +
+
+
+ +

ZY1000 comes with complete configurations for various targets.

+

These predefined configurations include reset init scripts and flash configuration.

+

Select and reload - Select configuration and reboot ZY1000 unit.

+ +
+   +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..654c6311a3 --- /dev/null +++ b/src/server/httpd/production.tcl @@ -0,0 +1,394 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+Info +
+
+
+Erase +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Production

+
+ } + + set form_action [formfetch form_action] + set form_serialnumber [formfetch form_serialnumber] + append buffer [production_info] + +append buffer { + +
+ + } + + 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 "
Running production procedure

" + append buffer "
Reset and init:
" + + append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]] + } + } + if {[string compare $form_action "Test"]==0} { + append buffer "
Running production test. Output from first 10 seconds printed below.

" + + 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 { + + } + + append buffer {

Firmware file(raw binary)

} + append buffer {

Serial number

} + +append buffer { + + + + + +
 
 
+ + + + + +
    +
+

+ +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ + 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. + +

Upload firmware - Power cycle target, reset target and program raw binary file to flash bank 0, offset 0 and verify flash programming. Leave target powered on.

+

Test - Power up target, run 10 second target test. Output is provided via the DCC output channel.

+

Power on - Power on target.

+

Power off - Power off target.

+

Serial number - A target script can use this string in the production procedure. Type "help production" for more info.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..91ed625c13 --- /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 0000000000..07c9198381 --- /dev/null +++ b/src/server/httpd/reload.tcl @@ -0,0 +1,322 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + +
+
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Reload Config Scripts

+
+ + } + + set form_action [formfetch form_action] + + if {[string compare $form_action "Reload"]==0} { + append buffer "Reloading Config Scripts...

" + reboot + } + +append buffer { +

+ +
+ +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ Restart ZY1000 to reload selected target config script. +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..1a00eb974a --- /dev/null +++ b/src/server/httpd/run.tcl @@ -0,0 +1,384 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+
+Info +
+
+
+Erase +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Run program

+
+ + + +} + + +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 { + +
+ + + +
Address
+ + + + +
 
 
+ +
+
+ + + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ +

Reset and run - reset CPU and let it run.

+

Halt - halt CPU.

+

Run from address - halt CPU and resume from address. Default is resume from current address.

+

Reset and init - reset CPU and run init script.

+ +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +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 0000000000..cf7a2b4464 --- /dev/null +++ b/src/server/httpd/support.tcl @@ -0,0 +1,431 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zylin ZY1000 JTAG debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+
+ + + +
+
+
+} +append buffer [capture zy1000_version] +append buffer { +
+
+
+ + + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ + + +
+
+
+   +
+
+

Submit Support Request

+
+ 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 { + +
+ + + + + + + + + + +
Support ID} +append buffer $support_id +append buffer {
Contact person
Phone
email
MAC address
+

+ Summary: +

+ +

+ Description: +

+ + +

+ Log:

+ +

+ Config:

+ +

+

+

+

+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+Quick Start Manual +
+OpenOCD Manual +
+Contact Zylin AS +
+
+ +
+ + +
+
+
+ + 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. +

+ Note that you can see precisely what information is submitted to Zylin in the + form: the log and your config files. + +

+   +
+
+ + + + Zylin AS, Auglendsdalen 78, N-4017 Stavanger, Norway - www.zylin.com +
+ + + + + + + + + + + +} + +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 0000000000..3df16367f2 --- /dev/null +++ b/src/server/httpd/targets.tcl @@ -0,0 +1,562 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Target config quick start guide

+
+ + 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. +

+ 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. +

+ 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. + + +

+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ + Quick start guide on how to configure a target. +
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

Target config quick start guide

+
+ + 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. +

+ 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. +

+ 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. + + +

+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ + Quick start guide on how to configure a target. +
+   +
+
+ + + + + + + + + + + + + +} + +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 0000000000..707ddd0fff --- /dev/null +++ b/src/server/httpd/terminal.tcl @@ -0,0 +1,366 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OpenOCD debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+ +
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + +
+
+   +
+
+ + + + + + + + + + + + +
+
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ +
+
+
+   +
+
+

UART forwarding

+
+ } + + 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 { +
+ Target baudrate: + + +

+ +

+ } + + if {[string compare $form_action "Set baudrate"]==0} { + append console [encode [ocd_uart $form_baudrate]] + } + +append buffer { + +

Simple UART

+ 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. +

+

+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+OpenOCD Manual +
+
+
+ +
+ + +
+
+
+ + Serial port data to target is forwarded(both directions) in the simple terminal window + to the left. Alternatively you can telnet } +append buffer [ip] +append buffer { 5555 + or connect via TCP/IP from e.g. HyperTerminal. +

+ 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. + +

+   +
+
+ + + + + + + +} + +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 0000000000..c09cc8c184 --- /dev/null +++ b/src/server/httpd/upgrade.tcl @@ -0,0 +1,418 @@ +# converted to .tcl by html2tcl.tcl +set buffer "" +append buffer { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zylin ZY1000 JTAG debugger + + + +} + + set console "" + set upload_filename /ram/upload + +append buffer { + +
+
+ + + +
+
+
+} +append buffer [capture version] +append buffer { +
+
+
+ + + + + + + + + + +
+
+   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + +} + + + 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 { + + + +} + + } + +append buffer { + + + +
+ + + + + + + + +
+ + +
+Flash +
+
+
+Memory +
+
+ + + +
+
+
+   +
+
+

Upgrade ZY1000 Firmware

+
+ + } + + set form_action [formfetch form_action]; + set form_filecontent [formfetch form_filecontent]; + + append buffer {
} + 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 "
Upgraded Zylin JTAG, rebooting (wait ca. 30 seconds)...

" + reboot + } else { + append buffer "
Not a valid Zylin JTAG firmware file.
" + } + } 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)...
" + } else { + append buffer {
Upgrade Zylin JTAG firmware + reboot.

} + append buffer {
} + append buffer {
 
 
} + append buffer {
} + append buffer {
} + append buffer {

} + } + +append buffer { + +
+ + +} + + 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 { + +} + + if {$show_details==1} { + append buffer "Hide details" + append buffer
+ } else { + append buffer {
} + append buffer "Show details" + append buffer {
} + } + +append buffer { +
+} + + if {$show_details==1} { + append buffer $console + } + +append buffer {} + + if {$show_details!=1} { + append buffer {} + } + +append buffer { + +
   
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Documentation +
+
+   + +
+
+Quick Start Manual +
+OpenOCD Manual +
+Contact Zylin AS +
+
+ +
+ + +
+
+
+ + Upload new firmware file to ZY1000, verify that it is a valid ZY1000 firmware + file, and upgrade flash. +

+ Restore factory settings restores all factory settings except the TCP/IP settings. +

+ The current version of the firmware is visible at the top of the web page. +

+ ZY1000 firmware can also be upgraded using serial port YModem upload. +

+ Check for new firmware at http://www.zylin.com/zy1000.html + +

+   +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +} + +start_chunked "html" +write_chunked $buffer +end_chunked + -- 2.30.2