| 4 | import { EventEmitter } from 'events'; |
| 5 | |
| 6 | export class STUtilServerController extends EventEmitter implements GDBServerController { |
| 7 | public readonly name: string = 'ST-Util'; |
| 8 | public readonly portsNeeded: string[] = ['gdbPort']; |
| 9 | |
| 10 | private args: ConfigurationArguments; |
| 11 | private ports: { [name: string]: number }; |
| 12 | |
| 13 | constructor() { |
| 14 | super(); |
| 15 | } |
| 16 | |
| 17 | public setPorts(ports: { [name: string]: number }): void { |
| 18 | this.ports = ports; |
| 19 | } |
| 20 | |
| 21 | public setArguments(args: ConfigurationArguments): void { |
| 22 | this.args = args; |
| 23 | } |
| 24 | |
| 25 | public customRequest(command: string, response: DebugProtocol.Response, args: any): boolean { |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | public initCommands(): string[] { |
| 30 | const gdbport = this.ports[createPortName(this.args.targetProcessor)]; |
| 31 | |
| 32 | return [ |
| 33 | `target-select extended-remote localhost:${gdbport}` |
| 34 | ]; |
| 35 | } |
| 36 | |
| 37 | public launchCommands(): string[] { |
| 38 | const commands = [ |
| 39 | 'interpreter-exec console "monitor halt"', |
| 40 | ...genDownloadCommands(this.args, ['interpreter-exec console "monitor reset"']), |
| 41 | 'interpreter-exec console "monitor reset"' |
| 42 | ]; |
| 43 | return commands; |
| 44 | } |
| 45 | |
| 46 | public attachCommands(): string[] { |
| 47 | const commands = [ |
| 48 | 'interpreter-exec console "monitor halt"' |
| 49 | ]; |
| 50 | return commands; |
| 51 | } |
| 52 | |
| 53 | public restartCommands(): string[] { |
| 54 | const commands: string[] = [ |
| 55 | 'interpreter-exec console "monitor halt"', |
| 56 | 'interpreter-exec console "monitor reset"' |
| 57 | ]; |
| 58 | return commands; |
| 59 | } |
| 60 | |
| 61 | public swoAndRTTCommands(): string[] { |
| 62 | const commands = []; |
| 63 | if (this.args.swoConfig.enabled && this.args.swoConfig.source !== 'probe') { |
nothing calls this directly
no outgoing calls
no test coverage detected