added beta version of flash.c

Signed-off-by: joaotfernandes <jtfernandes93@gmail.com>