public void SetConfiguration(object configuration, KnownInterfaceInstance context) { var settings = configuration as TiXDSDebugSettings ?? new TiXDSDebugSettings(); DataContext = _Editor = new TiXDSSettingsEditor(settings); _Editor.PropertyChanged += _Editor_PropertyChanged; }
public IGDBStubInstance StartGDBStub(IDebugStartService startService, DebugStartContext context) { var settings = context.Configuration as TiXDSDebugSettings ?? throw new Exception("Missing debug method settings"); var exe = new TiXDSSettingsEditor(settings).GDBAgentExecutable; if (string.IsNullOrEmpty(exe) || !File.Exists(exe)) { throw new Exception("Missing TI XDS stub: " + exe); } var tool = startService.LaunchCommandLineTool(new CommandLineToolLaunchInfo { Command = exe, WorkingDirectory = Path.GetDirectoryName(exe), Arguments = "cc3220s.dat" }); return(new StubInstance(context.Method.Directory, settings, tool)); }
public IGDBStubInstance StartGDBStub(IDebugStartService startService, DebugStartContext context) { var settings = context.Configuration as TiXDSDebugSettings ?? throw new Exception("Missing debug method settings"); var exe = new TiXDSSettingsEditor(settings).GDBAgentExecutable; if (string.IsNullOrEmpty(exe) || !File.Exists(exe)) { throw new Exception("Missing TI XDS stub: " + exe); } string configFile = null; switch (settings.FLASHDriver) { case TiXDSFLASHDriver.CC3220: configFile = "cc3220s.dat"; break; case TiXDSFLASHDriver.UniFLASH: configFile = Path.Combine(context.Method.Directory, "rm57x.dat"); break; } if (settings.FLASHDriver == TiXDSFLASHDriver.UniFLASH && startService.Mode != EmbeddedDebugMode.ConnectionTest && startService.Mode != EmbeddedDebugMode.Attach) { bool skipLoad = false; switch (settings.ProgramMode) { case ProgramMode.Disabled: skipLoad = true; break; case ProgramMode.Auto: if (startService.IsCurrentFirmwareAlreadyProgrammed()) { skipLoad = true; } break; } if (!skipLoad) { string uniFLASHDir = Path.Combine(context.Method.Directory, "UniFLASH"); var programTool = startService.LaunchCommandLineTool(new CommandLineToolLaunchInfo { Command = Path.Combine(uniFLASHDir, "dslite.bat"), Arguments = $@"--config={uniFLASHDir}\user_files\configs\rm57l8xx.ccxml {startService.TargetPath} --verbose", ShowInGDBStubWindow = true }); using (var logFile = new FileStream(Path.Combine(Path.GetDirectoryName(startService.TargetPath), "UniFLASH.log"), FileMode.Create, FileAccess.ReadWrite, FileShare.Read)) { programTool.LineReceived += (s, e) => { try { byte[] data = Encoding.UTF8.GetBytes(e.Line + "\r\n"); logFile.Write(data, 0, data.Length); logFile.Flush(); } catch { }; }; while (programTool.IsRunning) { Thread.Sleep(100); } if (programTool.ExitCode != 0) { throw new Exception($"UniFLASH exited with code {programTool.ExitCode}. Please check UniFLASH.log."); } } startService.OnFirmwareProgrammedSuccessfully(); } } if (!string.IsNullOrEmpty(settings.CustomConfigFile)) { configFile = settings.CustomConfigFile; } var tool = startService.LaunchCommandLineTool(new CommandLineToolLaunchInfo { Command = exe, WorkingDirectory = Path.GetDirectoryName(exe), Arguments = configFile }); return(new StubInstance(context.Method.Directory, settings, tool)); }