Standard I/O (STDIO)#
#include "rcsw/stdio/printf.h"
#include "rcsw/stdio/stdio.h"
RCSW’s stdio module provides a printf-family implementation and basic I/O helpers for environments where libc is not available. It wraps eyalroz/printf with the RCSW naming convention and platform abstraction layer.
When to Use This Module#
Use the stdio module when:
You are building for a bare-metal target without libc (e.g., a bootstrap, bootloader, or hardware validation test).
You are using the
simpleER plugin, which requiresstdio_printf()as its output function.You need printf output routed through a custom BSP character output function rather than the system’s
putchar.
On POSIX targets where libc is available, you generally do not need this
module. Disable it at build time with RCSW_CONFIG_NO_STDIO
=YES if you are not using it.
Platform Abstraction#
The stdio module routes character I/O through two CMake-configurable hooks:
They default to libc’s putchar and getchar. To route I/O elsewhere,
such as a UART, set them to functions your platform layer provides. In a
shared build those functions must be available when RCSW itself is linked;
see Components and Linking.
printf Formatting#
Float support, long long support, buffer sizes, and precision defaults are controlled by eyalroz/printf CMake options. To override an option, set it in your CMake invocation before including RCSW — CPM respects already-set cache variables.
String and Integer Utilities#
#include "rcsw/stdio/stdio.h"
Bare-metal replacements for common libc I/O and conversion functions. See the header for full signatures. Highlights:
stdio_puts()writes a string without a trailing newline (unlike POSIXputs).stdio_atoi()requires an explicit base argument; for base 16 an optional0x/0Xprefix is skipped.stdio_itoad()andstdio_itoax()are 32-bit only.
#include "rcsw/stdio/string.h" has the string and memory routines
(stdio_strlen(), stdio_strcmp(), stdio_memcpy(), …)
and ASCII-only character class functions (stdio_isdigit(),
stdio_ishex(), stdio_isalpha(), …). Like <ctype.h>
they take an int and return 1 or 0, but they don’t depend on the locale,
and a negative char value is in no class.