need your help i was tasting about bootloader so i wroted some code and after this i cant access to the device, what is solution for this problem?
here is code:
SystemUpdate.AccessBootloader();
if (SystemUpdate.GetMode() != SystemUpdate.SystemUpdateMode.Bootloader)
throw new InvalidOperationException("We must be in bootloader mode!");
PersistentStorage sd = new PersistentStorage("SD");
sd.MountFileSystem();
string fileName = "\\SD\\app.hex";
FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read);
// start update
SystemUpdate.ApplicationUpdate.Start();
// read the file in chucks
byte[] buffer = new byte[10 * 1024];
int length;
do
{
length = file.Read(buffer, 0, buffer.Length);
SystemUpdate.ApplicationUpdate.Write(buffer, 0, length);
} while (length == buffer.Length);
file.Close();
// End update
SystemUpdate.ApplicationUpdate.End();
// Access the application
SystemUpdate.AccessApplication();