A little refactoring out common code. The Cygwin build shows no changes to log.txt so we can pretty safely assume this is an innocuous change. No test on Tiva and the map file shows a reduction in code size.