- add missing svn props from r1270 commit
[fw/openocd] / src / server / httpd / menu.xml
1 <?xml version = "1.0" encoding="iso-8859-1" standalone="yes"?>
2 <?xml-stylesheet type="text/xsl" href="plaintext.xsl"?>
3 <website>
4         
5         <language lang="Norsk">
6
7                 <page lang="eng">
8                         <outfile>index.tcl</outfile>
9                         <menutext>Config Target</menutext> 
10                         <menulink>index.tcl</menulink> 
11                         <pageheading>OpenOCD debugger</pageheading>
12                         <level2parent>index.tcl</level2parent>
13                         <level2menu href="index.tcl" title="Target Status" titlestyle="color:#4e6627;">
14                         </level2menu>
15                         <!-- 
16                         <level2menu href="terminal.tcl" title="UART forwarding" titlestyle="color:#4e6627;">
17                         </level2menu>
18                          -->
19                 
20                         <pagetext>
21                         <markup_code><![CDATA[
22
23                         
24                         <table>
25                                 <tr><td style="height:10px;width:535px;">&nbsp</td></tr>
26                                 <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
27                                 <tr><td style="height:5px;width:535px;">&nbsp</td></tr>
28                         </table>
29
30                         <H1>Target Status</H1>
31
32                         <table>
33                                 <tr>
34                                         <td class="fontbigger">
35                                                 <tcl>
36                                                         set form_address [formfetch form_address]
37                                                         set form_action [formfetch form_action]
38                                                         
39                                                         if {[string compare $form_action "Halt"]==0} {
40                                                                 append console [encode [capture_catch "halt"]]
41                                                         }
42                                                         if {[string compare $form_action "Resume"]==0} {
43                                                                 append console [encode [capture_catch "resume"]]
44                                                         }
45                                                           
46                                                         if {[string compare $form_action "Reset and run"]==0} {
47                                                                 append console [encode [capture_catch "reset run"]]
48                                                         }
49                                                         
50                                                         if {[string compare $form_action "Power on"]==0} {
51                                                                 append console [encode [capture_catch "power on"]]
52                                                         }
53                                                         if {[string compare $form_action "Power off"]==0} {
54                                                                 append console [encode [capture_catch "power off"]]
55                                                         }
56                                                 </tcl>
57                                         
58                                                 <tcl>append console [encode [capture_catch poll]]</tcl>
59                                         </td>
60                                 </tr>
61                         </table>
62
63                         <form action="index.tcl" method="post"> 
64                                 <table><tr>
65                                         <td><input type="submit" name="form_action" value="Reset and run"></td>
66                                         <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Halt"></td>
67                                         <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Resume"></td>
68                                         <td style="width:50px;"></td><td><input type="submit" name="form_action" value="Power on"></td>
69                                         <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Power off"></td>
70                                 </tr></table>
71
72                                 <br>                                            
73                                 <br>                                            
74                                                                                 
75                                 <p>
76                         </form>
77                         ]]></markup_code>
78                         <right_column>
79                                 <markup_code><![CDATA[
80                                         <p>Target status shows that status of the connected target. </p> 
81                                         <p><b>Current target</b> - selected target configuration. <br>
82                                         <p><b>Startup</b> - whether or not the target script ran to completion. Note
83                                         that even if the target is disconnected, powered down or unresponsive, the
84                                         startup script will still run to completion. Startup - OK does not mean
85                                         that the target is fully operational, simply that the configuration script
86                                         did not contain syntax errors for instance. 
87                                         See log for details. <br>
88                                         <p><b>Target power</b> - Detects power on target. <br>
89                                         If the JTAG cable is not connected, or the target has no power, then no target power will be detected.</p>
90                                         <p>Type "help power" in telnet for command to control power relay.</p>
91                                 ]]></markup_code>
92                         </right_column>
93                         
94                         </pagetext>
95                 </page>
96                 
97                 
98
99
100                 <page lang="eng">
101                         <outfile>targets.tcl</outfile>
102                         <level2parent>documentation.tcl</level2parent>
103                         <pageheading>Target config quick start guide</pageheading>
104                         <pagetext>
105                                 <markup_code><![CDATA[
106                                 
107                                 A target needs an openocd.cfg file. This config file sets up
108                                 the CPU, flash and reset init script. Either OpenOCD ships with an
109                                 openocd.cfg file for your target or you need to take an existing
110                                 config file and modify it for your needs.
111                                 <p> 
112                                 The reset init script is crucial. It will set up e.g. MMU, chip
113                                 select registers, etc. after a reset. The init.cfg (reset init script)
114                                 is embedded into the openocd.cfg file in the sampls OpenOCD provides.
115                                 <p>
116                                 Writing an openocd.cfg from scratch is a non-trivial exercise, but
117                                 fortunally it only has to be done once for a target and afterwards it
118                                 rarely if ever needs to be changed.
119                                 
120                                 
121                                 ]]></markup_code>
122                                 <right_column>
123                                         
124                                           Quick start guide on how to configure a target.
125                                 </right_column>
126                         </pagetext>
127                         
128                         
129                 </page>
130
131
132
133                 
134                 <page lang="eng">
135                         <outfile>flashinfo.tcl</outfile>
136                         <menutext>Flash</menutext> 
137                         <menulink>flashinfo.tcl</menulink> 
138                         <pageheading>Flash Information</pageheading>
139                         <level2parent>flashinfo.tcl</level2parent>
140                         <level2menu href="flashinfo.tcl" title="Info" titlestyle="color:#4e6627;">
141                         </level2menu>
142                         <level2menu href="erase.tcl" title="Erase" titlestyle="color:#4e6627;">
143                         </level2menu>
144                         <level2menu href="flash.tcl" title="Program / Verify" titlestyle="color:#4e6627;">
145                         </level2menu>
146                         <level2menu href="production.tcl" title="Production" titlestyle="color:#4e6627;">
147                         </level2menu>
148
149                         <pagetext>
150                         <markup_code><![CDATA[
151
152                         <div style="font-size:14px;">Configured flash banks:</div>
153                         <p>                     
154                         <code style="white-space: nowrap;">
155                                 <tcl>
156                                         set flash_return [ocd_flash_banks]
157                                         if {[llength $flash_return]!=0} {
158                                                 append buffer [encode [flash banks]]
159                                         
160                                                 set form_action [formfetch form_action]
161                                                 if {[string compare $form_action "Reset CPU and probe flash"]==0} {
162                                                         append console [encode [capture_catch "reset init"]]
163                                                         append buffer [encode [capture_catch "flash probe 0"]]
164                                                         append buffer [encode [capture_catch "flash info 0"]]
165                                                 }
166                                         } else {
167                                                 append buffer "No flash bank configured."
168                                         }
169                                 </tcl>
170                                 <p>
171                                 <form action="flashinfo.tcl" method="post"> 
172                                         <input type="submit" name="form_action" value="Reset CPU and probe flash">
173                                 </form>
174                                 <tcl>
175                                         foreach a [ocd_flash_banks] {
176                                                 append buffer "Flash bank at [format "0x%08x size 0x%08x" $a(base) $a(size)]: "
177                                                 </tcl>
178                                                         <form action="downloadmem.tcl" method="post"> 
179                                                                 <input type="hidden" name="form_address" value="<tcl>append buffer [format "0x%08x" $a(base)]</tcl>">
180                                                                 <input type="hidden" name="form_length" value="<tcl>append buffer [format "0x%08x" $a(size)]</tcl>">
181                 
182                                                                 <input type="submit" value="Download" name="form_action">
183                                                                 <br>
184                                                         </form>
185                                                 <tcl>
186                                         }
187                                 </tcl>
188                         </code>
189                         
190
191                         ]]></markup_code>
192                         <right_column>
193                                 <![CDATA[
194                                 <p>Here you will find information about the flash chips that you have
195                                 in your configuration.<p/>
196                                 <p><b>Reset CPU and probe flash</b> - This will reset the CPU and show
197                                 you more detailed information about your flash. This includes information about
198                                 the different sectors in the flash, and the flash driver used.</p>
199                                 ]]>
200                         </right_column>
201                         
202                         </pagetext>
203                 </page>
204
205                 <page lang="eng">
206                         <outfile>flash.tcl</outfile>
207                         <level2parent>flashinfo.tcl</level2parent>
208                         <pageheading>Program / Verify Flash</pageheading>
209                         <pagetext>
210                         <markup_code><![CDATA[
211                         
212                         <tcl>
213                         
214                         set form_offset [formfetch form_offset]
215                         set form_action [formfetch form_action]
216                         set form_type [formfetch form_type]
217                         
218                         
219                         set post ""
220                         catch {set post $post_data} err
221                         
222                         if {[string compare $form_offset ""]==0} {
223                                 set form_offset 0
224                         }
225                         if {[string compare $form_type ""]==0} {
226                                 set form_type ""
227                         }
228                         
229                         </tcl><code style="white-space: nowrap;"><tcl>
230                         
231                         set data ""
232                         append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">}
233                         
234                         set action_reset [expr {[string length $form_action]!=0}] 
235                         set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] 
236                         set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]
237                         
238                         if {$action_reset} {
239                                 append console [encode [capture_catch "reset init"]]
240                         }
241                         </tcl>
242                         </code><tcl>
243                                 
244                         append buffer {<table>}
245                         append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>}
246                         append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>"
247                         
248                         </tcl>
249                         <tr><td class="formtext" style="padding-top:1px;">Type</td><td>
250                         <select name="form_type">
251                                         <option
252                            <tcl>if {[string compare $form_type ""]==0} { append buffer {selected="selected"} }  </tcl>
253                                         value ="">auto</option>
254                           <option 
255                            <tcl>if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} }  </tcl>
256                           value ="elf">elf</option>
257                           <option 
258                            <tcl>if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} }  </tcl>
259                           value ="bin">binary</option>
260                           <option 
261                            <tcl>if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} }  </tcl>
262                           value ="ihex">ihex</option>
263                           <!-- broken <option value ="s19">s19</option> -->
264                         </select>
265                         </td>
266                         
267                         </tr>
268                         
269                         
270                         </table>
271                         
272                                 <table>
273                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
274                                         <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
275                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
276                                 </table>
277                         
278                         <table><tr>
279                                 <td><input type="submit" name="form_action" value="Flash" ></td>
280                                 <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td>
281                                 <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td>
282                         </tr></table>
283                 
284                         <p>
285                         <tcl>
286                         
287                         if {$action_flash||$action_verify} {
288                                 catch {writeform form_filecontent $upload_filename} result
289                                 append console [encode $result]
290                         }
291                         append buffer "<br>"
292                         if {$action_flash} {
293                                 append console [encode [capture_catch "halt"]]
294                                 append buffer "<b>"
295                                 if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {
296                                         append buffer "Flash write failed<br>"
297                                         append console [encode $result]
298                                 } else {
299                                         append buffer [encode $result]
300                                         append buffer "Flash write succeed<br>"
301                                 }
302                                 append buffer "</b>"
303                         }
304                         if {$action_verify} {
305                                 append console [encode [capture_catch "halt"]]
306                                 append buffer "<b>"
307                                 if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {
308                                         append buffer "Verify failed<br>"
309                                         append console [encode $result]
310                                 } else {
311                                         append buffer [encode $result]
312                                         append buffer "Verify succeed<br>"
313                                 }
314                                 append buffer "</b>"
315                         }
316                         </tcl>          
317                                 
318                         </form>
319                         
320                         ]]></markup_code>
321                         
322                         <right_column>
323                                 <![CDATA[
324                                 <p>Program and/or verify the flash on your target.</p>
325                                 <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p>
326                                 <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p>
327                                 <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p>
328                                 <p><b>Offset</b> - This value is added to the address of the image.<br> 
329                                         Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> 
330                                         Typically 0 for elf/ihex and the address to     write the image to for binary files.</p>
331                                         ]]> 
332                         </right_column>
333                         
334                         
335                         </pagetext>
336                         
337                 </page>
338
339
340
341
342                 <page lang="eng">
343                         <outfile>production.tcl</outfile>
344                         <level2parent>flashinfo.tcl</level2parent>
345                         <pageheading>Production</pageheading>
346                         <pagetext>
347                         <markup_code><![CDATA[
348                         <tcl>
349                                 set form_action [formfetch form_action]
350                                 set form_serialnumber [formfetch form_serialnumber]
351                                 append buffer [production_info]
352                         </tcl>
353                                 
354                         <form enctype="multipart/form-data" action="production.tcl" method="post">
355                                 <code style="white-space: nowrap;">
356                                         <tcl>   
357                                                 if {[string compare $form_action "Upload firmware"]==0} {
358                                                         set wrotedata [catch {writeform form_filecontent $upload_filename} result]  
359                                                         append buffer [encode $result]
360                                                         if {$wrotedata==0} {
361                                                                 append buffer "<br>Running production procedure<p>"
362                                                                 append buffer "<br>Reset and init: <br>"
363                                                                 
364                                                                 append console [encode [capture_catch {catch "production $upload_filename $form_serialnumber"}]]
365                                                         }
366                                                 }
367                                                 if {[string compare $form_action "Test"]==0} {
368                                                         append buffer "<br>Running production test. Output from first 10 seconds printed below. <p>"
369                                                         
370                                                         append console [encode [capture_catch {catch production_test}]]
371                                                 }
372                                                 if {[string compare $form_action "Power on"]==0} {
373                                                         append console [encode [capture_catch "power on"]]
374                                                 }
375                                                 if {[string compare $form_action "Power off"]==0} {
376                                                         append console [encode [capture_catch "power off"]]
377                                                 }
378                                         </tcl>
379                                 </code>
380                                 <tcl>
381                                         append buffer {<p class="formtext">Firmware file(raw binary) <input type="file" name="form_filecontent"><p>}
382                                         append buffer {<p class="formtext">Serial number <input type="text" name="form_serialnumber"><p>}
383                                 </tcl>
384                                 
385                                 <table>
386                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
387                                         <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
388                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
389                                 </table>
390                         
391                                 <table><tr>
392                                         <td><input type="submit" name="form_action" value="Upload firmware" ></td>
393                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Test"></td>
394                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power on"></td>
395                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Power off">
396                                 </tr></table>
397                         </form>
398                         
399                         ]]></markup_code>
400                         
401                         <right_column>
402                                 <![CDATA[
403                                 The target script can implement the "production", "production_info" and "production_test" tcl proc's. These procedures
404                                 are used on this page. There are default implementations that do nothing.
405                                 
406                                 <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>
407                                 <p><b>Test</b> -  Power up target, run 10 second target test. Output is provided via the DCC output channel. </p>
408                                 <p><b>Power on</b> - Power on target.</p>
409                                 <p><b>Power off</b> - Power off target.</p>
410                                 <p><b>Serial number</b> - A target script can use this string in the production procedure. Type "help production" for more info.</p>
411                                         ]]> 
412                         </right_column>
413                         
414                         
415                         </pagetext>
416                         
417                 </page>
418
419
420
421                 <page lang="eng">
422                         <outfile>erase.tcl</outfile>
423                         <menulink>erase.tcl</menulink> 
424                         <pageheading>Erase Flash</pageheading>
425                         <level2parent>flashinfo.tcl</level2parent>
426                         <pagetext>
427                         <markup_code><![CDATA[
428
429
430                         
431                         <tcl>
432                         
433                         set form_address [formfetch form_address]
434                         set form_length [formfetch form_length]
435                         set form_action [formfetch form_action]
436                         
437                         if {[string compare $form_length ""]==0} {
438                                 set form_length 0x10000
439                         }  
440                         if {[string compare $form_address ""]==0} {
441                                 if {[catch {[first_flash_base]} result]==0} {
442                                                 set form_address "0x[tohex $result]"
443                                         }                       
444                         }  
445                         
446                         
447                         if {[string compare $form_address ""]!=0} {
448                                 if {[string compare $form_action "Erase"]==0} {
449                                                 append buffer "<code style=\"white-space: nowrap;\">"
450                                                 append console [encode [capture_catch {
451                                                 reset init
452                                                 flash erase_address $form_address $form_length}]]
453                                                 append buffer </code>
454                                 }  
455                         }
456                         
457                         
458                         </tcl>
459                         
460                         <form action="erase.tcl" method="post"> 
461                                 <table>
462                                 <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>
463                                 <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>
464                                 </td></tr>
465                                 </table>
466                                 <table>
467                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
468                                         <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
469                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
470                                 </table>
471                         
472                                 <input type="submit" name="form_action" value="Erase"><br>
473                                 
474                                 
475                         </form>
476                         
477
478                         
479                         ]]></markup_code>
480                         <right_column>
481                                 <![CDATA[
482                                 <p>Note that flash programming will erase flash if required.<p/>
483                                 <p>Reset and init CPU, then erase address range.</p>
484                                 <p>The length field is specified in number of bytes.</p>
485                                         ]]>
486                         </right_column>
487                         
488                         </pagetext>
489                 </page>
490
491
492                 <page lang="eng">
493                         <outfile>run.tcl</outfile>
494                         <menulink>run.tcl</menulink> 
495                         <pageheading>Run program</pageheading>
496                         <level2parent>flashinfo.tcl</level2parent>
497                         <pagetext>
498                         <markup_code><![CDATA[
499
500
501                         
502 <tcl>
503
504 set form_address [formfetch form_address]
505 set form_action [formfetch form_action]
506
507 if {[string compare $form_action "Run from address"]==0} {
508         append console [encode [capture_catch "halt"]]
509         append console [encode [capture_catch "wait_halt"]]
510         append console [encode [capture_catch "resume $form_address"]]
511 }  
512
513 if {[string compare $form_action "Halt"]==0} {
514         append console [encode [capture_catch "halt"]]
515         append console [encode [capture_catch "wait_halt"]]
516 }
517   
518 if {[string compare $form_action "Reset and run"]==0} {
519         append console [encode [capture_catch "reset run"]]
520 }
521   
522 if {[string compare $form_action "Reset and init"]==0} {
523         append console [encode [capture_catch "reset init"]]
524 }  
525
526 append console [encode [capture_catch poll]]
527
528 </tcl>
529
530 <form action="run.tcl" method="post"> 
531         <table>
532         <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>
533         </td></tr>
534         </table>
535         <table>
536                 <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
537                 <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
538                 <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
539         </table>
540         
541         <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>
542 </form>
543                         
544
545                         
546                         ]]></markup_code>
547                         <right_column>
548                                 <![CDATA[
549                                 <p>Reset and run - reset CPU and let it run.</p>
550                                 <p>Halt - halt CPU.</p>
551                                 <p>Run from address - halt CPU and resume from address. Default is resume from current address.</p>
552                                 <p>Reset and init - reset CPU and run init script.</p>
553                                 ]]>
554                         </right_column>
555                         
556                         </pagetext>
557                 </page>
558
559
560                 <page lang="eng">
561                         <outfile>browsemem.tcl</outfile>
562                         <menutext>Memory</menutext> 
563                         <menulink>browsemem.tcl</menulink> 
564                         <pageheading>Browse / Edit Memory</pageheading>
565                         <level2parent>browsemem.tcl</level2parent>
566                         <level2menu href="browsemem.tcl" title="Browse / Edit" titlestyle="color:#4e6627;">
567                         <![CDATA[
568                                 Browse and edit memory.
569                         ]]>
570                         </level2menu>
571                         <level2menu href="downloadmem.tcl" title="Download" titlestyle="color:#4e6627;">
572                         <![CDATA[
573                             Copy memory range to developer machine
574                         ]]>
575                         </level2menu>
576                         
577                         <pagetext>
578                         <markup_code><![CDATA[
579
580
581                         
582                         <tcl>
583                         
584                         set form_address [formfetch form_address]
585                         set form_length [formfetch form_length]
586                         set form_type [formfetch form_type]
587                         set form_action [formfetch form_action]
588                         set form_value [formfetch form_value]
589                         
590                         if {[string compare $form_length ""]==0} {
591                                 set form_length 0
592                         }  
593                         if {$form_length<=0} {
594                                 set form_length 0x80
595                         } 
596                         if {$form_length>0x1000} {
597                                 set form_length 0x1000
598                         } 
599                         
600                         if {[string compare $form_type ""]==0} {
601                                 set form_type mdw
602                         }
603                         
604                         if {[string compare $form_type "mdw"]==0} {
605                                 set wordsize 4
606                                 set modify_cmd mww 
607                         }
608                         if {[string compare $form_type "mdh"]==0} {
609                                 set wordsize 2
610                                 set modify_cmd mwh 
611                         }
612                         if {[string compare $form_type "mdb"]==0} {
613                                 set wordsize 1
614                                 set modify_cmd mwb 
615                         }
616                         
617                         
618                         
619                         
620                         if {[string compare $form_address ""]!=0} {
621                                 if {[string compare $form_action "Previous"]==0} {
622                                         # Kludge! Work around problems parsing hex in Jim Tcl expressions
623                                         incr form_address ; set form_address [expr $form_address-1]
624                                         if {$form_address-$form_length>0} {
625                                                 set form_address "0x[tohex [expr $form_address-$form_length]]"
626                                         } else {
627                                                 set form_address "0x0"
628                                         }
629                                 }  
630                                 if {[string compare $form_action "Next"]==0} {
631                                         # Kludge! Work around problems parsing hex in Jim Tcl expressions
632                                         incr form_address ; set form_address [expr $form_address-1]
633                                         set form_address "0x[tohex [expr $form_address+$form_length]]"
634                                 }  
635                                 if {[string compare $form_action "Modify"]==0} {
636                                         append console [capture_catch "$modify_cmd $form_address $form_value"]
637                                 }  
638                                 if {[string compare $form_action "Fill"]==0} {
639                                         append console [capture_catch "$modify_cmd $form_address $form_value $form_length"]
640                                 }  
641                         }
642                         
643                         
644                         </tcl>
645                         
646                         <form action="browsemem.tcl" method="post"> 
647                                 <table>
648                                 <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>
649                                 <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer "0x[tohex $form_length]"</tcl>"></td></tr>
650                                 <tr><td class="formtext">Value</td><td><input type="text" name="form_value" value="<tcl>append buffer $form_value</tcl>"></td>
651                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Modify"></td>
652                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Fill"></td></tr>
653                                 <tr><td class="formtext">Type</td><td style="padding-top:1px;">
654                                 <select name="form_type">
655                                   <option 
656                                     <tcl>if {[string compare $form_type "mdb"]==0} { append buffer {selected="selected"} }  </tcl> value ="mdb">8 bit
657                                   </option>
658                                   <option 
659                                    <tcl>if {[string compare $form_type "mdh"]==0} { append buffer {selected="selected"} }  </tcl> value ="mdh">16 bit
660                                   </option>
661                                         <option
662                                            <tcl>if {[string compare $form_type "mdw"]==0} { append buffer {selected="selected"} }  </tcl>value ="mdw">32 bit
663                                         </option>
664                                 </select>
665                                 
666                                 </td></tr>
667                                 </table>
668                                 <table>
669                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
670                                         <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
671                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
672                                 </table>
673                         
674                                 <table><tr>
675                                         <td><input type="submit" name="form_action" value="Refresh"></td>
676                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Previous" ></td>
677                                         <td class="buttonspacesmall">&nbsp</td><td><input type="submit" name="form_action" value="Next" ></td>
678                                 </tr></table>
679                                 <br>
680                                 
681                         </form>
682                         <p>
683                         <div class="fontbigger">Memory:</div><p>
684                         <code style="white-space: nowrap; font-size:11px;font:courier new;">
685                                 <tcl>
686                                 if {[string compare $form_address ""]!=0} {
687                                         append console [encode [capture_catch halt]]
688                                         append buffer [encode [capture_catch "$form_type $form_address [expr $form_length]"]]
689                                 } 
690                                 </tcl>
691                         </code>
692
693
694                         
695
696                         
697                         ]]></markup_code>
698                         <right_column>
699                                 <![CDATA[
700                                 <p>Browse and edit target memory.<br>
701                                    Length is in bytes, maximum 4096 bytes.</p> 
702                                 <p>An error message is shown when trying to browse or edit memory which cases a CPU fault.</p>
703                                 <p>CPU will be halted if required.</p>
704                                 <p><b>Modify</b> - Will modify only one byte, half-word or word starting at Address.</p>
705                                 <p><b>Fill</b> - Will fill the specified region with the specified value.</p>
706                                 <p><b>Refresh</b> - Display the content of the specified memory area.</p>
707                                         ]]>
708                         </right_column>
709                         
710                         </pagetext>
711                 </page>
712
713                 
714
715
716                 <page lang="eng">
717                         <outfile>downloadmem.tcl</outfile>
718                         <level2parent>browsemem.tcl</level2parent>
719                         <pageheading>Download Memory Range</pageheading>
720                         <pagetext>
721                         <markup_code><![CDATA[
722                         <tcl>
723                                 set form_address [formfetch form_address]
724                                 set form_length [formfetch form_length]
725                                 set form_action [formfetch form_action]
726                         </tcl>                  
727                         <form action="downloadmem.tcl" method="post"> 
728                                 <table>
729                                 <tr><td class="formtext">Address</td><td><input type="text" name="form_address" value="<tcl>append buffer $form_address</tcl>"></td></tr>
730                                 <tr><td class="formtext">Length</td><td><input type="text" name="form_length" value="<tcl>append buffer $form_length</tcl>"></td></tr>
731                                 </td></tr>
732                                 </table>
733
734                                 <table>
735                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
736                                         <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
737                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
738                                 </table>
739                         
740                                 <input type="submit" value="Download" name="form_action">
741                                 
742                                 
743                         </form>
744                         <tcl>
745                                 if {[string compare $form_action "Download"]==0} {
746                                         append console [encode [capture_catch "reset init"]]
747                                         append console [encode [capture_catch "dump_image /tmp/dump.bin $form_address $form_length"]]
748                                         </tcl>
749                                         <form action="../dump.bin" target="_blank"> 
750                                                 <input type="submit" name="form_action" value="Save downloaded memory">
751                                         </form>
752                                         <tcl> 
753                                 }
754                                 
755                         </tcl>
756
757
758                         
759                         ]]></markup_code>
760                         <right_column>
761                                 <![CDATA[       
762                                 Download memory from target. <br>
763                                 <b>Note</b> that download memory can take
764                                 a long time(potentially minutes for megabytes at low JTAG clk speeds).
765                                 <p/>
766                                 Once the memory is downloaded a link is available on the page to download
767                                 the file to your PC.
768                                 ]]>
769                         </right_column>
770                         </pagetext>
771                         
772                 </page>
773
774
775
776                 <page lang="eng">
777                         <outfile>openocd.tcl</outfile>
778                         <menutext>OpenOCD</menutext> 
779                         <menulink>openocd.tcl</menulink> 
780                         <pageheading>Run Command</pageheading>
781                         <level2parent>openocd.tcl</level2parent>
782                         <level2menu href="openocd.tcl" title="Run Command" titlestyle="color:#4e6627;">
783                         </level2menu>
784                         <level2menu href="guiupload.tcl" title="Upload File" titlestyle="color:#4e6627;">
785                         <![CDATA[
786                             Upload file
787                         ]]>
788                         </level2menu>
789                         
790                         <pagetext>
791                         <markup_code><![CDATA[
792
793                         <tcl>
794                                 set form_command [formfetch form_command]
795
796                                 set form_edittext ""
797                                 if {[string length $form_command]>0} {
798                                         set form_edittext [capture_catch {eval $form_command}]
799                                 }
800                                 
801                                 append buffer {<form action="openocd.tcl" method="post">} "\n"
802                                 append buffer {Command<br>}
803                                 append buffer {<textarea  style="overflow:auto;"  rows="5" cols="65" name="form_command" wrap="off">}
804                                 append buffer [to_textarea $form_command]
805                                 append buffer {</textarea><br>}
806                                 append buffer {<input type="submit" value="Run" name="form_action" ><br>}
807                                 append buffer {<textarea  style="overflow:auto;"  rows="21" cols="65" name="form_edittext" readonly=1 wrap="off">}
808                                 append buffer [to_textarea $form_edittext]
809                                 append buffer {</textarea><br>}
810                                 
811                                 append buffer {</form>} "\n"
812                         
813                         </tcl>
814
815                         ]]></markup_code>
816                         
817                         <right_column>
818                                 <![CDATA[
819                                 <p>Run tcl statement(s). Add "ocd_" prefix to OpenOCD commands otherwise
820                                 there will be no output, e.g. "reset init" use "ocd_reset init".
821                                 <p/>
822                                 <p><a href="/ram/log">Click here to download log</a>.</p>
823                                 <p>To download log you can also use commands like "wget http://<tcl>append buffer [ip]</tcl>/ram/log", or
824                                 point your web browser to said address.</p>
825                                 <p>
826                                 You can also execute tcl commands using curl from your developer PC:
827                                 </p>
828                                 <code>
829                                 curl --form form_command=ocd_version <tcl>append buffer [ip]</tcl>runtcl.tcl
830                                 </code>
831                                 
832                                 ]]>
833                         </right_column>
834                         </pagetext>
835                 </page>
836
837                 
838                 
839                 <page lang="eng">
840                         <outfile>guiupload.tcl</outfile>
841                         <level2parent>openocd.tcl</level2parent>
842                         <pageheading>Upload File</pageheading>
843                         <pagetext>
844                         <markup_code><![CDATA[
845                         
846                         <tcl>
847                                 set form_filename [formfetch form_filename];
848                                 set form_action [formfetch form_action];
849                                 #set form_filecontent [formfetch form_filecontent];
850                                 
851                                 append buffer {<form enctype="multipart/form-data" action="guiupload.tcl" method="post">}
852                                 append buffer <br> 
853                                 if {[string compare $form_action "Upload"]==0} {
854                                         if {[catch {writeform form_filecontent $form_filename} result]==0} {
855                                                 append buffer [encode $result]
856                                         } else {
857                                                 append buffer Wrote $form_filename
858                                         }
859                                 }
860                                 
861                                 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>}
862                                 append buffer {<td class="formtext">File to upload</td><td><input type="file" name="form_filecontent"></td></tr></table>}
863                                 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>}
864                                 append buffer {<input type="submit" name="form_action" value="Upload" ><br> }
865                                 append buffer {</form>}
866                         
867                         </tcl>
868                         
869                         ]]></markup_code>
870                         </pagetext>
871                         
872                 </page>
873                 
874
875
876                 <page lang="eng">
877                         <outfile>targets.tcl</outfile>
878                         <level2parent>documentation.tcl</level2parent>
879                         <pageheading>Target config quick start guide</pageheading>
880                         <pagetext>
881                                 <markup_code><![CDATA[
882                                 
883                                 A target needs an openocd.cfg file. This config file sets up
884                                 the CPU, flash and reset init script. Either OpenOCD ships with an
885                                 openocd.cfg file for your target or you need to take an existing
886                                 config file and modify it for your needs.
887                                 <p> 
888                                 The reset init script is crucial. It will set up e.g. MMU, chip
889                                 select registers, etc. after a reset. The init.cfg (reset init script)
890                                 is embedded into the openocd.cfg file in the sampls OpenOCD provides.
891                                 <p>
892                                 Writing an openocd.cfg from scratch is a non-trivial exercise, but
893                                 fortunally it only has to be done once for a target and afterwards it
894                                 rarely if ever needs to be changed.
895                                 
896                                 
897                                 ]]></markup_code>
898                                 <right_column>
899                                         
900                                           Quick start guide on how to configure a target.
901                                 </right_column>
902                         </pagetext>
903                         
904                         
905                 </page>
906
907
908                 
909
910
911                 <page lang="eng">
912                         <menulink>index.tcl</menulink> 
913                         <level2parent>index.tcl</level2parent>
914                         <outfile>terminal.tcl</outfile>
915                         <pageheading>UART forwarding</pageheading>
916                         <pagetext>
917                         <markup_code><![CDATA[
918                         <tcl>
919                                 set form_baudrate [formfetch form_baudrate]
920                                 if {[string length $form_baudrate]==0} {
921                                         set form_baudrate [ocd_uart]
922                                         set form_baudrate [string range $form_baudrate 0 [expr [string length $form_baudrate]-2]]
923                                 }
924                                 set form_action [formfetch form_action]
925                         </tcl>
926                         <form action="terminal.tcl" method="post">
927                                 Target baudrate: 
928                                         <select name="form_baudrate">
929                                                 <tcl>
930                                                         foreach i {9600 19200 38400 57600 115200} { 
931                                                         </tcl>
932                                                                 <option <tcl>if {[string compare $form_baudrate $i]==0} { append buffer {selected="selected"} }  </tcl>
933                                                                 value ="<tcl>append buffer $i</tcl>"><tcl>append buffer $i</tcl></option>
934                                                         <tcl>
935                                                         }
936                                                         </tcl>
937                                                 </select>
938
939                                         <p>     
940                                         <input type="submit" name="form_action" value="Set baudrate" >
941                                 </form>                 
942                         <tcl>
943                                 if {[string compare $form_action "Set baudrate"]==0} {
944                                         append console [encode [ocd_uart $form_baudrate]]
945                                 }
946                         </tcl>
947                         
948                         <h2>Simple UART</h2>
949                         This terminal window is purely for illustrative purposes. Use telnet or a terminal program
950                         to talk to the target over TCP/IP for anything but trivial case of reading/writing a few
951                         lines of texts in simple tests.
952                         <p>
953                         ]]></markup_code>
954                         <right_column>
955                                 <![CDATA[
956                                 Serial port data to target is forwarded(both directions) in the simple terminal window
957                                 to the left. Alternatively you can <b>telnet <tcl>append buffer [ip]</tcl> 5555</b>
958                                 or connect via TCP/IP from e.g. HyperTerminal.
959                                 <p>
960                                 Type "help uart" in telnet for information on how to set uart speed for target. Normally
961                                 the uart speed is set from the target configuration script by adding an "uart N", where
962                                 N is the baudrate.
963                                 ]]>
964                         </right_column>
965                         </pagetext>
966                         
967                 </page>
968
969
970                 
971         </language>
972         
973 </website>