Skip to content

Commit

Permalink
Avoid garbage on stdout for first print
Browse files Browse the repository at this point in the history
Caused by recursive stdio function calling.

Just use seL4_DebugPutString() directly to avoid any problems.

Signed-off-by: Indan Zupancic <indan@nul.nu>
  • Loading branch information
Indanz committed Nov 19, 2024
1 parent 88c7615 commit cb4c22d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libsel4platsupport/src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,12 @@ static void __serial_setup()
case NOT_INITIALIZED:
#ifdef CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR
setup_status = SETUP_COMPLETE;
printf("\nWarning: using printf before serial is set up. This only works as your\n");
printf("printf is backed by seL4_Debug_PutChar()\n");
/*
* Don't call any stdio functions here, it will cause unexpected recursion
* that will mess up the internal file buffer!
*/
seL4_DebugPutString("\nWarning: using printf before serial is set up. This only works as your\n"
"printf is backed by seL4_Debug_PutChar()\n");
started_regular = 1;
#else
/* attempt failsafe initialization and print something out */
Expand Down

0 comments on commit cb4c22d

Please sign in to comment.