[Fez Panda II]
Hi all,
I use the SystemUpdate.ApplicationUpdate.Write method and i need to get obtained hex file by using the “G” command in TeraTerm to pull my binary application.
[Fez Panda II]
Hi all,
I use the SystemUpdate.ApplicationUpdate.Write method and i need to get obtained hex file by using the “G” command in TeraTerm to pull my binary application.
double post, why don’t you just ask once and leave it at that?
public static void Main()
{
if (SystemUpdate.GetMode() == SystemUpdate.SystemUpdateMode.NonFormatted)
{
SystemUpdate.EnableBootloader();
}
else if (SystemUpdate.GetMode() == SystemUpdate.SystemUpdateMode.Application)
{
InterruptPort rightButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Digital.LDR, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
rightButton.OnInterrupt += new NativeEventHandler(rightButton_OnInterrupt);
Thread.Sleep(Timeout.Infinite);
}
else if (SystemUpdate.GetMode() == SystemUpdate.SystemUpdateMode.Bootloader)
{
if (PersistentStorage.DetectSDCard())
{
PersistentStorage sd = new PersistentStorage("SD");
sd.MountFileSystem();
string fileName = "\\SD\\app.hex";
if (File.Exists(fileName))
{
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();
}
}
private static void rightButton_OnInterrupt(uint data1, uint data2, DateTime time)
{
// Update the system using bootloader
SystemUpdate.AccessBootloader();
}
this code not works, can anyone help me?