printf-style output intended for debugging. Uses less memory and is more flexible than the newlib implementation.
This commit is contained in:
parent
1f72d3ea32
commit
195c23aaa4
7 changed files with 781 additions and 0 deletions
30
cpu/arm/common/dbg-io/dbg-printf.c
Normal file
30
cpu/arm/common/dbg-io/dbg-printf.c
Normal 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;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue