示例#1
0
        public void Start(ITransport transport)
        {
            if (_running)
            {
                return;
            }
            _state       = State.None;
            _target      = ATServiceProvider.GetService <STargetService, ITargetService>();
            _debugTarget = _target.GetCurrentTarget();

            _pc       = 0;
            _ramSpace = _debugTarget.Device.GetAddressSpace("data");

            _events.DebugLeave    += EventsOnDebugLeave;
            _events.DebugEnter    += EventsOnDebugEnter;
            _events.MemoryChanged += EventsOnMemoryChanged;
            _events.Start(_debugTarget);

            _server.SetTransport(transport);
            _server.UnknownData      += ServerOnUnknownData;
            _server.DebuggerAttached += ServerDebuggerAttached;
            // Start the debug server
            _server.Start();
            _output.Activate(Output.SDSerialOutputPane);

            DebugStateChanged?.Invoke();
            _running = true;
        }
示例#2
0
 public void Connect(string port, int speed)
 {
     if (_debugServer.InDebug)
     {
         return;
     }
     FireEvent(Events.Debug_Starting);
     _debugServer.DebuggerAttached     += _debugServer_DebuggerAttached;
     _debugServer.DebuggerDetached     += _debugServer_DebuggerDetached;
     _debugServer.DebuggerDisconnected += _debugServer_DebuggerDisconnected;
     _debugServer.UnknownData          += _debugServer_UnknownData;
     _transport.SetPort(port);
     _transport.SetSpeed(speed);
     _debugServer.SetTransport(_transport);
     _debugServer.Start();
     _debugServer.ResetTarget();
     FireEvent(Events.Debug_Started);
 }
示例#3
0
        // LIMITS
        //  WRITING TO UART REGISTERS WILL STOP THE COMMUNICATION
        static void Main(string[] args)
        {
            SetupCommandProcessor();

            var transport = new SerialTransport();

            transport.SetPort("COM4");
            transport.SetSpeed(500000);

            _srv = new DebugServer();
            _srv.SetTransport(transport);
            _srv.DebuggerAttached += _srv_DebuggerAttached;
            _srv.DebuggerDetached += _srv_DebuggerDetached;
            _srv.UnknownData      += SrvOnUnknownData;
            _th = new Thread(CommandLoop);

            SysConsole.WriteLine("Available register names");
            SysConsole.WriteLine("**************************************");
            SysConsole.WriteLine(Registers.RegisterMappings.Aggregate("", (s, pair) => s + ", " + pair.Key).Trim(','));
            SysConsole.WriteLine("**************************************");
            SysConsole.WriteLine("Available commands");
            SysConsole.WriteLine("c - Continue execution");
            SysConsole.WriteLine("t - Toggle all of PORTB (usually a led is on PB5)");
            SysConsole.WriteLine("w - write to memory, w (location, or IO reg) data");
            SysConsole.WriteLine("    the data is in the following format (number)[,(number)]");
            SysConsole.WriteLine("    Exp. ");
            SysConsole.WriteLine("    w pinb 0xFF");
            SysConsole.WriteLine("    w 0x0123 0xFF,0xF0,0xF1,100,255");
            SysConsole.WriteLine("r - read from memory, r (location, or IO reg) size");
            SysConsole.WriteLine("    Exp. ");
            SysConsole.WriteLine("    r pinb 1");
            SysConsole.WriteLine("    r 0x0123 0xFF");
            SysConsole.WriteLine("**************************************");

            SysConsole.WriteLine("Press any key to continue");
            SysConsole.ReadLine();

            _srv.Start();
            _th.Start();
            SysConsole.WriteLine("Powercycle the target");

            // Block everything
            _th.Join();
        }