Add comments and tiny improvements to STM32 flash loader algorithm
[fw/openocd] / src / server / httpd / menu.xml
index cf286e235b6a72a5b6126bfbf073591e016512fe..be1446416b163421b73e8d1667fba26fd0f12709 100644 (file)
-<?xml version = "1.0" encoding="iso-8859-1" standalone="yes"?>\r
-<?xml-stylesheet type="text/xsl" href="plaintext.xsl"?>\r
-<website>\r
-       \r
-       <language lang="Norsk">\r
-\r
-               <page lang="eng">\r
-                       <outfile>index.tcl</outfile>\r
-                       <menutext>Config Target</menutext> \r
-                       <menulink>index.tcl</menulink> \r
-                       <pageheading>OpenOCD debugger</pageheading>\r
-                       <level2parent>index.tcl</level2parent>\r
-                       <level2menu href="index.tcl" title="Target Status" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-                       <!-- \r
-                       <level2menu href="terminal.tcl" title="UART forwarding" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-                        -->\r
-               \r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-\r
-                       \r
-                       <table>\r
-                               <tr><td style="height:10px;width:535px;">&nbsp</td></tr>\r
-                               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-                               <tr><td style="height:5px;width:535px;">&nbsp</td></tr>\r
-                       </table>\r
-\r
-                       <H1>Target Status</H1>\r
-\r
-                       <table>\r
-                               <tr>\r
-                                       <td class="fontbigger">\r
-                                               <tcl>\r
-                                                       set form_address [formfetch form_address]\r
-                                                       set form_action [formfetch form_action]\r
-                                                       \r
-                                                       if {[string compare $form_action "Halt"]==0} {\r
-                                                               append console [encode [capture_catch "halt"]]\r
-                                                       }\r
-                                                       if {[string compare $form_action "Resume"]==0} {\r
-                                                               append console [encode [capture_catch "resume"]]\r
-                                                       }\r
-                                                         \r
-                                                       if {[string compare $form_action "Reset and run"]==0} {\r
-                                                               append console [encode [capture_catch "reset run"]]\r
-                                                       }\r
-                                                       \r
-                                                       if {[string compare $form_action "Power on"]==0} {\r
-                                                               append console [encode [capture_catch "power on"]]\r
-                                                       }\r
-                                                       if {[string compare $form_action "Power off"]==0} {\r
-                                                               append console [encode [capture_catch "power off"]]\r
-                                                       }\r
-                                               </tcl>\r
-                                       \r
-                                               <tcl>append console [encode [capture_catch poll]]</tcl>\r
-                                       </td>\r
-                               </tr>\r
-                       </table>\r
-\r
-                       <form action="index.tcl" method="post"> \r
-                               <table><tr>\r
-                                       <td><input type="submit" name="form_action" value="Reset and run"></td>\r
-                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td>\r
-                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td>\r
-                                       <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td>\r
-                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td>\r
-                               </tr></table>\r
-\r
-                               <br>                                            \r
-                               <br>                                            \r
-                                                                               \r
-                               <p>\r
-                       </form>\r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <markup_code><![CDATA[\r
-                                       <p>Target status shows that status of the connected target. </p> \r
-                                       <p><b>Current target</b> - selected target configuration. <br>\r
-                                       <p><b>Startup</b> - whether or not the target script ran to completion. Note\r
-                                       that even if the target is disconnected, powered down or unresponsive, the\r
-                                       startup script will still run to completion. Startup - OK does not mean\r
-                                       that the target is fully operational, simply that the configuration script\r
-                                       did not contain syntax errors for instance. \r
-                                       See log for details. <br>\r
-                                       <p><b>Target power</b> - Detects power on target. <br>\r
-                                       If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p>\r
-                                       <p><b>Power on</b> - Turn on ZY1000 target power relay.</p>\r
-                                       <p><b>Power off</b> - Turn off ZY1000  target power relay.</p>\r
-                                       <p>Type "help power" in telnet for command to control power relay.</p>\r
-                                       <p><b>Reboot ZY1000</b> - Reboots ZY1000 unit. Type "help reboot" in telnet.</p>\r
-                               ]]></markup_code>\r
-                       </right_column>\r
-                       \r
-                       </pagetext>\r
-               </page>\r
-               \r
-               \r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>targets.tcl</outfile>\r
-                       <level2parent>documentation.tcl</level2parent>\r
-                       <pageheading>Target config quick start guide</pageheading>\r
-                       <pagetext>\r
-                               <markup_code><![CDATA[\r
-                               \r
-                               A target needs an openocd.cfg file. This config file sets up\r
-                               the CPU, flash and reset init script. Either ZY1000 ships with an\r
-                               openocd.cfg file for your target or you need to take an existing\r
-                               config file and modify it for your needs.\r
-                               <p> \r
-                               The reset init script is crucial. It will set up e.g. MMU, chip\r
-                               select registers, etc. after a reset. The init.cfg (reset init script)\r
-                               is embedded into the openocd.cfg file in the sampls Zylin provides.\r
-                               <p>\r
-                               Writing an openocd.cfg from scratch is a non-trivial exercise, but\r
-                               fortunally it only has to be done once for a target and afterwards it\r
-                               rarely if ever needs to be changed.\r
-                               \r
-                               \r
-                               ]]></markup_code>\r
-                               <right_column>\r
-                                       \r
-                                         Quick start guide on how to configure a target.\r
-                               </right_column>\r
-                       </pagetext>\r
-                       \r
-                       \r
-               </page>\r
-\r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>reload.tcl</outfile>\r
-                       <level2parent>index.tcl</level2parent>\r
-                       <pageheading>Reload Config Scripts</pageheading>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-                       \r
-                       <tcl>\r
-                               set form_action [formfetch form_action]\r
-       \r
-                               if {[string compare $form_action "Reload"]==0} {\r
-                                       append buffer "Reloading Config Scripts...<p>"\r
-                                       reboot\r
-                               }\r
-                       </tcl>\r
-                       <form enctype="multipart/form-data" action="reload.tcl" method="post">\r
-                               <input type="submit" name="form_action" value="Reload">\r
-                       </form>\r
-                       \r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               Restart ZY1000 to reload selected target config script.                         \r
-                       </right_column>\r
-                       </pagetext>\r
-                       \r
-               </page>\r
-\r
-               \r
-               <page lang="eng">\r
-                       <outfile>flashinfo.tcl</outfile>\r
-                       <menutext>Flash</menutext> \r
-                       <menulink>flashinfo.tcl</menulink> \r
-                       <pageheading>Flash Information</pageheading>\r
-                       <level2parent>flashinfo.tcl</level2parent>\r
-                       <level2menu href="flashinfo.tcl" title="Info" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-                       <level2menu href="erase.tcl" title="Erase" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-                       <level2menu href="flash.tcl" title="Program / Verify" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-                       <level2menu href="production.tcl" title="Production" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-\r
-                       <div style="font-size:14px;">Configured flash banks:</div>\r
-                       <p>                     \r
-                       <code style="white-space: nowrap;">\r
-                               <tcl>\r
-                                       set flash_return [ocd_flash_banks]\r
-                                       if {[llength $flash_return]!=0} {\r
-                                               append buffer [encode [flash banks]]\r
-                                       \r
-                                               set form_action [formfetch form_action]\r
-                                               if {[string compare $form_action "Reset CPU and probe flash"]==0} {\r
-                                                       append console [encode [capture_catch "reset init"]]\r
-                                                       append buffer [encode [capture_catch "flash probe 0"]]\r
-                                                       append buffer [encode [capture_catch "flash info 0"]]\r
-                                               }\r
-                                       } else {\r
-                                               append buffer "No flash bank configured."\r
-                                       }\r
-                               </tcl>\r
-                               <p>\r
-                               <form action="flashinfo.tcl" method="post"> \r
-                                       <input type="submit" name="form_action" value="Reset CPU and probe flash">\r
-                               </form>\r
-                               <tcl>\r
-                                       foreach a [ocd_flash_banks] {\r
-                                               append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: "\r
-                                               </tcl>\r
-                                                       <form action="downloadmem.tcl" method="post"> \r
-                                                               <input type="hidden" name="form_address" value="<tcl>append buffer [format "0x%08x" $a(base)]</tcl>">\r
-                                                               <input type="hidden" name="form_length" value="<tcl>append buffer [format "0x%08x" $a(size)]</tcl>">\r
-               \r
-                                                               <input type="submit" value="Download" name="form_action">\r
-                                                               <br>\r
-                                                       </form>\r
-                                               <tcl>\r
-                                       }\r
-                               </tcl>\r
-                       </code>\r
-                       \r
-\r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <![CDATA[\r
-                               <p>Here you will find information about the flash chips that you have\r
-                               in your configuration.<p/>\r
-                               <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show\r
-                               you more detailed information about your flash. This includes information about\r
-                               the different sectors in the flash, and the flash driver used.</p>\r
-                               ]]>\r
-                       </right_column>\r
-                       \r
-                       </pagetext>\r
-               </page>\r
-\r
-               <page lang="eng">\r
-                       <outfile>flash.tcl</outfile>\r
-                       <level2parent>flashinfo.tcl</level2parent>\r
-                       <pageheading>Program / Verify Flash</pageheading>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-                       \r
-                       <tcl>\r
-                       \r
-                       set form_offset [formfetch form_offset]\r
-                       set form_action [formfetch form_action]\r
-                       set form_type [formfetch form_type]\r
-                       \r
-                       \r
-                       set post ""\r
-                       catch {set post $post_data} err\r
-                       \r
-                       if {[string compare $form_offset ""]==0} {\r
-                               set form_offset 0\r
-                       }\r
-                       if {[string compare $form_type ""]==0} {\r
-                               set form_type ""\r
-                       }\r
-                       \r
-                       </tcl><code style="white-space: nowrap;"><tcl>\r
-                       \r
-                       set data ""\r
-                       append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">}\r
-                       \r
-                       set action_reset [expr {[string length $form_action]!=0}] \r
-                       set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] \r
-                       set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]\r
-                       \r
-                       if {$action_reset} {\r
-                               append console [encode [capture_catch "reset init"]]\r
-                       }\r
-                       </tcl>\r
-                       </code><tcl>\r
-                               \r
-                       append buffer {<table>}\r
-                       append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>}\r
-                       append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>"\r
-                       \r
-                       </tcl>\r
-                       <tr><td class="formtext" style="padding-top:1px;">Type</td><td>\r
-                       <select name="form_type">\r
-                                       <option\r
-                          <tcl>if {[string compare $form_type ""]==0} { append buffer {selected="selected"} }  </tcl>\r
-                                       value ="">auto</option>\r
-                         <option \r
-                          <tcl>if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} }  </tcl>\r
-                         value ="elf">elf</option>\r
-                         <option \r
-                          <tcl>if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} }  </tcl>\r
-                         value ="bin">binary</option>\r
-                         <option \r
-                          <tcl>if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} }  </tcl>\r
-                         value ="ihex">ihex</option>\r
-                         <!-- broken <option value ="s19">s19</option> -->\r
-                       </select>\r
-                       </td>\r
-                       \r
-                       </tr>\r
-                       \r
-                       \r
-                       </table>\r
-                       \r
-                               <table>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                               </table>\r
-                       \r
-                       <table><tr>\r
-                               <td><input type="submit" name="form_action" value="Flash" ></td>\r
-                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td>\r
-                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td>\r
-                       </tr></table>\r
-               \r
-                       <p>\r
-                       <tcl>\r
-                       \r
-                       if {$action_flash||$action_verify} {\r
-                               catch {writeform form_filecontent $upload_filename} result\r
-                               append console [encode $result]\r
-                       }\r
-                       append buffer "<br>"\r
-                       if {$action_flash} {\r
-                               append console [encode [capture_catch "halt"]]\r
-                               append buffer "<b>"\r
-                               if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {\r
-                                       append buffer "Flash write failed<br>"\r
-                                       append console [encode $result]\r
-                               } else {\r
-                                       append buffer [encode $result]\r
-                                       append buffer "Flash write succeed<br>"\r
-                               }\r
-                               append buffer "</b>"\r
-                       }\r
-                       if {$action_verify} {\r
-                               append console [encode [capture_catch "halt"]]\r
-                               append buffer "<b>"\r
-                               if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {\r
-                                       append buffer "Verify failed<br>"\r
-                                       append console [encode $result]\r
-                               } else {\r
-                                       append buffer [encode $result]\r
-                                       append buffer "Verify succeed<br>"\r
-                               }\r
-                               append buffer "</b>"\r
-                       }\r
-                       </tcl>          \r
-                               \r
-                       </form>\r
-                       \r
-                       ]]></markup_code>\r
-                       \r
-                       <right_column>\r
-                               <![CDATA[\r
-                               <p>Program and/or verify the flash on your target.</p>\r
-                               <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p>\r
-                               <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p>\r
-                               <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p>\r
-                               <p><b>Offset</b> - This value is added to the address of the image.<br> \r
-                                       Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> \r
-                                       Typically 0 for elf/ihex and the address to     write the image to for binary files.</p>\r
-                                       ]]> \r
-                       </right_column>\r
-                       \r
-                       \r
-                       </pagetext>\r
-                       \r
-               </page>\r
-\r
-\r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>production.tcl</outfile>\r
-                       <level2parent>flashinfo.tcl</level2parent>\r
-                       <pageheading>Production</pageheading>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-                       <tcl>\r
-                               set form_action [formfetch form_action]\r
-                               set form_serialnumber [formfetch form_serialnumber]\r
-                               append buffer [production_info]\r
-                       </tcl>\r
-                               \r
-                       <form enctype="multipart/form-data" action="production.tcl" method="post">\r
-                               <code style="white-space: nowrap;">\r
-                                       <tcl>   \r
-                                               if {[string compare $form_action "Upload firmware"]==0} {\r
-                                                       set wrotedata [catch {writeform form_filecontent $upload_filename} result]  \r
-                                                       append buffer [encode $result]\r
-                                                       if {$wrotedata==0} {\r
-                                                               append buffer "<br>Running production procedure<p>"\r
-                                                               append buffer "<br>Reset and init: <br>"\r
-                                                               \r
-                                                               append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]]\r
-                                                       }\r
-                                               }\r
-                                               if {[string compare $form_action "Test"]==0} {\r
-                                                       append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>"\r
-                                                       \r
-                                                       append console [encode [capture_catch {catch production_test}]]\r
-                                               }\r
-                                               if {[string compare $form_action "Power on"]==0} {\r
-                                                       append console [encode [capture_catch "power on"]]\r
-                                               }\r
-                                               if {[string compare $form_action "Power off"]==0} {\r
-                                                       append console [encode [capture_catch "power off"]]\r
-                                               }\r
-                                       </tcl>\r
-                               </code>\r
-                               <tcl>\r
-                                       append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>}\r
-                                       append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>}\r
-                               </tcl>\r
-                               \r
-                               <table>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                               </table>\r
-                       \r
-                               <table><tr>\r
-                                       <td><input type="submit" name="form_action" value="Upload firmware" ></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Test"></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power on"></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power off">\r
-                               </tr></table>\r
-                       </form>\r
-                       \r
-                       ]]></markup_code>\r
-                       \r
-                       <right_column>\r
-                               <![CDATA[\r
-                               The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures\r
-                               are used on this page. There are default implementations that do nothing.\r
-                               \r
-                               <p><b>Upload firmware</b> - Power cycle target, reset target and program raw binary file to flash bank 0, offset 0 and verify flash programming. Leave target powered on.</p>\r
-                               <p><b>Test</b> -  Power up target, run 10 second target test. Output is provided via the DCC output channel. </p>\r
-                               <p><b>Power on</b> - Power on target.</p>\r
-                               <p><b>Power off</b> - Power off target.</p>\r
-                               <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p>\r
-                                       ]]> \r
-                       </right_column>\r
-                       \r
-                       \r
-                       </pagetext>\r
-                       \r
-               </page>\r
-\r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>erase.tcl</outfile>\r
-                       <menulink>erase.tcl</menulink> \r
-                       <pageheading>Erase Flash</pageheading>\r
-                       <level2parent>flashinfo.tcl</level2parent>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-\r
-\r
-                       \r
-                       <tcl>\r
-                       \r
-                       set form_address [formfetch form_address]\r
-                       set form_length [formfetch form_length]\r
-                       set form_action [formfetch form_action]\r
-                       \r
-                       if {[string compare $form_length ""]==0} {\r
-                               set form_length 0x10000\r
-                       }  \r
-                       if {[string compare $form_address ""]==0} {\r
-                               if {[catch {[zy1000_flash]} result]==0} {\r
-                                               set form_address "0x[tohex $result]"\r
-                                       }                       \r
-                       }  \r
-                       \r
-                       \r
-                       if {[string compare $form_address ""]!=0} {\r
-                               if {[string compare $form_action "Erase"]==0} {\r
-                                               append buffer "<code style=\"white-space: nowrap;\">"\r
-                                               append console [encode [capture_catch {\r
-                                               reset init\r
-                                               flash erase_address $form_address $form_length}]]\r
-                                               append buffer </code>\r
-                               }  \r
-                       }\r
-                       \r
-                       \r
-                       </tcl>\r
-                       \r
-                       <form action="erase.tcl" method="post"> \r
-                               <table>\r
-                               <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
-                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>\r
-                               </td></tr>\r
-                               </table>\r
-                               <table>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                               </table>\r
-                       \r
-                               <input type="submit" name="form_action" value="Erase"><br>\r
-                               \r
-                               \r
-                       </form>\r
-                       \r
-\r
-                       \r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <![CDATA[\r
-                               <p>Note that flash programming will erase flash if required.<p/>\r
-                               <p>Reset and init CPU, then erase address range.</p>\r
-                               <p>The length field is specified in number of bytes.</p>\r
-                                       ]]>\r
-                       </right_column>\r
-                       \r
-                       </pagetext>\r
-               </page>\r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>run.tcl</outfile>\r
-                       <menulink>run.tcl</menulink> \r
-                       <pageheading>Run program</pageheading>\r
-                       <level2parent>flashinfo.tcl</level2parent>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-\r
-\r
-                       \r
-<tcl>\r
-\r
-set form_address [formfetch form_address]\r
-set form_action [formfetch form_action]\r
-\r
-if {[string compare $form_action "Run from address"]==0} {\r
-       append console [encode [capture_catch "halt"]]\r
-       append console [encode [capture_catch "wait_halt"]]\r
-       append console [encode [capture_catch "resume $form_address"]]\r
-}  \r
-\r
-if {[string compare $form_action "Halt"]==0} {\r
-       append console [encode [capture_catch "halt"]]\r
-       append console [encode [capture_catch "wait_halt"]]\r
-}\r
-  \r
-if {[string compare $form_action "Reset and run"]==0} {\r
-       append console [encode [capture_catch "reset run"]]\r
-}\r
-  \r
-if {[string compare $form_action "Reset and init"]==0} {\r
-       append console [encode [capture_catch "reset init"]]\r
-}  \r
-\r
-append console [encode [capture_catch poll]]\r
-\r
-</tcl>\r
-\r
-<form action="run.tcl" method="post"> \r
-       <table>\r
-       <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
-       </td></tr>\r
-       </table>\r
-       <table>\r
-               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-       </table>\r
-       \r
-       <input type="submit" name="form_action" value="Reset and run"> <input type="submit" name="form_action" value="Run from address"> <input type="submit" name="form_action" value="Halt"><input type="submit" name="form_action" value="Reset and init"><br>\r
-</form>\r
-                       \r
-\r
-                       \r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <![CDATA[\r
-                               <p>Reset and run - reset CPU and let it run.</p>\r
-                               <p>Halt - halt CPU.</p>\r
-                               <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p>\r
-                               <p>Reset and init - reset CPU and run init script.</p>\r
-                               ]]>\r
-                       </right_column>\r
-                       \r
-                       </pagetext>\r
-               </page>\r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>browsemem.tcl</outfile>\r
-                       <menutext>Memory</menutext> \r
-                       <menulink>browsemem.tcl</menulink> \r
-                       <pageheading>Browse / Edit Memory</pageheading>\r
-                       <level2parent>browsemem.tcl</level2parent>\r
-                       <level2menu href="browsemem.tcl" title="Browse / Edit" titlestyle="color:#4e6627;">\r
-                       <![CDATA[\r
-                               Browse and edit memory.\r
-                       ]]>\r
-                       </level2menu>\r
-                       <level2menu href="downloadmem.tcl" title="Download" titlestyle="color:#4e6627;">\r
-                       <![CDATA[\r
-                           Copy memory range to developer machine\r
-                       ]]>\r
-                       </level2menu>\r
-                       \r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-\r
-\r
-                       \r
-                       <tcl>\r
-                       \r
-                       set form_address [formfetch form_address]\r
-                       set form_length [formfetch form_length]\r
-                       set form_type [formfetch form_type]\r
-                       set form_action [formfetch form_action]\r
-                       set form_value [formfetch form_value]\r
-                       \r
-                       if {[string compare $form_length ""]==0} {\r
-                               set form_length 0\r
-                       }  \r
-                       if {$form_length<=0} {\r
-                               set form_length 0x80\r
-                       } \r
-                       if {$form_length>0x1000} {\r
-                               set form_length 0x1000\r
-                       } \r
-                       \r
-                       if {[string compare $form_type ""]==0} {\r
-                               set form_type mdw\r
-                       }\r
-                       \r
-                       if {[string compare $form_type "mdw"]==0} {\r
-                               set wordsize 4\r
-                               set modify_cmd mww \r
-                       }\r
-                       if {[string compare $form_type "mdh"]==0} {\r
-                               set wordsize 2\r
-                               set modify_cmd mwh \r
-                       }\r
-                       if {[string compare $form_type "mdb"]==0} {\r
-                               set wordsize 1\r
-                               set modify_cmd mwb \r
-                       }\r
-                       \r
-                       \r
-                       \r
-                       \r
-                       if {[string compare $form_address ""]!=0} {\r
-                               if {[string compare $form_action "Previous"]==0} {\r
-                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions\r
-                                       incr form_address ; set form_address [expr $form_address-1]\r
-                                       if {$form_address-$form_length>0} {\r
-                                               set form_address "0x[tohex [expr $form_address-$form_length]]"\r
-                                       } else {\r
-                                               set form_address "0x0"\r
-                                       }\r
-                               }  \r
-                               if {[string compare $form_action "Next"]==0} {\r
-                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions\r
-                                       incr form_address ; set form_address [expr $form_address-1]\r
-                                       set form_address "0x[tohex [expr $form_address+$form_length]]"\r
-                               }  \r
-                               if {[string compare $form_action "Modify"]==0} {\r
-                                       append console [capture_catch "$modify_cmd $form_address $form_value"]\r
-                               }  \r
-                               if {[string compare $form_action "Fill"]==0} {\r
-                                       append console [capture_catch "$modify_cmd $form_address $form_value $form_length"]\r
-                               }  \r
-                       }\r
-                       \r
-                       \r
-                       </tcl>\r
-                       \r
-                       <form action="browsemem.tcl" method="post"> \r
-                               <table>\r
-                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
-                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer "0x[tohex $form_length]"</tcl>"></td></tr>\r
-                               <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="<tcl>append buffer $form_value</tcl>"></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Modify"></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Fill"></td></tr>\r
-                               <tr><td class="formtext">Type</td><td style="padding-top:1px;">\r
-                               <select name="form_type">\r
-                                 <option \r
-                                   <tcl>if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} }  </tcl> value ="mdb">8 bit\r
-                                 </option>\r
-                                 <option \r
-                                  <tcl>if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} }  </tcl> value ="mdh">16 bit\r
-                                 </option>\r
-                                       <option\r
-                                          <tcl>if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} }  </tcl>value ="mdw">32 bit\r
-                                       </option>\r
-                               </select>\r
-                               \r
-                               </td></tr>\r
-                               </table>\r
-                               <table>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                               </table>\r
-                       \r
-                               <table><tr>\r
-                                       <td><input type="submit" name="form_action" value="Refresh"></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Previous" ></td>\r
-                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Next" ></td>\r
-                               </tr></table>\r
-                               <br>\r
-                               \r
-                       </form>\r
-                       <p>\r
-                       <div class="fontbigger">Memory:</div><p>\r
-                       <code style="white-space: nowrap; font-size:11px;font:courier new;">\r
-                               <tcl>\r
-                               if {[string compare $form_address ""]!=0} {\r
-                                       append console [encode [capture_catch halt]]\r
-                                       append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]]\r
-                               } \r
-                               </tcl>\r
-                       </code>\r
-\r
-\r
-                       \r
-\r
-                       \r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <![CDATA[\r
-                               <p>Browse and edit target memory.<br>\r
-                                  Length is in bytes, maximum 4096 bytes.</p> \r
-                               <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p>\r
-                               <p>CPU will be halted if required.</p>\r
-                               <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p>\r
-                               <p><b>Fill</b> - Will fill the specified region with the specified value.</p>\r
-                               <p><b>Refresh</b> - Display the content of the specified memory area.</p>\r
-                                       ]]>\r
-                       </right_column>\r
-                       \r
-                       </pagetext>\r
-               </page>\r
-\r
-               \r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>downloadmem.tcl</outfile>\r
-                       <level2parent>browsemem.tcl</level2parent>\r
-                       <pageheading>Download Memory Range</pageheading>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-                       <tcl>\r
-                               set form_address [formfetch form_address]\r
-                               set form_length [formfetch form_length]\r
-                               set form_action [formfetch form_action]\r
-                       </tcl>                  \r
-                       <form action="downloadmem.tcl" method="post"> \r
-                               <table>\r
-                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>\r
-                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>\r
-                               </td></tr>\r
-                               </table>\r
-\r
-                               <table>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>\r
-                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>\r
-                               </table>\r
-                       \r
-                               <input type="submit" value="Download" name="form_action">\r
-                               \r
-                               \r
-                       </form>\r
-                       <tcl>\r
-                               if {[string compare $form_action "Download"]==0} {\r
-                                       append console [encode [capture_catch "reset init"]]\r
-                                       append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]]\r
-                                       </tcl>\r
-                                       <form action="../dump.bin" target="_blank"> \r
-                                               <input type="submit" name="form_action" value="Save downloaded memory">\r
-                                       </form>\r
-                                       <tcl> \r
-                               }\r
-                               \r
-                       </tcl>\r
-\r
-\r
-                       \r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <![CDATA[       \r
-                               Download memory to ZY1000 from target. <br>\r
-                               <b>Note</b> that download memory can take\r
-                               a long time(potentially minutes for megabytes at low JTAG clk speeds).\r
-                               <p/>\r
-                               Once the memory is downloaded a link is available on the page to download\r
-                               the file from ZY1000 to your PC.\r
-                               ]]>\r
-                       </right_column>\r
-                       </pagetext>\r
-                       \r
-               </page>\r
-\r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>openocd.tcl</outfile>\r
-                       <menutext>OpenOCD</menutext> \r
-                       <menulink>openocd.tcl</menulink> \r
-                       <pageheading>Run Command</pageheading>\r
-                       <level2parent>openocd.tcl</level2parent>\r
-                       <level2menu href="openocd.tcl" title="Run Command" titlestyle="color:#4e6627;">\r
-                       </level2menu>\r
-                       <level2menu href="guiupload.tcl" title="Upload File to ZY1000" titlestyle="color:#4e6627;">\r
-                       <![CDATA[\r
-                           Upload file to ZY1000\r
-                       ]]>\r
-                       </level2menu>\r
-                       \r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-\r
-                       <tcl>\r
-                               set form_command [formfetch form_command]\r
-\r
-                               set form_edittext ""\r
-                               if {[string length $form_command]>0} {                          \r
-                                       catch {capture_catch {eval "$form_command"}} form_edittext\r
-                               }\r
-                               \r
-                               append buffer {<form action="openocd.tcl" method="post">} "\n"\r
-                               append buffer {Command<br>}\r
-                               append buffer {<textarea  style="overflow:auto;"  rows="5" cols="65" name="form_command" wrap="off">}\r
-                               append buffer [to_textarea $form_command]\r
-                               append buffer {</textarea><br>}\r
-                               append buffer {<input type="submit" value="Run" name="form_action" ><br>}\r
-                               append buffer {<textarea  style="overflow:auto;"  rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">}\r
-                               append buffer [to_textarea $form_edittext]\r
-                               append buffer {</textarea><br>}\r
-                               \r
-                               append buffer {</form>} "\n"\r
-                       \r
-                       </tcl>\r
-\r
-                       ]]></markup_code>\r
-                       \r
-                       <right_column>\r
-                               <![CDATA[\r
-                               <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise\r
-                               there will be no output, e.g. "reset init" use "ocd_reset init".\r
-                               <p/>\r
-                               <p><a href="/ram/log">Click here to download log</a>.</p>\r
-                               <p>To download log you can also use commands like "wget http://<tcl>append buffer [ip]</tcl>/ram/log", or\r
-                               point your web browser to said address.</p>\r
-                               <p>\r
-                               You can also execute tcl commands using curl from your developer PC:\r
-                               </p>\r
-                               <code>\r
-                               curl --form form_command=ocd_version <tcl>append buffer [ip]</tcl>runtcl.tcl\r
-                               </code>\r
-                               \r
-                               ]]>\r
-                       </right_column>\r
-                       </pagetext>\r
-               </page>\r
-\r
-               \r
-               \r
-               <page lang="eng">\r
-                       <outfile>guiupload.tcl</outfile>\r
-                       <level2parent>openocd.tcl</level2parent>\r
-                       <pageheading>Upload File to ZY1000</pageheading>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-                       \r
-                       <tcl>\r
-                               set form_filename [formfetch form_filename];\r
-                               set form_action [formfetch form_action];\r
-                               #set form_filecontent [formfetch form_filecontent];\r
-                               \r
-                               append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">}\r
-                               append buffer <br> \r
-                               if {[string compare $form_action "Upload"]==0} {\r
-                                       if {[catch {writeform form_filecontent $form_filename} result]==0} {\r
-                                               append buffer [encode $result]\r
-                                       } else {\r
-                                               append buffer Wrote $form_filename\r
-                                       }\r
-                               }\r
-                               \r
-                               append buffer {<table style="padding:0px;border-collapse:collapse;"><tr><td class="formtext">Filename on ZY1000</td><td><input type="text" name="form_filename"></td></tr>}\r
-                               append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>}\r
-                               append buffer {<table><tr><td style="height:15px;width:535px;">&nbsp</td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;">&nbsp</td></tr></table>}\r
-                               append buffer {<input type="submit" name="form_action" value="Upload" ><br> }\r
-                               append buffer {</form>}\r
-                       \r
-                       </tcl>\r
-                       \r
-                       ]]></markup_code>\r
-                       <right_column>  \r
-                               <![CDATA[\r
-                                 <p>The ZY1000 has three filing systems "/rom", "/ram" and "/config". "/rom" is a read only filing\r
-                                 embedded into the firmware.</p>\r
-\r
-                                 <p>Use "/ram" to store temporary files.<p/>\r
-                                 \r
-                                 <p>\r
-                                 You can browse filing systems and download files by pointing your web browser to:\r
-                                 <ul> \r
-                                 <li><a href="/ram" target="_blank">/ram</a>\r
-                                 <li><a href="/rom" target="_blank">/rom</a>\r
-                                 <li><a href="/config" target="_blank">/config</a>\r
-                                 </ul>\r
-                                 </p> \r
-                                 \r
-                                 <p>\r
-                                 You can also upload files using e.g. curl from the command line. Example:\r
-                                 </p>\r
-                                 <code>\r
-                                 curl --form form_filecontent=@/tmp/myfile.elf --form form_filename=/ram/myfile.elf <tcl>append buffer [ip]</tcl>upload.tcl\r
-                                 </code>\r
-                                 <p> \r
-                                 If you have a tftp server installed on your development PC, you can access\r
-                                 files on your developer PC using a /tftp/ip/ prefix to the file to be accessed\r
-                                 on your developer PC. Note that if you do not increase the default packet\r
-                                 size for your tftp server, then the performance will be very poor. Normal\r
-                                 performance is about 500-600kBytes/s.\r
-                                 </p>\r
-                                 <code> \r
-                                 cp /tftp/10.0.0.106/build/src/openocd /ram/test\r
-                                 </code>\r
-                                 \r
-                                 ]]>\r
-                       </right_column>\r
-                       </pagetext>\r
-                       \r
-               </page>\r
-               \r
-\r
-\r
-               <page lang="eng">\r
-                       <outfile>targets.tcl</outfile>\r
-                       <level2parent>documentation.tcl</level2parent>\r
-                       <pageheading>Target config quick start guide</pageheading>\r
-                       <pagetext>\r
-                               <markup_code><![CDATA[\r
-                               \r
-                               A target needs an openocd.cfg file. This config file sets up\r
-                               the CPU, flash and reset init script. Either ZY1000 ships with an\r
-                               openocd.cfg file for your target or you need to take an existing\r
-                               config file and modify it for your needs.\r
-                               <p> \r
-                               The reset init script is crucial. It will set up e.g. MMU, chip\r
-                               select registers, etc. after a reset. The init.cfg (reset init script)\r
-                               is embedded into the openocd.cfg file in the sampls Zylin provides.\r
-                               <p>\r
-                               Writing an openocd.cfg from scratch is a non-trivial exercise, but\r
-                               fortunally it only has to be done once for a target and afterwards it\r
-                               rarely if ever needs to be changed.\r
-                               \r
-                               \r
-                               ]]></markup_code>\r
-                               <right_column>\r
-                                       \r
-                                         Quick start guide on how to configure a target.\r
-                               </right_column>\r
-                       </pagetext>\r
-                       \r
-                       \r
-               </page>\r
-\r
-\r
-               \r
-\r
-\r
-               <page lang="eng">\r
-                       <menulink>index.tcl</menulink> \r
-                       <level2parent>index.tcl</level2parent>\r
-                       <outfile>terminal.tcl</outfile>\r
-                       <pageheading>UART forwarding</pageheading>\r
-                       <pagetext>\r
-                       <markup_code><![CDATA[\r
-                       <tcl>\r
-                               set form_baudrate [formfetch form_baudrate]\r
-                               if {[string length $form_baudrate]==0} {\r
-                                       set form_baudrate [ocd_uart]\r
-                                       set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]]\r
-                               }\r
-                               set form_action [formfetch form_action]\r
-                       </tcl>\r
-                       <form action="terminal.tcl" method="post">\r
-                               Target baudrate: \r
-                                       <select name="form_baudrate">\r
-                                               <tcl>\r
-                                                       foreach i {9600 19200 38400 57600 115200} { \r
-                                                       </tcl>\r
-                                                               <option <tcl>if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} }  </tcl>\r
-                                                               value ="<tcl>append buffer $i</tcl>"><tcl>append buffer $i</tcl></option>\r
-                                                       <tcl>\r
-                                                       }\r
-                                                       </tcl>\r
-                                               </select>\r
-\r
-                                       <p>     \r
-                                       <input type="submit" name="form_action" value="Set baudrate" >\r
-                               </form>                 \r
-                       <tcl>\r
-                               if {[string compare $form_action "Set baudrate"]==0} {\r
-                                       append console [encode [ocd_uart $form_baudrate]]\r
-                               }\r
-                       </tcl>\r
-                       \r
-                       <h2>Simple UART</h2>\r
-                       This terminal window is purely for illustrative purposes. Use telnet or a terminal program\r
-                       to talk to the target over TCP/IP for anything but trivial case of reading/writing a few\r
-                       lines of texts in simple tests.\r
-                       <p>\r
-                       ]]></markup_code>\r
-                       <right_column>\r
-                               <![CDATA[\r
-                               Serial port data to target is forwarded(both directions) in the simple terminal window\r
-                               to the left. Alternatively you can <b>telnet <tcl>append buffer [ip]</tcl> 5555</b>\r
-                               or connect via TCP/IP from e.g. HyperTerminal.\r
-                               <p>\r
-                               Type "help uart" in telnet for information on how to set uart speed for target. Normally\r
-                               the uart speed is set from the target configuration script by adding an "uart N", where\r
-                               N is the baudrate.\r
-                               ]]>\r
-                       </right_column>\r
-                       </pagetext>\r
-                       \r
-               </page>\r
-\r
-\r
-               \r
-       </language>\r
-       \r
-</website>
\ No newline at end of file
+<?xml version = "1.0" encoding="iso-8859-1" standalone="yes"?>
+<?xml-stylesheet type="text/xsl" href="plaintext.xsl"?>
+<website>
+
+       <language lang="Norsk">
+
+               <page lang="eng">
+                       <outfile>index.tcl</outfile>
+                       <menutext>Config Target</menutext>
+                       <menulink>index.tcl</menulink>
+                       <pageheading>OpenOCD debugger</pageheading>
+                       <level2parent>index.tcl</level2parent>
+                       <level2menu href="index.tcl" title="Target Status" titlestyle="color:#4e6627;">
+                       </level2menu>
+                       <!--
+                       <level2menu href="terminal.tcl" title="UART forwarding" titlestyle="color:#4e6627;">
+                       </level2menu>
+                        -->
+
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+
+                       <table>
+                               <tr><td style="height:10px;width:535px;">&nbsp</td></tr>
+                               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+                               <tr><td style="height:5px;width:535px;">&nbsp</td></tr>
+                       </table>
+
+                       <H1>Target Status</H1>
+
+                       <table>
+                               <tr>
+                                       <td class="fontbigger">
+                                               <tcl>
+                                                       set form_address [formfetch form_address]
+                                                       set form_action [formfetch form_action]
+
+                                                       if {[string compare $form_action "Halt"]==0} {
+                                                               append console [encode [capture_catch "halt"]]
+                                                       }
+                                                       if {[string compare $form_action "Resume"]==0} {
+                                                               append console [encode [capture_catch "resume"]]
+                                                       }
+
+                                                       if {[string compare $form_action "Reset and run"]==0} {
+                                                               append console [encode [capture_catch "reset run"]]
+                                                       }
+
+                                                       if {[string compare $form_action "Power on"]==0} {
+                                                               append console [encode [capture_catch "power on"]]
+                                                       }
+                                                       if {[string compare $form_action "Power off"]==0} {
+                                                               append console [encode [capture_catch "power off"]]
+                                                       }
+                                               </tcl>
+
+                                               <tcl>append console [encode [capture_catch poll]]</tcl>
+                                       </td>
+                               </tr>
+                       </table>
+
+                       <form action="index.tcl" method="post">
+                               <table><tr>
+                                       <td><input type="submit" name="form_action" value="Reset and run"></td>
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td>
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td>
+                                       <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td>
+                                       <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td>
+                               </tr></table>
+
+                               <br>
+                               <br>
+
+                               <p>
+                       </form>
+                       ]]></markup_code>
+                       <right_column>
+                               <markup_code><![CDATA[
+                                       <p>Target status shows that status of the connected target. </p>
+                                       <p><b>Current target</b> - selected target configuration. <br>
+                                       <p><b>Startup</b> - whether or not the target script ran to completion. Note
+                                       that even if the target is disconnected, powered down or unresponsive, the
+                                       startup script will still run to completion. Startup - OK does not mean
+                                       that the target is fully operational, simply that the configuration script
+                                       did not contain syntax errors for instance.
+                                       See log for details. <br>
+                                       <p><b>Target power</b> - Detects power on target. <br>
+                                       If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p>
+                                       <p>Type "help power" in telnet for command to control power relay.</p>
+                               ]]></markup_code>
+                       </right_column>
+
+                       </pagetext>
+               </page>
+
+
+
+
+               <page lang="eng">
+                       <outfile>targets.tcl</outfile>
+                       <level2parent>documentation.tcl</level2parent>
+                       <pageheading>Target config quick start guide</pageheading>
+                       <pagetext>
+                               <markup_code><![CDATA[
+
+                               A target needs an openocd.cfg file. This config file sets up
+                               the CPU, flash and reset init script. Either OpenOCD ships with an
+                               openocd.cfg file for your target or you need to take an existing
+                               config file and modify it for your needs.
+                               <p>
+                               The reset init script is crucial. It will set up e.g. MMU, chip
+                               select registers, etc. after a reset. The init.cfg (reset init script)
+                               is embedded into the openocd.cfg file in the sampls OpenOCD provides.
+                               <p>
+                               Writing an openocd.cfg from scratch is a non-trivial exercise, but
+                               fortunally it only has to be done once for a target and afterwards it
+                               rarely if ever needs to be changed.
+
+
+                               ]]></markup_code>
+                               <right_column>
+
+                                       Quick start guide on how to configure a target.
+                               </right_column>
+                       </pagetext>
+
+
+               </page>
+
+
+
+
+               <page lang="eng">
+                       <outfile>flashinfo.tcl</outfile>
+                       <menutext>Flash</menutext>
+                       <menulink>flashinfo.tcl</menulink>
+                       <pageheading>Flash Information</pageheading>
+                       <level2parent>flashinfo.tcl</level2parent>
+                       <level2menu href="flashinfo.tcl" title="Info" titlestyle="color:#4e6627;">
+                       </level2menu>
+                       <level2menu href="erase.tcl" title="Erase" titlestyle="color:#4e6627;">
+                       </level2menu>
+                       <level2menu href="flash.tcl" title="Program / Verify" titlestyle="color:#4e6627;">
+                       </level2menu>
+                       <level2menu href="production.tcl" title="Production" titlestyle="color:#4e6627;">
+                       </level2menu>
+
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+                       <div style="font-size:14px;">Configured flash banks:</div>
+                       <p>
+                       <code style="white-space: nowrap;">
+                               <tcl>
+                                       set flash_return [ocd_flash_banks]
+                                       if {[llength $flash_return]!=0} {
+                                               append buffer [encode [flash banks]]
+
+                                               set form_action [formfetch form_action]
+                                               if {[string compare $form_action "Reset CPU and probe flash"]==0} {
+                                                       append console [encode [capture_catch "reset init"]]
+                                                       append buffer [encode [capture_catch "flash probe 0"]]
+                                                       append buffer [encode [capture_catch "flash info 0"]]
+                                               }
+                                       } else {
+                                               append buffer "No flash bank configured."
+                                       }
+                               </tcl>
+                               <p>
+                               <form action="flashinfo.tcl" method="post">
+                                       <input type="submit" name="form_action" value="Reset CPU and probe flash">
+                               </form>
+                               <tcl>
+                                       foreach a [ocd_flash_banks] {
+                                               append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: "
+                                               </tcl>
+                                                       <form action="downloadmem.tcl" method="post">
+                                                               <input type="hidden" name="form_address" value="<tcl>append buffer [format "0x%08x" $a(base)]</tcl>">
+                                                               <input type="hidden" name="form_length" value="<tcl>append buffer [format "0x%08x" $a(size)]</tcl>">
+
+                                                               <input type="submit" value="Download" name="form_action">
+                                                               <br>
+                                                       </form>
+                                               <tcl>
+                                       }
+                               </tcl>
+                       </code>
+
+
+                       ]]></markup_code>
+                       <right_column>
+                               <![CDATA[
+                               <p>Here you will find information about the flash chips that you have
+                               in your configuration.<p/>
+                               <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show
+                               you more detailed information about your flash. This includes information about
+                               the different sectors in the flash, and the flash driver used.</p>
+                               ]]>
+                       </right_column>
+
+                       </pagetext>
+               </page>
+
+               <page lang="eng">
+                       <outfile>flash.tcl</outfile>
+                       <level2parent>flashinfo.tcl</level2parent>
+                       <pageheading>Program / Verify Flash</pageheading>
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+                       <tcl>
+
+                       set form_offset [formfetch form_offset]
+                       set form_action [formfetch form_action]
+                       set form_type [formfetch form_type]
+
+
+                       set post ""
+                       catch {set post $post_data} err
+
+                       if {[string compare $form_offset ""]==0} {
+                               set form_offset 0
+                       }
+                       if {[string compare $form_type ""]==0} {
+                               set form_type ""
+                       }
+
+                       </tcl><code style="white-space: nowrap;"><tcl>
+
+                       set data ""
+                       append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">}
+
+                       set action_reset [expr {[string length $form_action]!=0}]
+                       set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}]
+                       set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]
+
+                       if {$action_reset} {
+                               append console [encode [capture_catch "reset init"]]
+                       }
+                       </tcl>
+                       </code><tcl>
+
+                       append buffer {<table>}
+                       append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>}
+                       append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>"
+
+                       </tcl>
+                       <tr><td class="formtext" style="padding-top:1px;">Type</td><td>
+                       <select name="form_type">
+                               <option
+                                       <tcl>if {[string compare $form_type ""]==0} { append buffer {selected="selected"} } </tcl>
+                                       value ="">auto</option>
+                               <option
+                                       <tcl>if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} } </tcl>
+                                       value ="elf">elf</option>
+                               <option
+                                       <tcl>if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} } </tcl>
+                                       value ="bin">binary</option>
+                               <option
+                                       <tcl>if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} } </tcl>
+                                       value ="ihex">ihex</option>
+                               <!-- broken <option value ="s19">s19</option> -->
+                       </select>
+                       </td>
+
+                       </tr>
+
+
+                       </table>
+
+                               <table>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                               </table>
+
+                       <table><tr>
+                               <td><input type="submit" name="form_action" value="Flash" ></td>
+                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td>
+                               <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td>
+                       </tr></table>
+
+                       <p>
+                       <tcl>
+
+                       if {$action_flash||$action_verify} {
+                               catch {writeform form_filecontent $upload_filename} result
+                               append console [encode $result]
+                       }
+                       append buffer "<br>"
+                       if {$action_flash} {
+                               append console [encode [capture_catch "halt"]]
+                               append buffer "<b>"
+                               if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {
+                                       append buffer "Flash write failed<br>"
+                                       append console [encode $result]
+                               } else {
+                                       append buffer [encode $result]
+                                       append buffer "Flash write succeed<br>"
+                               }
+                               append buffer "</b>"
+                       }
+                       if {$action_verify} {
+                               append console [encode [capture_catch "halt"]]
+                               append buffer "<b>"
+                               if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {
+                                       append buffer "Verify failed<br>"
+                                       append console [encode $result]
+                               } else {
+                                       append buffer [encode $result]
+                                       append buffer "Verify succeed<br>"
+                               }
+                               append buffer "</b>"
+                       }
+                       </tcl>
+
+                       </form>
+
+                       ]]></markup_code>
+
+                       <right_column>
+                               <![CDATA[
+                               <p>Program and/or verify the flash on your target.</p>
+                               <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p>
+                               <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p>
+                               <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p>
+                               <p><b>Offset</b> - This value is added to the address of the image.<br>
+                                       Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br>
+                                       Typically 0 for elf/ihex and the address to     write the image to for binary files.</p>
+                                       ]]>
+                       </right_column>
+
+
+                       </pagetext>
+
+               </page>
+
+
+
+
+               <page lang="eng">
+                       <outfile>production.tcl</outfile>
+                       <level2parent>flashinfo.tcl</level2parent>
+                       <pageheading>Production</pageheading>
+                       <pagetext>
+                       <markup_code><![CDATA[
+                       <tcl>
+                               set form_action [formfetch form_action]
+                               set form_serialnumber [formfetch form_serialnumber]
+                               append buffer [production_info]
+                       </tcl>
+
+                       <form enctype="multipart/form-data" action="production.tcl" method="post">
+                               <code style="white-space: nowrap;">
+                                       <tcl>
+                                               if {[string compare $form_action "Upload firmware"]==0} {
+                                                       set wrotedata [catch {writeform form_filecontent $upload_filename} result]
+                                                       append buffer [encode $result]
+                                                       if {$wrotedata==0} {
+                                                               append buffer "<br>Running production procedure<p>"
+                                                               append buffer "<br>Reset and init: <br>"
+
+                                                               append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]]
+                                                       }
+                                               }
+                                               if {[string compare $form_action "Test"]==0} {
+                                                       append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>"
+
+                                                       append console [encode [capture_catch {catch production_test}]]
+                                               }
+                                               if {[string compare $form_action "Power on"]==0} {
+                                                       append console [encode [capture_catch "power on"]]
+                                               }
+                                               if {[string compare $form_action "Power off"]==0} {
+                                                       append console [encode [capture_catch "power off"]]
+                                               }
+                                       </tcl>
+                               </code>
+                               <tcl>
+                                       append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>}
+                                       append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>}
+                               </tcl>
+
+                               <table>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                               </table>
+
+                               <table><tr>
+                                       <td><input type="submit" name="form_action" value="Upload firmware" ></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Test"></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power on"></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power off">
+                               </tr></table>
+                       </form>
+
+                       ]]></markup_code>
+
+                       <right_column>
+                               <![CDATA[
+                               The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures
+                               are used on this page. There are default implementations that do nothing.
+
+                               <p><b>Upload firmware</b> - Power cycle target, reset target and program raw binary file to flash bank 0, offset 0 and verify flash programming. Leave target powered on.</p>
+                               <p><b>Test</b> - Power up target, run 10 second target test. Output is provided via the DCC output channel. </p>
+                               <p><b>Power on</b> - Power on target.</p>
+                               <p><b>Power off</b> - Power off target.</p>
+                               <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p>
+                                       ]]>
+                       </right_column>
+
+
+                       </pagetext>
+
+               </page>
+
+
+
+               <page lang="eng">
+                       <outfile>erase.tcl</outfile>
+                       <menulink>erase.tcl</menulink>
+                       <pageheading>Erase Flash</pageheading>
+                       <level2parent>flashinfo.tcl</level2parent>
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+
+
+                       <tcl>
+
+                       set form_address [formfetch form_address]
+                       set form_length [formfetch form_length]
+                       set form_action [formfetch form_action]
+
+                       if {[string compare $form_length ""]==0} {
+                               set form_length 0x10000
+                       }
+                       if {[string compare $form_address ""]==0} {
+                               if {[catch {[first_flash_base]} result]==0} {
+                                               set form_address "0x[tohex $result]"
+                                       }
+                       }
+
+
+                       if {[string compare $form_address ""]!=0} {
+                               if {[string compare $form_action "Erase"]==0} {
+                                               append buffer "<code style=\"white-space: nowrap;\">"
+                                               append console [encode [capture_catch {
+                                               reset init
+                                               flash erase_address $form_address $form_length}]]
+                                               append buffer </code>
+                               }
+                       }
+
+
+                       </tcl>
+
+                       <form action="erase.tcl" method="post">
+                               <table>
+                               <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>
+                               </td></tr>
+                               </table>
+                               <table>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                               </table>
+
+                               <input type="submit" name="form_action" value="Erase"><br>
+
+
+                       </form>
+
+
+
+                       ]]></markup_code>
+                       <right_column>
+                               <![CDATA[
+                               <p>Note that flash programming will erase flash if required.<p/>
+                               <p>Reset and init CPU, then erase address range.</p>
+                               <p>The length field is specified in number of bytes.</p>
+                                       ]]>
+                       </right_column>
+
+                       </pagetext>
+               </page>
+
+
+               <page lang="eng">
+                       <outfile>run.tcl</outfile>
+                       <menulink>run.tcl</menulink>
+                       <pageheading>Run program</pageheading>
+                       <level2parent>flashinfo.tcl</level2parent>
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+
+
+<tcl>
+
+set form_address [formfetch form_address]
+set form_action [formfetch form_action]
+
+if {[string compare $form_action "Run from address"]==0} {
+       append console [encode [capture_catch "halt"]]
+       append console [encode [capture_catch "wait_halt"]]
+       append console [encode [capture_catch "resume $form_address"]]
+}
+
+if {[string compare $form_action "Halt"]==0} {
+       append console [encode [capture_catch "halt"]]
+       append console [encode [capture_catch "wait_halt"]]
+}
+
+if {[string compare $form_action "Reset and run"]==0} {
+       append console [encode [capture_catch "reset run"]]
+}
+
+if {[string compare $form_action "Reset and init"]==0} {
+       append console [encode [capture_catch "reset init"]]
+}
+
+append console [encode [capture_catch poll]]
+
+</tcl>
+
+<form action="run.tcl" method="post">
+       <table>
+       <tr><td class="formtext" style="padding-right:10px;">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>
+       </td></tr>
+       </table>
+       <table>
+               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+               <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+               <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+       </table>
+
+       <input type="submit" name="form_action" value="Reset and run"> <input type="submit" name="form_action" value="Run from address"> <input type="submit" name="form_action" value="Halt"><input type="submit" name="form_action" value="Reset and init"><br>
+</form>
+
+
+
+                       ]]></markup_code>
+                       <right_column>
+                               <![CDATA[
+                               <p>Reset and run - reset CPU and let it run.</p>
+                               <p>Halt - halt CPU.</p>
+                               <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p>
+                               <p>Reset and init - reset CPU and run init script.</p>
+                               ]]>
+                       </right_column>
+
+                       </pagetext>
+               </page>
+
+
+               <page lang="eng">
+                       <outfile>browsemem.tcl</outfile>
+                       <menutext>Memory</menutext>
+                       <menulink>browsemem.tcl</menulink>
+                       <pageheading>Browse / Edit Memory</pageheading>
+                       <level2parent>browsemem.tcl</level2parent>
+                       <level2menu href="browsemem.tcl" title="Browse / Edit" titlestyle="color:#4e6627;">
+                       <![CDATA[
+                               Browse and edit memory.
+                       ]]>
+                       </level2menu>
+                       <level2menu href="downloadmem.tcl" title="Download" titlestyle="color:#4e6627;">
+                       <![CDATA[
+                               Copy memory range to developer machine
+                       ]]>
+                       </level2menu>
+
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+
+
+                       <tcl>
+
+                       set form_address [formfetch form_address]
+                       set form_length [formfetch form_length]
+                       set form_type [formfetch form_type]
+                       set form_action [formfetch form_action]
+                       set form_value [formfetch form_value]
+
+                       if {[string compare $form_length ""]==0} {
+                               set form_length 0
+                       }
+                       if {$form_length<=0} {
+                               set form_length 0x80
+                       }
+                       if {$form_length>0x1000} {
+                               set form_length 0x1000
+                       }
+
+                       if {[string compare $form_type ""]==0} {
+                               set form_type mdw
+                       }
+
+                       if {[string compare $form_type "mdw"]==0} {
+                               set wordsize 4
+                               set modify_cmd mww
+                       }
+                       if {[string compare $form_type "mdh"]==0} {
+                               set wordsize 2
+                               set modify_cmd mwh
+                       }
+                       if {[string compare $form_type "mdb"]==0} {
+                               set wordsize 1
+                               set modify_cmd mwb
+                       }
+
+
+
+
+                       if {[string compare $form_address ""]!=0} {
+                               if {[string compare $form_action "Previous"]==0} {
+                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions
+                                       incr form_address ; set form_address [expr $form_address-1]
+                                       if {$form_address-$form_length>0} {
+                                               set form_address "0x[tohex [expr $form_address-$form_length]]"
+                                       } else {
+                                               set form_address "0x0"
+                                       }
+                               }
+                               if {[string compare $form_action "Next"]==0} {
+                                       # Kludge! Work around problems parsing hex in Jim Tcl expressions
+                                       incr form_address ; set form_address [expr $form_address-1]
+                                       set form_address "0x[tohex [expr $form_address+$form_length]]"
+                               }
+                               if {[string compare $form_action "Modify"]==0} {
+                                       append console [capture_catch "$modify_cmd $form_address $form_value"]
+                               }
+                               if {[string compare $form_action "Fill"]==0} {
+                                       append console [capture_catch "$modify_cmd $form_address $form_value $form_length"]
+                               }
+                       }
+
+
+                       </tcl>
+
+                       <form action="browsemem.tcl" method="post">
+                               <table>
+                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer "0x[tohex $form_length]"</tcl>"></td></tr>
+                               <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="<tcl>append buffer $form_value</tcl>"></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Modify"></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Fill"></td></tr>
+                               <tr><td class="formtext">Type</td><td style="padding-top:1px;">
+                               <select name="form_type">
+                                       <option
+                                               <tcl>if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} } </tcl> value ="mdb">8 bit
+                                       </option>
+                                       <option
+                                               <tcl>if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} } </tcl> value ="mdh">16 bit
+                                       </option>
+                                       <option
+                                               <tcl>if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} } </tcl>value ="mdw">32 bit
+                                       </option>
+                               </select>
+
+                               </td></tr>
+                               </table>
+                               <table>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                               </table>
+
+                               <table><tr>
+                                       <td><input type="submit" name="form_action" value="Refresh"></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Previous" ></td>
+                                       <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Next" ></td>
+                               </tr></table>
+                               <br>
+
+                       </form>
+                       <p>
+                       <div class="fontbigger">Memory:</div><p>
+                       <code style="white-space: nowrap; font-size:11px;font:courier new;">
+                               <tcl>
+                               if {[string compare $form_address ""]!=0} {
+                                       append console [encode [capture_catch halt]]
+                                       append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]]
+                               }
+                               </tcl>
+                       </code>
+
+
+
+
+
+                       ]]></markup_code>
+                       <right_column>
+                               <![CDATA[
+                               <p>Browse and edit target memory.<br>
+                                       Length is in bytes, maximum 4096 bytes.</p>
+                               <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p>
+                               <p>CPU will be halted if required.</p>
+                               <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p>
+                               <p><b>Fill</b> - Will fill the specified region with the specified value.</p>
+                               <p><b>Refresh</b> - Display the content of the specified memory area.</p>
+                                       ]]>
+                       </right_column>
+
+                       </pagetext>
+               </page>
+
+
+
+
+               <page lang="eng">
+                       <outfile>downloadmem.tcl</outfile>
+                       <level2parent>browsemem.tcl</level2parent>
+                       <pageheading>Download Memory Range</pageheading>
+                       <pagetext>
+                       <markup_code><![CDATA[
+                       <tcl>
+                               set form_address [formfetch form_address]
+                               set form_length [formfetch form_length]
+                               set form_action [formfetch form_action]
+                       </tcl>
+                       <form action="downloadmem.tcl" method="post">
+                               <table>
+                               <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>
+                               <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>
+                               </td></tr>
+                               </table>
+
+                               <table>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                                       <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
+                                       <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
+                               </table>
+
+                               <input type="submit" value="Download" name="form_action">
+
+
+                       </form>
+                       <tcl>
+                               if {[string compare $form_action "Download"]==0} {
+                                       append console [encode [capture_catch "reset init"]]
+                                       append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]]
+                                       </tcl>
+                                       <form action="../dump.bin" target="_blank">
+                                               <input type="submit" name="form_action" value="Save downloaded memory">
+                                       </form>
+                                       <tcl>
+                               }
+
+                       </tcl>
+
+
+
+                       ]]></markup_code>
+                       <right_column>
+                               <![CDATA[
+                               Download memory from target. <br>
+                               <b>Note</b> that download memory can take
+                               a long time(potentially minutes for megabytes at low JTAG clk speeds).
+                               <p/>
+                               Once the memory is downloaded a link is available on the page to download
+                               the file to your PC.
+                               ]]>
+                       </right_column>
+                       </pagetext>
+
+               </page>
+
+
+
+               <page lang="eng">
+                       <outfile>openocd.tcl</outfile>
+                       <menutext>OpenOCD</menutext>
+                       <menulink>openocd.tcl</menulink>
+                       <pageheading>Run Command</pageheading>
+                       <level2parent>openocd.tcl</level2parent>
+                       <level2menu href="openocd.tcl" title="Run Command" titlestyle="color:#4e6627;">
+                       </level2menu>
+                       <level2menu href="guiupload.tcl" title="Upload File" titlestyle="color:#4e6627;">
+                       <![CDATA[
+                               Upload file
+                       ]]>
+                       </level2menu>
+
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+                       <tcl>
+                               set form_command [formfetch form_command]
+
+                               set form_edittext ""
+                               if {[string length $form_command]>0} {
+                                       set form_edittext [capture_catch {eval $form_command}]
+                               }
+
+                               append buffer {<form action="openocd.tcl" method="post">} "\n"
+                               append buffer {Command<br>}
+                               append buffer {<textarea style="overflow:auto;" rows="5" cols="65" name="form_command" wrap="off">}
+                               append buffer [to_textarea $form_command]
+                               append buffer {</textarea><br>}
+                               append buffer {<input type="submit" value="Run" name="form_action" ><br>}
+                               append buffer {<textarea style="overflow:auto;" rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">}
+                               append buffer [to_textarea $form_edittext]
+                               append buffer {</textarea><br>}
+
+                               append buffer {</form>} "\n"
+
+                       </tcl>
+
+                       ]]></markup_code>
+
+                       <right_column>
+                               <![CDATA[
+                               <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise
+                               there will be no output, e.g. "reset init" use "ocd_reset init".
+                               <p/>
+                               <p><a href="/ram/log">Click here to download log</a>.</p>
+                               <p>To download log you can also use commands like "wget http://<tcl>append buffer [ip]</tcl>/ram/log", or
+                               point your web browser to said address.</p>
+                               <p>
+                               You can also execute tcl commands using curl from your developer PC:
+                               </p>
+                               <code>
+                               curl --form form_command=ocd_version <tcl>append buffer [ip]</tcl>runtcl.tcl
+                               </code>
+
+                               ]]>
+                       </right_column>
+                       </pagetext>
+               </page>
+
+
+
+               <page lang="eng">
+                       <outfile>guiupload.tcl</outfile>
+                       <level2parent>openocd.tcl</level2parent>
+                       <pageheading>Upload File</pageheading>
+                       <pagetext>
+                       <markup_code><![CDATA[
+
+                       <tcl>
+                               set form_filename [formfetch form_filename];
+                               set form_action [formfetch form_action];
+                               #set form_filecontent [formfetch form_filecontent];
+
+                               append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">}
+                               append buffer <br>
+                               if {[string compare $form_action "Upload"]==0} {
+                                       if {[catch {writeform form_filecontent $form_filename} result]==0} {
+                                               append buffer [encode $result]
+                                       } else {
+                                               append buffer Wrote $form_filename
+                                       }
+                               }
+
+                               append buffer {<table style="padding:0px;border-collapse:collapse;"><tr><td class="formtext">Filename on OpenOCD machine</td><td><input type="text" name="form_filename"></td></tr>}
+                               append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>}
+                               append buffer {<table><tr><td style="height:15px;width:535px;">&nbsp</td></tr><tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr><tr><td style="height:15px;width:535px;">&nbsp</td></tr></table>}
+                               append buffer {<input type="submit" name="form_action" value="Upload" ><br> }
+                               append buffer {</form>}
+
+                       </tcl>
+
+                       ]]></markup_code>
+                       </pagetext>
+
+               </page>
+
+
+
+               <page lang="eng">
+                       <outfile>targets.tcl</outfile>
+                       <level2parent>documentation.tcl</level2parent>
+                       <pageheading>Target config quick start guide</pageheading>
+                       <pagetext>
+                               <markup_code><![CDATA[
+
+                               A target needs an openocd.cfg file. This config file sets up
+                               the CPU, flash and reset init script. Either OpenOCD ships with an
+                               openocd.cfg file for your target or you need to take an existing
+                               config file and modify it for your needs.
+                               <p>
+                               The reset init script is crucial. It will set up e.g. MMU, chip
+                               select registers, etc. after a reset. The init.cfg (reset init script)
+                               is embedded into the openocd.cfg file in the sampls OpenOCD provides.
+                               <p>
+                               Writing an openocd.cfg from scratch is a non-trivial exercise, but
+                               fortunally it only has to be done once for a target and afterwards it
+                               rarely if ever needs to be changed.
+
+
+                               ]]></markup_code>
+                               <right_column>
+
+                                       Quick start guide on how to configure a target.
+                               </right_column>
+                       </pagetext>
+
+
+               </page>
+
+
+
+
+
+               <page lang="eng">
+                       <menulink>index.tcl</menulink>
+                       <level2parent>index.tcl</level2parent>
+                       <outfile>terminal.tcl</outfile>
+                       <pageheading>UART forwarding</pageheading>
+                       <pagetext>
+                       <markup_code><![CDATA[
+                       <tcl>
+                               set form_baudrate [formfetch form_baudrate]
+                               if {[string length $form_baudrate]==0} {
+                                       set form_baudrate [ocd_uart]
+                                       set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]]
+                               }
+                               set form_action [formfetch form_action]
+                       </tcl>
+                       <form action="terminal.tcl" method="post">
+                               Target baudrate:
+                                       <select name="form_baudrate">
+                                               <tcl>
+                                                       foreach i {9600 19200 38400 57600 115200} {
+                                                       </tcl>
+                                                               <option <tcl>if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} } </tcl>
+                                                               value ="<tcl>append buffer $i</tcl>"><tcl>append buffer $i</tcl></option>
+                                                       <tcl>
+                                                       }
+                                                       </tcl>
+                                               </select>
+
+                                       <p>
+                                       <input type="submit" name="form_action" value="Set baudrate" >
+                               </form>
+                       <tcl>
+                               if {[string compare $form_action "Set baudrate"]==0} {
+                                       append console [encode [ocd_uart $form_baudrate]]
+                               }
+                       </tcl>
+
+                       <h2>Simple UART</h2>
+                       This terminal window is purely for illustrative purposes. Use telnet or a terminal program
+                       to talk to the target over TCP/IP for anything but trivial case of reading/writing a few
+                       lines of texts in simple tests.
+                       <p>
+                       ]]></markup_code>
+                       <right_column>
+                               <![CDATA[
+                               Serial port data to target is forwarded(both directions) in the simple terminal window
+                               to the left. Alternatively you can <b>telnet <tcl>append buffer [ip]</tcl> 5555</b>
+                               or connect via TCP/IP from e.g. HyperTerminal.
+                               <p>
+                               Type "help uart" in telnet for information on how to set uart speed for target. Normally
+                               the uart speed is set from the target configuration script by adding an "uart N", where
+                               N is the baudrate.
+                               ]]>
+                       </right_column>
+                       </pagetext>
+
+               </page>
+
+
+
+       </language>
+
+</website>