コード例 #1
0
ファイル: run_tests.py プロジェクト: hyo1411/openocd-esp32
def dbg_start(toolchain, oocd, oocd_tcl, oocd_cfg_files, oocd_cfg_cmds, debug_oocd,
              chip_name, log_level, log_stream, log_file, gdb_log):
    global _oocd_inst, _gdb_inst
    connect_tmo = 15
    remote_tmo = 10
    # Start OpenOCD
    _oocd_inst = dbg.create_oocd(chip_name=chip_name,
                        oocd_exec=oocd,
                        oocd_scripts=oocd_tcl,
                        oocd_cfg_files=oocd_cfg_files,
                        oocd_cfg_cmds=oocd_cfg_cmds,
                        oocd_debug=debug_oocd,
                        log_level=log_level,
                        log_stream_handler=log_stream,
                        log_file_handler=log_file)
    _oocd_inst.start()
    try:
        # reset the board if it is stuck from the previous test run
        _oocd_inst.cmd_exec('reset halt')
        # Start GDB
        _gdb_inst = dbg.create_gdb(chip_name=chip_name,
                            gdb_path='%sgdb' % toolchain,
                            remote_target='127.0.0.1:%d' % dbg.Oocd.GDB_PORT,
                            log_level=log_level,
                            log_stream_handler=log_stream,
                            log_file_handler=log_file)
        if len(gdb_log):
            _gdb_inst.gdb_set('remotelogfile', gdb_log)
        if debug_oocd > 2:
            _gdb_inst.tmo_scale_factor = 3
        _gdb_inst.gdb_set('remotetimeout', '%d' % remote_tmo)
        _gdb_inst.connect(tmo=connect_tmo)
    except Exception as e:
        _oocd_inst.stop()
        raise e
コード例 #2
0
def dbg_start(toolchain, oocd, oocd_tcl, oocd_cfg_files, oocd_cfg_cmds, debug_oocd,
              target_name, log_level, log_stream, log_file):
    global _oocd_inst, _gdb_inst
    # Start OpenOCD
    _oocd_inst = dbg.create_oocd(chip_name=target_name,
                        oocd_exec=oocd,
                        oocd_scripts=oocd_tcl,
                        oocd_cfg_files=oocd_cfg_files,
                        oocd_cfg_cmds=oocd_cfg_cmds,
                        oocd_debug=debug_oocd,
                        log_level=log_level,
                        log_stream_handler=log_stream,
                        log_file_handler=log_file)
    _oocd_inst.start()
    try:
        # reset the board if it is stuck from the previous test run
        _oocd_inst.cmd_exec('reset halt')
        # Start GDB
        _gdb_inst = dbg.create_gdb(chip_name=target_name,
                            gdb_path='%sgdb' % toolchain,
                            remote_target=':%d' % dbg.Oocd.GDB_PORT,
                            log_level=log_level,
                            log_stream_handler=log_stream,
                            log_file_handler=log_file)
        _gdb_inst.connect()
    except Exception as e:
        _oocd_inst.stop()
        raise e
コード例 #3
0
ファイル: DebugUtils.py プロジェクト: stmariej/esp-idf
 def __init__(self,
              logfile_path,
              elffile_path,
              target,
              gdbinit_path=None,
              working_dir=None):
     self.gdb = debug_backend.create_gdb(
         chip_name=target,
         gdb_path='xtensa-{}-elf-gdb'.format(target),
         remote_target=None,
         extended_remote_mode=False,
         gdb_log_file=logfile_path,
         log_level=None,
         log_stream_handler=None,
         log_file_handler=None,
         scope=None)
     if working_dir:
         self.gdb.console_cmd_run('directory {}'.format(working_dir))
     self.gdb.exec_file_set(elffile_path)
     if gdbinit_path:
         try:
             self.gdb.console_cmd_run('source {}'.format(gdbinit_path))
         except debug_backend.defs.DebuggerTargetStateTimeoutError:
             # The internal timeout is not enough on RPI for more time consuming operations, e.g. "load".
             # So lets try to apply the commands one-by-one:
             with open(gdbinit_path, 'r') as f:
                 for line in f:
                     line = line.strip()
                     if len(line) > 0 and not line.startswith('#'):
                         self.gdb.console_cmd_run(line)