What steps do you take to protect an embedded system's bootloader and firmware from corruption during unexpected power losses?