Exemplo n.º 1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            var iface = cbQuickInterface.SelectedItem as QuickSetupDatabase.ProgrammingInterface;

            if (iface != null && iface.UsbIdentities != null && iface.UsbIdentities.Length > 0)
            {
                if (!UsbDriverHelper.TryCheckDeviceAndInstallDriversInteractively(iface.UsbIdentities, iface.UniversalDriverId))
                {
                    return;
                }
            }

            Process process = new Process();

            process.StartInfo.FileName         = _OpenOCDDirectory + @"\bin\openocd.exe";
            process.StartInfo.WorkingDirectory = _OpenOCDDirectory + @"\share\openocd\scripts";
            process.StartInfo.Arguments        = CommandLineTools.BuildCommandLine(_Method.GDBServerArguments, new Dictionary <string, string>(), Configuration);

            using (var frm = new CommandTestForm(process))
            {
                frm.ShowDialog();
                string output = frm.AllOutput;
                if (output.Contains("An adapter speed is not selected in the init script") && !cbQuickSpeed.Checked)
                {
                    if (MessageBox.Show("OpenOCD could not determine JTAG speed. Do you want to specify it explicitly?", "VisualGDB", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        cbQuickSpeed.Checked = true;
                        numSpeed2.Focus();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            var adapterCommand = (cbAdapter.SelectedItem as PropertyEntry.Enumerated.Suggestion)?.InternalValue;

            UsbDriverHelper.UsbIdentity id = new UsbDriverHelper.UsbIdentity {
                VID = "03eb"
            };
            if (adapterCommand != null)
            {
                switch (adapterCommand)
                {
                case "-2":
                    id.PID = "2103";
                    break;

                case "-g":
                    id.PID = "2107";
                    break;
                }
            }

            if (id.PID != null)
            {
                if (!UsbDriverHelper.TryCheckDeviceAndInstallDriversInteractively(new UsbDriverHelper.UsbIdentity[] { id }, "com.sysprogs.libusb.mini"))
                {
                    return;
                }
            }

            Process process = new Process();

            process.StartInfo.FileName         = _ToolchainBin + @"\avarice.exe";
            process.StartInfo.WorkingDirectory = _ToolchainBin;
            var cfg = Configuration;

            cfg.Remove("com.sysprogs.avr.avarice.erase");
            cfg.Remove("com.sysprogs.avr.avarice.program");
            cfg.Remove("com.sysprogs.avr.avarice.verify");
            cfg.Remove("com.sysprogs.avr.avarice.port");

            process.StartInfo.Arguments = CommandLineTools.BuildCommandLine(_MyMethod.GDBServerArguments, new Dictionary <string, string>(), cfg).Replace(_MyMethod.GDBServerArguments.GNUArgumentPrefix, "") + " -l";

            using (var frm = new CommandTestForm(process))
            {
                frm.ShowDialog();
            }
        }