public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null)
                {
                    return;
                }

                _DBG.Engine engine = device.DbgEngine;

                _DBG.WireProtocol.Commands.Monitor_DeploymentMap.Reply reply = engine.DeploymentMap();

                if (reply != null)
                {
                    for (int i = 0; i < reply.m_count; i++)
                    {
                        _DBG.WireProtocol.Commands.Monitor_DeploymentMap.DeploymentData dd = reply.m_map[i];

                        form.DumpToOutput("Assembly " + i.ToString());
                        form.DumpToOutput("  Address: " + dd.m_address.ToString());
                        form.DumpToOutput("  Size   : " + dd.m_size.ToString());
                        form.DumpToOutput("  CRC    : " + dd.m_CRC.ToString());
                    }

                    if (reply.m_count == 0)
                    {
                        form.DumpToOutput("No deployed assemblies");
                    }
                }
                else
                {
                    form.DumpToOutput("Command Not Supported by Device");
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (device == null || form == null)
                {
                    return;
                }

                _DBG.Engine engine = device.DbgEngine;

                _DBG.WireProtocol.Commands.Monitor_MemoryMap.Range[] range = engine.MemoryMap();

                if (range != null && range.Length > 0)
                {
                    form.DumpToOutput("Type     Start       Size");
                    form.DumpToOutput("--------------------------------");
                    for (int i = 0; i < range.Length; i++)
                    {
                        string mem = "";
                        switch (range[i].m_flags)
                        {
                        case _DBG.WireProtocol.Commands.Monitor_MemoryMap.c_FLASH:
                            mem = "FLASH";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_MemoryMap.c_RAM:
                            mem = "RAM";
                            break;
                        }
                        form.DumpToOutput(string.Format("{0,-6} 0x{1:x08}  0x{2:x08}", mem, range[i].m_address, range[i].m_length));
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                MFDevice.IMFDeviceInfo info = device.MFDeviceInfo;

                if (!info.Valid)
                {
                    form.DumpToOutput("DeviceInfo is not valid!");
                }
                else
                {
                    form.DumpToOutput("DeviceInfo:");
                    form.DumpToOutput(String.Format("  HAL build info: {0}, {1}", info.HalBuildVersion.ToString(), info.HalBuildInfo));
                    form.DumpToOutput(String.Format("  OEM Product codes (vendor, model, SKU): {0}, {1}, {2}", info.OEM.ToString(), info.Model.ToString(), info.SKU.ToString()));
                    form.DumpToOutput("  Serial Numbers (module, system):");
                    form.DumpToOutput("    " + info.ModuleSerialNumber);
                    form.DumpToOutput("    " + info.SystemSerialNumber);
                    form.DumpToOutput(String.Format("  Solution Build Info: {0}, {1}", info.SolutionBuildVersion.ToString(), info.SolutionBuildInfo));

                    form.DumpToOutput("  AppDomains:");
                    foreach (MFDevice.IAppDomainInfo adi in info.AppDomains)
                    {
                        form.DumpToOutput(String.Format("    {0}, id={1}", adi.Name, adi.ID));
                    }

                    form.DumpToOutput("  Assemblies:");
                    foreach (MFDevice.IAssemblyInfo ai in info.Assemblies)
                    {
                        form.DumpToOutput(String.Format("    {0},{1}", ai.Name, ai.Version));
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null) return;

                _DBG.Engine engine = device.DbgEngine;

                ReadOnlyCollection<string> files = form.Files;
                if (files.Count == 0) return;

                uint address = uint.MaxValue;

                _DBG.PortBooter fl = new _DBG.PortBooter(engine);
                fl.OnProgress += new _DBG.PortBooter.ProgressEventHandler(OnProgress);
                fl.Start();

                try
                {
                    foreach (string file in files)
                    {
                        if (!File.Exists(file))
                        {
                            form.DumpToOutput(string.Format("Error: File doesn't exist {0}", file));
                            continue;
                        }

                        ArrayList blocks = new ArrayList();

                        uint tmp = _DBG.SRecordFile.Parse(file, blocks, null);

                        m_form = form;

                        fl.Program(blocks);

                        if (address == uint.MaxValue)
                        {
                            if (tmp != 0)
                            {
                                address = tmp;
                            }
                        }
                    }

                    if (address == uint.MaxValue) address = 0;

                    m_form.DumpToOutput(string.Format("Executing address 0x{0:x08}", address));
                    fl.Execute(address);
                    System.Threading.Thread.Sleep(200);
                }
                finally
                {
                    if (fl != null)
                    {
                        fl.OnProgress -= new _DBG.PortBooter.ProgressEventHandler(OnProgress);
                        fl.Stop();
                        fl.Dispose();
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null) return;

                _DBG.Engine engine = device.DbgEngine;

                engine.RebootDevice(Microsoft.SPOT.Debugger.Engine.RebootOption.EnterBootloader);

                device.ConnectToTinyBooter();
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null)
                {
                    return;
                }

                _DBG.Engine engine = device.DbgEngine;

                engine.RebootDevice(Microsoft.SPOT.Debugger.Engine.RebootOption.EnterBootloader);

                device.ConnectToTinyBooter();
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                _DBG.Engine engine = device.DbgEngine;

                if (device.ConnectToTinyBooter())
                {
                    // ExecuteMemory at address 0 performs an enumerate and execute, which
                    // will clear the bootloader entry flag
                    engine.ExecuteMemory(0);
                }
                else
                {
                    form.DumpToOutput("Unable to connect to TinyBooter!");
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
                sfd.DefaultExt      = "*.key";
                sfd.CheckPathExists = true;
                sfd.Filter          = "Key File (*.key)|*.key|All Files (*.*)|*.*";
                sfd.FilterIndex     = 0;
                sfd.AddExtension    = true;
                sfd.OverwritePrompt = true;
                sfd.Title           = "Create Empty Key";

                if (System.Windows.Forms.DialogResult.OK == sfd.ShowDialog())
                {
                    MFKeyConfig cfg      = new MFKeyConfig();
                    KeyPair     emptyKey = cfg.CreateEmptyKeyPair();
                    cfg.SaveKeyPair(emptyKey, sfd.FileName);
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (device.ConnectToTinyBooter())
                {
                    _WP.Commands.Monitor_FlashSectorMap.Reply reply = device.DbgEngine.GetFlashSectorMap();

                    if (reply != null)
                    {
                        foreach (_WP.Commands.Monitor_FlashSectorMap.FlashSectorData sector in reply.m_map)
                        {
                            if (0 != (sector.m_flags & _WP.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CODE) ||
                                0 != (sector.m_flags & _WP.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CONFIG))
                            {
                                device.DbgEngine.EraseMemory(sector.m_address, sector.m_size);
                            }
                        }
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                _DBG.Engine engine = device.DbgEngine;

                if (device.ConnectToTinyBooter())
                {
                    // ExecuteMemory at address 0 performs an enumerate and execute, which
                    // will clear the bootloader entry flag
                    engine.ExecuteMemory(0);
                }
                else
                {
                    form.DumpToOutput("Unable to connect to TinyBooter!");
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (device == null || form == null) return;

                _DBG.Engine engine = device.DbgEngine;

                _DBG.WireProtocol.Commands.Monitor_MemoryMap.Range[] range = engine.MemoryMap();

                if (range != null && range.Length > 0)
                {
                    form.DumpToOutput("Type     Start       Size");
                    form.DumpToOutput("--------------------------------");
                    for (int i = 0; i < range.Length; i++)
                    {
                        string mem = "";
                        switch (range[i].m_flags)
                        {
                            case _DBG.WireProtocol.Commands.Monitor_MemoryMap.c_FLASH:
                                mem = "FLASH";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_MemoryMap.c_RAM:
                                mem = "RAM";
                                break;
                        }
                        form.DumpToOutput(string.Format("{0,-6} 0x{1:x08}  0x{2:x08}", mem, range[i].m_address, range[i].m_length));
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null) return;

                _DBG.Engine engine = device.DbgEngine;

                _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.Reply reply = engine.GetFlashSectorMap();

                if (reply != null)
                {
                    form.DumpToOutput(" Sector    Start       Size        Usage");
                    form.DumpToOutput("-----------------------------------------------");
                    for (int i = 0; i < reply.m_map.Length; i++)
                    {
                        _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.FlashSectorData fsd = reply.m_map[i];

                        string usage = "";
                        switch (fsd.m_flags & _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_MASK)
                        {
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_APPLICATION:
                                usage = "Application";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_BOOTSTRAP:
                                usage = "Bootstrap";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CODE:
                                usage = "Code";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CONFIG:
                                usage = "Configuration";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_DEPLOYMENT:
                                usage = "Deployment";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_JITTER:
                                usage = "Jitter";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_FS:
                                usage = "File System";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_RESERVED:
                                usage = "Reserved";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_STORAGE_A:
                                usage = "Storage (A)";
                                break;
                            case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_STORAGE_B:
                                usage = "Storage (B)";
                                break;
                        }

                        form.DumpToOutput(string.Format("{0,5}  {1,12}{2,12}   {3}", i, string.Format("0x{0:x08}", fsd.m_address), string.Format("0x{0:x08}", fsd.m_size), usage));
                    }
                }
            }
 public override void OnAction(IMFDeployForm form, MFDevice device)
 {
     device.Reboot(false);
 }
 public override void OnAction(IMFDeployForm form, MFDevice device)
 {
     device.Reboot(false);
 }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null)
                {
                    return;
                }

                _DBG.Engine engine = device.DbgEngine;

                _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.Reply reply = engine.GetFlashSectorMap();

                if (reply != null)
                {
                    form.DumpToOutput(" Sector    Start       Size        Usage");
                    form.DumpToOutput("-----------------------------------------------");
                    for (int i = 0; i < reply.m_map.Length; i++)
                    {
                        _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.FlashSectorData fsd = reply.m_map[i];

                        string usage = "";
                        switch (fsd.m_flags & _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_MASK)
                        {
                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_BOOTSTRAP:
                            usage = "Bootstrap";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CODE:
                            usage = "Code";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CONFIG:
                            usage = "Configuration";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_DEPLOYMENT:
                            usage = "Deployment";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_UPDATE:
                            usage = "Update Storage";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_FS:
                            usage = "File System";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_SIMPLE_A:
                            usage = "Simple Storage (A)";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_SIMPLE_B:
                            usage = "Simple Storage (B)";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_STORAGE_A:
                            usage = "EWR Storage (A)";
                            break;

                        case _DBG.WireProtocol.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_STORAGE_B:
                            usage = "EWR Storage (B)";
                            break;
                        }

                        form.DumpToOutput(string.Format("{0,5}  {1,12}{2,12}   {3}", i, string.Format("0x{0:x08}", fsd.m_address), string.Format("0x{0:x08}", fsd.m_size), usage));
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
                sfd.DefaultExt = "*.key";
                sfd.CheckPathExists = true;
                sfd.Filter = "Key File (*.key)|*.key|All Files (*.*)|*.*";
                sfd.FilterIndex = 0;
                sfd.AddExtension = true;
                sfd.OverwritePrompt = true;
                sfd.Title = "Create Empty Key";

                if (System.Windows.Forms.DialogResult.OK == sfd.ShowDialog())
                {
                    MFKeyConfig cfg = new MFKeyConfig();
                    KeyPair emptyKey = cfg.CreateEmptyKeyPair();
                    cfg.SaveKeyPair(emptyKey, sfd.FileName);
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (device.ConnectToTinyBooter())
                {
                    _WP.Commands.Monitor_FlashSectorMap.Reply reply = device.DbgEngine.GetFlashSectorMap();

                    if (reply != null)
                    {
                        foreach (_WP.Commands.Monitor_FlashSectorMap.FlashSectorData sector in reply.m_map)
                        {
                            if (0 != (sector.m_flags & _WP.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CODE) ||
                                0 != (sector.m_flags & _WP.Commands.Monitor_FlashSectorMap.c_MEMORY_USAGE_CONFIG))
                            {
                                device.DbgEngine.EraseMemory(sector.m_address, sector.m_size);
                            }
                        }
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null)
                {
                    return;
                }

                _DBG.Engine engine = device.DbgEngine;

                ReadOnlyCollection <string> files = form.Files;

                if (files.Count == 0)
                {
                    return;
                }

                uint address = uint.MaxValue;

                _DBG.PortBooter fl = new _DBG.PortBooter(engine);
                fl.OnProgress += new _DBG.PortBooter.ProgressEventHandler(OnProgress);
                fl.Start();

                try
                {
                    foreach (string file in files)
                    {
                        if (!File.Exists(file))
                        {
                            form.DumpToOutput(string.Format("Error: File doesn't exist {0}", file));
                            continue;
                        }

                        ArrayList blocks = new ArrayList();

                        uint tmp = _DBG.SRecordFile.Parse(file, blocks, null);

                        m_form = form;

                        fl.Program(blocks);

                        if (address == uint.MaxValue)
                        {
                            if (tmp != 0)
                            {
                                address = tmp;
                            }
                        }
                    }

                    if (address == uint.MaxValue)
                    {
                        address = 0;
                    }

                    m_form.DumpToOutput(string.Format("Executing address 0x{0:x08}", address));
                    fl.Execute(address);
                    System.Threading.Thread.Sleep(200);
                }
                finally
                {
                    if (fl != null)
                    {
                        fl.OnProgress -= new _DBG.PortBooter.ProgressEventHandler(OnProgress);
                        fl.Stop();
                        fl.Dispose();
                    }
                }
            }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                MFDevice.IMFDeviceInfo info = device.MFDeviceInfo;
                
                if ( !info.Valid )
                {
                    form.DumpToOutput("DeviceInfo is not valid!");
                }
                else
                {
                    form.DumpToOutput("DeviceInfo:");
                    form.DumpToOutput(String.Format("  HAL build info: {0}, {1}", info.HalBuildVersion.ToString(), info.HalBuildInfo));
                    form.DumpToOutput(String.Format("  OEM Product codes (vendor, model, SKU): {0}, {1}, {2}", info.OEM.ToString(), info.Model.ToString(), info.SKU.ToString()));
                    form.DumpToOutput("  Serial Numbers (module, system):");
                    form.DumpToOutput("    " + info.ModuleSerialNumber);
                    form.DumpToOutput("    " + info.SystemSerialNumber);
                    form.DumpToOutput(String.Format("  Solution Build Info: {0}, {1}", info.SolutionBuildVersion.ToString(), info.SolutionBuildInfo));
                    
                    form.DumpToOutput("  AppDomains:");
                    foreach (MFDevice.IAppDomainInfo adi in info.AppDomains)
                    {
                    form.DumpToOutput(String.Format("    {0}, id={1}", adi.Name, adi.ID));
                    }

                    form.DumpToOutput("  Assemblies:");
                    foreach (MFDevice.IAssemblyInfo ai in info.Assemblies)
                    {
                    form.DumpToOutput(String.Format("    {0},{1}", ai.Name, ai.Version));
                    }
                }
            }
Example #20
0
 public virtual void    OnAction(IMFDeployForm form, MFDevice device)
 {
 }
Example #21
0
 public virtual void    OnAction(IMFDeployForm form, MFDevice device) { }
            public override void OnAction(IMFDeployForm form, MFDevice device)
            {
                if (form == null || device == null) return;

                _DBG.Engine engine = device.DbgEngine;

                _DBG.WireProtocol.Commands.Monitor_DeploymentMap.Reply reply = engine.DeploymentMap();

                if (reply != null)
                {
                    for (int i = 0; i < reply.m_count; i++)
                    {
                        _DBG.WireProtocol.Commands.Monitor_DeploymentMap.DeploymentData dd = reply.m_map[i];

                        form.DumpToOutput("Assembly " + i.ToString());
                        form.DumpToOutput("  Address: " + dd.m_address.ToString());
                        form.DumpToOutput("  Size   : " + dd.m_size.ToString());
                        form.DumpToOutput("  CRC    : " + dd.m_CRC.ToString());
                    }

                    if (reply.m_count == 0)
                    {
                        form.DumpToOutput("No deployed assemblies");
                    }
                }
                else
                {
                    form.DumpToOutput("Command Not Supported by Device");
                }
            }