]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-dss-files/am335x-dss-files.git/blob - am335x-ctt.dss
Add extra robustness with try/catch statements
[sitara-dss-files/am335x-dss-files.git] / am335x-ctt.dss
1 /*\r
2  * Copyright (c) 2006-2014, Texas Instruments Incorporated\r
3  * All rights reserved.\r
4  *\r
5  * Redistribution and use in source and binary forms, with or without\r
6  * modification, are permitted provided that the following conditions\r
7  * are met:\r
8  *\r
9  * *  Redistributions of source code must retain the above copyright\r
10  *    notice, this list of conditions and the following disclaimer.\r
11  *\r
12  * *  Redistributions in binary form must reproduce the above copyright\r
13  *    notice, this list of conditions and the following disclaimer in the\r
14  *    documentation and/or other materials provided with the distribution.\r
15  *\r
16  * *  Neither the name of Texas Instruments Incorporated nor the names of\r
17  *    its contributors may be used to endorse or promote products derived\r
18  *    from this software without specific prior written permission.\r
19  *\r
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\r
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\r
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31  *\r
32  */\r
33 \r
34 var ctt_registers = [\r
35         0x44e00000,\r
36         0x44e00004,\r
37         0x44e00008,\r
38         0x44e0000c,\r
39         0x44e00010,\r
40         0x44e00014,\r
41         0x44e00018,\r
42         0x44e0001c,\r
43         0x44e00020,\r
44         0x44e00024,\r
45         0x44e00028,\r
46         0x44e0002c,\r
47         0x44e00030,\r
48         0x44e00034,\r
49         0x44e00038,\r
50         0x44e0003c,\r
51         0x44e00040,\r
52         0x44e00044,\r
53         0x44e00048,\r
54         0x44e0004c,\r
55         0x44e00050,\r
56         0x44e00054,\r
57         0x44e00058,\r
58         0x44e00060,\r
59         0x44e00064,\r
60         0x44e00068,\r
61         0x44e0006c,\r
62         0x44e00070,\r
63         0x44e00074,\r
64         0x44e00078,\r
65         0x44e0007c,\r
66         0x44e00080,\r
67         0x44e00084,\r
68         0x44e00088,\r
69         0x44e0008c,\r
70         0x44e00090,\r
71         0x44e00094,\r
72         0x44e00098,\r
73         0x44e0009c,\r
74         0x44e000a0,\r
75         0x44e000a4,\r
76         0x44e000a8,\r
77         0x44e000ac,\r
78         0x44e000b0,\r
79         0x44e000b4,\r
80         0x44e000b8,\r
81         0x44e000bc,\r
82         0x44e000c0,\r
83         0x44e000c4,\r
84         0x44e000c8,\r
85         0x44e000cc,\r
86         0x44e000d0,\r
87         0x44e000d4,\r
88         0x44e000d8,\r
89         0x44e000dc,\r
90         0x44e000e0,\r
91         0x44e000e4,\r
92         0x44e000e8,\r
93         0x44e000ec,\r
94         0x44e000f0,\r
95         0x44e000f4,\r
96         0x44e000f8,\r
97         0x44e000fc,\r
98         0x44e00100,\r
99         0x44e00104,\r
100         0x44e0010c,\r
101         0x44e00110,\r
102         0x44e0011c,\r
103         0x44e00120,\r
104         0x44e00124,\r
105         0x44e00128,\r
106         0x44e0012c,\r
107         0x44e00130,\r
108         0x44e00134,\r
109         0x44e00138,\r
110         0x44e0013c,\r
111         0x44e00140,\r
112         0x44e00144,\r
113         0x44e00148,\r
114         0x44e0014c,\r
115         0x44e00150,\r
116         0x44e00400,\r
117         0x44e00404,\r
118         0x44e00408,\r
119         0x44e0040c,\r
120         0x44e00410,\r
121         0x44e00414,\r
122         0x44e00418,\r
123         0x44e0041c,\r
124         0x44e00420,\r
125         0x44e00424,\r
126         0x44e00428,\r
127         0x44e0042c,\r
128         0x44e00430,\r
129         0x44e00434,\r
130         0x44e00438,\r
131         0x44e0043c,\r
132         0x44e00440,\r
133         0x44e00444,\r
134         0x44e00448,\r
135         0x44e0044c,\r
136         0x44e00450,\r
137         0x44e00454,\r
138         0x44e00458,\r
139         0x44e0045c,\r
140         0x44e00460,\r
141         0x44e00464,\r
142         0x44e00468,\r
143         0x44e0046c,\r
144         0x44e00470,\r
145         0x44e00474,\r
146         0x44e00478,\r
147         0x44e0047c,\r
148         0x44e00480,\r
149         0x44e00484,\r
150         0x44e00488,\r
151         0x44e0048c,\r
152         0x44e00490,\r
153         0x44e00494,\r
154         0x44e00498,\r
155         0x44e0049c,\r
156         0x44e004a0,\r
157         0x44e004a4,\r
158         0x44e004a8,\r
159         0x44e004ac,\r
160         0x44e004b0,\r
161         0x44e004b4,\r
162         0x44e004b8,\r
163         0x44e004bc,\r
164         0x44e004c0,\r
165         0x44e004c4,\r
166         0x44e004c8,\r
167         0x44e004cc,\r
168         0x44e004d0,\r
169         0x44e004d4,\r
170         0x44e004d8,\r
171         0x44e00504,\r
172         0x44e00508,\r
173         0x44e0050c,\r
174         0x44e00510,\r
175         0x44e00514,\r
176         0x44e00518,\r
177         0x44e0051c,\r
178         0x44e00520,\r
179         0x44e00528,\r
180         0x44e0052c,\r
181         0x44e00530,\r
182         0x44e00534,\r
183         0x44e00538,\r
184         0x44e0053c,\r
185         0x44e00600,\r
186         0x44e00604,\r
187         0x44e00700,\r
188         0x44e00800,\r
189         0x44e00804,\r
190         0x44e00900,\r
191         0x44e00904,\r
192         0x44e00908,\r
193         0x44e0090c,\r
194         0x44e00910,\r
195         0x44e00914,\r
196         0x44e00a00,\r
197         0x44e00a20,\r
198         0x44e00b00,\r
199         0x44e00b04,\r
200         0x44e00b08,\r
201         0x44e00b0c,\r
202         0x44e00b10,\r
203         0x44e00c00,\r
204         0x44e00c04,\r
205         0x44e00c08,\r
206         0x44e00c0c,\r
207         0x44e00d00,\r
208         0x44e00d04,\r
209         0x44e00d08,\r
210         0x44e00d0c,\r
211         0x44e00e00,\r
212         0x44e00e04,\r
213         0x44e00e08,\r
214         0x44e00f00,\r
215         0x44e00f04,\r
216         0x44e00f08,\r
217         0x44e00f0c,\r
218         0x44e00f10,\r
219         0x44e00f14,\r
220         0x44e00f18,\r
221         0x44e00f1c,\r
222         0x44e01000,\r
223         0x44e01004,\r
224         0x44e01100,\r
225         0x44e01104,\r
226         0x44e01110,\r
227         0x44e01114,\r
228         0x44e01200,\r
229         0x44e01204,\r
230         0x44e10040];\r
231 \r
232 debugSessionDAP = ds.openSession("*","CS_DAP_M3");\r
233 debugSessionDAP.target.connect();\r
234 \r
235 //Build a filename that includes date/time\r
236 var today = new Date();\r
237 var year4digit = today.getFullYear();\r
238 var month2digit = ("0" + (today.getMonth()+1)).slice(-2);\r
239 var day2digit = ("0" + today.getDate()).slice(-2);\r
240 var hour2digit = ("0" + today.getHours()).slice(-2);\r
241 var minutes2digit = ("0" + today.getMinutes()).slice(-2);\r
242 var seconds2digit = ("0" + today.getSeconds()).slice(-2);\r
243 var filename_date = '_' + year4digit + '-' + month2digit + '-' + day2digit + '_' + hour2digit + minutes2digit + seconds2digit; \r
244 var userHomeFolder = System.getProperty("user.home");\r
245 var filename = userHomeFolder + '/Desktop/' + 'am335x-ctt' + filename_date + '.rd1';\r
246 \r
247 file = new java.io.FileWriter(filename);\r
248 file.write("DeviceName AM335x1.0\n");\r
249 \r
250 // helper function to create 8-digit hex numbers in ascii format\r
251 function d2h(d) {return ("00000000" + (+d).toString(16)).slice(-8);}\r
252 \r
253 // read CTT data from physical addresses\r
254 for(i=0; i<ctt_registers.length; i++)\r
255 {\r
256         value = debugSessionDAP.memory.readWord(0,ctt_registers[i],false);\r
257         value_string = d2h(value);\r
258         file.write('0x' + ("0000" + ctt_registers[i].toString(16)).slice(-8) + " 0x" + value_string + "\n");\r
259 }\r
260 print("Data collection complete.");\r
261 \r
262 file.close();\r
263 debugSessionDAP.target.disconnect();\r
264 print("Created file " + filename);\r
265 \r