Beispiel #1
0
        }        //DoParse();

        //---------------------------------------------------------------------
        // Hex_Parse()
        //---------------------------------------------------------------------
        private void Hex_Parse(object obj, clsHexFileParseEventArgs e)
        {
            clsHex objHex = (clsHex)obj;

            if (e.eventType == clsHexFileParseEventArgs.EventType.started)
            {
                clsDebugTextbox.OutputInfo("Parsing hex-file...", e.tabLevel);
            }
            else if (e.eventType == clsHexFileParseEventArgs.EventType.warning)
            {
                clsDebugTextbox.OutputWarning(e.message, e.tabLevel);
            }
            else if (e.eventType == clsHexFileParseEventArgs.EventType.info)
            {
                clsDebugTextbox.OutputInfo(e.message, e.tabLevel);
            }
            else if (e.eventType == clsHexFileParseEventArgs.EventType.failed)
            {
                clsDebugTextbox.OutputError("Parsing of hex-file failed", e.tabLevel);
            }
            else if (e.eventType == clsHexFileParseEventArgs.EventType.success)
            {
                clsDebugTextbox.OutputSuccess("Hex-file successfully parsed", e.tabLevel);
                clsDebugTextbox.OutputInfo("", 0);
                clsDebugTextbox.OutputInfo(objHex.progWordsUsed.ToString() + " program words found in " + objHex.progRowsUsed.ToString() + " rows " /*+ (objHex.progWordsUsed * 3 ).ToString() + " bytes)"*/, e.tabLevel);
                clsDebugTextbox.OutputInfo(objHex.eeWordsUsed.ToString() + " eeprom words found " /*+ (objHex.eeWordsUsed * 2).ToString() + " bytes)"*/, e.tabLevel);
                clsDebugTextbox.OutputInfo(objHex.configWordsUsed.ToString() + " config words found " /*+ (objHex.configWordsUsed*2).ToString() + " bytes)"*/, e.tabLevel);
            }
        }        //Hex_Parse()
Beispiel #2
0
        }// DoMagic()

        //---------------------------------------------------------------------
        // DoParse()
        // Description:
        //---------------------------------------------------------------------
        private void DoParse(clsParseSettings pobjParseSettings, clsDownloadSettings pobjDownloadSettings)
        {
            int  iBootLoaderSizeR = 0;
            bool bParseResult     = false;

            // Here we only assume a bootloader size to be able to parse the hex-file
            if (objDevice.family.name == "PIC18F")
            {
                objHex           = new clsHex18F(strFile);
                iBootLoaderSizeR = 5 * objDevice.pageSizeR;
            }
            else if (objDevice.family.name == "PIC18FJ")
            {
                objHex           = new clsHex18FJ(strFile);
                iBootLoaderSizeR = 16;
            }
            else if (objDevice.family.name == "PIC24F")
            {
                objHex           = new clsHex24F(strFile);
                iBootLoaderSizeR = 4;
            }
            else if (objDevice.family.name == "PIC24FJ")
            {
                objHex           = new clsHex24FJ(strFile);
                iBootLoaderSizeR = 8;
            }
            else if (objDevice.family.name == "PIC24H")
            {
                objHex           = new clsHex24H(strFile);
                iBootLoaderSizeR = 8;
            }
            else if (objDevice.family.name == "dsPIC30F")
            {
                objHex           = new clsHex30F(strFile);
                iBootLoaderSizeR = 4;
            }
            else if (objDevice.family.name == "dsPIC33FJ")
            {
                objHex           = new clsHex33FJ(strFile);
                iBootLoaderSizeR = 8;
            }
            else
            {
                return;
            }

            // Check file existence
            if (File.Exists(strFile) == false)
            {
                return;
            }

            // Enum events
            objHex.HexFileValidate += new clsHex.HexFileValidateDelegate(Hex_Validate);
            objHex.HexFileParse    += new clsHex.HexFileParseDelegate(Hex_Parse);

            // Parse
            if (objDevice != null)
            {
                objHex.ParseHexFile(pobjParseSettings, 0, ref bParseResult);

                pobjDownloadSettings.writeProgram &= objHex.hasValidProgram;
                pobjDownloadSettings.writeEEPROM  &= objHex.hasValidEEPROM;
                pobjDownloadSettings.writeConfigs &= objHex.hasValidConfigs;
            }
        }        //DoParse();