stmhal: Factor out stdio and readline to separate files.

Adds readline_init() to clear readline history on soft reset.  Addresses
issue #387.