printf()函数调用
__swrite
_write_r
_write
HAL_UART_Transmit
__swrite
\newlib-cygwin-cygwin-3_3_2-release\newlib\libc\stdio\stdio.c
_READ_WRITE_RETURN_TYPE
__swrite (struct _reent *ptr, void *cookie,
char const *buf, _READ_WRITE_BUFSIZE_TYPE n)
{
register FILE *fp = (FILE *) cookie;
ssize_t w;
#ifdef __SCLE
int oldmode=0;
#endif
if (fp->_flags & __SAPP)
_lseek_r (ptr, fp->_file, (_off_t) 0, SEEK_END);
fp->_flags &= ~__SOFF; /* in case O_APPEND mode is set */
#ifdef __SCLE
if (fp->_flags & __SCLE)
oldmode = setmode (fp->_file, O_BINARY);
#endif
w = _write_r (ptr, fp->_file, buf, n);
#ifdef __SCLE
if (oldmode)
setmode (fp->_file, oldmode);
#endif
return w;
}
_write_r
\newlib-cygwin-cygwin-3_3_2-release\newlib\libc\reent\writer.c
_ssize_t
_write_r (struct _reent *ptr, int fd, const void *buf, size_t cnt)
{
_ssize_t ret;
errno = 0;
if ((ret = (_ssize_t)_write (fd, buf, cnt)) == -1 && errno != 0)
ptr->_errno = errno;
return ret;
}