Hi,
I’m having an issue trying to implement IFU, the code runs, it flash it but after the reset the device freezes. This is my code:
public const int BLOCK_SIZE = 65536;
public static void FlashFirmware()
{
InFieldUpdate.Initialize(InFieldUpdate.Types.Application);
DebugTools.Print("IFU | Loading firmware file ...");
LoadFile("\\SD\\app.hex", InFieldUpdate.Types.Application);
DebugTools.Print("IFU | Update completed, restarting ...");
InFieldUpdate.FlashAndReset();
}
public static void LoadFile(string filename, InFieldUpdate.Types type)
{
using (var stream = new FileStream(filename, FileMode.Open))
{
var data = new byte[BLOCK_SIZE];
for (int i = 0; i < stream.Length / BLOCK_SIZE; i++)
{
stream.Read(data, 0, BLOCK_SIZE);
InFieldUpdate.Load(type, data, BLOCK_SIZE);
}
stream.Read(data, 0, (int)stream.Length % BLOCK_SIZE);
InFieldUpdate.Load(type, data, (int)stream.Length % BLOCK_SIZE);
}
}