Fix flash security check, add resume parameter and add software reset