stmhal, file: Implement a,x,+ open modes, seek and tell.

Also now returns correct POSIX errno when an IO operation fails.

Addresses issues #516 and #676.