How would you design a firmware update mechanism that ensures the device cannot be bricked during a power failure?