Example #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);
                }
 
        }
Example #2
0
        public bool RunGDB(GDBConfig cfg)
        {

            if (gdb_Process == null || gdb_Process.HasExited)
            {
                gdb_Process = new process_runner(true, false);

                gdb_Process.onNewStdOutputData += new EventHandler<ConsoleOutputEventArgs>(recv_output);
                gdb_Process.onProcessKill += new EventHandler(GDB_Process_onProcessKill);

                if (gdb_Process.start(@cfg.GDBexePath, cfg.GDBcmdArgs, "") != process_runner.STATUS_CODES.OK)
                {
                    throw new Exception("ErrorStartingGDB");
                }
                else return true;
            }
            else //reset openocd app
            {
                killGDB();
                return RunGDB(cfg);
            }
        }