diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c50519b064..cb9c7fcc58 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -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 diff --git a/arch/arm64/src/common/arm64_head.S b/arch/arm64/src/common/arm64_head.S index ec6cc41f40..82104b7d57 100644 --- a/arch/arm64/src/common/arm64_head.S +++ b/arch/arm64/src/common/arm64_head.S @@ -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 */ diff --git a/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig b/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig index 06af9b7ea3..821eb9c6c6 100644 --- a/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig +++ b/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig @@ -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 diff --git a/boards/arm64/qemu/qemu-armv8a/configs/nsh_smp/defconfig b/boards/arm64/qemu/qemu-armv8a/configs/nsh_smp/defconfig index 3540638a72..c7fdd37a93 100644 --- a/boards/arm64/qemu/qemu-armv8a/configs/nsh_smp/defconfig +++ b/boards/arm64/qemu/qemu-armv8a/configs/nsh_smp/defconfig @@ -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