Skip to content

Commit 094dc22

Browse files
dgarskedanielinux
authored andcommitted
Change default wolfBoot_printf logging to use stderr.
1 parent a49f440 commit 094dc22

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

include/printf.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@
4040
#endif
4141
void uart_write(const char* buf, unsigned int sz);
4242

43-
/* turn on small printf support */
43+
/* turn on small printf support in string.c */
4444
#if !defined(PRINTF_ENABLED) && !defined(NO_PRINTF_UART)
4545
#define PRINTF_ENABLED
4646
#endif
4747
#endif
4848

49-
#ifdef PRINTF_ENABLED
49+
/* support for wolfBoot_printf logging */
50+
#if defined(PRINTF_ENABLED) && !defined(WOLFBOOT_NO_PRINTF)
5051
# include <stdio.h>
5152
# if defined(DEBUG_ZYNQ) && !defined(USE_QNX)
5253
# include "xil_printf.h"
@@ -62,8 +63,12 @@
6263
# define wolfBoot_printf(_f_, ...) uart_printf(_f_, ##__VA_ARGS__)
6364
# elif defined(__CCRX__)
6465
# define wolfBoot_printf printf
65-
# else
66+
# elif defined(WOLFBOOT_LOG_PRINTF)
67+
/* allow output to stdout */
6668
# define wolfBoot_printf(_f_, ...) printf(_f_, ##__VA_ARGS__)
69+
# else
70+
/* use stderr by default */
71+
# define wolfBoot_printf(_f_, ...) fprintf(stderr, _f_, ##__VA_ARGS__)
6772
# endif
6873
#else
6974
# define wolfBoot_printf(_f_, ...) do{}while(0)

0 commit comments

Comments
 (0)