MCPcopy Create free account
hub / github.com/Marus/cortex-debug / PEServerController

Class PEServerController

src/pemicro.ts:8–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6const commandExistsSync = require('command-exists').sync;
7
8export class PEServerController extends EventEmitter implements GDBServerController {
9 public portsNeeded: string[] = ['gdbPort', 'swoPort', 'consolePort'];
10 public name: 'PE';
11
12 private args: ConfigurationArguments;
13 private ports: { [name: string]: number };
14
15 constructor() {
16 super();
17 }
18
19 public setPorts(ports: { [name: string]: number }): void {
20 this.ports = ports;
21 }
22
23 public setArguments(args: ConfigurationArguments): void {
24 this.args = args;
25 }
26
27 public customRequest(command: string, response: DebugProtocol.Response, args: any): boolean {
28 return false;
29 }
30
31 public initCommands(): string[] {
32 const gdbport = this.ports[createPortName(this.args.targetProcessor)];
33
34 return [
35 `target-select extended-remote localhost:${gdbport}`
36 ];
37 }
38
39 public launchCommands(): string[] {
40 const commands = [
41 ...genDownloadCommands(this.args, ['interpreter-exec console "monitor _reset"']),
42 'interpreter-exec console "monitor _reset"'
43 ];
44
45 return commands;
46 }
47
48 public attachCommands(): string[] {
49 const commands = [
50 'interpreter-exec console "monitor halt"'
51 ];
52
53 return commands;
54 }
55
56 public restartCommands(): string[] {
57 const commands: string[] = [
58 'interpreter-exec console "monitor _reset"'
59 ];
60
61 return commands;
62 }
63
64 public swoAndRTTCommands(): string[] {
65 // No commands needed for SWO. All are sent on the streaming port

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected