arm64: add ARCH_EARLY_PRINT support

Summary:
  The aarch64 have EL0~El3 execute level and NS/S (security state),
the NuttX should be execute at EL1 in NS(ARmv8-A) or S(ARmv8-R)
state. but booting NuttX have different ELs and state while with
different platform, if NuttX runing at wrong ELs or state it will
be not normal anymore. So we need to print something in arm64_head.S
to debug this situation.
Enabling this option will need to implement up_earlyserialinit and
up_lowputc functions just you see in qemu, if you not sure,
keeping the option disable.

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
This commit is contained in:
qinwei1 2023-02-28 15:07:42 +08:00 committed by Xiang Xiao
parent e5564a9872
commit 4240723b78
4 changed files with 23 additions and 7 deletions

View File

@ -64,6 +64,19 @@ config ARCH_HAVE_PSCI
maybe not applicable for arm core without PCSI firmware
interface implement
config ARCH_EARLY_PRINT
bool "arch early print support"
default n
---help---
The aarch64 have EL0~El3 execute level and NS/S (security state),
the NuttX should be execute at EL1 in NS(ARmv8-A) or S(ARmv8-R)
state. but booting NuttX have different ELs and state while with
different platform, if NuttX runing at wrong ELs or state it will
be not normal anymore. So we need to print something in arm64_head.S
to debug this situation.
Enabling this option will need to implement up_earlyserialinit and
up_lowputc functions just you see in qemu, if you not sure,
keeping the option disable.
config ARCH_CORTEX_A53
bool

View File

@ -48,7 +48,7 @@
#define __HEAD_FLAGS ((__HEAD_FLAG_PAGE_SIZE << 1) | \
(__HEAD_FLAG_PHYS_BASE << 3))
#ifdef CONFIG_DEBUG_FEATURES
#ifdef CONFIG_ARCH_EARLY_PRINT
#define RODATA_STR(label, msg) \
.pushsection .rodata.str, "aMS", %progbits, 1 ; \
@ -66,7 +66,7 @@ label: .asciz msg; \
RODATA_STR(boot_string_##sym, _s)
#else
#define PRINT(sym, s)
#endif /* CONFIG_DEBUG_FEATURES */
#endif /* CONFIG_ARCH_EARLY_PRINT */
/****************************************************************************
* Private Functions
@ -166,7 +166,7 @@ primary_core:
bl __reset_prep_c
#ifdef CONFIG_DEBUG_FEATURES
#ifdef CONFIG_ARCH_EARLY_PRINT
/* Initialize the UART for early print.
* Should only be called on the boot CPU
*/
@ -228,8 +228,9 @@ jump_to_c_entry:
/* Fail-stop */
fail:
PRINT(fail, "- Boot failed -\r\n")
1: wfe
/* Boot failed */
1: wfe
b 1b
/* Set the minimum necessary to safely call C code */
@ -283,7 +284,7 @@ out:
ret x23
#ifdef CONFIG_DEBUG_FEATURES
#ifdef CONFIG_ARCH_EARLY_PRINT
/* Print early debug messages.
* x0: Nul-terminated string to print.
@ -303,4 +304,4 @@ boot_stage_puts:
.type boot_low_puts, %function;
#endif /* !CONFIG_DEBUG_FEATURES */
#endif /* !CONFIG_ARCH_EARLY_PRINT */

View File

@ -12,6 +12,7 @@ CONFIG_ARCH_BOARD_QEMU_ARMV8A=y
CONFIG_ARCH_CHIP="qemu"
CONFIG_ARCH_CHIP_QEMU=y
CONFIG_ARCH_CHIP_QEMU_A53=y
CONFIG_ARCH_EARLY_PRINT=y
CONFIG_ARCH_INTERRUPTSTACK=4096
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y

View File

@ -13,6 +13,7 @@ CONFIG_ARCH_BOARD_QEMU_ARMV8A=y
CONFIG_ARCH_CHIP="qemu"
CONFIG_ARCH_CHIP_QEMU=y
CONFIG_ARCH_CHIP_QEMU_A53=y
CONFIG_ARCH_EARLY_PRINT=y
CONFIG_ARCH_INTERRUPTSTACK=8192
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y