public OpenOCDDebugConfigurator(DebugMethod method, QuickSetupDatabase quickSetup) { InitializeComponent(); _QuickSetupData = quickSetup; _Method = method; _OpenOCDDirectory = Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\..\..\..\OpenOCD"); openOCDScriptSelector1.SubdirectoryName = "interface"; openOCDScriptSelector1.OverrideOpenOCDDirectory(_OpenOCDDirectory); foreach (var prop in method.AdditionalProperties.PropertyGroups[0].Properties) { if (prop is PropertyEntry.Enumerated) { for (int pass = 0; pass < 2; pass++) foreach (var ctl in pass == 0 ? pnlFLASH.Controls : panel2.Controls) { if (ctl is ComboBox && (ctl as ComboBox).Tag is string && (ctl as ComboBox).Tag.ToString() == prop.UniqueID) { foreach (var obj in (prop as PropertyEntry.Enumerated).SuggestionList) (ctl as ComboBox).Items.Add(obj); (ctl as ComboBox).SelectedIndex = (prop as PropertyEntry.Enumerated).DefaultEntryIndex; _ComboBoxes[prop.UniqueID] = ctl as ComboBox; } } } } var ifaces = _QuickSetupData.AllInterfaces; if (ifaces != null) foreach (var iface in ifaces) cbQuickInterface.Items.Add(iface); cbQuickInterface.Items.Add(new ManualIfacePseudoitem()); }
public IGDBStubInstance StartGDBStub(IDebugStartService startService, DebugStartContext context) { var settings = (RISCVOpenOCDSettings)context.Configuration; OpenOCDCommandLine cmdLine = OpenOCDCommandLine.Parse(settings.CommandLine, startService.CommandLineHelper); if (context.ResolvedDevices?.Interface != null) { if (context.ResolvedDevices.AllCompatibleDevices.Length > 1 || settings.AlwaysPassSerialNumber) { var db = new QuickSetupDatabase(false, context.Method.Directory); var matchingIface = db.AllInterfaces.FirstOrDefault(i => i.ID == context.ResolvedDevices.Interface.ID); if (matchingIface?.SerialNumberCommand != null) { cmdLine.InsertAfterInterfaceScript(new OpenOCDCommandLine.CommandItem { Command = $"{matchingIface.SerialNumberCommand} {EscapeSerialNumber(context.ResolvedDevices.BestMatch.Device.SerialNumber)}" }); } } } if (startService.Mode == EmbeddedDebugMode.Attach) { for (; ;) { var item = cmdLine.Items.OfType <OpenOCDCommandLine.CommandItem>().FirstOrDefault(c => c.Command.StartsWith("reset")); if (item == null) { break; } cmdLine.Items.Remove(item); } } int gdbPort, telnetPort; using (var allocator = startService.BeginAllocatingTCPPorts()) { gdbPort = PortAllocationHelper.AllocateUnusedTCPPort(allocator, "SYS:GDB_PORT", settings.PreferredGDBPort); telnetPort = PortAllocationHelper.AllocateUnusedTCPPort(allocator, "com.sysprogs.openocd.telnet_port", settings.PreferredTelnetPort); } cmdLine.Items.Insert(0, new OpenOCDCommandLine.CommandItem { Command = "gdb_port " + gdbPort }); cmdLine.Items.Insert(1, new OpenOCDCommandLine.CommandItem { Command = "telnet_port " + telnetPort }); cmdLine.Items.Add(new OpenOCDCommandLine.CommandItem { Command = "echo VisualGDB_OpenOCD_Ready" }); var tool = startService.LaunchCommandLineTool(new CommandLineToolLaunchInfo { Command = Path.Combine(GetOpenOCDDirectory(context.Method.Directory), "bin\\openocd.exe"), Arguments = cmdLine.ToString(), WorkingDirectory = Path.Combine(GetOpenOCDDirectory(context.Method.Directory), "share\\openocd\\scripts") }); return(CreateStub(context, settings, cmdLine, gdbPort, telnetPort, null, tool)); }
protected override QuickSetupDatabase.TargetDeviceFamily TryDetectDeviceById(QuickSetupDatabase db, LoadedBSP.ConfiguredMCU mcu) { if (IsE300CPU(mcu)) { return(db.TryDetectDeviceById(mcu, "E300")); } else { return(base.TryDetectDeviceById(db, mcu)); } }
public OpenOCDDebugConfigurator(DebugMethod method, QuickSetupDatabase quickSetup) { InitializeComponent(); _QuickSetupData = quickSetup; _Method = method; _OpenOCDDirectory = Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\..\..\..\OpenOCD"); openOCDScriptSelector1.SubdirectoryName = "interface"; openOCDScriptSelector1.OverrideOpenOCDDirectory(_OpenOCDDirectory); foreach (var prop in method.AdditionalProperties.PropertyGroups[0].Properties) { if (prop is PropertyEntry.Enumerated) { for (int pass = 0; pass < 2; pass++) { foreach (var ctl in pass == 0 ? pnlFLASH.Controls : panel2.Controls) { if (ctl is ComboBox && (ctl as ComboBox).Tag is string && (ctl as ComboBox).Tag.ToString() == prop.UniqueID) { foreach (var obj in (prop as PropertyEntry.Enumerated).SuggestionList) { (ctl as ComboBox).Items.Add(obj); } (ctl as ComboBox).SelectedIndex = (prop as PropertyEntry.Enumerated).DefaultEntryIndex; _ComboBoxes[prop.UniqueID] = ctl as ComboBox; } } } } } var ifaces = _QuickSetupData.AllInterfaces; if (ifaces != null) { foreach (var iface in ifaces) { cbQuickInterface.Items.Add(iface); } } cbQuickInterface.Items.Add(new ManualIfacePseudoitem()); }
private void SetSelectedDevice(QuickSetupDatabase.ProgrammingInterface iface) { if (iface != null) for (int i = 0; i < cbQuickInterface.Items.Count; i++) { var thisIface = cbQuickInterface.Items[i] as QuickSetupDatabase.ProgrammingInterface; if (thisIface != null && thisIface.ID == iface.ID) { cbQuickInterface.SelectedIndex = i; break; } } }