Add stdio host based debugging support

These changes were made by David Rowe <david@rowetel.com> to
support host assisted debugging, where files can be read and
written from the PC by the embedded target.