lib: sbi: Introduce an early console buffer for caching early prints

The console device is registered by platform only in early_init()
callback so any prints before this point will be lost. Introduce an
early console buffer for caching prints before platform early_init().

For crashes before platform early_init(), users can simply dump the
contents of the console_early_buffer[] string using a debugger. The
relative address of the console_early_buffer[] string can be found
using following two commands:

CONSOLE_EARLY_FIFO_ADDR=`${CROSS_COMPILE}objdump -D \
build/platform/generic/firmware/fw_dynamic.elf | \
grep "<console_early_fifo>:" | awk '{print $1}'`

${CROSS_COMPILE}objdump -R build/platform/generic/firmware/fw_dynamic.elf | \
grep $CONSOLE_EARLY_FIFO_ADDR | awk '{print $3}'

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-By: Himanshu Chauhan <hchauhan@ventanamicro.com>
This commit is contained in:
Anup Patel
2024-07-05 10:04:12 +05:30
committed by Anup Patel
parent d35c76a766
commit bb7267a07f
2 changed files with 32 additions and 1 deletions

View File

@@ -1,6 +1,10 @@
# SPDX-License-Identifier: BSD-2-Clause
menu "SBI Extension Support"
menu "Generic SBI Support"
config CONSOLE_EARLY_BUFFER_SIZE
int "Early console buffer size (bytes)"
default 256
config SBI_ECALL_TIME
bool "Timer extension"