Validating an upgrade image

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
magnus
Member
Posts: 13
Joined: Tue Aug 06, 2019 8:40 pm

Validating an upgrade image

Post by magnus »

Hi,

I'm working on remote updating the boot-flash from an XE232 and I'm having some troubles deciding what image to overwrite.

The idea is to have room for three images with fixed positions on the flash. A factory image and two upgrade-images. When we perform an update we choose the upgrade-image with the lowest version and overwrite that one.

Everything works exactly as we want, except for the case when an update goes wrong. Lets say that one resets the system during the update process.

As expected the system will boot up from the last working image, but now I can't figure out how to decide what image to overwrite. I can iterate all
images with fl_getNextBootImage() but that will also list corrupt images. So next time an update is performed it will chose the one with the lowest version number which means that it is overwriting the only valid upgrade image.

This can leave us in a state where the factory image is the only image left. This is something that we would like to avoid.

Is there a way to validate an upgrade image?
Or is there a built-in way to know which boot image that we booted from? (That way we could make sure to always update the other one.)

To figure this out I've been trying to read the code here: https://github.com/xcore/sc_flash/blob/ ... flashlib.c
But it doesn't seem to be up to date as it doesn't include the fix described here: https://www.xmos.com/download/Tools-Adv ... h(1.0).pdf


Post Reply