From patchwork Mon Aug 25 16:27:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 137 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139283; bh=xNkh2ZhO2RpO50TrW1UogUuxW/Ns6u6NmvIEv0s/LOQ=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jUAJFKu7X+umngY7wSLpIs9ooqvO4Fv6V2g4ib9qfN3bsKeb8KQI/wXcNEef6tgrA DbniZlDqjvJda0w0OGuKSar424RGQiFv9e+Y+oaDZJM4AK2F2WQ4Z0vEKeHEmYzvlW 7gfvOIgOCT8+auFu8aRyOsDQLiOjM5e0W8pf38C5ty3rW2Mr/0qfgb/kMuBDvNrN93 OgQaaF+YnAl9TNr6/vbH9Bj+/lFxBzHXmm7Mhuwp8ZdSO4joqNKgFDBXZ86+2xy9kF qAGf5oFBNFMOkZIkuIady7rZkgJZwd9tJdU975iBxOim9ojvQC0GwzysDZlAZ4LosK aLUrarrCM0EVg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2282967797 for ; Mon, 25 Aug 2025 10:28:03 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lU-wtWqF-OHZ for ; Mon, 25 Aug 2025 10:28:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139281; bh=xNkh2ZhO2RpO50TrW1UogUuxW/Ns6u6NmvIEv0s/LOQ=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=CdUZxgD3o6hHDXDNn8DoKyUXFpmaiT0EHzTxV3ACO93TjNcPh+6bSYuxstHxUwQVR tnkiYXua0MmDJokZmBUSKkNmFmnt1R0U/B3KjNWbK17dJEpmP0Qtb8dUL1InvPrUCp iMzbVROuf9K37ZIU1+1DKIB6xaAK/nlyokjXIAaqdsWOE6x1LDc0QFa0yPfsQpASrs 4+70iaskJHo4xMgL2wxuHRLA25ahq93cOHydErRKMTwSxwH6IAy7ZwAB8A98f6VuS/ MhksRTtmzzON3CllGVvIhpy80yb+JAB/r1JxlQIUn8/n9bWREcCIKiQY35Dn1XfAe7 ZkvvqysID8uXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A5CD8677A8 for ; Mon, 25 Aug 2025 10:28:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139279; bh=qsVeSFbu1pjH5YW5pEXbxABAMO3w6AksnO4zO2zinfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ua6HG2HElcPLkD+jMeFJWNQpieaX3ZA65Dp9JhPJ47HN0TARgzJpEbUb2BA/15GFb dCKcFc7vuftG2jouhnVLgnzSk081NoJx5rsxXyKUrGFwA+/mywdcpnjr1pBbFOp9PU Jy+O+HY7BE2UJLQm0+y0E5N8MQvtl+fvL2FMtXba4fp3X5239f2rSCLAR4vcXF5tQj BYpspYGHJEsyDnUcnL/f8u92gbp+KJRz1XifFnOE9pjxZmIowIw0FCdTkw8zLC2Gfl 1N3oRSjH9+y2lLbJxFjqme9VIZvMuA2N+oBgKhhvRPEkk36vgDRJdxGcO9/a0rejsf +msrzf09+AG/w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E5C0B6779E; Mon, 25 Aug 2025 10:27:59 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id QLl_D1Ncoy6B; Mon, 25 Aug 2025 10:27:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139276; bh=v2O+LePaJDu4aO0qaqULi9vAXO6DF/fxUGo2cfFvTnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UIiPSq/xHOIqn8SN0JihcQHxEkN++gyyvHweVetjye5SVqmHJ+vvNrzIU20oqDQX8 wLtQYE/uBH/yqyqzCcZ/6p0564ty2H/mfm/NPo+cnKQq/iwoYlsf2Jxo9V3KvEyg8p V0tlzBrVUFQibd9J8jVaQGQgZkL+mBkEg/RL8B58/GJ/XHVyO6woWriS+EbSfDa/QN nbH8l73WNEBgyOLcFytfoqpkpNefTngOpVM4fMu0sJroUIJ4L7HwvowcylJX5zwtIl otguGQdVpBm6tT8o/UFLeP7NKoFlXUVqbs+smGy0Dsyv7ylA3HP8FzJpjYJUgBnOeu Cgjf90w6c3M2Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6FEB267706; Mon, 25 Aug 2025 10:27:56 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:19 -0600 Message-ID: <20250825162727.3185381-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4UGOH7TO3WDGJAYSRULFE5NDZOTHI45A X-Message-ID-Hash: 4UGOH7TO3WDGJAYSRULFE5NDZOTHI45A X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 16/16] doc: Tidy up the console docs a little List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Tweak the documentation to look better when viewed. Use 'write' instead of 'put'. Signed-off-by: Simon Glass --- (no changes since v1) doc/usage/console.rst | 69 ++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/doc/usage/console.rst b/doc/usage/console.rst index f624cc58038..d7d41bca187 100644 --- a/doc/usage/console.rst +++ b/doc/usage/console.rst @@ -6,10 +6,10 @@ U-Boot console handling ======================= -HOW THE CONSOLE WORKS? ----------------------- +Introduction +------------ -At system startup U-Boot initializes a serial console. When U-Boot +At system-startup U-Boot initializes a serial console. When U-Boot relocates itself to RAM, all console drivers are initialized (they will register all detected console devices to the system for further use). @@ -17,43 +17,46 @@ use). If not defined in the environment, the first input device is assigned to the 'stdin' file, the first output one to 'stdout' and 'stderr'. -You can use the command "coninfo" to see all registered console +You can use the command `coninfo` to see all registered console devices and their flags. You can assign a standard file (stdin, stdout or stderr) to any device you see in that list simply by assigning its name to the corresponding environment variable. For -example: +example:: - setenv stdin serial <- To use the serial input - setenv stdout video <- To use the video console + # Use the serial input + setenv stdin serial -Do a simple "saveenv" to save the console settings in the environment + # Use the video console + setenv stdout vidconsole + +Do a simple `saveenv` to save the console settings in the environment and get them working on the next startup, too. -HOW CAN I USE STANDARD FILE INTO THE SOURCES? ---------------------------------------------- +How to output text to the console +--------------------------------- You can use the following functions to access the console: -* STDOUT: - putc (to put a char to stdout) - puts (to put a string to stdout) - printf (to format and put a string to stdout) - -* STDIN: - tstc (to test for the presence of a char in stdin) - getc (to get a char from stdin) - -* STDERR: - eputc (to put a char to stderr) - eputs (to put a string to stderr) - eprintf (to format and put a string to stderr) - -* FILE (can be 'stdin', 'stdout', 'stderr'): - fputc (like putc but redirected to a file) - fputs (like puts but redirected to a file) - fprintf (like printf but redirected to a file) - ftstc (like tstc but redirected to a file) - fgetc (like getc but redirected to a file) - -Remember that all FILE-related functions CANNOT be used before -U-Boot relocation (done in 'board_init_r' in `arch/*/lib/board.c`). +stdout + - putc() - write a char to stdout + - puts() - write a string to stdout + - printf() - format and write a string to stdout + +stdin + - tstc() - test for the presence of a char in stdin + - getchar() - get a char from stdin + +stderr + - eputc() - write a char to stderr + - eputs() - write a string to stderr + - eprintf() - format and write a string to stderr + +file ('stdin', 'stdout' or 'stderr') + - fputc() - write a char to a file + - fputs() - write a string to a file + - fprintf() - format and write a string to a file + - ftstc() - test for the presence of a char in file + - fgetc() - get a char from a file + +Remember that FILE-related functions CANNOT be used before U-Boot relocation, +which is done in `board_init_r()`.