Skip to content

Commit

Permalink
Add define to send stderr to stdout and enable for sonata.
Browse files Browse the repository at this point in the history
This is useful because although sonata has a second UART its not currently initialised.
See #317 and #275 .
  • Loading branch information
rmn30 committed Jan 22, 2025
1 parent 52a1ba4 commit 65b6f21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sdk/boards/sonata-prerelease.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"SUNBURST_SHADOW_SIZE=0x800",
"ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM=1",
"ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM=1",
"CHERIOT_NO_SAIL_83"
"CHERIOT_NO_SAIL_83",
"STDERR_TO_STDOUT=1"
],
"cxflags": "-mllvm -enable-machine-outliner=never",
"driver_includes" : [
Expand Down
6 changes: 5 additions & 1 deletion sdk/include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ typedef volatile void FILE;
#elif DEVICE_EXISTS(uart)
# define stdout MMIO_CAPABILITY(void, uart)
# define stdin MMIO_CAPABILITY(void uart)
#else
#error No device found for stdout and stderr
#endif

#if DEVICE_EXISTS(uart1)
#if DEVICE_EXISTS(uart1) && !STDERR_TO_STDOUT
# define stderr MMIO_CAPABILITY(void, uart1)
#elif defined(stdout)
# define stderr stdout
#else
#error No device found for stderr
#endif

int __cheri_libcall vfprintf(FILE *stream, const char *fmt, va_list ap);
Expand Down

0 comments on commit 65b6f21

Please sign in to comment.