Beispiel #1
0
        private void CompareToFile(string filename)
        {
            Trionic5Tools.SymbolCollection compSymbols = new Trionic5Tools.SymbolCollection();
            AddressLookupCollection compAddressLookup = new AddressLookupCollection();
            dockManager1.BeginUpdate();
            try
            {
                DevExpress.XtraBars.Docking.DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                CompareResults tabdet = new CompareResults();
                tabdet.Dock = DockStyle.Fill;
                tabdet.Filename = filename;

                tabdet.onSymbolSelect += new CompareResults.NotifySelectSymbol(tabdet_onSymbolSelect);
                dockPanel.Controls.Add(tabdet);
                //dockPanel.DockAsTab(dockPanel1);
                dockPanel.Text = "Compare results: " + Path.GetFileName(filename);
                bool isDocked = false;
                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                {
                    if (pnl.Text.StartsWith("Compare results: ") && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                    {
                        dockPanel.DockAsTab(pnl, 0);

                        isDocked = true;
                        break;
                    }
                }
                if (!isDocked)
                {
                    dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Left, 1);
                    dockPanel.Width = 400;
                }
                Trionic5FileInformation m_FileInformation = new Trionic5FileInformation();
                Trionic5File m_CompareToFile = CompareSymbolTable(filename, compSymbols, compAddressLookup, tabdet.gridControl1, out m_FileInformation);
                m_CompareToFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);
                tabdet.ComparedTrionic5File = m_CompareToFile;
                tabdet.ComparedTrionic5FileInformation = m_FileInformation;
                tabdet.CompareSymbolCollection = compSymbols;
                tabdet.CompareAddressLookupCollection = compAddressLookup;
                tabdet.OpenGridViewGroups(tabdet.gridControl1, 1);
            }
            catch (Exception E)
            {
                Console.WriteLine(E.Message);
            }
            dockManager1.EndUpdate();
        }
Beispiel #2
0
 void tabdet_onSymbolSelect(object sender, CompareResults.SelectSymbolEventArgs e)
 {
     // <GS-22042010> should be compare viewer for Pgm_mod / Pgm_status as well!
     if (e.SymbolName == m_trionicFileInformation.GetProgramModeSymbol())
     {
         frmEasyFirmwareInfo info = new frmEasyFirmwareInfo();
         info.Pgm_mod = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetProgramModeSymbol()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetProgramModeSymbol()));
         info.SetPrimarySourceName(Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename));
         info.Pgm_mod2 = m_trionicFile.ReadDataFromFile(e.Filename, (uint)e.SymbolAddress, (uint)e.SymbolLength);
         info.SetSecondarySourceName(Path.GetFileNameWithoutExtension(e.Filename));
         info.ShowDialog();
     }
     else if (!e.ShowDiffMap)
     {
         StartTableViewer(e.SymbolName);
         StartCompareMapViewer(e.SymbolName, e.Filename, e.SymbolAddress, e.SymbolLength, e.Symbols, e.Addresses, e.CompTrionic5File, e.CompTrionic5FileInformation);
     }
     else
     {
         StartCompareDifferenceViewer(e.SymbolName, e.Filename, e.SymbolAddress, e.SymbolLength, e.CompTrionic5File, e.CompTrionic5FileInformation);
     }
     TryShowHelpForSymbol();
 }
Beispiel #3
0
        void tabdet_onSymbolSelectRAM(object sender, CompareResults.SelectSymbolEventArgs e)
        {
            //<GS-22042010> should be compare viewer for Pgm_mod / Pgm_status as well
            if (e.SymbolName == m_trionicFileInformation.GetProgramModeSymbol())
            {
                frmEasyFirmwareInfo info = new frmEasyFirmwareInfo();
                info.Pgm_mod = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(m_trionicFileInformation.GetProgramModeSymbol()), (uint)m_trionicFileInformation.GetSymbolLength(m_trionicFileInformation.GetProgramModeSymbol()));
                info.SetPrimarySourceName(Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename));
                info.Pgm_mod2 = m_trionicFile.ReadDataFromFile(e.Filename, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(e.SymbolName), (uint)e.SymbolLength);
                info.SetSecondarySourceName("SRAM " + Path.GetFileNameWithoutExtension(e.Filename));
                info.ShowDialog();
            }
            else if (!e.ShowDiffMap)
            {
                StartTableViewer(e.SymbolName); // normal viewer
                StartTableViewerSRAMFile(e.SymbolName, e.Filename);
            }
            else
            {
                //show difference between SRAM and binary file
                StartSRAMToFlashCompareDifferenceViewer(e.SymbolName, e.Filename, m_trionicFileInformation.Filename, e.SymbolLength, m_trionicFileInformation.GetSymbolAddressSRAM(e.SymbolName), m_trionicFileInformation.GetSymbolAddressFlash(e.SymbolName));

            }
        }
Beispiel #4
0
        private void StartCompareToSRAMFile(string sramfilename)
        {
            Trionic5Tools.SymbolCollection scdiff = new Trionic5Tools.SymbolCollection();
            foreach (Trionic5Tools.SymbolHelper sh in m_trionicFileInformation.SymbolCollection)
            {
                if (sh.Flash_start_address > 0 && sh.Start_address > 0)
                {
                    // get sram content and binfile content for this symbol

                    byte[] sramsymbol = m_trionicFile.ReadDataFromFile(sramfilename, (uint)sh.Start_address, (uint)sh.Length);
                    byte[] flashsymbol = m_trionicFile.ReadData((uint)sh.Flash_start_address, (uint)sh.Length);
                    int bdifferent = 0;
                    for (int btel = 0; btel < sh.Length; btel++)
                    {
                        if (sramsymbol[btel] != flashsymbol[btel])
                        {
                            bdifferent++;
                        }
                    }
                    if (bdifferent > 0)
                    {
                        // symbol is not equal!
                        scdiff.Add(sh);
                    }
                }
            }
            dockManager1.BeginUpdate();
            try
            {
                DevExpress.XtraBars.Docking.DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                CompareResults tabdet = new CompareResults();
                tabdet.Dock = DockStyle.Fill;
                tabdet.Filename = sramfilename;

                tabdet.onSymbolSelect += new CompareResults.NotifySelectSymbol(tabdet_onSymbolSelectRAM);
                dockPanel.Controls.Add(tabdet);
                //dockPanel.DockAsTab(dockPanel1);
                dockPanel.Text = "SRAM <> BIN Compare results: " + Path.GetFileName(sramfilename);
                dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Left, 1);
                dockPanel.Width = 700;
                //CompareSymbolTable(filename, compSymbols, compAddressLookup, tabdet.gridControl1);
                tabdet.CompareSymbolCollection = scdiff;

                System.Data.DataTable dt = new System.Data.DataTable();
                dt.Columns.Add("SYMBOLNAME");
                dt.Columns.Add("SRAMADDRESS", Type.GetType("System.Int32"));
                dt.Columns.Add("FLASHADDRESS", Type.GetType("System.Int32"));
                dt.Columns.Add("LENGTHBYTES", Type.GetType("System.Int32"));
                dt.Columns.Add("LENGTHVALUES", Type.GetType("System.Int32"));
                dt.Columns.Add("DESCRIPTION");
                dt.Columns.Add("ISCHANGED", Type.GetType("System.Boolean"));
                dt.Columns.Add("CATEGORY", Type.GetType("System.Int32"));
                dt.Columns.Add("DIFFPERCENTAGE", Type.GetType("System.Double"));
                dt.Columns.Add("DIFFABSOLUTE", Type.GetType("System.Int32"));
                dt.Columns.Add("DIFFAVERAGE", Type.GetType("System.Double"));
                dt.Columns.Add("CATEGORYNAME");
                dt.Columns.Add("SUBCATEGORYNAME");

                foreach (Trionic5Tools.SymbolHelper sh in scdiff)
                {
                    float diffperc = 0;
                    int diffabs = 0;
                    float diffavg = 0;
                    dt.Rows.Add(sh.Varname, sh.Start_address, sh.Flash_start_address, sh.Length, sh.Length, sh.Helptext, false, (int)sh.Category, diffperc, diffabs, diffavg, sh.Category.ToString().Replace("_", " "), sh.Subcategory.ToString().Replace("_", " "));
                }
                tabdet.gridControl1.DataSource = dt;

                //tabdet.CompareAddressLookupCollection = compAddressLookup;
                tabdet.OpenGridViewGroups(tabdet.gridControl1, 1);
            }
            catch (Exception E)
            {
                Console.WriteLine(E.Message);
            }
            dockManager1.EndUpdate();
        }