fromHexFile method

void fromHexFile(
  1. String stringFile, [
  2. NRFArch? arch
])

Find the correct Arch for the provided settings file

Implementation

void fromHexFile(String stringFile, [NRFArch? arch]){
  logger?.verbose('Retreiving Hex File');
  hexFile = stringFile;
  ihex = IntelHex.fromfile(hexFile);

  // check the 3 possible addresses for CRC matches
  try{
    probeSettings(blSett51Addr);
    setArch('NRF51');
  }
  catch(e){
  try{
      probeSettings(blSett52Addr);
      setArch('NRF52');
    }
    catch(e){
      try{
        probeSettings(blSett52QfabAddress);
        setArch('NRF52QFAB');
      }
      catch(e){
        try{
          probeSettings(blSett52810Address);
          setArch('NRF52810');
        }
        catch(e){
          try{
            probeSettings(blSett52840Address);
            setArch('NRF52840');
          }
          catch(e){
            throw("Failed to parse .hex file: $e");
          }
        }
      }
    }
  }
  blSettAddr = ihex.minaddr();
}