Ejemplo n.º 1
0
        public bool RunOpenOCD(openOCDConfig cfg, bool flash_cfg)
        {
          
                if (OpenOCD_Process == null || OpenOCD_Process.HasExited)
                {
                    OpenOCD_Process = new process_runner(false, true);

                    OpenOCD_Process.onNewErrorOutputData += new EventHandler<ConsoleOutputEventArgs>(recv_output);
                    OpenOCD_Process.onProcessKill += new EventHandler(OpenOCD_Process_onProcessKill);
                    if (flash_cfg)
                    {
                        if (OpenOCD_Process.start(@cfg.OCDexePath, " '-f " + cfg.OCDcfgFlashPath + "'", "") != process_runner.STATUS_CODES.OK)
                        {
                            throw new Exception("ErrorStartingOpenOCD");
                        }
                        else return true;
                    }
                    else
                    {
                        if (OpenOCD_Process.start(@cfg.OCDexePath, " '-f " + cfg.OCDcfgPath + "'", "") != process_runner.STATUS_CODES.OK)
                        {
                            throw new Exception("ErrorStartingOpenOCD");
                        }
                        else
                        {
                          if (!_TelnetClient.Connect())
                            {
                              //  throw new Exception("ErrorConncetingTelnet");
                            }
                           
                            return true;
                        }
                    }
                }
                else //reset openocd app
                {
                    killOpenOCD();
                    return RunOpenOCD(cfg, flash_cfg);
                }
 
        }
Ejemplo n.º 2
0
        private void load_cfg()
        {

            try
            {
                XmlSerializer ser = new XmlSerializer(typeof(openOCDConfig));
                StreamReader str = new StreamReader("config_ocd.dat");
                _cfg = (openOCDConfig)ser.Deserialize(str);
                str.Close();
                updateTextBoxes();
                _cfg.loaded = true;
            }
            catch
            {
                _cfg.loaded = false;
            }
        }