@@ -1,332 +1,330 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "dsu3plugin.h" |
|
23 | 23 | #include <QFileDialog> |
|
24 | 24 | #include <QDir> |
|
25 | 25 | #include <socexplorerengine.h> |
|
26 | 26 | |
|
27 | 27 | |
|
28 | 28 | struct acceptedMemctrlr_str |
|
29 | 29 | { |
|
30 | 30 | int vid; |
|
31 | 31 | int pid; |
|
32 | 32 | const char* name; |
|
33 | 33 | }; |
|
34 | 34 | |
|
35 | 35 | const struct acceptedMemctrlr_str acceptedMemctrlr[]= |
|
36 | 36 | { |
|
37 | 37 | {0x04,0x0f,"MCTRL"}, |
|
38 | 38 | {0x01,0x51,"FTSRCTRL"}, |
|
39 | 39 | {0x20,0x01,"SRCTRLE_0WS" }, |
|
40 | 40 | {0x20,0x02,"SRCTRLE_1WS" } |
|
41 | 41 | }; |
|
42 | 42 | |
|
43 | 43 | #define acceptedMemctrlrCnt 4 |
|
44 | 44 | |
|
45 | 45 | dsu3plugin::dsu3plugin(QWidget *parent):socexplorerplugin(parent,false) |
|
46 | 46 | { |
|
47 | 47 | this->UI = new dsu3pluginui(); |
|
48 | 48 | this->setWidget((QWidget*)this->UI); |
|
49 |
this->elf |
|
|
50 | // this->pyObject = new dsu3pluginPywrapper(this); | |
|
51 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString))); | |
|
52 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget())); | |
|
53 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run())); | |
|
54 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop())); | |
|
55 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheEnable()),this,SLOT(cacheEnable())); | |
|
56 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheDisable()),this,SLOT(cacheDisable())); | |
|
57 | // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(setCacheEnable(bool)),this,SLOT(setCacheEnable(bool))); | |
|
58 | ||
|
49 | this->elfFile = new ElfFile(); | |
|
59 | 50 | connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile())); |
|
60 | 51 | connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget())); |
|
61 | 52 | connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun())); |
|
62 |
connect(this,SIGNAL(updateInfo( |
|
|
53 | connect(this,SIGNAL(updateInfo(ElfFile*)),this->UI,SLOT(updateInfo(ElfFile*))); | |
|
63 | 54 | this->running = false; |
|
64 | 55 | } |
|
65 | 56 | |
|
66 | 57 | |
|
67 | 58 | dsu3plugin::~dsu3plugin() |
|
68 | 59 | { |
|
69 | 60 | |
|
70 | 61 | } |
|
71 | 62 | |
|
72 | 63 | |
|
73 | 64 | void dsu3plugin::openFile() |
|
74 | 65 | { |
|
75 | 66 | QString filename = QFileDialog::getOpenFileName(this,tr("Open elf File"), QDir::homePath(), tr("Elf Files (*)")); |
|
76 | 67 | if(filename!="") |
|
77 | 68 | { |
|
78 | 69 | this->openFile(filename); |
|
79 | 70 | } |
|
80 | 71 | } |
|
81 | 72 | |
|
82 | 73 | void dsu3plugin::openFile(QString fileName) |
|
83 | 74 | { |
|
84 |
this->elf |
|
|
85 |
emit this->updateInfo(this->elf |
|
|
75 | this->elfFile->openFile(fileName); | |
|
76 | emit this->updateInfo(this->elfFile); | |
|
86 | 77 | } |
|
87 | 78 | |
|
88 | 79 | bool dsu3plugin::configureTarget() |
|
89 | 80 | { |
|
90 | 81 | int detectedMctrlr=-1; |
|
91 | 82 | if(parent==NULL) |
|
92 | 83 | return false; |
|
93 | 84 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
|
94 | 85 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
95 | 86 | DSUBASEADDRESS = 0x90000000; |
|
96 | 87 | unsigned int MCTRLBASEADDRESS =-1; |
|
97 | 88 | for(int i=0; i<acceptedMemctrlrCnt;i++) |
|
98 | 89 | { |
|
99 | 90 | MCTRLBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,acceptedMemctrlr[i].vid , acceptedMemctrlr[i].pid,0); |
|
100 | 91 | if(MCTRLBASEADDRESS != (unsigned int)-1) |
|
101 | 92 | { |
|
102 | 93 | SocExplorerEngine::message(this,QString("Found %1 @%2").arg(acceptedMemctrlr[i].name).arg(MCTRLBASEADDRESS,8,16),1); |
|
103 | 94 | detectedMctrlr=i; |
|
104 | 95 | break; |
|
105 | 96 | } |
|
106 | 97 | } |
|
107 | 98 | if(MCTRLBASEADDRESS == (unsigned int)-1) |
|
108 | 99 | { |
|
109 | 100 | SocExplorerEngine::message(this,"Can't any compatible memory controller",1); |
|
110 | 101 | return false; |
|
111 | 102 | } |
|
112 | 103 | |
|
113 | 104 | |
|
114 | 105 | //Force a debug break |
|
115 | 106 | WriteRegs(uIntlist()<<0x0000002f,(unsigned int)DSUBASEADDRESS); |
|
116 | 107 | WriteRegs(uIntlist()<<0x0000ffff,(unsigned int)DSUBASEADDRESS+0x20); |
|
117 | 108 | //Clear time tag counter |
|
118 | 109 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x8); |
|
119 | 110 | |
|
120 | 111 | //Clear ASR registers |
|
121 | 112 | WriteRegs(uIntlist()<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400040); |
|
122 | 113 | WriteRegs(uIntlist()<<0x2,(unsigned int)DSUBASEADDRESS+0x400024); |
|
123 | 114 | WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); |
|
124 | 115 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x48); |
|
125 | 116 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x000004C); |
|
126 | 117 | WriteRegs(uIntlist()<<0,(unsigned int)DSUBASEADDRESS+0x400040); |
|
127 | 118 | |
|
128 | 119 | // {0x04,0x0f,"MCTRL"}, |
|
129 | 120 | // {0x01,0x51,"FTSRCTRL"}, |
|
130 | 121 | // {0x20,0x01,"SRCTRLE_0WS" }, |
|
131 | 122 | // {0x20,0x02,"SRCTRLE_1WS" } |
|
132 | 123 | if(QString(acceptedMemctrlr[detectedMctrlr].name)=="MCTRL" || QString(acceptedMemctrlr[detectedMctrlr].name)=="FTSRCTRL" ) |
|
133 | 124 | { |
|
134 | 125 | WriteRegs(uIntlist()<<0x2FF<<0xE60<<0,(unsigned int)MCTRLBASEADDRESS); |
|
135 | 126 | } |
|
136 | 127 | if(QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_0WS" || QString(acceptedMemctrlr[detectedMctrlr].name)=="SRCTRLE_1WS" ) |
|
137 | 128 | { |
|
138 | 129 | //let's perform a mem Wash |
|
139 | 130 | unsigned int val = ReadReg(MCTRLBASEADDRESS); |
|
140 | 131 | val |=1<<31; |
|
141 | 132 | WriteRegs(uIntlist()<<val,(unsigned int)MCTRLBASEADDRESS); |
|
142 | 133 | usleep(1000*1000); |
|
143 | 134 | } |
|
144 | 135 | |
|
145 | 136 | |
|
146 | 137 | WriteRegs(uIntlist()<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x400060); |
|
147 | 138 | WriteRegs(uIntlist()<<0x0000FFFF,(unsigned int)DSUBASEADDRESS+0x24); |
|
148 | 139 | |
|
149 | 140 | memSet(DSUBASEADDRESS+0x300000,0,1567); |
|
150 | 141 | WriteRegs(uIntlist()<<0<<0xF30000E0<<0x00000002<<0x40000000<<0x40000000<<0x40000004<<0x1000000,(unsigned int)DSUBASEADDRESS+0x400000); |
|
151 | 142 | WriteRegs(uIntlist()<<0<<0<<0<<0<<0<<0<<0x403ffff0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0<<0,(unsigned int)DSUBASEADDRESS+0x300020); |
|
152 | 143 | WriteRegs(uIntlist()<<0x000002EF,(unsigned int)DSUBASEADDRESS); |
|
153 | 144 | |
|
154 | 145 | //Disable interrupts |
|
155 | 146 | unsigned int APBIRQCTRLRBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x0d,0); |
|
156 | 147 | if(APBIRQCTRLRBASEADD == (unsigned int)-1) |
|
157 | 148 | return false; |
|
158 | 149 | WriteRegs(uIntlist()<<0x00000000,APBIRQCTRLRBASEADD+0x040); |
|
159 | 150 | WriteRegs(uIntlist()<<0xFFFE0000,APBIRQCTRLRBASEADD+0x080); |
|
160 | 151 | WriteRegs(uIntlist()<<0<<0,APBIRQCTRLRBASEADD); |
|
161 | 152 | |
|
162 | 153 | //Set up timer |
|
163 | 154 | unsigned int APBTIMERBASEADD = (unsigned int)SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,1,0x11,0); |
|
164 | 155 | if(APBTIMERBASEADD == (unsigned int)-1) |
|
165 | 156 | return false; |
|
166 | 157 | WriteRegs(uIntlist()<<0xffffffff,APBTIMERBASEADD+0x014); |
|
167 | 158 | WriteRegs(uIntlist()<<0x00000018,APBTIMERBASEADD+0x04); |
|
168 | 159 | WriteRegs(uIntlist()<<0x00000007,APBTIMERBASEADD+0x018); |
|
169 | 160 | return true; |
|
170 | 161 | } |
|
171 | 162 | |
|
172 | 163 | bool dsu3plugin::cacheDisable() |
|
173 | 164 | { |
|
174 | 165 | return setCacheEnable(false); |
|
175 | 166 | } |
|
176 | 167 | |
|
177 | 168 | bool dsu3plugin::cacheEnable() |
|
178 | 169 | { |
|
179 | 170 | return setCacheEnable(true); |
|
180 | 171 | } |
|
181 | 172 | |
|
182 | 173 | bool dsu3plugin::setCacheEnable(bool enabled) |
|
183 | 174 | { |
|
184 | 175 | if(parent==NULL) |
|
185 | 176 | return false; |
|
186 | 177 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
|
187 | 178 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
188 | 179 | DSUBASEADDRESS = 0x90000000; |
|
189 | 180 | WriteRegs(uIntlist()<<2,DSUBASEADDRESS+0x400024); |
|
190 | 181 | unsigned int reg = ReadReg(DSUBASEADDRESS+0x700000); |
|
191 | 182 | if(enabled) |
|
192 | 183 | { |
|
193 | 184 | WriteRegs(uIntlist()<<(0x0001000F|reg),DSUBASEADDRESS+0x700000); |
|
194 | 185 | //flushes cache. |
|
195 | 186 | WriteRegs(uIntlist()<<(0x0061000F|reg),DSUBASEADDRESS+0x700000); |
|
196 | 187 | } |
|
197 | 188 | else |
|
198 | 189 | { |
|
199 | 190 | WriteRegs(uIntlist()<<((!0x0001000F)®),DSUBASEADDRESS+0x700000); |
|
200 | 191 | WriteRegs(uIntlist()<<(0x00600000|reg),DSUBASEADDRESS+0x700000); |
|
201 | 192 | } |
|
202 | 193 | return true; |
|
203 | 194 | } |
|
204 | 195 | |
|
205 | 196 | bool dsu3plugin::flashTarget() |
|
206 | 197 | { |
|
207 | 198 | stop(); |
|
208 | 199 | cacheDisable(); |
|
209 | 200 | configureTarget(); |
|
210 | 201 | /*Write .text*/ |
|
211 | 202 | this->writeSection(".text"); |
|
212 | 203 | /*Write .data*/ |
|
213 | 204 | this->writeSection(".data"); |
|
214 | 205 | return true; |
|
215 | 206 | } |
|
216 | 207 | |
|
217 | 208 | void dsu3plugin::run() |
|
218 | 209 | { |
|
219 | 210 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
|
220 | 211 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
221 | 212 | DSUBASEADDRESS = 0x90000000; |
|
222 | 213 | WriteRegs(uIntlist()<<0,DSUBASEADDRESS+0x020); |
|
223 | 214 | this->running = true; |
|
224 | 215 | this->UI->setRunning(true); |
|
225 | 216 | } |
|
226 | 217 | |
|
227 | 218 | void dsu3plugin::stop() |
|
228 | 219 | { |
|
229 | 220 | unsigned int DSUBASEADDRESS = SocExplorerEngine::self()->getEnumDeviceBaseAddress(this,0x01 , 0x004,0); |
|
230 | 221 | if(DSUBASEADDRESS == (unsigned int)-1) |
|
231 | 222 | DSUBASEADDRESS = 0x90000000; |
|
232 | 223 | WriteRegs(uIntlist()<<0xFFFF,DSUBASEADDRESS+0x020); |
|
233 | 224 | this->running = false; |
|
234 | 225 | this->UI->setRunning(false); |
|
235 | 226 | } |
|
236 | 227 | |
|
237 | 228 | void dsu3plugin::toggleRun() |
|
238 | 229 | { |
|
239 | 230 | if(this->running) |
|
240 | 231 | this->stop(); |
|
241 | 232 | else |
|
242 | 233 | this->run(); |
|
243 | 234 | } |
|
244 | 235 | |
|
236 | bool dsu3plugin::dumpSymbol(const QString &symbolName, QString file, const QString &format) | |
|
237 | { | |
|
238 | if(this->elfFile->isopened()) | |
|
239 | { | |
|
240 | int symbolIndex=this->elfFile->getSymbolIndex(symbolName); | |
|
241 | if(symbolIndex!=-1) | |
|
242 | return this->dumpMemory(this->elfFile->getSymbolAddress(symbolIndex),this->elfFile->getSymbolSize(symbolIndex)/4,file,format); | |
|
243 | } | |
|
244 | return false; | |
|
245 | } | |
|
246 | ||
|
245 | 247 | void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address) |
|
246 | 248 | { |
|
247 | 249 | unsigned int* buff; |
|
248 | 250 | buff = (unsigned int*)malloc(Values.count()*sizeof(unsigned int)); |
|
249 | 251 | for(int i=0;i<Values.count();i++) |
|
250 | 252 | { |
|
251 | 253 | buff[i]=Values.at(i); |
|
252 | 254 | } |
|
253 | 255 | parent->Write(buff,(unsigned int)Values.count(),address); |
|
254 | 256 | free(buff); |
|
255 | 257 | } |
|
256 | 258 | |
|
257 | 259 | unsigned int dsu3plugin::ReadReg(unsigned int address) |
|
258 | 260 | { |
|
259 | 261 | unsigned int buff; |
|
260 | 262 | parent->Read(&buff,1,address); |
|
261 | 263 | return buff; |
|
262 | 264 | } |
|
263 | 265 | |
|
264 | 266 | void dsu3plugin::writeSection(int index) |
|
265 | 267 | { |
|
266 | 268 | char* buffch=NULL; |
|
267 | 269 | unsigned int* buff; |
|
268 |
int size = this->elf |
|
|
270 | int size = this->elfFile->getSectionDatasz(index); | |
|
269 | 271 | int sizeInt = size/4; |
|
270 | 272 | if(parent==NULL) |
|
271 | 273 | return; |
|
272 |
this->elf |
|
|
274 | this->elfFile->getSectionData(index,&buffch); | |
|
273 | 275 | buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int)); |
|
274 | 276 | for(int i=0;i<sizeInt;i++) |
|
275 | 277 | { |
|
276 | 278 | buff[i] = 0x0FF & ((unsigned int)buffch[4*i]); |
|
277 | 279 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+1])); |
|
278 | 280 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+2])); |
|
279 | 281 | buff[i] = (buff[i]<<8) + (0x0FF & ((unsigned int)buffch[(4*i)+3])); |
|
280 | 282 | } |
|
281 | 283 | if(size%4) |
|
282 | 284 | { |
|
283 | 285 | buff[sizeInt]=0; |
|
284 | 286 | for(int i=(size%4);i>0;i--) |
|
285 | 287 | { |
|
286 | 288 | buff[sizeInt] = (buff[sizeInt]<<8) + (0x0FF & ((unsigned int)buffch[size-i])); |
|
287 | 289 | } |
|
288 | 290 | sizeInt++; |
|
289 | 291 | } |
|
290 |
parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elf |
|
|
292 | parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfFile->getSectionPaddr(index)); | |
|
291 | 293 | free(buff); |
|
292 | 294 | } |
|
293 | 295 | |
|
294 | 296 | void dsu3plugin::writeSection(const QString &name) |
|
295 | 297 | { |
|
296 | for(int i=0;i<this->elfparserInst->getSectioncount();i++) | |
|
298 | if(elfFile->isopened()) | |
|
297 | 299 | { |
|
298 |
|
|
|
299 | { | |
|
300 | printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i)); | |
|
301 | writeSection(i); | |
|
302 | } | |
|
300 | writeSection(this->elfFile->getSectionIndex(name)); | |
|
303 | 301 | } |
|
304 | 302 | } |
|
305 | 303 | |
|
306 | 304 | |
|
307 | 305 | unsigned int dsu3plugin::Write(unsigned int *Value,unsigned int count,unsigned int address) |
|
308 | 306 | { |
|
309 | 307 | if(parent!=NULL) |
|
310 | 308 | return parent->Write(Value,count,address); |
|
311 | 309 | return 0; |
|
312 | 310 | } |
|
313 | 311 | |
|
314 | 312 | bool dsu3plugin::memSet(unsigned int address,int value, unsigned int count) |
|
315 | 313 | { |
|
316 | 314 | unsigned int* buffer = (unsigned int*)malloc(count*sizeof(unsigned int)); |
|
317 | 315 | if(buffer!=NULL) |
|
318 | 316 | { |
|
319 | 317 | memset((void*)buffer,value,count*sizeof(unsigned int)); |
|
320 | 318 | parent->Write(buffer,count,address); |
|
321 | 319 | free(buffer ); |
|
322 | 320 | return true; |
|
323 | 321 | } |
|
324 | 322 | return false; |
|
325 | 323 | } |
|
326 | 324 | |
|
327 | 325 | unsigned int dsu3plugin::Read(unsigned int *Value,unsigned int count, unsigned int address) |
|
328 | 326 | { |
|
329 | 327 | if(parent!=NULL) |
|
330 | 328 | return parent->Read(Value,count,address); |
|
331 | 329 | return 0; |
|
332 | 330 | } |
@@ -1,70 +1,73 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef DSU3PLUGIN_H |
|
23 | 23 | #define DSU3PLUGIN_H |
|
24 | 24 | #include "dsu3pluginui.h" |
|
25 | 25 | #include <QMenuBar> |
|
26 | 26 | #include <QMenu> |
|
27 | 27 | #include <QAction> |
|
28 | 28 | #include <QMainWindow> |
|
29 | 29 | #include <QList> |
|
30 | 30 | #include "elfparser.h" |
|
31 | #include <elffile.h> | |
|
31 | 32 | #include <socexplorerplugin.h> |
|
32 | 33 | #include <socexplorerengine.h> |
|
33 | 34 | |
|
34 | 35 | typedef QList<unsigned int> uIntlist; |
|
35 | 36 | |
|
36 | 37 | class dsu3plugin : public socexplorerplugin |
|
37 | 38 | { |
|
38 | 39 | Q_OBJECT |
|
39 | 40 | public: |
|
40 | 41 | explicit dsu3plugin(QWidget *parent = 0); |
|
41 | 42 | ~dsu3plugin(); |
|
42 | 43 | bool memSet(unsigned int address, int value, unsigned int count); |
|
43 | 44 | public slots: |
|
44 | 45 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); |
|
45 | 46 | unsigned int Read(unsigned int *Value,unsigned int count, unsigned int address=0); |
|
46 | 47 | void openFile(); |
|
47 | 48 | void openFile(QString fileName); |
|
48 | 49 | bool configureTarget(); |
|
49 | 50 | bool cacheDisable(); |
|
50 | 51 | bool cacheEnable(); |
|
51 | 52 | bool setCacheEnable(bool enabled); |
|
52 | 53 | bool flashTarget(); |
|
53 | 54 | void run(); |
|
54 | 55 | void stop(); |
|
55 | 56 | void toggleRun(); |
|
56 | 57 | //added for python backward compatibility |
|
57 | 58 | void loadFile(){this->flashTarget();} |
|
59 | bool dumpSymbol(const QString& symbolName,QString file,const QString& format); | |
|
60 | ||
|
58 | 61 | signals: |
|
59 |
void updateInfo( |
|
|
62 | void updateInfo(ElfFile* elfFile); | |
|
60 | 63 | private: |
|
61 | 64 | void WriteRegs(uIntlist Values, unsigned int address); |
|
62 | 65 | unsigned int ReadReg(unsigned int address); |
|
63 | 66 | void writeSection(int index); |
|
64 | 67 | void writeSection(const QString& name); |
|
65 | 68 | dsu3pluginui* UI; |
|
66 | elfparser* elfparserInst; | |
|
69 | ElfFile* elfFile; | |
|
67 | 70 | bool running; |
|
68 | 71 | }; |
|
69 | 72 | |
|
70 | 73 | #endif // DSU3PLUGIN_H |
@@ -1,62 +1,66 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | #include <dsu3pluginui.h> |
|
24 | 24 | |
|
25 | 25 | dsu3pluginui::dsu3pluginui(QWidget *parent) |
|
26 | 26 | :QWidget(parent) |
|
27 | 27 | { |
|
28 | 28 | this->openFileQpb = new QPushButton(tr("Open File")); |
|
29 | 29 | this->flashTargetQpb = new QPushButton(tr("Flash Target")); |
|
30 | 30 | this->runQpb = new QPushButton(tr("Run")); |
|
31 | 31 | this->mainLayout = new QGridLayout(); |
|
32 |
this->elf |
|
|
32 | this->elfFileWidgetInst = new elfFileWidget(); | |
|
33 | 33 | this->mainLayout->addWidget(this->openFileQpb,0,0,1,1); |
|
34 | 34 | this->mainLayout->addWidget(this->flashTargetQpb,0,1,1,1); |
|
35 | 35 | this->mainLayout->addWidget(this->runQpb,0,2,1,1); |
|
36 |
this->mainLayout->addWidget(this->elf |
|
|
36 | this->mainLayout->addWidget(this->elfFileWidgetInst,1,0,1,-1); | |
|
37 | 37 | this->setLayout(this->mainLayout); |
|
38 | 38 | connect(this->openFileQpb,SIGNAL(clicked()),this,SIGNAL(openFile())); |
|
39 | 39 | connect(this->flashTargetQpb,SIGNAL(clicked()),this,SIGNAL(flashTarget())); |
|
40 | 40 | connect(this->runQpb,SIGNAL(clicked()),this,SIGNAL(run())); |
|
41 | connect(this,SIGNAL(updateInfo(elfparser*)),this->elfInfoWdgtInst,SLOT(updateInfo(elfparser*))); | |
|
42 | 41 | |
|
43 | 42 | } |
|
44 | 43 | |
|
45 | 44 | void dsu3pluginui::setRunning(bool running) |
|
46 | 45 | { |
|
47 | 46 | if(running) |
|
48 | 47 | this->runQpb->setText("Stop"); |
|
49 | 48 | else |
|
50 | 49 | this->runQpb->setText("Run"); |
|
51 | 50 | } |
|
52 | 51 | |
|
52 | void dsu3pluginui::updateInfo(ElfFile *file) | |
|
53 | { | |
|
54 | this->elfFileWidgetInst->setFile(file); | |
|
55 | } | |
|
56 | ||
|
53 | 57 | |
|
54 | 58 | |
|
55 | 59 | |
|
56 | 60 | |
|
57 | 61 | |
|
58 | 62 | |
|
59 | 63 | |
|
60 | 64 | |
|
61 | 65 | |
|
62 | 66 |
@@ -1,57 +1,59 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SocExplorer Software |
|
3 | 3 | -- Copyright (C) 2012, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@lpp.polytechnique.fr |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef DSU3PLUGINUI_H |
|
23 | 23 | #define DSU3PLUGINUI_H |
|
24 | 24 | |
|
25 | 25 | #include <QWidget> |
|
26 | 26 | #include <QHBoxLayout> |
|
27 | 27 | #include <QPushButton> |
|
28 | 28 | #include <qhexedit.h> |
|
29 | 29 | #include <QSplitter> |
|
30 | 30 | #include <QVBoxLayout> |
|
31 | 31 | #include <QGridLayout> |
|
32 | 32 | #include "elfinfowdgt.h" |
|
33 | #include <elffile.h> | |
|
34 | #include <elffilewidget.h> | |
|
33 | 35 | |
|
34 | 36 | class dsu3pluginui : public QWidget |
|
35 | 37 | { |
|
36 | 38 | Q_OBJECT |
|
37 | 39 | public: |
|
38 | 40 | explicit dsu3pluginui(QWidget *parent = 0); |
|
39 | 41 | |
|
40 | 42 | public slots: |
|
41 | 43 | void setRunning(bool running); |
|
44 | void updateInfo(ElfFile* file); | |
|
42 | 45 | signals: |
|
43 | 46 | void openFile(); |
|
44 | void updateInfo(elfparser* parser); | |
|
45 | 47 | bool flashTarget(); |
|
46 | 48 | void run(); |
|
47 | 49 | private: |
|
48 | 50 | QGridLayout* mainLayout; |
|
49 | 51 | QPushButton* openFileQpb; |
|
50 | 52 | QPushButton* flashTargetQpb; |
|
51 | 53 | QPushButton* runQpb; |
|
52 |
elf |
|
|
54 | elfFileWidget* elfFileWidgetInst; | |
|
53 | 55 | }; |
|
54 | 56 | |
|
55 | 57 | #endif // DSU3PLUGINUI_H |
|
56 | 58 | |
|
57 | 59 |
General Comments 0
You need to be logged in to leave comments.
Login now