From a7e32851c5712f8821874c2e264f81f512d90bac Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Tue, 4 Oct 2022 17:48:00 +0200 Subject: sandbox: implement DEBUG_LL support We can't currently debug malloc() or early parts of the driver model on sandbox, because we require both to allocate the sandbox console device. To make debugging such early startup easier in future, add some simple DEBUG_LL support. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20221004154800.3457742-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- arch/sandbox/Kconfig | 1 + arch/sandbox/Makefile | 3 ++- arch/sandbox/include/asm/debug_ll.h | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 arch/sandbox/include/asm/debug_ll.h diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index a8bca8757f..d3889fcac0 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -16,6 +16,7 @@ config SANDBOX select ARCH_HAS_STACK_DUMP if ASAN select GENERIC_FIND_NEXT_BIT select HAS_ARCH_SJLJ + select HAS_ASM_DEBUG_LL default y config ARCH_TEXT_BASE diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index aee6bccc9c..d5ba05ba86 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -30,7 +30,8 @@ KBUILD_CFLAGS += -Dmalloc=barebox_malloc -Dcalloc=barebox_calloc \ -Dopendir=barebox_opendir -Dreaddir=barebox_readdir \ -Dclosedir=barebox_closedir -Dreadlink=barebox_readlink \ -Doptarg=barebox_optarg -Doptind=barebox_optind \ - -Dsetjmp=barebox_setjmp -Dlongjmp=barebox_longjmp + -Dsetjmp=barebox_setjmp -Dlongjmp=barebox_longjmp \ + -Dputchar=barebox_putchar machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y)) diff --git a/arch/sandbox/include/asm/debug_ll.h b/arch/sandbox/include/asm/debug_ll.h new file mode 100644 index 0000000000..7bef871058 --- /dev/null +++ b/arch/sandbox/include/asm/debug_ll.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_DEBUG_LL__ +#define __ASM_DEBUG_LL__ + +#undef putchar + +static inline void PUTC_LL(char ch) +{ + int putchar(int c); + putchar(ch); +} + +#define putchar barebox_putchar + +#endif /* __ASM_DEBUG_LL__ */ -- cgit v1.2.3