I have isolated my code in a separate program, must be something that i did wrong.
The files are on the SD and source location was:
C:\Program Files (x86)\GHI Electronics\GHI NETMF v4.3 SDK\Firmwares\G120
I only copied the 3 hex files, not the signature files, is that ok?
public class Program
static PersistentStorage MySD;
const int BLOCK_SIZE = 10 * 1024;
private static FileStream _fs;
public static void Main()
MySD = new PersistentStorage("SD");
//firmware + application update
LoadDataFromSD(@ "SD\IRC.HEX", SystemUpdate.SystemUpdateType.Deployment);
LoadDataFromSD(@ "SD\CONFIG.HEX", SystemUpdate.SystemUpdateType.Config);
LoadDataFromSD(@ "SD\FIRMWARE.HEX", SystemUpdate.SystemUpdateType.Firmware);
LoadDataFromSD(@ "SD\FIRMWARE2.HEX", SystemUpdate.SystemUpdateType.Firmware);
// Check to see if you can update
// Loads the passed in file from the SD card into memory.
static void LoadDataFromSD(string filename, SystemUpdate.SystemUpdateType ifutype)
_fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
len = _fs.Length;
blocknum = (int)len / BLOCK_SIZE;
rest = (int)len % BLOCK_SIZE;
hex = new byte[BLOCK_SIZE];
for (int i = 0; i < blocknum; i++)
_fs.Read(hex, 0, BLOCK_SIZE);
SystemUpdate.Load(ifutype, hex, BLOCK_SIZE);
Debug.Print("Loading file " + filename + ", block " + i + "/" + blocknum);
_fs.Read(hex, 0, rest);
SystemUpdate.Load(ifutype, hex, rest);
_fs = null;
hex = null;
@ David@ Emrol - Reinhard Ostermeier is correct in that you cannot update the loader through IFU, I forgot that bit when replying last time. Running, or even updating to, a 4.3 firmware on a 4.2 loader is not a scenario that we support or even test. Any number of things can go wrong.
And as andre.m said, it is true you do not need to always update the loader, but that is within a framework version, not crossing between them.
If the bootloader has changed in a significant way (which is always hard to guess as long as a firmware does not list the compatible loader versions). it needs to be updated along with the firmware. This is not possible with IFU.
But a FW update from 4.2.8 to 4.2.9 or from 4.3.2 to 4.3.3 should usually be possible.
An update from 4.2.x to 4.3.x might work, but I would not bet any money on it.
So in fact IFU is only good for your own application and minor FW updates, like a bug fix release.
This is at least better than nothing and leads to another requirement often heard in the forums:
Support of multiple GHI SDK Versions on one development machine.
Because it’s not possible to upgrade all devices in the field to the latest firmware.
@ David@ Emrol - Reinhard is correct. It is usually possible for a firmware to run on a loader that is a very versions old, usually. That’s why you can use IFU to update from something like 4.2.10 to 4.2.11. The loader has changed a lot between 4.2.11 and 4.3.3, in addition to changing NETMF versions. Updating the firmware to 4.3.3 while the loader stays at 4.2.11 is not something we support.
Because of this we plan to add a USB cable between the PC and the G120 in our device at all time (we have USB Client with galvanic isolation ).
Additionally we connect the LDR0/1 and reset to digital outputs in the device, which are controlled by the PC.
We then can connect remotely to the PC and do a loader update as if we are at the device.
Not nice to do this for many devices, but at least a possibility (and even automatable if FEZConfig supports a batch mode. @ John - does it?)