[Concept,00/13] Add putsn() for length-based console output

Message ID 20260204001002.2638622-1-sjg@u-boot.org
Headers
Series Add putsn() for length-based console output |

Message

Simon Glass Feb. 4, 2026, 12:09 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

This series adds putsn() which outputs exactly a specified number of
characters from a buffer, regardless of any nul characters that may be
present. This is useful for printing substrings or binary data without
allocating temporary buffers.

The infrastructure for length-based output already exists at the driver
level (membuf_put(), __serial_puts()), so this series mainly adds the
public API and necessary wrapper functions at the console layer.

The feature is controlled by CONFIG_CONSOLE_PUTSN and is enabled by
default for sandbox.


Simon Glass (13):
  console: Add a Kconfig option for putsn() support
  serial: Support length-based serial output
  console: Add length-based console-recording support
  console: Add length-based pre-console support
  console: Add length-based debug UART support
  sandbox: Add support for length-based console output
  console: Add putsn() support to struct stdio_dev
  console: Add vidconsole support for length-based output
  console: Add the putsn() API for length-based string output
  console: Shorten the console-error-output function names
  console: Add err_putsn() for length-based error output
  console: Add putsn() to ulib
  CI: Add artifacts for the 'make check' CI jobs

 .gitlab-ci.yml                    |   9 ++
 arch/sandbox/cpu/os.c             |   8 +-
 common/Kconfig                    |   9 ++
 common/console.c                  | 177 +++++++++++++++++++++++++++---
 drivers/serial/serial-uclass.c    |  34 ++++++
 drivers/video/console_truetype.c  |   6 +-
 drivers/video/vidconsole-uclass.c |  33 +++---
 include/console.h                 |  23 +++-
 include/debug_uart.h              |  17 +++
 include/os.h                      |  13 +++
 include/serial.h                  |  12 ++
 include/stdio.h                   |  12 ++
 include/stdio_dev.h               |  12 ++
 include/u-boot-lib.h              |  15 +++
 lib/ulib/ulib.c                   |  10 ++
 test/common/console.c             |  48 ++++++++
 test/dm/serial.c                  |  20 ++++
 17 files changed, 416 insertions(+), 42 deletions(-)