|
1 | 1 | # Sequence diagrams for pyOCD sub-commands |
2 | 2 |
|
3 | 3 | ## Erase |
4 | | -```mermaid |
5 | | -flowchart TD |
6 | | - SessionStart([Session Start]) --> HaltAllCores[Halt all cores] |
7 | | - HaltAllCores --> SetVectorCatch[Set vector catch all cores] |
8 | | - SetVectorCatch --> SystemResetPrimary[System reset using primary core] |
9 | | - SystemResetPrimary --> ClearVectorCatch[Clear vector catch all cores] |
10 | | - ClearVectorCatch --> EraseEverything[Erase all using primary core] |
11 | | - EraseEverything --> Decision{Erase successful?} |
| 4 | +- Sessions starts |
| 5 | + - Set Debug enable |
| 6 | +- Discovery phase: |
| 7 | + - Use selected connect mode (normal, pre-reset, under reset) |
| 8 | + - Execute Debug sequence if necessary |
| 9 | +- Erase phase: |
| 10 | + - Halt all cores |
| 11 | + - Set Vector catch for all cores |
| 12 | + - Reset device (based on reset_type) [using primary core] |
| 13 | + - Clear Vector catch for all cores |
| 14 | + - Collect all memory regions that need to be erased |
| 15 | + - Check if selected flash algorithms can be executed with primary core |
| 16 | + - YES: |
| 17 | + - If 'chip erase' execute chipErase function or fall back to sector erase for all sectors |
| 18 | + - If 'sector erase' collect |
| 19 | + - NO: |
| 20 | + - Switch to core, required by algorithm and do erase |
| 21 | + - Erase successful |
| 22 | +- Clean-up phase: |
| 23 | + - Put all cores in deadloops |
| 24 | +- Session ends: |
| 25 | + - Remove Debug enable on device |
12 | 26 |
|
13 | | - Decision -- Yes --> LeaveUsedCoresDeadLoops[Leave used cores in dead loops] |
14 | | - LeaveUsedCoresDeadLoops --> SessionEnd([Session End]) |
15 | | -
|
16 | | - Decision -- No --> FallbackToAlternates[Fallback to alternate cores] |
17 | | - FallbackToAlternates --> ProcessorResetAlternates[Processor reset on alternate cores] |
18 | | - ProcessorResetAlternates --> EraseViaAlternates[Erase via alternate cores] |
19 | | - EraseViaAlternates --> LeaveUsedCoresDeadLoops |
20 | | -``` |
21 | | - |
22 | | - |
23 | | -## Load |
24 | | -```mermaid |
25 | | -flowchart TD |
26 | | - SessionStart([Session Start]) --> HaltAllCores[Halt all cores] |
27 | | - HaltAllCores --> SetVectorCatch[Set vector catch all cores] |
28 | | - SetVectorCatch --> SystemResetPrimary[System reset using primary core] |
29 | | - SystemResetPrimary --> ClearVectorCatch[Clear vector catch all cores] |
30 | | - ClearVectorCatch --> ProgramEverything[Program everything with primary core] |
31 | | - ProgramEverything --> Decision{Program successful?} |
32 | | -
|
33 | | - Decision -- Yes --> LeaveUsedCoresDeadLoops[Leave used cores in dead loops] |
34 | | - LeaveUsedCoresDeadLoops --> OptionalHardwareReset[Optional hardware reset] |
35 | | - OptionalHardwareReset --> SessionEnd([Session End]) |
36 | | -
|
37 | | - Decision -- No --> FallbackToAlternates[Fallback to alternate cores] |
38 | | - FallbackToAlternates --> ProcessorResetAlternates[Processor reset on alternate cores] |
39 | | - ProcessorResetAlternates --> ProgramViaAlternates[Program via alternate cores] |
40 | | - ProgramViaAlternates --> LeaveUsedCoresDeadLoops |
41 | | -``` |
42 | | - |
43 | | - |
44 | | -## Load & Run |
45 | | -```mermaid |
46 | | -flowchart TD |
47 | | - LoadSessionStart([Session Start]) --> Load[Load] |
48 | | - Load --> LoadSessionEnd([Session End]) |
49 | | - LoadSessionEnd -.-> GDBSessionStart([Session Start]) |
50 | | - GDBSessionStart --> HaltAllCores[Halt all cores] |
51 | | - HaltAllCores --> CreateGDBServers[Create GDB Servers for all cores] |
52 | | - CreateGDBServers --> SystemReset[System Reset] |
53 | | - SystemReset --> WaitForConnection(Wait for connection) |
54 | | - WaitForConnection -->|no connection| WaitForConnection |
55 | | - WaitForConnection -->|connection received| Connected[Connection established] |
56 | | - Connected -.-> AllDisconnected(All connections closed) |
57 | | - AllDisconnected --> GDBSessionEnd([Session End]) |
58 | | -``` |
59 | | - |
60 | | - |
61 | | -## Load & Debug |
62 | | -```mermaid |
63 | | -flowchart TD |
64 | | - LoadSessionStart([Session Start]) --> Load[Load] |
65 | | - Load --> LoadSessionEnd([Session End]) |
66 | | - LoadSessionEnd -.-> GDBSessionStart([Session Start]) |
67 | | - GDBSessionStart --> HaltAllCores[Halt all cores] |
68 | | - HaltAllCores --> CreateGDBServers[Create GDB Servers for all cores] |
69 | | - CreateGDBServers --> WaitForConnection(Wait for connection) |
70 | | - WaitForConnection -->|no connection| WaitForConnection |
71 | | - WaitForConnection -->|connection received| Connected[Connection established] |
72 | | - Connected --> InitCommands[Execute init commands] |
73 | | - InitCommands -.-> Debug[Debug application] |
74 | | - Debug -.-> StopDebugSession[Stop debug session] |
75 | | - StopDebugSession -.-> GDBSessionEnd([Session End]) |
76 | | -``` |
77 | | - |
78 | | - |
79 | | - |
80 | | - |
81 | | -# Current implementation |
82 | | - |
83 | | -## Erase |
84 | | -```mermaid |
85 | | -flowchart TD |
86 | | - SessionStart([Session Start]) --> HaltAllCores[Halt all cores] |
87 | | - HaltAllCores --> SetVectorCatch[Set vector catch all cores] |
88 | | - SetVectorCatch --> SystemResetPrimary[System reset using primary core] |
89 | | - SystemResetPrimary --> ClearVectorCatch[Clear vector catch all cores] |
90 | | - ClearVectorCatch --> EraseEverything[Erase all using primary core] |
91 | | - EraseEverything --> LeaveUsedCoresDeadLoops[Leave primary core in dead loop] |
92 | | - LeaveUsedCoresDeadLoops --> SessionEnd([Session End]) |
93 | | -``` |
94 | 27 |
|
95 | 28 | ## Load |
96 | | -```mermaid |
97 | | -flowchart TD |
98 | | - SessionStart([Session Start]) --> HaltAllCores[Halt all cores] |
99 | | - HaltAllCores --> SetVectorCatch[Set vector catch all cores] |
100 | | - SetVectorCatch --> SystemResetPrimary[System reset using primary core] |
101 | | - SystemResetPrimary --> ClearVectorCatch[Clear vector catch all cores] |
102 | | - ClearVectorCatch --> ProgramEverything[Program everything with primary core] |
103 | | - ProgramEverything --> LeaveUsedCoresDeadLoops[Leave primary core in dead loop] |
104 | | - LeaveUsedCoresDeadLoops --> OptionalHardwareReset[Optional hardware reset] |
105 | | - OptionalHardwareReset --> SessionEnd([Session End]) |
106 | | -``` |
| 29 | +- Session starts |
| 30 | + - Set Debug enable |
| 31 | +- Discovery phase: |
| 32 | + - Use selected connect mode (normal, pre-reset, under-reset) |
| 33 | + - Execute Debug sequence if necessary |
| 34 | +- Flash phase: |
| 35 | + - Halt all cores |
| 36 | + - Set vector catch for all cores |
| 37 | + - Reset device (based on reset_type) [using primary core] |
| 38 | + - Clear vector catch for all cores |
| 39 | + - Collect all memory regions to be programmed |
| 40 | + - Check if selected flash algorithms can be used with the primary core |
| 41 | + - YES: |
| 42 | + - Flash application |
| 43 | + - NO: |
| 44 | + - Switch to core, required by the algorithm and flash the application |
| 45 | + - Flash successful |
| 46 | + - Optional: |
| 47 | + - Set vector catch for all cores |
| 48 | + - Hardware reset device |
| 49 | + - Clear vector catch for all cores |
| 50 | + - Clean-up phase: |
| 51 | + - Put all cores in deadloops |
| 52 | + - Session ends: |
| 53 | + - Remove Debug enable on device |
| 54 | + |
| 55 | + |
| 56 | +## GDBServer |
| 57 | +- Session start |
| 58 | + - Set Debug enable |
| 59 | +- Discovery phase: |
| 60 | + - Use selected connect mode (normal, pre-reset, under-reset) |
| 61 | + - Execute Debug sequence if necessary |
| 62 | +- GDB phase: |
| 63 | + - Halt all cores |
| 64 | + - Create GDb servers for all cores |
| 65 | + - If 'reset-run' option, reset device using 'reset_type' [with primary core] |
| 66 | + - Wait for connection |
| 67 | + - Connected |
| 68 | + - Execute GDB init commands (monitor reset halt) |
| 69 | + - Debug.. |
| 70 | +- Debug session ends |
| 71 | + - Remove Debug enable on device |
0 commit comments