FreeCalypso > hg > freecalypso-hwlab
annotate doc/Calypso-OpenOCD-Howto @ 89:fb75855a74a9
fc-simtool: select response parsing: show number of records
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 24 Jan 2021 18:03:55 +0000 |
parents | 6d02f30e35ad |
children |
rev | line source |
---|---|
63
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 Using OpenOCD to operate on Calypso JTAG: proof of concept |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ========================================================== |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 We have a proof-of-concept OpenOCD configuration for talking to Calypso JTAG |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 based on the theoretical findings described in the Calypso-JTAG-notes document |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 in the freecalypso-docs repository; the present document describes how one can |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 practically use OpenOCD on an FCDEV3B target. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 Choice of JTAG adapter hardware |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 =============================== |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 The PoC presented here uses an off-the-shelf unbuffered FT2232D breakout board |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 with a special EEPROM configuration as the JTAG adapter, as described in the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 Unbuffered-FT2232x-JTAG article. ADBUS0 through ADBUS3 are wired to standard |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 JTAG signals as required by FTDI and ADBUS7 (acting as a GPIO) is wired to the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 XDS_RESET line on JTAG connector pin 2. This choice of using a generic FT2232D |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 breakout board as opposed to a more purpose-made "professional" JTAG adapter |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 was made deliberately in order to force the user to make a mental shift |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 regarding reset signals: any standard JTAG adapter product will have two reset |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 outputs designated as TRST and SRST, but the XDS_RESET signal on the FCDEV3B |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 does not correspond to either of those. But a generic (non-JTAG-specific) |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 FT2232x breakout board does not have TRST or SRST, it only has ADBUS and ACBUS |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 pins that become GPIOs in MPSSE mode, allowing the user to break out of the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 TRST and SRST mentality: you just have a bunch of GPIOs, then arbitrarily pick |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 one of those GPIOs and connect it to XDS_RESET, *without* associating it with |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 either TRST or SRST. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 The full set of needed wire connections is thus: |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 FT2232D signal FCDEV3B JTAG signal |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 ----------------------------------- |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 ADBUS0 TCK (pin 11) |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 ADBUS1 TDI (pin 3) |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 ADBUS2 TDO (pin 7) |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 ADBUS3 TMS (pin 1) |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ADBUS7 XDS_RESET (pin 2) |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 You will also need to connect at least one ground pin, hence 6 wires in total. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 There is no need to connect the undocumented and non-understood EMU0 and EMU1 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 signals - we don't know what to do with them and we work without them. This |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 wiring arrangement and all functionality described in this article work exactly |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 the same way on both D-Sample and FCDEV3B boards. You will also need to |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 reprogram the EEPROM on the FT2232D board as described in the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 Unbuffered-FT2232x-JTAG article *before* you connect it to the Calypso target |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 board. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 One can also connect just the 4 JTAG wires, without reset: there are some |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 historical commercial phones and modems on which JTAG lines are accessible, but |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 Iota nTESTRESET is not, or perhaps nTESTRESET is accessible, but you don't feel |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 like replicating the transistor circuit that is required in order to drive it |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 safely - the circuit that is present on development boards, but not on hacked-up |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 phones and modems. In that case you will still be able to halt an already- |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 running Calypso, but of course you won't be able to exercise reset_halt or |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 reset_run operations described below. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 Unpowered FT2232D adapter quirk |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 =============================== |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 If you connect the FT2232D board to the FCDEV3B as described above, including |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 the XDS_RESET signal and ground, you will notice the following quirk: if the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 custom-crimped JTAG cable is connected between the two boards, but the FT2232D |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 board is not plugged into a USB host (has no USB power), the FCDEV3B will be |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 held down in test reset: the green LED will be off, and neither button on the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 board will do anything. The FCDEV3B will be released from this reset and will |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 boot in test reset mode with the green LED on the moment you plug the FT2232D |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 board into your USB host. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 Running OpenOCD |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 =============== |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 With the FT2232D board plugged into your host PC or laptop and programmed with |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 the custom USB ID of 0403:7151, you can run OpenOCD with the custom config file |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 presented in the calypso-jtag directory in this repository: |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 openocd -f ft2232d-unbuf-poc.cfg |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 Being a proof of concept, this OpenOCD config file does not follow any of the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 guidelines regarding separation between adapters and targets, but is fully |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 monolithic instead. This config is written to work with openocd-0.10.0 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 (depends on the new ftdi driver), but does NOT use the target/ti_calypso.cfg |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 fragment that has been included in mainline OpenOCD for quite some time: in the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 Mother's opinion, the latter is bogus. If someone wishes to bring Calypso |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 support in the mainline OpenOCD distribution up to par, I do not have any |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 advice or guidance for you: it is your job, not mine. The present PoC config |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 that is rather antagonistic to mainline OpenOCD, its framework and its |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 guidelines will always remain our standard answer to FreeCalypso customers |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 asking how to make JTAG work. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 When you run OpenOCD as above, the FCDEV3B target needs to be in the running |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 state with the green LED on. OpenOCD will exercise and verify the scan chain, |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 but it won't issue any resets or halts on its own, thus whatever code was |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 running on the board won't be disturbed in any way by the act of running |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 OpenOCD. You can then reset and/or halt the target as desired with our custom |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 commands (Tcl procedures) as described below. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 Halting the Calypso without a reset |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 =================================== |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 To halt an already-running Calypso ARM7 core without a reset, stopping it at |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 whatever point it happens to be in its code execution, execute this sequence: |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 enable_halt; halt |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 The enable_halt step is a custom Tcl procedure added by us, issuing the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 mysterious 0xB instruction and DR scan that are needed in order to enable halts |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 on TI's modified version of the ARM7TDMI core. Once you have halted as above, |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 you can resume and halt again without needing to re-execute the enable_halt |
64
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
108 step; the only time when the enable_halt step will need to be repeated is when |
63
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 the Calypso is reset. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 You can safely halt the Calypso in this manner when the flash is blank and the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 boot ROM waits forever for a serial download, when you have loaded a RAM image |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 with fc-xram -j and the target is left in loadagent, or when one of our standard |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 firmwares is running; in all of these states the Calypso watchdog timer is |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 disabled. However, if you are going to halt the Calypso when the watchdog timer |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 is running, you will need to execute our wd (watchdog disable) command quickly |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 after the halt, before the watchdog timer is allowed to expire. A simple way |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 would be: |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 enable_halt; halt; wd |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 The wd command (Tcl procedure) name was deliberately made short so it can be |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 typed quickly with fingers if need be. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 Resetting with or without a halt |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 ================================ |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 We don't support OpenOCD's standard reset command because we found it too |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 difficult to override its built-in assumptions which are wrong for our Calypso. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 Instead we have our own reset_halt and reset_run custom commands (Tcl |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 procedures) that replace OpenOCD's standard 'reset halt' and 'reset run', |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 respectively. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 The reset_run command will reset the board without halting the Calypso, letting |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 it boot and run normally. It is equivalent to pressing the RESET button on the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 board with your finger, except that it also re-initializes OpenOCD's scan scain |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 and "target examination" state which would otherwise get confused. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 The reset_halt command will reset the board and halt the Calypso immediately as |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 it comes out of reset, halting at the reset vector before the first instruction |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 of the boot ROM code (or the first instruction from external memory if operating |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 on a D-Sample board with the boot switch set to external) is executed. The |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 necessary disabling of the watchdog timer (wd procedure call) is already built |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 into the reset_halt Tcl procedure; except for this wd step, all Calypso and Iota |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 registers will be in their most pristine reset state. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 Recovering bricked Compal phones |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 ================================ |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 Some Mot C1xx phones have Calypso JTAG signals brought out to accessible contact |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 pads, allowing a way to recover from a bricked flash bootloader via JTAG. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 However, they do not bring out Iota nTESTRESET, instead they bring out a signal |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 which they call DLPWR, which is really Iota RPWON. A procedure similar to our |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 reset_halt would need to be performed as the first step in the recovery |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 sequence, but it would need to be modified to work with DLPWR instead of |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 XDS_RESET. The RPWON aka DLPWR signal will need to be driven with an OC/OD |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 driver (it is internally pulled up to raw VBAT, which is not a safe voltage for |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 standard 3.3V logic), and the switch-on and boot sequence will be triggered |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 when this signal is pulled low, i.e., transitions from high to low. The |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 subsequent release transition (from low back to pull-up high) does not matter, |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 i.e., RPWON may be permanently pulled down as the Calypso boots and runs, very |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 much unlike nTESTRESET or XDS_RESET. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 It will be up to you to design whatever circuit you wish to use to produce an |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 OC/OD driver that can be triggered from OpenOCD, but connecting RPWON aka DLPWR |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 directly to an FT2232x I/O pin is not acceptable. Copying the circuit from |
64
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
167 TI/FC development boards that propagates XDS_RESET into nTESTRESET won't work |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
168 either: this circuit only works when the V-IO regulator is already on, but |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
169 RPWON is not a reset and will need to be triggered when the chipset is fully |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
170 "cold". |
63
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 You will also need to figure out the appropriate timing. You will need to |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 insert a certain delay between RPWON assertion and the 'jtag arp_init' step in |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 our reset_halt procedure: the VRPC state machine in the Iota chip will do a |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 bunch of work between sensing a low on RPWON and releasing the Calypso from |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 reset via ON_nOFF, and until then the JTAG scan chain won't work. But the |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 delay cannot be too long either, or you won't halt the Calypso before it starts |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 executing bogus code from the phone's bricked flash. |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 Once you do get a working reset_halt variant, the following steps will be |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 straightforward: |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 1) Run fc-loadtool -h compal -c none /dev/ttyXXX on the serial port connected |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 to the phone's headset jack; |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 2) Enable the boot ROM and jump to it with these commands: |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 mwh 0xFFFFFB10 0x100 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 resume 0 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 The boot ROM will run while fc-loadtool is sending its beacons, fc-loadtool |
66879ce73b3e
doc/Calypso-OpenOCD-Howto article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 will load and run loadagent, and you can then recover the flash. |
64
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
193 |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
194 Lack of performance optimizations |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
195 ================================= |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
196 |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
197 Our PoC OpenOCD-on-Calypso config does not set up a work area (an area of |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
198 system RAM that is declared as a scratchpad for OpenOCD), nor does it enable |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
199 arm7_9 dcc_downloads or arm7_9 fast_memory_access. These omissions are |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
200 intentional, as those performance optimizations are outside of the scope of |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
201 what I set out to do, which is to prove Calypso JTAG as working and provide a |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
202 "golden reference" setup. |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
203 |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
204 If you wish to set up an area in Calypso IRAM as a work area for OpenOCD, which |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
205 is a prerequisite for arm7_9 dcc_downloads, you will need to choose the location |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
206 based on your specific application - whether a given area will be suitable or |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
207 not will depend on exactly what you are debugging and exactly what you are |
6d02f30e35ad
doc/Calypso-OpenOCD-Howto: noted lack of performance optimizations
Mychaela Falconia <falcon@freecalypso.org>
parents:
63
diff
changeset
|
208 trying to do, which is once again outside of the scope of this PoC. |