printf-style output intended for debugging. Uses less memory and is more flexible than the newlib implementation.

This commit is contained in:
ksb 2009-07-11 14:26:28 +00:00
parent 1f72d3ea32
commit 195c23aaa4
7 changed files with 781 additions and 0 deletions

View file

@ -0,0 +1,30 @@
#include <stdio.h>
#include <debug-uart.h>
#include <string.h>
#include <strformat.h>
static StrFormatResult
write_str(void *user_data, const char *data, unsigned int len)
{
dbg_send_bytes((unsigned char*)data, len);
return STRFORMAT_OK;
}
static StrFormatContext ctxt =
{
write_str,
NULL
};
int
printf(const char *fmt, ...)
{
int res;
va_list ap;
va_start(ap, fmt);
res = format_str_v(&ctxt, fmt, ap);
va_end(ap);
return res;
}