The application discloses a fault-tolerant method for
firmware updating, an electronic device, a storage medium and a program product. When the device is started, the state of a flag register is read first. If the state of the flag register is a preset first value, an old
firmware is loaded from a
flash memory, and the device is started based on the old
firmware. The old firmware is the firmware applied by the device when the device is last successfully started. If the state of the flag register is a preset second value, a new firmware is loaded from a storage unit, and the device is started by using the new firmware. Then, a starting result when the device is started by using the new firmware is acquired. If the starting result indicates that the device fails to start, the state of the flag register is set to the first value. According to the embodiment of the application, when firmware
programming is wrong, the starting path is switched by using the flag register, the accurate old firmware in the
flash memory is read, the device is restarted to restore the normal starting logic, the PCIe interface initialization continuously fails due to the wrong firmware is avoided, and the reliability of the firmware online updating is improved.