Make stm32flash work in Linux as well. Fixes to Makefile and serial flushing.