whitespace cleanup, mostly for docs
[fw/openocd] / src / server / httpd / flash.tcl
1 # converted to .tcl by html2tcl.tcl
2 set buffer ""
3 append buffer {
4         
5         
6
7                 
8                 
9                 
10
11
12                 
13
14
15
16                 
17                 
18
19                 <html xmlns="http://www.w3.org/TR/REC-html40">
20 <head>
21 <title>OpenOCD debugger</title>
22 <meta charset="utf-8" content="text/html" http-equiv="Content-Type"/>
23 <link type="text/css" rel="stylesheet" href="menuweb.css"/>
24 </head>
25 }
26
27                                 set console ""
28                                 set upload_filename /ram/upload
29                         
30 append buffer {
31 <body style="margin:0px;">
32 <div style="width:974px;height:85px;">
33 <div style="float:left;position:relative;left:32px;width:478px;">
34 <a href="/">
35                                                         OpenOCD
36                                                 </a>
37 </div>
38 <div style="float:left;position:relative;height:26px; width:278px;left:122px;background-image:url('menu_cuts/top_right.png');">
39 <div style="position:relative;left:15px;top:4px;" class="textlight">
40 }
41 append buffer [capture version]
42 append buffer {
43 </div>
44 </div>
45 </div>
46 <table style="padding:0px;border-collapse:collapse;">
47 <tr>
48 <td style="width:33px;">
49 <div style="width:20px;height:510px;">
50                                                                 &nbsp;
51                                                         </div>
52 </td>
53 <td style="vertical-align:top;height:100%;width:140px;padding:0px;">
54 <table style="padding:0px;border-collapse:collapse;height:100%;width:140px;">
55 <tr style="height:59px;">
56 <td/>
57 </tr>
58 <tr>
59 <td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">
60 <div style="position:relative;left:10px;top:10px;font-weight:bold;">
61 <a href="flashinfo.tcl" style="">Info</a>
62 </div>
63 </td>
64 </tr>
65 <tr>
66 <td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">
67 <div style="position:relative;left:10px;top:10px;font-weight:bold;">
68 <a href="erase.tcl" style="">Erase</a>
69 </div>
70 </td>
71 </tr>
72 <tr>
73 <td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab_selected.png');background-repeat: no-repeat;">
74 <div style="position:relative;left:10px;top:10px;font-weight:bold;">
75 <a href="flash.tcl" style="font-weight: bold;">Program / Verify</a>
76 </div>
77 </td>
78 </tr>
79 <tr>
80 <td style="width:140px;height:38px;background-image:url('menu_cuts/v_tab.png');background-repeat: no-repeat;">
81 <div style="position:relative;left:10px;top:10px;font-weight:bold;">
82 <a href="production.tcl" style="">Production</a>
83 </div>
84 </td>
85 </tr>
86 <tr>
87 <td style="width:140px;height:35px;background-image:url('menu_cuts/v_1.png')"/>
88 </tr>
89 <tr>
90 <td style="width:140px;background-image:url('menu_cuts/v_2_tile.png')"/>
91 </tr>
92 <tr>
93 <td style="width:140px;height:140px;background-image:url('menu_cuts/v_3.png')"/>
94 </tr>
95 </table>
96 </td>
97 <td style="vertical-align:top;padding:0px;height:100%">
98 <table style="padding:0px;border-collapse:collapse;height:100%;">
99 <tr>
100 <td>
101 <table style="padding:0px;border-collapse:collapse;">
102 <tr>
103 <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">
104 <div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
105 <a href="index.tcl">Config Target</a>
106 </div>
107 </td>
108 <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1_selected.png');background-repeat: no-repeat;">
109 <div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
110 <a href="flashinfo.tcl" style="font-weight: bold;">Flash</a>
111 </div>
112 </td>
113 <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">
114 <div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
115 <a href="browsemem.tcl">Memory</a>
116 </div>
117 </td>
118 <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab1.png');background-repeat: no-repeat;">
119 <div style="position:relative;top:7px;font-weight:bold;text-align:center;width:100px;">
120 <a href="openocd.tcl">OpenOCD</a>
121 </div>
122 </td>
123 </tr>
124 </table>
125 </td>
126 </tr>
127 <tr>
128 <td style="height:30px;width:535px;background-image:url('menu_cuts/center_top.png');background-repeat: no-repeat;background-position:top right;" colspan="6">
129 <div style="width:500px;background-color:#ffffff;height:100%;">
130                                                                                         &nbsp;
131                                                                                 </div>
132 </td>
133 </tr>
134 <tr>
135 <td style="background-color:#ffffff;text-indent:30px;height:40px;" colspan="6">
136 <H1>Program / Verify Flash</H1>
137 </td>
138 </tr>
139 <tr style="height:100%;">
140 <td style="background-color:#ffffff;padding-left:30px;padding-right:30px;width=535px;height:100%;" colspan="6">
141                         
142                         }
143
144                         
145                         set form_offset [formfetch form_offset]
146                         set form_action [formfetch form_action]
147                         set form_type [formfetch form_type]
148                         
149                         
150                         set post ""
151                         catch {set post $post_data} err
152                         
153                         if {[string compare $form_offset ""]==0} {
154                                 set form_offset 0
155                         }
156                         if {[string compare $form_type ""]==0} {
157                                 set form_type ""
158                         }
159                         
160                         
161 append buffer {<code style="white-space: nowrap;">}
162
163                         
164                         set data ""
165                         append buffer {<form enctype="multipart/form-data" action="flash.tcl" method="post">}
166                         
167                         set action_reset [expr {[string length $form_action]!=0}] 
168                         set action_flash [expr {[string compare $form_action "Flash"]==0 || [string compare $form_action "Flash and verify"]==0}] 
169                         set action_verify [expr {[string compare $form_action "Verify"]==0 || [string compare $form_action "Flash and verify"]==0}]
170                         
171                         if {$action_reset} {
172                                 append console [encode [capture_catch "reset init"]]
173                         }
174                         
175 append buffer {
176                         </code>}
177
178                                 
179                         append buffer {<table>}
180                         append buffer {<tr><td class="formtext">File</td><td><input type="file" name="form_filecontent"></td></tr>}
181                         append buffer "<tr><td class=\"formtext\" >Offset</td><td><input type=\"text\" name=\"form_offset\" value=\"$form_offset\"></td></tr>"
182                         
183                         
184 append buffer {
185                         <tr><td class="formtext" style="padding-top:1px;">Type</td><td>
186                         <select name="form_type">
187                                         <option
188                            }
189 if {[string compare $form_type ""]==0} { append buffer {selected="selected"} }  
190 append buffer {
191                                         value ="">auto</option>
192                           <option 
193                            }
194 if {[string compare $form_type "elf"]==0} { append buffer {selected="selected"} }  
195 append buffer {
196                           value ="elf">elf</option>
197                           <option 
198                            }
199 if {[string compare $form_type "bin"]==0} { append buffer {selected="selected"} }  
200 append buffer {
201                           value ="bin">binary</option>
202                           <option 
203                            }
204 if {[string compare $form_type "ihex"]==0} { append buffer {selected="selected"} }  
205 append buffer {
206                           value ="ihex">ihex</option>
207                           <!-- broken <option value ="s19">s19</option> -->
208                         </select>
209                         </td>
210                         
211                         </tr>
212                         
213                         
214                         </table>
215                         
216                                 <table>
217                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
218                                         <tr><td style="height:1px;width:535px;background-color:#a2c5d1;"></td></tr>
219                                         <tr><td style="height:15px;width:535px;">&nbsp</td></tr>
220                                 </table>
221                         
222                         <table><tr>
223                                 <td><input type="submit" name="form_action" value="Flash" ></td>
224                                 <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Flash and verify" ></td>
225                                 <td class="buttonspacesmall"></td><td><input type="submit" name="form_action" value="Verify" ></td>
226                         </tr></table>
227                 
228                         <p>
229                         }
230
231                         
232                         if {$action_flash||$action_verify} {
233                                 catch {writeform form_filecontent $upload_filename} result
234                                 append console [encode $result]
235                         }
236                         append buffer "<br>"
237                         if {$action_flash} {
238                                 append console [encode [capture_catch "halt"]]
239                                 append buffer "<b>"
240                                 if {[catch {capture_catch {eval "flash write_image erase $upload_filename $form_offset $form_type"}} result]} {
241                                         append buffer "Flash write failed<br>"
242                                         append console [encode $result]
243                                 } else {
244                                         append buffer [encode $result]
245                                         append buffer "Flash write succeed<br>"
246                                 }
247                                 append buffer "</b>"
248                         }
249                         if {$action_verify} {
250                                 append console [encode [capture_catch "halt"]]
251                                 append buffer "<b>"
252                                 if {[catch {capture_catch {eval "verify_image $upload_filename $form_offset $form_type"}} result]} {
253                                         append buffer "Verify failed<br>"
254                                         append console [encode $result]
255                                 } else {
256                                         append buffer [encode $result]
257                                         append buffer "Verify succeed<br>"
258                                 }
259                                 append buffer "</b>"
260                         }
261                         
262 append buffer {         
263                                 
264                         </form>
265                         
266                         </td>
267 </tr>
268 }
269
270                                                                         
271                                                                         set toggle_details [formfetch toggle_details]
272                                                                         if {[string length $toggle_details]==0} {
273                                                                                 set toggle_details 0
274                                                                         }
275                                                                         set show_details [load_var show_details]
276                                                                         if {[string length $show_details]==0} {
277                                                                                 set show_details 0
278                                                                         }
279                                                                         if {$toggle_details==1} {
280                                                                                 set show_details [expr 1-$show_details]
281                                                                                 save_var show_details $show_details
282                                                                         }
283                                                                         
284                                                                         if {[string length $console]!=0} {
285                                                                                 
286 append buffer {
287 <tr style="height:100%;">
288 <td style="height:100%;background-color:red;" colspan="6">
289 <table style="padding:0px;border-collapse:collapse;background-color:#ffffff;width:100%" class="textgray">
290 <td style="width:25px;">&nbsp;</td>
291 }
292
293                                                                                                                 if {$show_details==1} {
294                                                                                                                         append buffer <
295                                                                                                                         append buffer {td style="background-color:#dddddd;padding-left:5px;padding-right:5px;padding-top:3px;padding-bottom:3px;"}
296                                                                                                                         append buffer >
297                                                                                                                 } else {
298                                                                                                                         append buffer <
299                                                                                                                         append buffer {td style="background-image:url('menu_cuts/h_tab_free.png');width:110px;height:29px;background-repeat: no-repeat;background-position:top left;"}
300                                                                                                                         append buffer >
301                                                                                                                 }
302                                                                                                         
303 append buffer {
304 <a class="openocd" href="flash.tcl?toggle_details=1">
305 }
306
307                                                                                                                         if {$show_details==1} {
308                                                                                                                                 append buffer "Hide details"
309                                                                                                                                 append buffer <br/>
310                                                                                                                         } else {
311                                                                                                                                 append buffer {<div style="position:relative;top:7px;text-align:center;">}
312                                                                                                                                 append buffer "Show details"
313                                                                                                                                 append buffer {</div>}
314                                                                                                                         }
315                                                                                                                         
316 append buffer {
317 </a>
318 }
319
320                                                                                                                         if {$show_details==1} {
321                                                                                                                                 append buffer $console
322                                                                                                                         }
323                                                                                                                 
324 append buffer {</td>}
325
326                                                                                                                 if {$show_details!=1} {
327                                                                                                                         append buffer {<td>&nbsp;</td>}
328                                                                                                                 }
329                                                                                                          
330 append buffer {
331 <td style="width:25px;">&nbsp;</td>
332 </table>
333 </td>
334 </tr>
335 }
336
337                                                                          }
338                                                                 
339 append buffer {
340 <tr>
341 <td style="height:30px;background-image:url('menu_cuts/center_bottom.png');background-repeat: no-repeat;background-position:top right;" colspan="6">
342 <div style="width:500px;background-color:#ffffff;height:100%;">
343                                                                                         &nbsp;
344                                                                                 </div>
345 </td>
346 </tr>
347 </table>
348 </td>
349 <td style="width:6px;"/>
350 <td style="width:245px;height:100%">
351 <table style="padding:0px;border-collapse:collapse;height:100%;">
352 <tr>
353 <td style="width:103px;height:29px;background-image:url('menu_cuts/h_tab2_selected.png');background-repeat: no-repeat;">
354 <div style="position:relative;top:7px;;font-weight:bold;text-align:center;width:100px;" class="textgray">
355                                                                                     Documentation
356                                                                                  </div>
357 </td>
358 <td width="40px">
359                                                                                 &nbsp;
360                                                                         </td>
361 <td/>
362 </tr>
363 <tr>
364 <td style="height:10px;width:245px;background-image:url('menu_cuts/right_top_small.png');" colspan="3"/>
365 </tr>
366 <tr>
367 <td style="background-color:#d8d7d7;width:245px;padding-left:10px;padding-buttom:10px;line-height:17px;" colspan="3">
368 <a target="_blank" href="http://openocd.berlios.de/doc/openocd.pdf">OpenOCD Manual</a>
369 <br/>
370 </td>
371 </tr>
372 <tr>
373 <td style="background-color:#d8d7d7;height:15px;" colspan="3"/>
374 </tr>
375 <tr>
376 <td colspan="3">
377 <table style="padding:0px;border-collapse:collapse;">
378 <td style="background-color:#d8d7d7;width:10px;height:1px"/>
379 <td style="background-color:#999999;width:225px; height:1px;"/>
380 <td style="background-color:#d8d7d7;width:10px;height:1px"/>
381 </table>
382 </td>
383 </tr>
384 <tr>
385 <td style="background-color:#d8d7d7;height:15px;" colspan="3"/>
386 </tr>
387 <tr style="height:100%;">
388 <td style="height:100%;background-color:#d8d7d7;padding-left:10px;padding-right:10px;" colspan="3" class="textgray">
389                                 
390                                 <p>Program and/or verify the flash on your target.</p>
391                                 <p><b>Flash</b> - Halt CPU, automatically erase flash if required and program flash with image.</p>
392                                 <p><b>Flash and verify</b> - Programs the flash and verifies the programmed flash content is correct.</p>
393                                 <p><b>Verify</b> - Halt CPU and verify image in flash or RAM.</p>
394                                 <p><b>Offset</b> - This value is added to the address of the image.<br> 
395                                         Binary images start at address 0 by default, whereas elf and ihex have addresses encoded into the image.<br> 
396                                         Typically 0 for elf/ihex and the address to     write the image to for binary files.</p>
397                                          
398                         </td>
399 </tr>
400 <tr>
401 <td style="height:30px;background-image:url('menu_cuts/right_bottom.png');" colspan="3">
402                                                                                 &nbsp;
403                                                                         </td>
404 </tr>
405 </table>
406 </td>
407 </tr>
408 </table>
409 </body>
410 </html>
411
412
413
414
415                 
416
417
418
419                 
420
421
422                 
423
424
425                 
426
427                 
428
429
430                 
431
432
433
434                 
435
436                 
437                 
438                 
439                 
440
441
442                 
443
444
445                 
446
447
448                 
449
450
451                 
452         
453         
454 }
455
456 start_chunked "html"
457 write_chunked $buffer
458 end_chunked
459