Started to add IFU to our ported application and got this weird issue.
Running SITCore-SC20-Firmware-v2.2.0.4000, tca file generated with TinyCLR config is on SD Card.
Reading, Verify and FlashAndReset tca file from SD card is working perfect. (Code A)
Using QuadSpi this is rasing this exception (Code B)
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### GHIElectronics.TinyCLR.Update.InFieldUpdate::NativeAuthenticateApplication [IP: 0000] ####
#### GHIElectronics.TinyCLR.Update.InFieldUpdate::VerifyApplication [IP: 0016] ####
Exception thrown: 'System.InvalidOperationException' in GHIElectronics.TinyCLR.Update.dll
Same tca file on the SD card.
Code A (working)
try
{
var indicatorPin = Variables.BootLed;
byte[] ApplicationKey = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
var filestreamApp = new FileStream(@"A:\mfc.tca", FileMode.Open);
var updater = new ApplicationUpdate(filestreamApp, ApplicationKey);
var applicationVersion = updater.Verify();
SysLogFileWriteLine("Update MFC Application version: " + applicationVersion);
updater.ActivityPin = indicatorPin;
updater.FlashAndReset();
}
catch
{
SysLogFileWriteLine("Update Firmware failure." );
}
Code B (Raising Exception)
try
{
var qspiController = StorageController.FromName(SC20260.StorageController.QuadSpi);
var updater = new InFieldUpdate(qspiController);
var indicatorPin = Variables.BootLed;
var dataChunk = new byte[1 * 1024]; // must be multiple of 1K
var idxApp = 0; // Buffer application
byte[] ApplicationKey = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
var filestreamApp = new FileStream(@"A:\mfc.tca", FileMode.Open);
while (idxApp < filestreamApp.Length)
{
var count = filestreamApp.Read(dataChunk, 0, dataChunk.Length);
idxApp += updater.LoadApplicationChunk(dataChunk, 0, count);
}
var applicationVersion = updater.VerifyApplication();
SysLogFileWriteLine("Update MFC Application version: " + applicationVersion);
updater.ActivityPin = indicatorPin;
updater.FlashAndReset();
}
catch
{
SysLogFileWriteLine("Update Firmware failure." );
}
You see an issue in this methode B ?
Thx