fixed memory flashing routine for stm32; enabled more code in main