Does the “data” byte-array have a minimum required size? When data happens to be 16 bytes long, for example, I get an “Invalid param. Data is too small” exception (screenshot). Is this normal?
@ andre - LOL, I wish I had an app size of only 16 bytes!
Imagine this setup from GHI’s SystemUpdate Class documentation. To paraphrase:
We are reading the application hex file from some source. In the example, the source is a SD card.
We are using SystemUpdate.Load() to load the hex file in block increments. The block size in the example is 10 * 1024 bytes = 10240 bytes long.
Finally, at the very end, there will likely be a remainder. This remainder is (ApplicationSize modulo 10240). We still need to use Load() to load the remainder.
So if my application size is 40976 bytes, I will end up with a 16-byte remainder. And this will throw an exception once I finally Load() this portion.
If this is not intentional behavior, it can actually be quite insidious. Imagine in-field update working for some hex file sizes and not others. It would be very confusing.
Thanks all :)). I hope in the future, my baby will be also a programmer same as all of you here. :)))
@ Iggmoe: You are right, we will correct it in next.
Temporary solution:
if you can, how about if we write a small C# application to add 0xFF into end of that hex file? and remember correct its checksum too :)).
@ Dad - Thanks for the tip on the workaround. If the new firmware will be released in 4 weeks or less, I think I can wait for the official fix. Out of curiosity, what kind of checksum is it? Simple additive checksum or CRC?