implement flash routines for firmware