stmhal: Use OSError with POSIX error code for HAL errors.

Addresses issue #921.