public AvrDudeWindow(AVRProject project)
        {
            InitializeComponent();

            // two projects allow changes to be discarded
            this.originalProject = project;
            this.project         = project.Clone();

            burnerPanel = new BurnerPanel(this.project);
            grpboxBurnerPanel.Controls.Add(burnerPanel);
            burnerPanel.Dock = DockStyle.Fill;

            burnerPanel.ProjToForm();

            dropDetectionType.SelectedIndex = 0;
            dropMemoryType.SelectedIndex    = 0;

            // this is the only way i can think of that will
            // allow the user to view the progress bar live
            // by using the command line window
            // because redirecting STDERR doesn't work since
            // the .NET built-in stream redirection only has
            // the ability to read line by line so the progress
            // bar is lost

            ProjectBuilder.SetEnviroVarsForProc(avrdude.StartInfo);
            avrdude.StartInfo.FileName = "cmd";
        }
示例#2
0
        public AvrDudeWindow(AVRProject project)
        {
            InitializeComponent();

            // two projects allow changes to be discarded
            this.originalProject = project;
            this.project = project.Clone();

            burnerPanel = new BurnerPanel(this.project);
            grpboxBurnerPanel.Controls.Add(burnerPanel);
            burnerPanel.Dock = DockStyle.Fill;

            burnerPanel.ProjToForm();

            dropDetectionType.SelectedIndex = 0;
            dropMemoryType.SelectedIndex = 0;

            // this is the only way i can think of that will
            // allow the user to view the progress bar live
            // by using the command line window
            // because redirecting STDERR doesn't work since
            // the .NET built-in stream redirection only has
            // the ability to read line by line so the progress
            // bar is lost

            ProjectBuilder.SetEnviroVarsForProc(avrdude.StartInfo);
            avrdude.StartInfo.FileName = "cmd";
        }
        private void btnFuseTool_Click(object sender, EventArgs e)
        {
            TryKill();

            burnerPanel.FormToProj();

            FuseCalculator fc = new FuseCalculator(project);

            fc.ShowDialog();

            burnerPanel.ProjToForm();
        }
示例#4
0
        private void FuseCalculator_Load(object sender, EventArgs e)
        {
            // avoid having two fuse calculators open since this tool can be
            // opened from two places
            if (isOpen)
            {
                this.Close();
                return;
            }

            isOpen = true;

            burnerPanel.ProjToForm();

            XmlDocument xDoc = new XmlDocument();

            try
            {
                string chipName = Program.ProperChipName(project.Device);
                string xmlFilePathA;
                string xmlFilePathB;
                int    cnt = chipName.Length;
                do
                {
                    xmlFilePathA = SettingsManagement.AppInstallPath + "chip_xml" + Path.DirectorySeparatorChar + chipName.Substring(0, cnt) + ".xml";
                    xmlFilePathB = SettingsManagement.AppDataPath + "chip_xml" + Path.DirectorySeparatorChar + chipName.Substring(0, cnt) + ".xml";

                    if (cnt == 0)
                    {
                        throw new Exception("chip data xml (" + chipName + ".xml) was not found in " + SettingsManagement.AppInstallPath + "chip_xml or " + SettingsManagement.AppDataPath + "chip_xml");
                    }

                    if (File.Exists(xmlFilePathB) == false)
                    {
                        if (File.Exists(xmlFilePathA))
                        {
                            File.Copy(xmlFilePathA, xmlFilePathB, true);
                            break;
                        }
                        else
                        {
                            cnt--;
                        }
                    }
                    else
                    {
                        break;
                    }
                }while (true);

                xDoc.Load(xmlFilePathB);
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show("Could not find matching XML file for your device");
                this.Close();
                return;
            }
            catch (XmlException ex)
            {
                MessageBox.Show("Error in Chip Description XML File: " + ex.Message);
                this.Close();
                return;
            }
            catch (Exception ex)
            {
                ErrorReportWindow.Show(ex, "Fuse Calculator Error");
                this.Close();
                return;
            }

            XmlElement docEle = xDoc.DocumentElement;

            foreach (XmlElement xFuseContainer in docEle.GetElementsByTagName("FUSE"))
            {
                foreach (XmlElement xList in xFuseContainer.GetElementsByTagName("LIST"))
                {
                    string   t        = xList.InnerText.Trim().Trim(new char[] { '[', ']', }).Trim();
                    string[] fuseList = t.Split(':');
                    foreach (string fuse in fuseList)
                    {
                        if (string.IsNullOrEmpty(fuse) == false)
                        {
                            foreach (XmlElement xFuse in xFuseContainer.GetElementsByTagName(fuse))
                            {
                                FusePanel fp = new FusePanel(xFuse, project.BurnFuseBox, this);
                                TabPage   tp = new TabPage(fuse);
                                tp.Controls.Add(fp);
                                fp.Dock = DockStyle.Fill;
                                tabControl1.TabPages.Add(tp);
                            }
                        }
                    }

                    break;
                }

                break;
            }

            foreach (XmlElement xLockBitContainer in docEle.GetElementsByTagName("LOCKBIT"))
            {
                FusePanel fp = new FusePanel(xLockBitContainer, project.BurnFuseBox, this);
                TabPage   tp = new TabPage("Lock Bits");
                tp.Controls.Add(fp);
                fp.Dock = DockStyle.Fill;
                tabControl1.TabPages.Add(tp);

                break;
            }
        }
示例#5
0
        private void PopulateForm()
        {
            burnerPanel.ProjToForm();

            txtOutputPath.Text = project.OutputDir;

            if (dropDevices.Items.Count > 0)
            {
                dropDevices.SelectedIndex = 0;
                if (dropDevices.Items.Contains(project.Device.ToLowerInvariant()))
                {
                    dropDevices.SelectedIndex = dropDevices.Items.IndexOf(project.Device.ToLowerInvariant());
                }
                else
                {
                    dropDevices.SelectedIndex = dropDevices.Items.Add(project.Device);
                }
            }
            else
            {
                dropDevices.SelectedIndex = dropDevices.Items.Add(project.Device);
            }

            txtOtherOptions.Text           = project.OtherOptions;
            txtCOptions.Text               = project.OtherOptionsForC;
            txtCPPOptions.Text             = project.OtherOptionsForCPP;
            txtSOptions.Text               = project.OtherOptionsForS;
            txtLinkerOptions.Text          = project.LinkerOptions;
            txtInitStackAddr.Text          = Convert.ToString(project.InitStackAddr, 16).ToUpper();
            numClockFreq.Value             = project.ClockFreq;
            chkUseInitStack.Checked        = project.UseInitStack;
            listOptimization.SelectedIndex = listOptimization.Items.IndexOf(project.Optimization);

            chklistOptions.SetItemChecked(2, project.PackStructs);
            chklistOptions.SetItemChecked(3, project.ShortEnums);
            chklistOptions.SetItemChecked(1, project.UnsignedBitfields);
            chklistOptions.SetItemChecked(0, project.UnsignedChars);
            chklistOptions.SetItemChecked(4, project.FunctionSections);
            chklistOptions.SetItemChecked(5, project.DataSections);

            txtArduinoCoreOverride.Text = project.ArduinoCoreOverride;

            listLinkObj.Items.Clear();
            foreach (string i in project.LinkLibList)
            {
                listLinkObj.Items.Add(i);
            }
            foreach (string i in project.LinkObjList)
            {
                listLinkObj.Items.Add(i);
            }

            dgvIncPaths.Rows.Clear();
            foreach (string s in project.IncludeDirList)
            {
                int i = dgvIncPaths.Rows.Add(new DataGridViewRow());
                dgvIncPaths.Rows[i].Cells[0].Value = s;
            }

            dgvLibPaths.Rows.Clear();
            foreach (string s in project.LibraryDirList)
            {
                int i = dgvLibPaths.Rows.Add(new DataGridViewRow());
                dgvLibPaths.Rows[i].Cells[0].Value = s;
            }

            dgvMemory.Rows.Clear();
            foreach (MemorySegment m in project.MemorySegList.Values)
            {
                DataGridViewRow dgvr   = new DataGridViewRow();
                string[]        memStr = new string[3];
                string          s      = "Flash";
                if (m.Type.ToLowerInvariant().Contains("flash"))
                {
                    s = "Flash";
                }
                else if (m.Type.ToLowerInvariant().Contains("eeprom"))
                {
                    s = "EEPROM";
                }
                else if (m.Type.ToLowerInvariant().Contains("sram"))
                {
                    s = "SRAM";
                }
                memStr[0] = s;
                memStr[1] = m.Name;
                memStr[2] = Convert.ToString(m.Addr, 16).ToUpper();
                dgvr.CreateCells(dgvMemory, memStr);
                int i = dgvMemory.Rows.Add(dgvr);
            }
        }