├── COPYING
├── OpenOCD-QtGUI.pro
├── OpenOCD-QtGUI.pro.tmp
├── OpenOCD-QtGUI.pro.user
├── QtTelnet
├── QtTelnet
├── qttelnet.cpp
├── qttelnet.h
└── qttelnet.pri
├── README
├── at91sam7_wiggler.min.cfg
├── doit.sh
├── main.cpp
├── mainwidget.cpp
├── mainwidget.h
├── mainwidget.ui
└── openocd-qtgui.conf
/COPYING:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/OpenOCD-QtGUI.pro:
--------------------------------------------------------------------------------
1 | ######################################################################
2 | # Automatically generated by qmake (2.01a) Fr. Nov 8 17:11:49 2013
3 | ######################################################################
4 |
5 | TEMPLATE = app
6 | TARGET =
7 | DEPENDPATH += . QtTelnet
8 | INCLUDEPATH += . QtTelnet
9 |
10 | QT += network
11 | HEADERS += mainwidget.h QtTelnet/qttelnet.h
12 | FORMS += mainwidget.ui
13 | SOURCES += main.cpp mainwidget.cpp QtTelnet/qttelnet.cpp
14 |
--------------------------------------------------------------------------------
/OpenOCD-QtGUI.pro.tmp:
--------------------------------------------------------------------------------
1 | ######################################################################
2 | # Automatically generated by qmake (2.01a) Fr. Nov 8 17:11:49 2013
3 | ######################################################################
4 |
5 | TEMPLATE = app
6 | TARGET =
7 | DEPENDPATH += . QtTelnet
8 | INCLUDEPATH += . QtTelnet
9 |
10 | # Input
11 | HEADERS += mainwidget.h QtTelnet/qttelnet.h
12 | FORMS += mainwidget.ui
13 | SOURCES += main.cpp mainwidget.cpp QtTelnet/qttelnet.cpp
14 |
--------------------------------------------------------------------------------
/OpenOCD-QtGUI.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ProjectExplorer.Project.ActiveTarget
7 | 0
8 |
9 |
10 | ProjectExplorer.Project.EditorSettings
11 |
12 | true
13 | false
14 | true
15 |
16 | Cpp
17 |
18 | CppGlobal
19 |
20 |
21 |
22 | QmlJS
23 |
24 | QmlJSGlobal
25 |
26 |
27 | 2
28 | UTF-8
29 | false
30 | 4
31 | false
32 | true
33 | 1
34 | true
35 | 0
36 | true
37 | 0
38 | 8
39 | true
40 | 1
41 | true
42 | true
43 | true
44 | false
45 |
46 |
47 |
48 | ProjectExplorer.Project.PluginSettings
49 |
50 |
51 |
52 | ProjectExplorer.Project.Target.0
53 |
54 | Desktop
55 | Desktop
56 | {64765850-6139-4ba9-b5c1-fe5fc6df679d}
57 | 0
58 | 0
59 | 0
60 |
61 |
62 |
63 | true
64 | qmake
65 |
66 | QtProjectManager.QMakeBuildStep
67 | false
68 | false
69 |
70 | false
71 |
72 |
73 | true
74 | Make
75 |
76 | Qt4ProjectManager.MakeStep
77 |
78 | -w
79 | -r
80 |
81 | false
82 | -r -w
83 |
84 |
85 | 2
86 | Build
87 |
88 | ProjectExplorer.BuildSteps.Build
89 |
90 |
91 |
92 | true
93 | Make
94 |
95 | Qt4ProjectManager.MakeStep
96 |
97 | -w
98 | -r
99 |
100 | true
101 | -r -w clean
102 |
103 |
104 | 1
105 | Bereinigen
106 |
107 | ProjectExplorer.BuildSteps.Clean
108 |
109 | 2
110 | false
111 |
112 | Release
113 |
114 | Qt4ProjectManager.Qt4BuildConfiguration
115 | 0
116 | /home/user/ratio/coding/Qt4/OpenOCD-GUI_v4/OpenOCD-GUI
117 | false
118 |
119 | 1
120 |
121 |
122 | 0
123 | Deployment
124 |
125 | ProjectExplorer.BuildSteps.Deploy
126 |
127 | 1
128 | Lokales Deployment
129 |
130 | ProjectExplorer.DefaultDeployConfiguration
131 |
132 | 1
133 |
134 |
135 | 2
136 |
137 | OpenOCD-QtGUI
138 |
139 | Qt4ProjectManager.Qt4RunConfiguration:/tmp/OpenOCD-GUI/OpenOCD-QtGUI.pro
140 |
141 | OpenOCD-QtGUI.pro
142 | false
143 | false
144 |
145 | 3768
146 | true
147 | false
148 | false
149 | false
150 | true
151 |
152 | 1
153 |
154 |
155 |
156 | ProjectExplorer.Project.Target.1
157 |
158 | Lokal ausführen
159 | Lokal ausführen
160 | {994aae52-bdd0-46e9-b93a-4bb26a6012d4}
161 | 0
162 | -1
163 | 0
164 |
165 |
166 |
167 | true
168 | qmake
169 |
170 | QtProjectManager.QMakeBuildStep
171 | false
172 | false
173 |
174 | false
175 |
176 |
177 | true
178 | Make
179 |
180 | Qt4ProjectManager.MakeStep
181 |
182 | false
183 |
184 |
185 |
186 | 2
187 | Build
188 |
189 | ProjectExplorer.BuildSteps.Build
190 |
191 |
192 |
193 | true
194 | Make
195 |
196 | Qt4ProjectManager.MakeStep
197 |
198 | true
199 | clean
200 |
201 |
202 | 1
203 | Bereinigen
204 |
205 | ProjectExplorer.BuildSteps.Clean
206 |
207 | 2
208 | false
209 |
210 | Release
211 |
212 | Qt4ProjectManager.Qt4BuildConfiguration
213 | 0
214 | /home/user/ratio/coding/Qt4/OpenOCD-GUI_v4/OpenOCD-GUI
215 | false
216 |
217 | 1
218 | 0
219 |
220 |
221 | 2
222 |
223 |
224 |
225 | false
226 | %{buildDir}
227 | Benutzerdefinierte ausführbare Datei
228 |
229 | ProjectExplorer.CustomExecutableRunConfiguration
230 | 3768
231 | true
232 | false
233 | false
234 | false
235 | true
236 |
237 | 1
238 |
239 |
240 |
241 | ProjectExplorer.Project.TargetCount
242 | 2
243 |
244 |
245 | ProjectExplorer.Project.Updater.EnvironmentId
246 | {952153fe-7a33-4ab6-b334-8e542c64f073}
247 |
248 |
249 | ProjectExplorer.Project.Updater.FileVersion
250 | 14
251 |
252 |
253 |
--------------------------------------------------------------------------------
/QtTelnet/QtTelnet:
--------------------------------------------------------------------------------
1 | #include "qttelnet.h"
2 |
--------------------------------------------------------------------------------
/QtTelnet/qttelnet.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 | ** All rights reserved.
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
6 | **
7 | ** This file is part of a Qt Solutions component.
8 | **
9 | ** Commercial Usage
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
11 | ** accordance with the Qt Solutions Commercial License Agreement provided
12 | ** with the Software or, alternatively, in accordance with the terms
13 | ** contained in a written agreement between you and Nokia.
14 | **
15 | ** GNU Lesser General Public License Usage
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
17 | ** General Public License version 2.1 as published by the Free Software
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
19 | ** packaging of this file. Please review the following information to
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22 | **
23 | ** In addition, as a special exception, Nokia gives you certain
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
25 | ** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
26 | ** package.
27 | **
28 | ** GNU General Public License Usage
29 | ** Alternatively, this file may be used under the terms of the GNU
30 | ** General Public License version 3.0 as published by the Free Software
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
32 | ** packaging of this file. Please review the following information to
33 | ** ensure the GNU General Public License version 3.0 requirements will be
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
35 | **
36 | ** Please note Third Party Software included with Qt Solutions may impose
37 | ** additional restrictions and it is the user's responsibility to ensure
38 | ** that they have met the licensing requirements of the GPL, LGPL, or Qt
39 | ** Solutions Commercial license and the relevant license of the Third
40 | ** Party Software they are using.
41 | **
42 | ** If you are unsure which license is appropriate for your use, please
43 | ** contact Nokia at qt-info@nokia.com.
44 | **
45 | ****************************************************************************/
46 |
47 | /*!
48 | \class QtTelnet
49 | \brief The QtTelnet class proveds an API to connect to Telnet servers,
50 | issue commands and receive replies.
51 |
52 | When a QtTelnet object has been created, you need to call
53 | connectToHost() to establish a connection with a Telnet server.
54 | When the connection is established the connected() signal is
55 | emitted. At this point you should call login(). The
56 | QtTelnet object will emit connectionError() if the connection
57 | fails, and authenticationFailed() if the login() failed.
58 |
59 | Once the connection has been successfully established and
60 | you've logged in you can send control messages using sendControl()
61 | and data using sendData(). Connect to the message() signal to
62 | receive data from the Telnet server. The connection is closed with
63 | close().
64 |
65 | You can use your own socket if you call setSocket() before
66 | connecting. The socket used by QtTelnet is available from
67 | socket().
68 | */
69 |
70 | #include "qttelnet.h"
71 | #include
72 | #include
73 | #include
74 | #include
75 | #include
76 | #include
77 | #include
78 | #include
79 |
80 | #ifdef Q_WS_WIN
81 | # include
82 | #endif
83 | #if defined (Q_OS_UNIX)
84 | # include
85 | # include
86 | # include
87 | #endif
88 |
89 | // #define QTTELNET_DEBUG
90 |
91 | #ifdef QTTELNET_DEBUG
92 | #include
93 | #endif
94 |
95 | class QtTelnetAuth
96 | {
97 | public:
98 | enum State { AuthIntermediate, AuthSuccess, AuthFailure };
99 |
100 | QtTelnetAuth(char code) : st(AuthIntermediate), cd(code) {};
101 | virtual ~QtTelnetAuth() {}
102 |
103 | int code() const { return cd; }
104 | State state() const { return st; }
105 | void setState(State state) { st = state; };
106 |
107 | virtual QByteArray authStep(const QByteArray &data) = 0;
108 |
109 | private:
110 | State st;
111 | int cd;
112 | };
113 |
114 | class QtTelnetReceiveBuffer
115 | {
116 | public:
117 | QtTelnetReceiveBuffer() : bytesAvailable(0) {}
118 | void append(const QByteArray &data) { buffers.append(data); }
119 | void push_back(const QByteArray &data) { buffers.prepend(data); }
120 | long size() const { return bytesAvailable; }
121 | QByteArray readAll()
122 | {
123 | QByteArray a;
124 | while (!buffers.isEmpty()) {
125 | a.append(buffers.takeFirst());
126 | }
127 | return a;
128 | }
129 |
130 | private:
131 | QList buffers;
132 | long bytesAvailable;
133 | };
134 |
135 | namespace Common // RFC854
136 | {
137 | // Commands
138 | const uchar CEOF = 236;
139 | const uchar SUSP = 237;
140 | const uchar ABORT = 238;
141 | const uchar SE = 240;
142 | const uchar NOP = 241;
143 | const uchar DM = 242;
144 | const uchar BRK = 243;
145 | const uchar IP = 244;
146 | const uchar AO = 245;
147 | const uchar AYT = 246;
148 | const uchar EC = 247;
149 | const uchar EL = 248;
150 | const uchar GA = 249;
151 | const uchar SB = 250;
152 | const uchar WILL = 251;
153 | const uchar WONT = 252;
154 | const uchar DO = 253;
155 | const uchar DONT = 254;
156 | const uchar IAC = 255;
157 |
158 | // Types
159 | const char IS = 0;
160 | const char SEND = 1;
161 |
162 | const char Authentication = 37; // RFC1416,
163 | // implemented to always return NULL
164 | const char SuppressGoAhead = 3; // RFC858
165 | const char Echo = 1; // RFC857, not implemented (returns WONT/DONT)
166 | const char LineMode = 34; // RFC1184, implemented
167 | const uchar LineModeEOF = 236, // RFC1184, not implemented
168 | LineModeSUSP = 237,
169 | LineModeABORT = 238;
170 | const char Status = 5; // RFC859, should be implemented!
171 | const char Logout = 18; // RFC727, implemented
172 | const char TerminalType = 24; // RFC1091,
173 | // implemented to always return UNKNOWN
174 | const char NAWS = 31; // RFC1073, implemented
175 | const char TerminalSpeed = 32; // RFC1079, not implemented
176 | const char FlowControl = 33; // RFC1372, should be implemented?
177 | const char XDisplayLocation = 35; // RFC1096, not implemented
178 | const char EnvironmentOld = 36; // RFC1408, should not be implemented!
179 | const char Environment = 39; // RFC1572, should be implemented
180 | const char Encrypt = 38; // RFC2946, not implemented
181 |
182 | #ifdef QTTELNET_DEBUG
183 | QString typeStr(char op)
184 | {
185 | QString str;
186 | switch (op) {
187 | case IS:
188 | str = "IS";
189 | break;
190 | case SEND:
191 | str = "SEND";
192 | break;
193 | default:
194 | str = QString("Unknown common type (%1)").arg(op);
195 | }
196 | return str;
197 | }
198 | QString operationStr(char op)
199 | {
200 | QString str;
201 | switch (quint8(op)) {
202 | case quint8(WILL):
203 | str = "WILL";
204 | break;
205 | case quint8(WONT):
206 | str = "WONT";
207 | break;
208 | case quint8(DO):
209 | str = "DO";
210 | break;
211 | case quint8(DONT):
212 | str = "DONT";
213 | break;
214 | case quint8(SB):
215 | str = "SB";
216 | break;
217 | default:
218 | str = QString("Unknown operation (%1)").arg(quint8(op));
219 | }
220 | return str;
221 | }
222 |
223 | QString optionStr(char op)
224 | {
225 | QString str;
226 | switch (op) {
227 | case Authentication:
228 | str = "AUTHENTICATION";
229 | break;
230 | case SuppressGoAhead:
231 | str = "SUPPRESS GO AHEAD";
232 | break;
233 | case Echo:
234 | str = "ECHO";
235 | break;
236 | case LineMode:
237 | str = "LINEMODE";
238 | break;
239 | case Status:
240 | str = "STATUS";
241 | break;
242 | case Logout:
243 | str = "LOGOUT";
244 | break;
245 | case TerminalType:
246 | str = "TERMINAL-TYPE";
247 | break;
248 | case TerminalSpeed:
249 | str = "TERMINAL-SPEED";
250 | break;
251 | case NAWS:
252 | str = "NAWS";
253 | break;
254 | case FlowControl:
255 | str = "TOGGLE-FLOW-CONTROL";
256 | break;
257 | case XDisplayLocation:
258 | str = "X-DISPLAY-LOCATION";
259 | break;
260 | case EnvironmentOld:
261 | str = "ENVIRON";
262 | break;
263 | case Environment:
264 | str = "NEW-ENVIRON";
265 | break;
266 | case Encrypt:
267 | str = "ENCRYPT";
268 | break;
269 | default:
270 | str = QString("Unknown option (%1)").arg(op);
271 | }
272 | return str;
273 | }
274 | #endif
275 | };
276 |
277 | namespace Auth // RFC1416
278 | {
279 | enum Auth
280 | {
281 | REPLY = 2,
282 | NAME
283 | };
284 | enum Types
285 | {
286 | AUTHNULL, // Can't have enum values named NULL :/
287 | KERBEROS_V4,
288 | KERBEROS_V5,
289 | SPX,
290 | SRA = 6,
291 | LOKI = 10
292 | };
293 | enum Modifiers
294 | {
295 | AUTH_WHO_MASK = 1,
296 | AUTH_CLIENT_TO_SERVER = 0,
297 | AUTH_SERVER_TO_CLIENT = 1,
298 | AUTH_HOW_MASK = 2,
299 | AUTH_HOW_ONE_WAY = 0,
300 | AUTH_HOW_MUTUAL = 2
301 | };
302 | enum SRA
303 | {
304 | SRA_KEY = 0,
305 | SRA_USER = 1,
306 | SRA_CONTINUE = 2,
307 | SRA_PASSWORD = 3,
308 | SRA_ACCEPT = 4,
309 | SRA_REJECT = 5
310 | };
311 |
312 | #ifdef QTTELNET_DEBUG
313 | QString authStr(int op)
314 | {
315 | QString str;
316 | switch (op) {
317 | case REPLY:
318 | str = "REPLY";
319 | break;
320 | case NAME:
321 | str = "NAME";
322 | break;
323 | default:
324 | str = QString("Unknown auth (%1)").arg(op);
325 | }
326 | return str;
327 | }
328 | QString typeStr(int op)
329 | {
330 | QString str;
331 | switch (op) {
332 | case AUTHNULL:
333 | str = "NULL";
334 | break;
335 | case KERBEROS_V4:
336 | str = "KERBEROS_V4";
337 | break;
338 | case KERBEROS_V5:
339 | str = "KERBEROS_V5";
340 | break;
341 | case SPX:
342 | str = "SPX";
343 | break;
344 | case SRA:
345 | str = "SRA";
346 | break;
347 | case LOKI:
348 | str = "LOKI";
349 | break;
350 | default:
351 | str = QString("Unknown auth type (%1)").arg(op);
352 | }
353 | return str;
354 | }
355 | QString whoStr(int op)
356 | {
357 | QString str;
358 | op = op & AUTH_WHO_MASK;
359 | switch (op) {
360 | case AUTH_CLIENT_TO_SERVER:
361 | str = "CLIENT";
362 | break;
363 | case AUTH_SERVER_TO_CLIENT:
364 | str = "SERVER";
365 | break;
366 | default:
367 | str = QString("Unknown who type (%1)").arg(op);
368 | }
369 | return str;
370 | }
371 | QString howStr(int op)
372 | {
373 | QString str;
374 | op = op & AUTH_HOW_MASK;
375 | switch (op) {
376 | case AUTH_HOW_ONE_WAY:
377 | str = "ONE-WAY";
378 | break;
379 | case AUTH_HOW_MUTUAL:
380 | str = "MUTUAL";
381 | break;
382 | default:
383 | str = QString("Unknown how type (%1)").arg(op);
384 | }
385 | return str;
386 | }
387 | QString sraStr(int op)
388 | {
389 | QString str;
390 | switch (op) {
391 | case SRA_KEY:
392 | str = "KEY";
393 | break;
394 | case SRA_REJECT:
395 | str = "REJECT";
396 | break;
397 | case SRA_ACCEPT:
398 | str = "ACCEPT";
399 | break;
400 | case SRA_USER:
401 | str = "USER";
402 | break;
403 | case SRA_CONTINUE:
404 | str = "CONTINUE";
405 | break;
406 | case SRA_PASSWORD:
407 | str = "PASSWORD";
408 | break;
409 | default:
410 | str = QString("Unknown SRA option (%1)").arg(op);
411 | }
412 | return str;
413 | }
414 | #endif
415 | };
416 |
417 | namespace LineMode // RFC1184
418 | {
419 | const char Mode = 1;
420 | const char ForwardMask = 2;
421 | const char SLC = 3;
422 | enum Modes
423 | {
424 | EDIT = 1,
425 | TRAPSIG = 2,
426 | MODE_ACK = 4,
427 | SOFT_TAB = 8,
428 | LIT_ECHO = 16
429 | };
430 | enum SLCs
431 | {
432 | SLC_SYNCH = 1,
433 | SLC_BRK = 2,
434 | SLC_IP = 3,
435 | SLC_AO = 4,
436 | SLC_AYT = 5,
437 | SLC_EOR = 6,
438 | SLC_ABORT = 7,
439 | SLC_EOF = 8,
440 | SLC_SUSP = 9,
441 | SLC_EC = 10,
442 | SLC_EL = 11,
443 | SLC_EW = 12,
444 | SLC_RP = 13,
445 | SLC_LNEXT = 14,
446 | SLC_XON = 15,
447 | SLC_XOFF = 16,
448 | SLC_FORW1 = 17,
449 | SLC_FORW2 = 18,
450 | SLC_MCL = 19,
451 | SLC_MCR = 20,
452 | SLC_MCWL = 21,
453 | SLC_MCWR = 22,
454 | SLC_MCBOL = 23,
455 | SLC_MCEOL = 24,
456 | SLC_INSRT = 25,
457 | SLC_OVER = 26,
458 | SLC_ECR = 27,
459 | SLC_EWR = 28,
460 | SLC_EBOL = 29,
461 | SLC_EEOL = 30,
462 | SLC_DEFAULT = 3,
463 | SLC_VALUE = 2,
464 | SLC_CANTCHANGE = 1,
465 | SLC_NOSUPPORT = 0,
466 | SLC_LEVELBITS = 3,
467 | SLC_ACK = 128,
468 | SLC_FLUSHIN = 64,
469 | SLC_FLUSHOUT = 32
470 | };
471 | };
472 |
473 | class QtTelnetAuthNull : public QtTelnetAuth
474 | {
475 | public:
476 | QtTelnetAuthNull() : QtTelnetAuth(0) {}
477 |
478 | QByteArray authStep(const QByteArray &data);
479 | };
480 |
481 | QByteArray QtTelnetAuthNull::authStep(const QByteArray &data)
482 | {
483 | Q_ASSERT(data[0] == Common::Authentication);
484 |
485 | if (data.size() < 2 || data[1] != Common::SEND)
486 | return QByteArray();
487 |
488 | char buf[8] = {Common::IAC, Common::SB, Common::Authentication,
489 | Common::IS, Auth::AUTHNULL, 0, // CLIENT|ONE-WAY
490 | Common::IAC, Common::SE};
491 | setState(AuthSuccess);
492 | return QByteArray(buf, sizeof(buf));
493 | }
494 |
495 | class QtTelnetPrivate : public QObject
496 | {
497 | Q_OBJECT
498 | public:
499 | QtTelnetPrivate(QtTelnet *parent);
500 | ~QtTelnetPrivate();
501 |
502 | QMap modes;
503 | QList< QPair > osent;
504 |
505 | QtTelnet *q;
506 | QTcpSocket *socket;
507 | QtTelnetReceiveBuffer buffer;
508 | QSocketNotifier *notifier;
509 |
510 | QSize windowSize;
511 |
512 | bool connected, nocheckp;
513 | bool triedlogin, triedpass, firsttry;
514 |
515 | QMap auths;
516 | QtTelnetAuth *curauth;
517 | bool nullauth;
518 |
519 | QRegExp loginp, passp, promptp;
520 | QString login, pass;
521 |
522 | bool allowOption(int oper, int opt);
523 | void sendOptions();
524 | void sendCommand(const QByteArray &command);
525 | void sendCommand(const char *command, int length);
526 | void sendCommand(const char operation, const char option);
527 | void sendString(const QString &str);
528 | bool replyNeeded(uchar operation, uchar option);
529 | void setMode(uchar operation, uchar option);
530 | bool alreadySent(uchar operation, uchar option);
531 | void addSent(uchar operation, uchar option);
532 | void sendWindowSize();
533 |
534 | int parsePlaintext(const QByteArray &data);
535 | int parseIAC(const QByteArray &data);
536 | bool isOperation(const uchar c);
537 | bool isCommand(const uchar c);
538 | QByteArray getSubOption(const QByteArray &data);
539 | void parseSubAuth(const QByteArray &data);
540 | void parseSubTT(const QByteArray &data);
541 | void parseSubNAWS(const QByteArray &data);
542 | uchar opposite(uchar operation, bool positive);
543 |
544 | void consume();
545 |
546 | void setSocket(QTcpSocket *socket);
547 |
548 | public slots:
549 | void socketConnected();
550 | void socketConnectionClosed();
551 | void socketReadyRead();
552 | void socketError(QAbstractSocket::SocketError error);
553 | void socketException(int);
554 | };
555 |
556 | QtTelnetPrivate::QtTelnetPrivate(QtTelnet *parent)
557 | : q(parent), socket(0), notifier(0),
558 | connected(false), nocheckp(false),
559 | triedlogin(false), triedpass(false), firsttry(true),
560 | curauth(0), nullauth(false),
561 | loginp("ogin:\\s*$"), passp("assword:\\s*$")
562 | {
563 | setSocket(new QTcpSocket(this));
564 | }
565 |
566 | QtTelnetPrivate::~QtTelnetPrivate()
567 | {
568 | delete socket;
569 | delete notifier;
570 | delete curauth;
571 | }
572 |
573 | void QtTelnetPrivate::setSocket(QTcpSocket *s)
574 | {
575 | if (socket) {
576 | q->logout();
577 | socket->flush();
578 | }
579 | delete socket;
580 | socket = s;
581 | connected = false;
582 | if (socket) {
583 | connect(socket, SIGNAL(connected()), this, SLOT(socketConnected()));
584 | connect(socket, SIGNAL(disconnected()),
585 | this, SLOT(socketConnectionClosed()));
586 | connect(socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
587 | connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
588 | this, SLOT(socketError(QAbstractSocket::SocketError)));
589 | }
590 | }
591 |
592 | /*
593 | Returns the opposite value of the one we pass in.
594 | */
595 | uchar QtTelnetPrivate::opposite(uchar operation, bool positive)
596 | {
597 | if (operation == Common::DO)
598 | return (positive ? Common::WILL : Common::WONT);
599 | else if (operation == Common::DONT) // Not allowed to say WILL
600 | return Common::WONT;
601 | else if (operation == Common::WILL)
602 | return (positive ? Common::DO : Common::DONT);
603 | else if (operation == Common::WONT) // Not allowed to say DO
604 | return Common::DONT;
605 | return 0;
606 | }
607 |
608 | void QtTelnetPrivate::consume()
609 | {
610 | const QByteArray data = buffer.readAll();
611 | int currpos = 0;
612 | int prevpos = -1;;
613 | while (prevpos < currpos && currpos < data.size()) {
614 | prevpos = currpos;
615 | const uchar c = uchar(data[currpos]);
616 | if (c == Common::DM)
617 | ++currpos;
618 | else if (c == Common::IAC)
619 | currpos += parseIAC(data.mid(currpos));
620 | else // Assume plain text
621 | currpos += parsePlaintext(data.mid(currpos));
622 | }
623 | if (currpos < data.size())
624 | buffer.push_back(data.mid(currpos));
625 | }
626 |
627 | bool QtTelnetPrivate::isCommand(const uchar c)
628 | {
629 | return (c == Common::DM);
630 | }
631 |
632 | bool QtTelnetPrivate::isOperation(const uchar c)
633 | {
634 | return (c == Common::WILL || c == Common::WONT
635 | || c == Common::DO ||c == Common::DONT);
636 | }
637 |
638 | QByteArray QtTelnetPrivate::getSubOption(const QByteArray &data)
639 | {
640 | Q_ASSERT(!data.isEmpty() && uchar(data[0]) == Common::IAC);
641 |
642 | if (data.size() < 4 || uchar(data[1]) != Common::SB)
643 | return QByteArray();
644 |
645 | for (int i = 2; i < data.size() - 1; ++i) {
646 | if (uchar(data[i]) == Common::IAC && uchar(data[i+1]) == Common::SE) {
647 | return data.mid(2, i-2);
648 | }
649 | }
650 | return QByteArray();
651 | }
652 |
653 | void QtTelnetPrivate::parseSubNAWS(const QByteArray &data)
654 | {
655 | Q_UNUSED(data);
656 | }
657 |
658 | void QtTelnetPrivate::parseSubTT(const QByteArray &data)
659 | {
660 | Q_ASSERT(!data.isEmpty() && data[0] == Common::TerminalType);
661 |
662 | if (data.size() < 2 || data[1] != Common::SEND)
663 | return;
664 |
665 | const char c1[4] = { Common::IAC, Common::SB,
666 | Common::TerminalType, Common::IS};
667 | sendCommand(c1, sizeof(c1));
668 | sendString("UNKNOWN");
669 | const char c2[2] = { Common::IAC, Common::SE };
670 | sendCommand(c2, sizeof(c2));
671 | }
672 |
673 | void QtTelnetPrivate::parseSubAuth(const QByteArray &data)
674 | {
675 | Q_ASSERT(data[0] == Common::Authentication);
676 |
677 | if (!curauth && data[1] == Common::SEND) {
678 | int pos = 2;
679 | while (pos < data.size() && !curauth) {
680 | curauth = auths[data[pos]];
681 | pos += 2;
682 |
683 | if (curauth) {
684 | emit q->loginRequired();
685 | break;
686 | }
687 | }
688 | if (!curauth) {
689 | curauth = new QtTelnetAuthNull;
690 | nullauth = true;
691 | if (loginp.isEmpty() && passp.isEmpty()) {
692 | // emit q->loginRequired();
693 | nocheckp = true;
694 | }
695 | }
696 | }
697 | if (curauth) {
698 | const QByteArray a = curauth->authStep(data);
699 | if (!a.isEmpty())
700 | sendCommand(a);
701 |
702 | if (curauth->state() == QtTelnetAuth::AuthFailure)
703 | emit q->loginFailed();
704 | else if (curauth->state() == QtTelnetAuth::AuthSuccess) {
705 | if (loginp.isEmpty() && passp.isEmpty())
706 | emit q->loggedIn();
707 | if (!nullauth)
708 | nocheckp = true;
709 | }
710 | }
711 | }
712 |
713 | /*
714 | returns number of bytes consumed
715 | */
716 | int QtTelnetPrivate::parseIAC(const QByteArray &data)
717 | {
718 | if (data.isEmpty())
719 | return 0;
720 |
721 | Q_ASSERT(uchar(data.at(0)) == Common::IAC);
722 |
723 | if (data.size() >= 3 && isOperation(data[1])) { // IAC, Operation, Option
724 | const uchar operation = data[1];
725 | const uchar option = data[2];
726 | if (operation == Common::WONT && option == Common::Logout) {
727 | q->close();
728 | return 3;
729 | }
730 | if (operation == Common::DONT && option == Common::Authentication) {
731 | if (loginp.isEmpty() && passp.isEmpty())
732 | emit q->loggedIn();
733 | nullauth = true;
734 | }
735 | if (replyNeeded(operation, option)) {
736 | bool allowed = allowOption(operation, option);
737 | sendCommand(opposite(operation, allowed), option);
738 | setMode(operation, option);
739 | }
740 | return 3;
741 | }
742 | if (data.size() >= 2 && isCommand(data[1])) { // IAC Command
743 | return 2;
744 | }
745 |
746 | QByteArray suboption = getSubOption(data);
747 | if (suboption.isEmpty())
748 | return 0;
749 |
750 | // IAC SB Operation SubOption [...] IAC SE
751 | switch (suboption[0]) {
752 | case Common::Authentication:
753 | parseSubAuth(suboption);
754 | break;
755 | case Common::TerminalType:
756 | parseSubTT(suboption);
757 | break;
758 | case Common::NAWS:
759 | parseSubNAWS(data);
760 | break;
761 | default:
762 | qWarning("QtTelnetPrivate::parseIAC: unknown suboption %d",
763 | quint8(suboption.at(0)));
764 | break;
765 | }
766 | return suboption.size() + 4;
767 | }
768 |
769 | int QtTelnetPrivate::parsePlaintext(const QByteArray &data)
770 | {
771 | int consumed = 0;
772 | int length = data.indexOf('\0');
773 | if (length == -1) {
774 | length = data.size();
775 | consumed = length;
776 | } else {
777 | consumed = length + 1; // + 1 for removing '\0'
778 | }
779 |
780 | QString text = QString::fromLocal8Bit(data.constData(), length);
781 |
782 | if (!nocheckp && nullauth) {
783 | if (!promptp.isEmpty() && promptp.indexIn(text) != -1) {
784 | emit q->loggedIn();
785 | nocheckp = true;
786 | }
787 | }
788 | if (!nocheckp && nullauth) {
789 | if (!loginp.isEmpty() && loginp.indexIn(text) != -1) {
790 | if (triedlogin || firsttry) {
791 | emit q->message(text); // Display the login prompt
792 | text.clear();
793 | emit q->loginRequired(); // Get a (new) login
794 | firsttry = false;
795 | }
796 | if (!triedlogin) {
797 | q->sendData(login);
798 | triedlogin = true;
799 | }
800 | }
801 | if (!passp.isEmpty() && passp.indexIn(text) != -1) {
802 | if (triedpass || firsttry) {
803 | emit q->message(text); // Display the password prompt
804 | text.clear();
805 | emit q->loginRequired(); // Get a (new) pass
806 | firsttry = false;
807 | }
808 | if (!triedpass) {
809 | q->sendData(pass);
810 | triedpass = true;
811 | // We don't have to store the password anymore
812 | pass.fill(' ');
813 | pass.resize(0);
814 | }
815 | }
816 | }
817 |
818 | if (!text.isEmpty())
819 | emit q->message(text);
820 | return consumed;
821 | }
822 |
823 | bool QtTelnetPrivate::replyNeeded(uchar operation, uchar option)
824 | {
825 | if (operation == Common::DO || operation == Common::DONT) {
826 | // RFC854 requires that we don't acknowledge
827 | // requests to enter a mode we're already in
828 | if (operation == Common::DO && modes[option])
829 | return false;
830 | if (operation == Common::DONT && !modes[option])
831 | return false;
832 | }
833 | return true;
834 | }
835 |
836 | void QtTelnetPrivate::setMode(uchar operation, uchar option)
837 | {
838 | if (operation != Common::DO && operation != Common::DONT)
839 | return;
840 |
841 | modes[option] = (operation == Common::DO);
842 | if (option == Common::NAWS && modes[Common::NAWS])
843 | sendWindowSize();
844 | }
845 |
846 | void QtTelnetPrivate::sendWindowSize()
847 | {
848 | if (!modes[Common::NAWS])
849 | return;
850 | if (!q->isValidWindowSize())
851 | return;
852 |
853 | short h = htons(windowSize.height());
854 | short w = htons(windowSize.width());
855 | const char c[9] = { Common::IAC, Common::SB, Common::NAWS,
856 | (w & 0x00ff), (w >> 8), (h & 0x00ff), (h >> 8),
857 | Common::IAC, Common::SE };
858 | sendCommand(c, sizeof(c));
859 | }
860 |
861 | void QtTelnetPrivate::addSent(uchar operation, uchar option)
862 | {
863 | osent.append(QPair(operation, option));
864 | }
865 |
866 | bool QtTelnetPrivate::alreadySent(uchar operation, uchar option)
867 | {
868 | QPair value(operation, option);
869 | if (osent.contains(value)) {
870 | osent.removeAll(value);
871 | return true;
872 | }
873 | return false;
874 | }
875 |
876 | void QtTelnetPrivate::sendString(const QString &str)
877 | {
878 | if (!connected || str.length() == 0)
879 | return;
880 |
881 | socket->write(str.toLocal8Bit());
882 | }
883 |
884 | void QtTelnetPrivate::sendCommand(const QByteArray &command)
885 | {
886 | if (!connected || command.isEmpty())
887 | return;
888 |
889 | if (command.size() == 3) {
890 | const char operation = command.at(1);
891 | const char option = command.at(2);
892 | if (alreadySent(operation, option))
893 | return;
894 | addSent(operation, option);
895 | }
896 | socket->write(command);
897 | }
898 |
899 | void QtTelnetPrivate::sendCommand(const char operation, const char option)
900 | {
901 | const char c[3] = { Common::IAC, operation, option };
902 | sendCommand(c, 3);
903 | }
904 |
905 | void QtTelnetPrivate::sendCommand(const char *command, int length)
906 | {
907 | QByteArray a(command, length);
908 | sendCommand(a);
909 | }
910 |
911 | bool QtTelnetPrivate::allowOption(int /*oper*/, int opt)
912 | {
913 | if (opt == Common::Authentication ||
914 | opt == Common::SuppressGoAhead ||
915 | opt == Common::LineMode ||
916 | opt == Common::Status ||
917 | opt == Common::Logout ||
918 | opt == Common::TerminalType)
919 | return true;
920 | if (opt == Common::NAWS && q->isValidWindowSize())
921 | return true;
922 | return false;
923 | }
924 |
925 | void QtTelnetPrivate::sendOptions()
926 | {
927 | sendCommand(Common::WILL, Common::Authentication);
928 | sendCommand(Common::DO, Common::SuppressGoAhead);
929 | sendCommand(Common::WILL, Common::LineMode);
930 | sendCommand(Common::DO, Common::Status);
931 | if (q->isValidWindowSize())
932 | sendCommand(Common::WILL, Common::NAWS);
933 | }
934 |
935 | void QtTelnetPrivate::socketConnected()
936 | {
937 | connected = true;
938 | delete notifier;
939 | notifier = new QSocketNotifier(socket->socketDescriptor(),
940 | QSocketNotifier::Exception, this);
941 | connect(notifier, SIGNAL(activated(int)),
942 | this, SLOT(socketException(int)));
943 | sendOptions();
944 | }
945 |
946 | void QtTelnetPrivate::socketException(int)
947 | {
948 | // qDebug("out-of-band data received, should handle that here!");
949 | }
950 |
951 | void QtTelnetPrivate::socketConnectionClosed()
952 | {
953 | delete notifier;
954 | notifier = 0;
955 | connected = false;
956 | emit q->loggedOut();
957 | }
958 |
959 | void QtTelnetPrivate::socketReadyRead()
960 | {
961 | buffer.append(socket->readAll());
962 | consume();
963 | }
964 |
965 | void QtTelnetPrivate::socketError(QAbstractSocket::SocketError error)
966 | {
967 | emit q->connectionError(error);
968 | }
969 |
970 | /*!
971 | \enum QtTelnet::Control
972 |
973 | This enum specifies control messages you can send to the Telnet server
974 | using sendControl().
975 |
976 | \value GoAhead Sends the \c GO \c AHEAD control message, meaning that the
977 | server can continue to send data.
978 |
979 | \value InterruptProcess Interrupts the current running process on
980 | the server. This is the equivalent of pressing \key{Ctrl+C} in most
981 | terminal emulators.
982 |
983 | \value AreYouThere Sends the \c ARE \c YOU \c THERE control
984 | message, to check if the connection is still alive.
985 |
986 | \value AbortOutput Temporarily suspends the output from the server.
987 | The output will resume if you send this control message again.
988 |
989 | \value EraseCharacter Erases the last entered character.
990 |
991 | \value EraseLine Erases the last line.
992 |
993 | \value Break Sends the \c BREAK control message.
994 |
995 | \value EndOfFile Sends the \c END \c OF \c FILE control message.
996 |
997 | \value Suspend Suspends the current running process on the server.
998 | Equivalent to pressing \key{Ctrl+Z} in most terminal emulators.
999 |
1000 | \value Abort Sends the \c ABORT control message.
1001 |
1002 | \sa sendControl()
1003 | */
1004 |
1005 | /*!
1006 | Constructs a QtTelnet object.
1007 |
1008 | You must call connectToHost() before calling any of the other
1009 | member functions.
1010 |
1011 | The \a parent is sent to the QObject constructor.
1012 |
1013 | \sa connectToHost()
1014 | */
1015 | QtTelnet::QtTelnet(QObject *parent)
1016 | : QObject(parent), d(new QtTelnetPrivate(this))
1017 | {
1018 | }
1019 |
1020 | /*!
1021 | Destroys the QtTelnet object. This will also close
1022 | the connection to the server.
1023 |
1024 | \sa logout()
1025 | */
1026 | QtTelnet::~QtTelnet()
1027 | {
1028 | delete d;
1029 | }
1030 |
1031 | /*!
1032 | Calling this function will make the QtTelnet object attempt to
1033 | connect to a Telnet server specified by the given \a host and \a
1034 | port.
1035 |
1036 | The connected() signal is emitted if the connection
1037 | succeeds, and the connectionError() signal is emitted if the
1038 | connection fails. Once the connection is establishe you must call
1039 | login().
1040 |
1041 | \sa close()
1042 | */
1043 | void QtTelnet::connectToHost(const QString &host, quint16 port)
1044 | {
1045 | if (d->connected)
1046 | return;
1047 | d->socket->connectToHost(host, port);
1048 | }
1049 |
1050 | /*!
1051 | Closes the connection to a Telnet server.
1052 |
1053 | \sa connectToHost() login()
1054 | */
1055 | void QtTelnet::close()
1056 | {
1057 | if (!d->connected)
1058 | return;
1059 | delete d->notifier;
1060 | d->notifier = 0;
1061 | d->connected = false;
1062 | d->socket->close();
1063 | emit loggedOut();
1064 | }
1065 |
1066 | /*!
1067 | Sends the control message \a ctrl to the Telnet server the
1068 | QtTelnet object is connected to.
1069 |
1070 | \sa Control sendData() sendSync()
1071 | */
1072 | void QtTelnet::sendControl(Control ctrl)
1073 | {
1074 | bool sendsync = false;
1075 | char c;
1076 | switch (ctrl) {
1077 | case InterruptProcess: // Ctrl-C
1078 | c = Common::IP;
1079 | sendsync = true;
1080 | break;
1081 | case AbortOutput: // suspend/resume output
1082 | c = Common::AO;
1083 | sendsync = true;
1084 | break;
1085 | case Break:
1086 | c = Common::BRK;
1087 | break;
1088 | case Suspend: // Ctrl-Z
1089 | c = Common::SUSP;
1090 | break;
1091 | case EndOfFile:
1092 | c = Common::CEOF;
1093 | break;
1094 | case Abort:
1095 | c = Common::ABORT;
1096 | break;
1097 | case GoAhead:
1098 | c = Common::GA;
1099 | break;
1100 | case AreYouThere:
1101 | c = Common::AYT;
1102 | sendsync = true;
1103 | break;
1104 | case EraseCharacter:
1105 | c = Common::EC;
1106 | break;
1107 | case EraseLine:
1108 | c = Common::EL;
1109 | break;
1110 | default:
1111 | return;
1112 | }
1113 | const char command[2] = {Common::IAC, c};
1114 | d->sendCommand(command, sizeof(command));
1115 | if (sendsync)
1116 | sendSync();
1117 | }
1118 |
1119 | /*!
1120 | Sends the string \a data to the Telnet server. This is often a
1121 | command the Telnet server will execute.
1122 |
1123 | \sa sendControl()
1124 | */
1125 | void QtTelnet::sendData(const QString &data)
1126 | {
1127 | if (!d->connected)
1128 | return;
1129 |
1130 | QByteArray str = data.toLocal8Bit();
1131 | d->socket->write(str);
1132 | d->socket->write("\r\n\0", 3);
1133 | }
1134 |
1135 | /*!
1136 | This function will log you out of the Telnet server.
1137 | You cannot send any other data after sending this command.
1138 |
1139 | \sa login() sendData() sendControl()
1140 | */
1141 | void QtTelnet::logout()
1142 | {
1143 | d->sendCommand(Common::DO, Common::Logout);
1144 | }
1145 |
1146 | /*!
1147 | Sets the client window size to \a size.
1148 |
1149 | The width and height are given in number of characters.
1150 | Non-visible clients should pass an invalid size (i.e. QSize()).
1151 |
1152 | \sa isValidWindowSize()
1153 | */
1154 | void QtTelnet::setWindowSize(const QSize &size)
1155 | {
1156 | setWindowSize(size.width(), size.height());
1157 | }
1158 |
1159 | /*!
1160 | Sets the client window size.
1161 |
1162 | The \a width and \a height are given in number of characters.
1163 |
1164 | \overload
1165 | */
1166 | void QtTelnet::setWindowSize(int width, int height)
1167 | {
1168 | bool wasvalid = isValidWindowSize();
1169 |
1170 | d->windowSize.setWidth(width);
1171 | d->windowSize.setHeight(height);
1172 |
1173 | if (wasvalid && isValidWindowSize())
1174 | d->sendWindowSize();
1175 | else if (isValidWindowSize())
1176 | d->sendCommand(Common::WILL, Common::NAWS);
1177 | else if (wasvalid)
1178 | d->sendCommand(Common::WONT, Common::NAWS);
1179 | }
1180 |
1181 | /*!
1182 | Returns the window's size. This will be an invalid size
1183 | if the Telnet server is not using the NAWS option (RFC1073).
1184 |
1185 | \sa isValidWindowSize()
1186 | */
1187 | QSize QtTelnet::windowSize() const
1188 | {
1189 | return (d->modes[Common::NAWS] ? d->windowSize : QSize());
1190 | }
1191 |
1192 | /*!
1193 | Returns true if the window size is valid, i.e.
1194 | windowSize().isValid() returns true; otherwise returns false.
1195 |
1196 | \sa setWindowSize()
1197 | */
1198 | bool QtTelnet::isValidWindowSize() const
1199 | {
1200 | return windowSize().isValid();
1201 | }
1202 |
1203 | /*!
1204 | Set the \a socket to be used in the communication.
1205 |
1206 | This function allows you to use your own QSocket subclass. You
1207 | should call this function before calling connectToHost(); if you
1208 | call it after a connection has been established the connection
1209 | will be closed, so in all cases you will need to call
1210 | connectToHost() after calling this function.
1211 |
1212 | \sa socket(), connectToHost(), logout()
1213 | */
1214 | void QtTelnet::setSocket(QTcpSocket *socket)
1215 | {
1216 | d->setSocket(socket);
1217 | }
1218 |
1219 | /*!
1220 | Returns the QTcpSocket instance used by this telnet object.
1221 |
1222 | \sa setSocket()
1223 | */
1224 | QTcpSocket *QtTelnet::socket() const
1225 | {
1226 | return d->socket;
1227 | }
1228 |
1229 | /*!
1230 | Sends the Telnet \c SYNC sequence, meaning that the Telnet server
1231 | should discard any data waiting to be processed once the \c SYNC
1232 | sequence has been received. This is sent using a TCP urgent
1233 | notification.
1234 |
1235 | \sa sendControl()
1236 | */
1237 | void QtTelnet::sendSync()
1238 | {
1239 | if (!d->connected)
1240 | return;
1241 | d->socket->flush(); // Force the socket to send all the pending data before
1242 | // sending the SYNC sequence.
1243 | int s = d->socket->socketDescriptor();
1244 | char tosend = (char)Common::DM;
1245 | ::send(s, &tosend, 1, MSG_OOB); // Send the DATA MARK as out-of-band
1246 | }
1247 |
1248 | /*!
1249 | Sets the expected shell prompt pattern.
1250 |
1251 | The \a pattern is used to automatically recognize when the client
1252 | has successfully logged in. When a line is read that matches the
1253 | \a pattern, the loggedIn() signal will be emitted.
1254 |
1255 | \sa login(), loggedIn()
1256 | */
1257 | void QtTelnet::setPromptPattern(const QRegExp &pattern)
1258 | {
1259 | d->promptp = pattern;
1260 | }
1261 |
1262 | /*!
1263 | \fn void QtTelnet::setPromptString(const QString &pattern)
1264 |
1265 | Sets the expected shell prompt to \a pattern.
1266 |
1267 | \overload
1268 | */
1269 |
1270 | /*!
1271 | Sets the expected login pattern.
1272 |
1273 | The \a pattern is used to automatically recognize when the server
1274 | asks for a username. If no username has been set, the
1275 | loginRequired() signal will be emitted.
1276 |
1277 | \sa login()
1278 | */
1279 | void QtTelnet::setLoginPattern(const QRegExp &pattern)
1280 | {
1281 | d->loginp = pattern;
1282 | }
1283 |
1284 | /*!
1285 | \fn void QtTelnet::setLoginString(const QString &login)
1286 |
1287 | Sets the expected login string to \a login.
1288 |
1289 | \overload
1290 | */
1291 |
1292 | /*!
1293 | Sets the expected password prompt pattern.
1294 |
1295 | The \a pattern is used to automatically recognize when the server
1296 | asks for a password. If no password has been set, the loginRequired()
1297 | signal will be emitted.
1298 |
1299 | \sa login()
1300 | */
1301 | void QtTelnet::setPasswordPattern(const QRegExp &pattern)
1302 | {
1303 | d->passp = pattern;
1304 | }
1305 |
1306 | /*!
1307 | \fn void QtTelnet::setPasswordString(const QString &pattern)
1308 |
1309 | Sets the expected password prompt to \a pattern.
1310 |
1311 | \overload
1312 | */
1313 |
1314 | /*!
1315 | Sets the \a username and \a password to be used when logging in to
1316 | the server.
1317 |
1318 | \sa setLoginPattern(), setPasswordPattern()
1319 | */
1320 | void QtTelnet::login(const QString &username, const QString &password)
1321 | {
1322 | d->triedpass = d->triedlogin = false;
1323 | d->login = username;
1324 | d->pass = password;
1325 | }
1326 |
1327 | /*!
1328 | \fn void QtTelnet::loginRequired()
1329 |
1330 | This signal is emitted when the QtTelnet class sees
1331 | that the Telnet server expects authentication and you
1332 | have not already called login().
1333 |
1334 | As a reply to this signal you should either call
1335 | login() or logout()
1336 |
1337 | \sa login(), logout()
1338 | */
1339 |
1340 | /*!
1341 | \fn void QtTelnet::loginFailed()
1342 |
1343 | This signal is emitted when the login has failed.
1344 | Do note that you might in certain cases see several
1345 | loginRequired() signals being emitted but no
1346 | loginFailed() signals. This is due to the Telnet
1347 | specification not requiring the Telnet server to
1348 | support reliable authentication methods.
1349 |
1350 | \sa login(), loginRequired()
1351 | */
1352 |
1353 | /*!
1354 | \fn void QtTelnet::loggedOut()
1355 |
1356 | This signal is emitted when you have called logout()
1357 | and the Telnet server has actually logged you out.
1358 |
1359 | \sa logout(), login()
1360 | */
1361 |
1362 | /*!
1363 | \fn void QtTelnet::loggedIn()
1364 |
1365 | This signal is emitted when you have been logged in
1366 | to the server as a result of the login() command
1367 | being called. Do note that you might never see this
1368 | signal even if you have been logged in, due to the
1369 | Telnet specification not requiring Telnet servers
1370 | to notify clients when users are logged in.
1371 |
1372 | \sa login(), setPromptPattern()
1373 | */
1374 |
1375 | /*!
1376 | \fn void QtTelnet::connectionError(QAbstractSocket::SocketError error)
1377 |
1378 | This signal is emitted if the underlying socket
1379 | implementation receives an error. The \a error
1380 | argument is the same as being used in
1381 | QSocket::connectionError()
1382 | */
1383 |
1384 | /*!
1385 | \fn void QtTelnet::message(const QString &data)
1386 |
1387 | This signal is emitted when the QtTelnet object
1388 | receives more \a data from the Telnet server.
1389 |
1390 | \sa sendData()
1391 | */
1392 |
1393 | #include "qttelnet.moc"
1394 |
1395 |
--------------------------------------------------------------------------------
/QtTelnet/qttelnet.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 | ** All rights reserved.
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
6 | **
7 | ** This file is part of a Qt Solutions component.
8 | **
9 | ** Commercial Usage
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
11 | ** accordance with the Qt Solutions Commercial License Agreement provided
12 | ** with the Software or, alternatively, in accordance with the terms
13 | ** contained in a written agreement between you and Nokia.
14 | **
15 | ** GNU Lesser General Public License Usage
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
17 | ** General Public License version 2.1 as published by the Free Software
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
19 | ** packaging of this file. Please review the following information to
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22 | **
23 | ** In addition, as a special exception, Nokia gives you certain
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
25 | ** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
26 | ** package.
27 | **
28 | ** GNU General Public License Usage
29 | ** Alternatively, this file may be used under the terms of the GNU
30 | ** General Public License version 3.0 as published by the Free Software
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
32 | ** packaging of this file. Please review the following information to
33 | ** ensure the GNU General Public License version 3.0 requirements will be
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
35 | **
36 | ** Please note Third Party Software included with Qt Solutions may impose
37 | ** additional restrictions and it is the user's responsibility to ensure
38 | ** that they have met the licensing requirements of the GPL, LGPL, or Qt
39 | ** Solutions Commercial license and the relevant license of the Third
40 | ** Party Software they are using.
41 | **
42 | ** If you are unsure which license is appropriate for your use, please
43 | ** contact Nokia at qt-info@nokia.com.
44 | **
45 | ****************************************************************************/
46 |
47 | #ifndef QTTELNET_H
48 | #define QTTELNET_H
49 |
50 | #include
51 | #include
52 | #include
53 | #include
54 | #include
55 |
56 | class QtTelnetPrivate;
57 |
58 | #if defined(Q_WS_WIN)
59 | # if !defined(QT_QTTELNET_EXPORT) && !defined(QT_QTTELNET_IMPORT)
60 | # define QT_QTTELNET_EXPORT
61 | # elif defined(QT_QTTELNET_IMPORT)
62 | # if defined(QT_QTTELNET_EXPORT)
63 | # undef QT_QTTELNET_EXPORT
64 | # endif
65 | # define QT_QTTELNET_EXPORT __declspec(dllimport)
66 | # elif defined(QT_QTTELNET_EXPORT)
67 | # undef QT_QTTELNET_EXPORT
68 | # define QT_QTTELNET_EXPORT __declspec(dllexport)
69 | # endif
70 | #else
71 | # define QT_QTTELNET_EXPORT
72 | #endif
73 |
74 | class QT_QTTELNET_EXPORT QtTelnet : public QObject
75 | {
76 | Q_OBJECT
77 | friend class QtTelnetPrivate;
78 | public:
79 | QtTelnet(QObject *parent = 0);
80 | ~QtTelnet();
81 |
82 | enum Control { GoAhead, InterruptProcess, AreYouThere, AbortOutput,
83 | EraseCharacter, EraseLine, Break, EndOfFile, Suspend,
84 | Abort };
85 |
86 | void connectToHost(const QString &host, quint16 port = 23);
87 |
88 | void login(const QString &user, const QString &pass);
89 |
90 | void setWindowSize(const QSize &size);
91 | void setWindowSize(int width, int height); // In number of characters
92 | QSize windowSize() const;
93 | bool isValidWindowSize() const;
94 |
95 | void setSocket(QTcpSocket *socket);
96 | QTcpSocket *socket() const;
97 |
98 | void setPromptPattern(const QRegExp &pattern);
99 | void setPromptString(const QString &pattern)
100 | { setPromptPattern(QRegExp(QRegExp::escape(pattern))); }
101 | public Q_SLOTS:
102 | void close();
103 | void logout();
104 | void sendControl(Control ctrl);
105 | void sendData(const QString &data);
106 | void sendSync();
107 |
108 | Q_SIGNALS:
109 | void loginRequired();
110 | void loginFailed();
111 | void loggedIn();
112 | void loggedOut();
113 | void connectionError(QAbstractSocket::SocketError error);
114 | void message(const QString &data);
115 |
116 | public:
117 | void setLoginPattern(const QRegExp &pattern);
118 | void setLoginString(const QString &pattern)
119 | { setLoginPattern(QRegExp(QRegExp::escape(pattern))); }
120 | void setPasswordPattern(const QRegExp &pattern);
121 | void setPasswordString(const QString &pattern)
122 | { setPasswordPattern(QRegExp(QRegExp::escape(pattern))); }
123 |
124 | private:
125 | QtTelnetPrivate *d;
126 | };
127 | #endif
128 |
--------------------------------------------------------------------------------
/QtTelnet/qttelnet.pri:
--------------------------------------------------------------------------------
1 | include(../common.pri)
2 | INCLUDEPATH += $$PWD
3 | DEPENDPATH += $$PWD
4 |
5 | qttelnet-uselib:!qttelnet-buildlib {
6 | LIBS += -L$$QTTELNET_LIBDIR -l$$QTTELNET_LIBNAME
7 | } else {
8 | SOURCES += $$PWD/qttelnet.cpp
9 | HEADERS += $$PWD/qttelnet.h
10 | win32:LIBS += -lWs2_32
11 | }
12 | QT += network
13 |
14 | win32 {
15 | contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTTELNET_EXPORT
16 | else:qttelnet-uselib:DEFINES += QT_QTTELNET_IMPORT
17 | }
18 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | openocd-qtgui readme
2 |
3 | Overview:
4 |
5 | OpenOCD-QtGUI is a graphical frontend for OpenOCD.
6 | It's built with the Qt Window Framework.
7 |
8 |
9 | Author:
10 |
11 | Sven Sperner
12 |
13 |
14 | Checkout:
15 |
16 | git clone https://github.com/sperner/OpenOCD-QtGUI
17 |
18 |
19 | Dependencies:
20 |
21 | OpenOCD-QtGUI depends on QtTelnet which is included.
22 |
23 |
24 | Compile:
25 |
26 | qmake -project
27 | mv OpenOCD-QtGUI.pro OpenOCD-QtGUI.pro.tmp
28 | cat OpenOCD-QtGUI.pro.tmp | sed 's/\#\ Input/QT\ +=\ network/g' > OpenOCD-QtGUI.pro
29 | rm OpenOCD-QtGUI.pro.tmp
30 | qmake
31 | make
32 |
33 | or simply:
34 |
35 | ./doit.sh
36 |
37 |
38 | Configurations:
39 |
40 | Configuration file: openocd-qtgui.conf
41 |
42 |
43 | Qt-Creator:
44 |
45 | This project was developed using the Qt-Creator.
46 | The project file is included in the package.
47 |
48 |
49 | Usage:
50 |
51 | OpenOCD-QtGUI
52 |
--------------------------------------------------------------------------------
/at91sam7_wiggler.min.cfg:
--------------------------------------------------------------------------------
1 | #choose ports
2 | telnet_port 4444
3 | gdb_port 3333
4 |
5 | #interface
6 | interface parport
7 | #parport_port 0 #0x378
8 | parport_cable wiggler
9 | #jtag_khz 0 #jtag_speed 0
10 |
11 | reset_config srst_only srst_pulls_trst
12 |
13 | #set CHIPNAME at91sam7s256
14 | #source [find target/at91sam7sx.cfg]
15 |
16 | jtag newtap at91sam7s cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f
17 | target create at91sam7s.cpu arm7tdmi -endian little -chain-position at91sam7s.cpu -variant arm7tdmi
18 | at91sam7s.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup 0
19 | flash bank at91sam7 0 0 0 0 at91sam7s.cpu 0 0 0 0 0 0 0 18432
20 |
21 | at91sam7s.cpu configure -event reset-init {
22 | soft_reset_halt
23 | # RSTC_CR : Reset peripherals
24 | mww 0xfffffd00 0xa5000004
25 | # disable watchdog
26 | mww 0xfffffd44 0x00008000
27 | # enable user reset
28 | mww 0xfffffd08 0xa5000001
29 | # CKGR_MOR : enable the main oscillator
30 | mww 0xfffffc20 0x00000601
31 | sleep 10
32 | # CKGR_PLLR: 96.1097 MHz
33 | mww 0xfffffc2c 0x00481c0e
34 | sleep 10
35 | # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz
36 | mww 0xfffffc30 0x00000007
37 | sleep 10
38 | # MC_FMR: flash mode (FWS=1,FMCN=73)
39 | mww 0xffffff60 0x00490100
40 | sleep 100
41 | }
42 |
43 | #shutdown
--------------------------------------------------------------------------------
/doit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | make distclean
4 | qmake -project
5 | mv OpenOCD-QtGUI.pro OpenOCD-QtGUI.pro.tmp
6 | cat OpenOCD-QtGUI.pro.tmp | sed 's/\#\ Input/QT\ +=\ network/g' > OpenOCD-QtGUI.pro
7 | qmake
8 | make
9 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Graphical frontend for the Open On-Chip Debugger
3 | Copyright (C) 2013 Sven Sperner
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #include
20 | #include "mainwidget.h"
21 |
22 |
23 | int main(int argc, char *argv[])
24 | {
25 | QApplication application(argc, argv);
26 | MainWidget widget;
27 | widget.show();
28 | return application.exec();
29 | }
30 |
--------------------------------------------------------------------------------
/mainwidget.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Graphical frontend for the Open On-Chip Debugger
3 | Copyright (C) 2013 Sven Sperner
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #define SAM7_VERSION "0.3.3"
20 |
21 | #include "mainwidget.h"
22 | #include "ui_mainwidget.h"
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #include
30 | using namespace std;
31 |
32 |
33 | MainWidget::MainWidget(QWidget *parent) : QWidget(parent), main(new Ui::MainWidget)
34 | {
35 | main->setupUi(this);
36 |
37 | setGeometry(QRect(100,100,800,480));
38 | setWindowTitle(QString("SAM7 openOCD GUI v") + SAM7_VERSION);
39 |
40 | openOCD = new QProcess(this);
41 | telnet = new QtTelnet(this);
42 |
43 | // control buttons
44 | connect(main->pushButtonOocdConnect, SIGNAL(clicked()), this, SLOT(connectToServer()));
45 | connect(telnet, SIGNAL(message(QString)), this, SLOT(telnetMessage(QString)));
46 | connect(telnet->socket(), SIGNAL(connected()), this, SLOT(telnetConnected()));
47 | connect(telnet, SIGNAL(connectionError(QAbstractSocket::SocketError)), this, SLOT(telnetConnectionError()));
48 |
49 | connect(main->pushButtonOocdReset, SIGNAL(clicked()), this, SLOT(resetOocd()));
50 | connect(main->lineEditInput, SIGNAL(returnPressed()), this, SLOT(telnetData()));
51 |
52 | // ram
53 | connect(main->pushButtonRamFile, SIGNAL(clicked()), this, SLOT(ramFileSelect()));
54 | connect(main->pushButtonRamLoad, SIGNAL(clicked()), this, SLOT(ramLoad()));
55 |
56 | // flash
57 | connect(main->pushButtonFlashFile, SIGNAL(clicked()), this, SLOT(flashFileSelect()));
58 | connect(main->pushButtonFlashLoad, SIGNAL(clicked()), this, SLOT(flashLoad()));
59 |
60 | // command buttons
61 | connect(main->pushButtonSoftReset, SIGNAL(clicked()), this, SLOT(softReset()));
62 | connect(main->pushButtonReset, SIGNAL(clicked()), this, SLOT(reset()));
63 | connect(main->pushButtonResume, SIGNAL(clicked()), this, SLOT(resume()));
64 | connect(main->pushButtonHalt, SIGNAL(clicked()), this, SLOT(halt()));
65 | connect(main->pushButtonPoll, SIGNAL(clicked()), this, SLOT(poll()));
66 | connect(main->pushButtonShowMem, SIGNAL(clicked()), this, SLOT(showMemory()));
67 | connect(main->pushButtonEraseFlash, SIGNAL(clicked()), this, SLOT(eraseFlash()));
68 | connect(main->pushButtonRemap, SIGNAL(clicked()), this, SLOT(remap()));
69 | connect(main->pushButtonPeriphReset, SIGNAL(clicked()), this, SLOT(peripheralReset()));
70 | connect(main->pushButtonCpuReset, SIGNAL(clicked()), this, SLOT(cpuReset()));
71 |
72 | // openocd tab
73 | connect(main->pushButtonOcdConfigFile, SIGNAL(clicked()), this, SLOT(ocdConfigFileSelect()));
74 | connect(main->pushButtonOcdConfigStart, SIGNAL(clicked()), this, SLOT(ocdConfigStart()));
75 |
76 | connect(openOCD, SIGNAL(readyRead()), this, SLOT(openOcdMessage()));
77 | connect(openOCD, SIGNAL(readyReadStandardOutput()), this, SLOT(openOcdStdout()));
78 | connect(openOCD, SIGNAL(readyReadStandardError()), this, SLOT(openOcdStderr()));
79 |
80 | connect(main->pushButtonUndo, SIGNAL(clicked()), this, SLOT(editUndo()));
81 | connect(main->pushButtonRedo, SIGNAL(clicked()), this, SLOT(editRedo()));
82 | connect(main->pushButtonReload, SIGNAL(clicked()), this, SLOT(editReload()));
83 | connect(main->pushButtonSave, SIGNAL(clicked()), this, SLOT(editSave()));
84 |
85 | // configuration tab
86 | connect(main->pushButtonGuiConfigFile, SIGNAL(clicked()), this, SLOT(selectConfigFile()));
87 | connect(main->pushButtonGuiConfigLoad, SIGNAL(clicked()), this, SLOT(loadConfiguration()));
88 | connect(main->pushButtonGuiConfigSave, SIGNAL(clicked()), this, SLOT(saveConfiguration()));
89 |
90 | QFile dirFile(DIR_FILE_NAME);
91 | if (dirFile.open(QIODevice::ReadOnly | QIODevice::Text))
92 | {
93 | QTextStream dirin(&dirFile);
94 | recentDir = dirin.readLine(256);
95 | }
96 |
97 | QFile cfgFile(main->lineEditOcdConfig->text());
98 | if (cfgFile.open(QIODevice::ReadOnly | QIODevice::Text))
99 | {
100 | QTextStream cfgin(&cfgFile);
101 | main->textEditOcdConfig->setText(cfgin.readAll());
102 | }
103 | }
104 |
105 | MainWidget::~MainWidget()
106 | {
107 | QFile dirFile(DIR_FILE_NAME);
108 | if (dirFile.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text))
109 | {
110 | QTextStream out(&dirFile);
111 | out << recentDir;
112 | }
113 |
114 | delete main;
115 | }
116 |
117 |
118 |
119 | // private Slots:
120 |
121 | // control buttons:
122 | void MainWidget::connectToServer()
123 | {
124 | if (main->pushButtonOocdConnect->text() == "Connect")
125 | {
126 | telnet->connectToHost(main->lineEditHost->text(), main->lineEditPort->text().toInt());
127 | }
128 | else
129 | {
130 | telnet->close();
131 | main->textEditOutput->append("GUI: Connection closed");
132 | main->pushButtonOocdConnect->setText("Connect");
133 | }
134 | }
135 |
136 | void MainWidget::telnetConnected()
137 | {
138 | main->textEditOutput->append("GUI: Connected to " + main->lineEditHost->text() + ":" + main->lineEditPort->text());
139 | main->pushButtonOocdConnect->setText("Disconnect");
140 | }
141 |
142 | void MainWidget::telnetConnectionError()
143 | {
144 | main->textEditOutput->append("GUI: Can not connect to " + main->lineEditHost->text() + ":" + main->lineEditPort->text());
145 | }
146 |
147 | void MainWidget::resetOocd()
148 | {
149 | if (main->pushButtonOocdConnect->text() == "Disconnect")
150 | {
151 | telnet->close();
152 | telnet->connectToHost(main->lineEditHost->text(), main->lineEditPort->text().toInt());
153 | main->textEditOutput->append("GUI: Reset Connection");
154 | }
155 | else
156 | {
157 | main->textEditOutput->append("GUI: Not connected");
158 | }
159 | }
160 |
161 |
162 | void MainWidget::telnetMessage(const QString &msg) // receive output
163 | {
164 | main->textEditOutput->append(stripCR(msg));
165 | QScrollBar *s = main->textEditOutput->verticalScrollBar();
166 | s->setValue(s->maximum());
167 | }
168 |
169 | void MainWidget::telnetData() // send command
170 | {
171 | telnet->sendData(main->lineEditInput->text());
172 | main->lineEditInput->clear();
173 | }
174 |
175 |
176 | void MainWidget::ramFileSelect()
177 | {
178 | QFileDialog fDlg(this, "Select RAM Image", recentDir, "*.bin *.BIN *.elf *.ELF");
179 |
180 | if(fDlg.exec())
181 | {
182 | main->lineEditRam->setText(fDlg.selectedFiles().at(0));
183 | recentDir = fDlg.directory().absolutePath();
184 | }
185 | }
186 |
187 | void MainWidget::ramLoad() // download image to RAM
188 | {
189 | QString buffer = main->lineEditRam->text();
190 | int tmp = buffer.size();
191 |
192 | if ((buffer[tmp-3] == 'e' && buffer[tmp-2] == 'l' && buffer[tmp-1] == 'f') ||
193 | (buffer[tmp-3] == 'E' && buffer[tmp-2] == 'L' && buffer[tmp-1] == 'F'))
194 | {
195 | telnet->sendData("soft_reset_halt");
196 | telnet->sendData("load_image " + main->lineEditRam->text() + " 0x0 elf");
197 | }
198 | else if ((buffer[tmp-3] == 'b' && buffer[tmp-2] == 'i' && buffer[tmp-1] == 'n') ||
199 | (buffer[tmp-3] == 'B' && buffer[tmp-2] == 'I' && buffer[tmp-1] == 'N'))
200 | {
201 | telnet->sendData("soft_reset_halt");
202 | telnet->sendData("load_image " + main->lineEditRam->text() + " 0x200000 bin");
203 | }
204 | }
205 |
206 | void MainWidget::flashFileSelect()
207 | {
208 | QFileDialog fDlg(this, "Select FLASH Image", recentDir, "*.bin *.BIN *.elf *.ELF");
209 |
210 | if(fDlg.exec())
211 | {
212 | main->lineEditFlash->setText(fDlg.selectedFiles().at(0));
213 | recentDir = fDlg.directory().absolutePath();
214 | }
215 | }
216 |
217 | void MainWidget::flashLoad() // download image to FLASH
218 | {
219 | QString buffer = main->lineEditFlash->text();
220 | int tmp = buffer.size();
221 |
222 | if ((buffer[tmp-3] == 'e' && buffer[tmp-2] == 'l' && buffer[tmp-1] == 'f') ||
223 | (buffer[tmp-3] == 'E' && buffer[tmp-2] == 'L' && buffer[tmp-1] == 'F'))
224 | {
225 | telnet->sendData("soft_reset_halt");
226 | if (main->checkBoxErase->isChecked())
227 | telnet->sendData(main->lineEditFlashWriteCmd->text() + " erase " + main->lineEditFlash->text() + " 0x0 elf");
228 | else
229 | telnet->sendData(main->lineEditFlashWriteCmd->text() + " " + main->lineEditFlash->text() + " 0x0 elf");
230 | }
231 | else if ((buffer[tmp-3] == 'b' && buffer[tmp-2] == 'i' && buffer[tmp-1] == 'n') ||
232 | (buffer[tmp-3] == 'B' && buffer[tmp-2] == 'I' && buffer[tmp-1] == 'N'))
233 | {
234 | telnet->sendData("soft_reset_halt");
235 | if (main->checkBoxErase->isChecked())
236 | {
237 | telnet->sendData(main->lineEditFlashWriteCmd->text() + " erase " + main->lineEditFlash->text() + " 0x100000 bin");
238 | }
239 | else
240 | {
241 | telnet->sendData(main->lineEditFlashWriteCmd->text() + " " + main->lineEditFlash->text() + " 0x100000 bin");
242 | }
243 | }
244 | }
245 |
246 |
247 |
248 | // command buttons:
249 | void MainWidget::softReset()
250 | {
251 | telnet->sendData(main->lineEditSoftResetCmd->text());
252 | }
253 |
254 | void MainWidget::reset()
255 | {
256 | telnet->sendData(main->lineEditResetCmd->text());
257 | }
258 |
259 | void MainWidget::halt()
260 | {
261 | telnet->sendData(main->lineEditHaltCmd->text());
262 | }
263 |
264 | void MainWidget::resume()
265 | {
266 | telnet->sendData(main->lineEditResumeCmd->text());
267 | }
268 |
269 | void MainWidget::poll()
270 | {
271 | telnet->sendData(main->lineEditPollCmd->text());
272 | }
273 |
274 | void MainWidget::eraseFlash()
275 | {
276 | telnet->sendData(main->lineEditSoftResetCmd->text());
277 | telnet->sendData(main->lineEditFlashEraseCmd->text());
278 | }
279 |
280 | //
281 | void MainWidget::showMemory()
282 | {
283 | telnet->sendData("mdw " + main->lineEditBaseAddress->text() + " 0x08"); // base (mapped)
284 | telnet->sendData("mdw " + main->lineEditFlashAddress->text() + " 0x08"); // flash
285 | telnet->sendData("mdw " + main->lineEditRamAddress->text() + " 0x08"); // sram
286 | }
287 |
288 | void MainWidget::remap()
289 | {
290 | telnet->sendData("mww " + main->lineEditRemapAddress->text() + " " + main->lineEditRemapValue->text());
291 | }
292 |
293 | void MainWidget::peripheralReset()
294 | {
295 | telnet->sendData("mww " + main->lineEditPeriphResetAddress->text() + " " + main->lineEditPeriphResetValue->text());
296 | }
297 |
298 | void MainWidget::cpuReset()
299 | {
300 | telnet->sendData("mww " + main->lineEditCpuResetAddress->text() + " " + main->lineEditCpuResetValue->text());
301 | }
302 |
303 |
304 |
305 | // openocd tab
306 | void MainWidget::ocdConfigFileSelect()
307 | {
308 | QFileDialog fDlg(this, "Select OpenOCD Configuration", recentDir, "*.cfg *.conf *.config *.oocd *.open *.openocd");
309 |
310 | if(fDlg.exec())
311 | {
312 | main->lineEditOcdConfig->setText(fDlg.selectedFiles().at(0));
313 | recentDir = fDlg.directory().absolutePath();
314 | }
315 | editReload();
316 | }
317 |
318 | void MainWidget::ocdConfigStart() // start OpenOCD with Config
319 | {
320 | if (main->pushButtonOcdConfigStart->text() == "Start")
321 | {
322 | QString path = "/usr/bin/openocd";
323 | QStringList arguments;
324 | arguments << "-f" << main->lineEditOcdConfig->text();
325 | openOCD->start(path, arguments);
326 | main->textEditOcdTerminal->append("GUI: OpenOCD started");
327 | main->pushButtonOcdConfigStart->setText("Stop");
328 | }
329 | else
330 | {
331 | openOCD->terminate();
332 | if (!openOCD->waitForFinished(1000))
333 | openOCD->kill();
334 | main->textEditOcdTerminal->append("GUI: OpenOCD stopped");
335 | main->pushButtonOcdConfigStart->setText("Start");
336 | }
337 | }
338 |
339 | void MainWidget::openOcdMessage()
340 | {
341 | main->textEditOcdTerminal->append(stripCR(openOCD->readAll()));
342 | QScrollBar *s = main->textEditOcdTerminal->verticalScrollBar();
343 | s->setValue(s->maximum());
344 | }
345 |
346 | void MainWidget::openOcdStdout()
347 | {
348 | main->textEditOcdTerminal->append(stripCR(openOCD->readAllStandardOutput()));
349 | QScrollBar *s = main->textEditOcdTerminal->verticalScrollBar();
350 | s->setValue(s->maximum());
351 | }
352 |
353 | void MainWidget::openOcdStderr()
354 | {
355 | main->textEditOcdTerminal->append(stripCR(openOCD->readAllStandardError()));
356 | QScrollBar *s = main->textEditOcdTerminal->verticalScrollBar();
357 | s->setValue(s->maximum());
358 | }
359 |
360 | void MainWidget::editUndo()
361 | {
362 | main->textEditOcdConfig->undo();
363 | }
364 |
365 | void MainWidget::editRedo()
366 | {
367 | main->textEditOcdConfig->redo();
368 | }
369 |
370 | void MainWidget::editReload()
371 | {
372 | QFile cfgFile(main->lineEditOcdConfig->text());
373 | if (cfgFile.open(QIODevice::ReadOnly | QIODevice::Text))
374 | {
375 | QTextStream cfgin(&cfgFile);
376 | main->textEditOcdConfig->setText(cfgin.readAll());
377 | main->textEditOcdTerminal->append("GUI: OpenOCD-Config loaded");
378 | }
379 | }
380 |
381 | void MainWidget::editSave()
382 | {
383 | QFile cfgFile(main->lineEditOcdConfig->text());
384 | if (cfgFile.open(QIODevice::WriteOnly | QIODevice::Text))
385 | {
386 | QTextStream cfgout(&cfgFile);
387 | cfgout << main->textEditOcdConfig->toPlainText();
388 | main->textEditOcdTerminal->append("GUI: OpenOCD-Config saved");
389 | }
390 | }
391 |
392 |
393 |
394 | // configuration tab
395 | void MainWidget::selectConfigFile()
396 | {
397 | QFileDialog fDlg(this, "Select GUI Configuration", recentDir, "*.cfg *.conf *.config");
398 |
399 | if(fDlg.exec())
400 | {
401 | main->lineEditGuiConfig->setText(fDlg.selectedFiles().at(0));
402 | recentDir = fDlg.directory().absolutePath();
403 | }
404 | }
405 |
406 | void MainWidget::loadConfiguration()
407 | {
408 | QString buffer;
409 | QStringList buflist;
410 | QFile cfgFile(main->lineEditGuiConfig->text());
411 | if (cfgFile.open(QIODevice::ReadOnly | QIODevice::Text))
412 | {
413 | QTextStream cfgIn(&cfgFile);
414 | while (!cfgIn.atEnd())
415 | {
416 | buffer = cfgIn.readLine();
417 | if (buffer[0] == '#') continue; //skip comments
418 | buflist = buffer.split(' ');
419 | if (buflist[0] == "BASE") {
420 | main->lineEditBaseAddress->setText(buflist[2]);
421 | }
422 | else if (buflist[0] == "FLASH") {
423 | main->lineEditFlashAddress->setText(buflist[2]);
424 | }
425 | else if (buflist[0] == "RAM") {
426 | main->lineEditRamAddress->setText(buflist[2]);
427 | }
428 | else if (buflist[0] == "REMAP") {
429 | main->lineEditRemapAddress->setText(buflist[2]);
430 | main->lineEditRemapValue->setText(buflist[3]);
431 | }
432 | else if (buflist[0] == "RESETCPU") {
433 | main->lineEditCpuResetAddress->setText(buflist[2]);
434 | main->lineEditCpuResetValue->setText(buflist[3]);
435 | }
436 | else if (buflist[0] == "RESETPERIPH") {
437 | main->lineEditPeriphResetAddress->setText(buflist[2]);
438 | main->lineEditPeriphResetValue->setText(buflist[3]);
439 | }
440 | else if (buflist[0] == "FLASHPROBE") {
441 | main->lineEditFlashProbeCmd->setText(buflist[2]+" "+buflist[3]+" "+buflist[4]);
442 | }
443 | else if (buflist[0] == "FLASHINFO") {
444 | main->lineEditFlashInfoCmd->setText(buflist[2]+" "+buflist[3]+" "+buflist[4]);
445 | }
446 | else if (buflist[0] == "FLASHERASE") {
447 | main->lineEditFlashEraseCmd->setText(buflist[2]+" "+buflist[3]+" "+buflist[4]+" "+buflist[5]);
448 | }
449 | else if (buflist[0] == "FLASHUNLOCK") {
450 | main->lineEditFlashUnlockCmd->setText(buflist[2]+" "+buflist[3]+" "+buflist[4]+" "+buflist[5]+" "+buflist[6]);
451 | }
452 | else if (buflist[0] == "FLASHWRITE") {
453 | main->lineEditFlashWriteCmd->setText(buflist[2]+" "+buflist[3]);
454 | }
455 | else if (buflist[0] == "ERASESUFFIX") {
456 | main->lineEditEraseSuffix->setText(buflist[2]);
457 | }
458 | else if (buflist[0] == "RAMWRITE") {
459 | main->lineEditRamWriteCmd->setText(buflist[2]);
460 | }
461 | else if (buflist[0] == "RESET") {
462 | main->lineEditResetCmd->setText(buflist[2]);
463 | }
464 | else if (buflist[0] == "HALT") {
465 | main->lineEditHaltCmd->setText(buflist[2]);
466 | }
467 | else if (buflist[0] == "RESUME") {
468 | main->lineEditResumeCmd->setText(buflist[2]);
469 | }
470 | else if (buflist[0] == "POLL") {
471 | main->lineEditPollCmd->setText(buflist[2]);
472 | }
473 | else if (buflist[0] == "SOFTRESET") {
474 | main->lineEditSoftResetCmd->setText(buflist[2]);
475 | }
476 | }
477 | main->textEditOcdTerminal->append("GUI: GUI-Config loaded");
478 | }
479 | }
480 |
481 | void MainWidget::saveConfiguration()
482 | {
483 | QFile cfgFile(main->lineEditGuiConfig->text());
484 | if (cfgFile.open(QIODevice::WriteOnly | QIODevice::Text))
485 | {
486 | QTextStream cfgOut(&cfgFile);
487 | cfgOut << "BASE = " << main->lineEditBaseAddress->text() << " " << endl;
488 | cfgOut << "FLASH = " << main->lineEditFlashAddress->text() << " " << endl;
489 | cfgOut << "RAM = " << main->lineEditRamAddress->text() << " " << endl;
490 | cfgOut << "REMAP = " << main->lineEditRemapAddress->text() << " "
491 | << main->lineEditRemapValue->text() << endl;
492 | cfgOut << "RESETCPU = " << main->lineEditCpuResetAddress->text() << " "
493 | << main->lineEditCpuResetValue->text() << endl;
494 | cfgOut << "RESETPERIPH = " << main->lineEditPeriphResetAddress->text() << " "
495 | << main->lineEditPeriphResetValue->text() << endl;
496 | cfgOut << "FLASHPROBE = " << main->lineEditFlashProbeCmd->text() << " " << endl;
497 | cfgOut << "FLASHINFO = " << main->lineEditFlashInfoCmd->text() << " " << endl;
498 | cfgOut << "FLASHERASE = " << main->lineEditFlashEraseCmd->text() << " " << endl;
499 | cfgOut << "FLASHUNLOCK = " << main->lineEditFlashUnlockCmd->text() << " " << endl;
500 | cfgOut << "FLASHWRITE = " << main->lineEditFlashWriteCmd->text() << " " << endl;
501 | cfgOut << "ERASESUFFIX = " << main->lineEditEraseSuffix->text() << " " << endl;
502 | cfgOut << "RAMWRITE = " << main->lineEditRamWriteCmd->text() << " " << endl;
503 | cfgOut << "RESET = " << main->lineEditResetCmd->text() << " " << endl;
504 | cfgOut << "HALT = " << main->lineEditHaltCmd->text() << " " << endl;
505 | cfgOut << "RESUME = " << main->lineEditResumeCmd->text() << " " << endl;
506 | cfgOut << "POLL = " << main->lineEditPollCmd->text() << " " << endl;
507 | cfgOut << "SOFTRESET = " << main->lineEditSoftResetCmd->text() << " " << endl;
508 | main->textEditOcdTerminal->append("GUI: GUI-Config saved as " + cfgFile.fileName());
509 | }
510 | }
511 |
512 |
513 |
514 | // private Funktions:
515 | QString MainWidget::stripCR(const QString &msg)
516 | {
517 | QString nmsg(msg);
518 | nmsg.remove('\r');
519 | //nmsg.remove('\n\r\n\r');
520 | nmsg.remove(QRegExp("\033\\[[0-9;]*[A-Za-z]")); // Also remove terminal control codes
521 | return nmsg.isEmpty() ? NULL : nmsg;
522 | }
523 |
524 | void MainWidget::removeEmptyLines()
525 | {
526 |
527 | }
528 |
--------------------------------------------------------------------------------
/mainwidget.h:
--------------------------------------------------------------------------------
1 | /*
2 | Graphical frontend for the Open On-Chip Debugger
3 | Copyright (C) 2013 Sven Sperner
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef MAINWIDGET_H
20 | #define MAINWIDGET_H
21 |
22 | #include
23 | //#include
24 | #include "QtTelnet/qttelnet.h"
25 | #include
26 | #include
27 |
28 | #define DIR_FILE_NAME "/tmp/oocdqt-recentdir.dat"
29 |
30 | namespace Ui
31 | {
32 | class MainWidget;
33 | }
34 |
35 | class MainWidget : public QWidget
36 | {
37 | Q_OBJECT
38 |
39 | public:
40 | MainWidget(QWidget *parent = 0);
41 | ~MainWidget();
42 |
43 | private:
44 | QString stripCR(const QString &msg);
45 | void removeEmptyLines();
46 |
47 |
48 | private slots:
49 | // control buttons:
50 | void connectToServer();
51 | void telnetConnected();
52 | void telnetConnectionError();
53 | void resetOocd();
54 | void telnetMessage(const QString &msg);
55 | void telnetData();
56 | void ramFileSelect();
57 | void ramLoad();
58 | void flashFileSelect();
59 | void flashLoad();
60 | // command buttons:
61 | void softReset();
62 | void reset();
63 | void halt();
64 | void resume();
65 | void poll();
66 | void eraseFlash();
67 | void showMemory();
68 | void remap();
69 | void peripheralReset();
70 | void cpuReset();
71 | // openocd tab:
72 | void ocdConfigFileSelect();
73 | void ocdConfigStart();
74 | void openOcdMessage();
75 | void openOcdStdout();
76 | void openOcdStderr();
77 | void editUndo();
78 | void editRedo();
79 | void editReload();
80 | void editSave();
81 | // config tab
82 | void selectConfigFile();
83 | void loadConfiguration();
84 | void saveConfiguration();
85 |
86 | private:
87 | Ui::MainWidget *main;
88 | QProcess *openOCD;
89 | QtTelnet *telnet;
90 | QString recentDir;
91 | };
92 |
93 | #endif // MAINWIDGET_H
94 |
--------------------------------------------------------------------------------
/mainwidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 620
10 | 436
11 |
12 |
13 |
14 | SAM7 openOCD GUI V0.3
15 |
16 |
17 | -
18 |
19 |
20 | 0
21 |
22 |
23 |
24 | Telnet
25 |
26 |
27 |
-
28 |
29 |
-
30 |
31 |
32 | Qt::LeftToRight
33 |
34 |
35 | openOCD:
36 |
37 |
38 |
39 | -
40 |
41 |
42 | Qt::Horizontal
43 |
44 |
45 |
46 | 40
47 | 20
48 |
49 |
50 |
51 |
52 | -
53 |
54 |
55 | localhost
56 |
57 |
58 |
59 | -
60 |
61 |
62 | 4444
63 |
64 |
65 |
66 | -
67 |
68 |
69 | Connect to the openOCD server via telnet over port 4444
70 |
71 |
72 | Connect
73 |
74 |
75 |
76 | -
77 |
78 |
79 | Reset the JTAG connection
80 |
81 |
82 | Reset
83 |
84 |
85 |
86 |
87 |
88 | -
89 |
90 |
91 | FLASH:
92 |
93 |
94 | lineEditFlash
95 |
96 |
97 |
98 | -
99 |
100 |
-
101 |
102 |
103 | -
104 |
105 |
106 | Erase
107 |
108 |
109 |
110 | -
111 |
112 |
113 | browse for flash image
114 |
115 |
116 | ...
117 |
118 |
119 |
120 | -
121 |
122 |
123 | load the flash image into the chip
124 |
125 |
126 | Load
127 |
128 |
129 |
130 |
131 |
132 | -
133 |
134 |
135 | RAM:
136 |
137 |
138 | lineEditRam
139 |
140 |
141 |
142 | -
143 |
144 |
-
145 |
146 |
147 | -
148 |
149 |
150 | browse for RAM image
151 |
152 |
153 | ...
154 |
155 |
156 |
157 | -
158 |
159 |
160 | Load the RAM image into the chip
161 |
162 |
163 | Load
164 |
165 |
166 |
167 |
168 |
169 | -
170 |
171 |
172 | output:
173 |
174 |
175 | textEditOutput
176 |
177 |
178 |
179 | -
180 |
181 |
182 |
183 | Courier New
184 |
185 |
186 |
187 | IBeamCursor
188 |
189 |
190 | Qt::DefaultContextMenu
191 |
192 |
193 | false
194 |
195 |
196 | QTextEdit::NoWrap
197 |
198 |
199 | true
200 |
201 |
202 |
203 | -
204 |
205 |
206 | input:
207 |
208 |
209 | lineEditInput
210 |
211 |
212 |
213 | -
214 |
215 |
-
216 |
217 |
218 | -
219 |
220 |
221 | Submit
222 |
223 |
224 |
225 |
226 |
227 | -
228 |
229 |
230 |
231 | true
232 |
233 |
234 |
235 | QFrame::StyledPanel
236 |
237 |
238 |
-
239 |
240 |
-
241 |
242 |
243 | Device:
244 |
245 |
246 | lineEditRam
247 |
248 |
249 |
250 | -
251 |
252 |
253 | Qt::Horizontal
254 |
255 |
256 |
257 | 40
258 | 20
259 |
260 |
261 |
262 |
263 | -
264 |
265 |
266 | soft_reset_halt
267 |
268 |
269 | Soft Reset Halt
270 |
271 |
272 |
273 | -
274 |
275 |
276 | Reset
277 |
278 |
279 |
280 | -
281 |
282 |
283 | halt the processor
284 |
285 |
286 | Halt
287 |
288 |
289 |
290 | -
291 |
292 |
293 | resume
294 |
295 |
296 | Resume
297 |
298 |
299 |
300 | -
301 |
302 |
303 | check for the processor state
304 |
305 |
306 | Poll
307 |
308 |
309 |
310 |
311 |
312 | -
313 |
314 |
-
315 |
316 |
317 | delete all data in the flash memory
318 |
319 |
320 | Erase Flash
321 |
322 |
323 |
324 | -
325 |
326 |
327 | Qt::Horizontal
328 |
329 |
330 |
331 | 40
332 | 20
333 |
334 |
335 |
336 |
337 | -
338 |
339 |
340 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
341 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
342 | p, li { white-space: pre-wrap; }
343 | </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
344 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">show some bytes of the RAM, FLASH and remapped memory</span></p>
345 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">use this function to check, which memory is mapped to 0x000 0000</span></p></body></html>
346 |
347 |
348 | Show Memories
349 |
350 |
351 |
352 | -
353 |
354 |
355 | do the remap command
356 |
357 |
358 | Remap to SRAM
359 |
360 |
361 |
362 | -
363 |
364 |
365 | Resets Peripherals and also remaps back to flash
366 |
367 |
368 | Peripheral Reset
369 |
370 |
371 |
372 | -
373 |
374 |
375 | Reset the CPU and all its registers
376 |
377 |
378 | CPU Reset
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 | OpenOCD
392 |
393 |
394 | -
395 |
396 |
-
397 |
398 |
399 | OpenOCD-Config:
400 |
401 |
402 | lineEditRam
403 |
404 |
405 |
406 | -
407 |
408 |
409 | at91sam7_wiggler.cfg
410 |
411 |
412 |
413 | -
414 |
415 |
416 | browse for RAM image
417 |
418 |
419 | ...
420 |
421 |
422 |
423 | -
424 |
425 |
426 | Start
427 |
428 |
429 |
430 |
431 |
432 | -
433 |
434 |
435 |
436 | Courier New
437 |
438 |
439 |
440 | IBeamCursor
441 |
442 |
443 | Qt::DefaultContextMenu
444 |
445 |
446 | false
447 |
448 |
449 | QTextEdit::NoWrap
450 |
451 |
452 | false
453 |
454 |
455 |
456 | -
457 |
458 |
-
459 |
460 |
461 | Qt::Vertical
462 |
463 |
464 |
465 | 20
466 | 40
467 |
468 |
469 |
470 |
471 | -
472 |
473 |
474 | Undo
475 |
476 |
477 |
478 | -
479 |
480 |
481 | Redo
482 |
483 |
484 |
485 | -
486 |
487 |
488 | Qt::Vertical
489 |
490 |
491 |
492 | 20
493 | 40
494 |
495 |
496 |
497 |
498 | -
499 |
500 |
501 | Reaload
502 |
503 |
504 |
505 | -
506 |
507 |
508 | Save
509 |
510 |
511 |
512 | -
513 |
514 |
515 | Qt::Vertical
516 |
517 |
518 |
519 | 20
520 | 40
521 |
522 |
523 |
524 |
525 |
526 |
527 | -
528 |
529 |
530 |
531 | Courier New
532 |
533 |
534 |
535 | IBeamCursor
536 |
537 |
538 | Qt::DefaultContextMenu
539 |
540 |
541 | false
542 |
543 |
544 | QTextEdit::NoWrap
545 |
546 |
547 | true
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 | Config
556 |
557 |
558 | -
559 |
560 |
-
561 |
562 |
563 | GUI-Config:
564 |
565 |
566 | lineEditRam
567 |
568 |
569 |
570 | -
571 |
572 |
573 | openocd-qtgui.conf
574 |
575 |
576 |
577 | -
578 |
579 |
580 | browse for RAM image
581 |
582 |
583 | ...
584 |
585 |
586 |
587 | -
588 |
589 |
590 | Load
591 |
592 |
593 |
594 | -
595 |
596 |
597 | Save
598 |
599 |
600 |
601 | -
602 |
603 |
604 | Qt::Vertical
605 |
606 |
607 |
608 | 20
609 | 40
610 |
611 |
612 |
613 |
614 |
615 |
616 | -
617 |
618 |
-
619 |
620 |
621 | Base-Address:
622 |
623 |
624 | lineEditRam
625 |
626 |
627 |
628 | -
629 |
630 |
631 |
632 | Courier New
633 | 12
634 | 75
635 | true
636 |
637 |
638 |
639 | 0x00000000
640 |
641 |
642 |
643 | -
644 |
645 |
646 | Flash-Address:
647 |
648 |
649 | lineEditRam
650 |
651 |
652 |
653 | -
654 |
655 |
656 |
657 | Courier New
658 | 12
659 | 75
660 | true
661 |
662 |
663 |
664 | 0x00100000
665 |
666 |
667 |
668 | -
669 |
670 |
671 | RAM-Address:
672 |
673 |
674 | lineEditRam
675 |
676 |
677 |
678 | -
679 |
680 |
681 |
682 | Courier New
683 | 12
684 | 75
685 | true
686 |
687 |
688 |
689 | 0x00200000
690 |
691 |
692 |
693 | -
694 |
695 |
696 | CPU Reset:
697 |
698 |
699 |
700 | -
701 |
702 |
703 |
704 | Courier New
705 | 12
706 | 75
707 | true
708 |
709 |
710 |
711 | 0xfffffd00
712 |
713 |
714 |
715 | -
716 |
717 |
718 |
719 | Courier New
720 | 12
721 | 75
722 | true
723 |
724 |
725 |
726 | 0xa5000001
727 |
728 |
729 |
730 | -
731 |
732 |
733 | Peripheral Reset:
734 |
735 |
736 |
737 | -
738 |
739 |
740 |
741 | Courier New
742 | 12
743 | 75
744 | true
745 |
746 |
747 |
748 | 0xfffffd00
749 |
750 |
751 |
752 | -
753 |
754 |
755 |
756 | Courier New
757 | 12
758 | 75
759 | true
760 |
761 |
762 |
763 | 0xa5000004
764 |
765 |
766 |
767 | -
768 |
769 |
770 | Remap to SRAM:
771 |
772 |
773 |
774 | -
775 |
776 |
777 |
778 | Courier New
779 | 12
780 | 75
781 | true
782 | true
783 |
784 |
785 |
786 | 0xffffff00
787 |
788 |
789 |
790 | -
791 |
792 |
793 |
794 | Courier New
795 | 12
796 | 75
797 | true
798 |
799 |
800 |
801 | 0x00000001
802 |
803 |
804 |
805 |
806 |
807 | -
808 |
809 |
-
810 |
811 |
812 | Reset:
813 |
814 |
815 |
816 | -
817 |
818 |
819 | reset
820 |
821 |
822 |
823 | -
824 |
825 |
826 | Halt:
827 |
828 |
829 |
830 | -
831 |
832 |
833 | halt
834 |
835 |
836 |
837 | -
838 |
839 |
840 | Resume:
841 |
842 |
843 |
844 | -
845 |
846 |
847 | resume
848 |
849 |
850 |
851 | -
852 |
853 |
854 | Poll:
855 |
856 |
857 |
858 | -
859 |
860 |
861 | poll
862 |
863 |
864 |
865 | -
866 |
867 |
868 | Soft-Reset:
869 |
870 |
871 |
872 | -
873 |
874 |
875 | soft_reset_halt
876 |
877 |
878 |
879 |
880 |
881 | -
882 |
883 |
-
884 |
885 |
886 | Flash Probe:
887 |
888 |
889 |
890 | -
891 |
892 |
893 | flash probe 0
894 |
895 |
896 |
897 | -
898 |
899 |
900 | Flash Info:
901 |
902 |
903 |
904 | -
905 |
906 |
907 | flash info 0
908 |
909 |
910 |
911 | -
912 |
913 |
914 | Flash Erase:
915 |
916 |
917 |
918 | -
919 |
920 |
921 | flash erase_address 0x100000 0x10000
922 |
923 |
924 |
925 | -
926 |
927 |
928 | Flash Unlock:
929 |
930 |
931 |
932 | -
933 |
934 |
935 | flash protect 0 0 15
936 |
937 |
938 |
939 | -
940 |
941 |
942 | Flash Write:
943 |
944 |
945 |
946 | -
947 |
948 |
-
949 |
950 |
951 | flash write_image
952 |
953 |
954 |
955 | -
956 |
957 |
958 | erase
959 |
960 |
961 |
962 |
963 |
964 | -
965 |
966 |
967 | RAM Write:
968 |
969 |
970 |
971 | -
972 |
973 |
974 | load_image
975 |
976 |
977 |
978 |
979 |
980 | -
981 |
982 |
983 | Qt::Vertical
984 |
985 |
986 |
987 | 20
988 | 40
989 |
990 |
991 |
992 |
993 | -
994 |
995 |
996 | Qt::Vertical
997 |
998 |
999 |
1000 | 20
1001 | 40
1002 |
1003 |
1004 |
1005 |
1006 | -
1007 |
1008 |
1009 | Qt::Horizontal
1010 |
1011 |
1012 |
1013 | 40
1014 | 20
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
--------------------------------------------------------------------------------
/openocd-qtgui.conf:
--------------------------------------------------------------------------------
1 | BASE = 0x00000000
2 | FLASH = 0x00100000
3 | RAM = 0x00200000
4 | REMAP = 0xffffff00 0x00000001
5 | RESETCPU = 0xfffffd00 0xa5000001
6 | RESETPERIPH = 0xfffffd00 0xa5000004
7 | FLASHPROBE = flash probe 0
8 | FLASHINFO = flash info 0
9 | FLASHERASE = flash erase_address 0x100000 0x10000
10 | FLASHUNLOCK = flash protect 0 0 15
11 | FLASHWRITE = flash write_image
12 | ERASESUFFIX = erase
13 | RAMWRITE = load_image
14 | RESET = reset
15 | HALT = halt
16 | RESUME = resume
17 | POLL = poll
18 | SOFTRESET = soft_reset_halt
19 |
--------------------------------------------------------------------------------