Arm Trusted Firmware debug output

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Arm Trusted Firmware debug output

Jump to solution
3,628 Views
micha_m_EB
Contributor IV

Hello,

I am using Android on a i.MX 8QuadXPlus MEK board. And there I wanted to enable UART output in the Arm Trusted Firmware (ATF) by setting DEBUG_CONSOLE to 1 in $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/include/platform_def.h.

However if I compile that setting in, then flashing doesn't work any more. Spending some time, I traced the issue down to:

...

func console_register

...

    str x0, [x21, :lo12:console_list] /* list head = new console */

...

in vendor/nxp-opensource/arm-trusted-firmware/drivers/console/aarch64/multi_console.S

Not working means, that it is hanging forever in

2:132 1/ 1 [=================100%=================] SDPS: boot -f u-boot-imx8qxp-mek-uuu.imx

and nothing is happening on UART.

Does anyone know what is going wrong here?

Edit:

BTW: I am using an own build tee-imx8qx.bin

2nd Edit:
It is not in that instruction that the CPU gets stuck but the effects of the instruction is causing the flashing to stop.

Tags (2)
0 Kudos
1 Solution
3,433 Views
micha_m_EB
Contributor IV

Hi,

I think I've solved it now. It seems to be a bug in $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/include/platform_def.h and $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/imx8qx_bl31_setup.c

It seems that ATF that is executed in the flashing process is not compiled with TEE_IMX8 defined. And hence DEBUG_CONSOLE_A35=0. However that leads in imx8qx_bl31_setup.c to the state that lpuart32_serial_init(IMX_BOOT_UART_BASE); is not called which is obviously important for the UART functionality in ATF.

So setting

#define DEBUG_CONSOLE 1

#ifdef TEE_IMX8
#define DEBUG_CONSOLE_A35 1
#else
#define DEBUG_CONSOLE_A35 1
#endif

In $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/include/platform_def.h lead to UART output during flashing also from ATF.

Best regards,

#micha

View solution in original post

0 Kudos
6 Replies
3,434 Views
micha_m_EB
Contributor IV

Hi,

I think I've solved it now. It seems to be a bug in $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/include/platform_def.h and $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/imx8qx_bl31_setup.c

It seems that ATF that is executed in the flashing process is not compiled with TEE_IMX8 defined. And hence DEBUG_CONSOLE_A35=0. However that leads in imx8qx_bl31_setup.c to the state that lpuart32_serial_init(IMX_BOOT_UART_BASE); is not called which is obviously important for the UART functionality in ATF.

So setting

#define DEBUG_CONSOLE 1

#ifdef TEE_IMX8
#define DEBUG_CONSOLE_A35 1
#else
#define DEBUG_CONSOLE_A35 1
#endif

In $AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/imx8qx/include/platform_def.h lead to UART output during flashing also from ATF.

Best regards,

#micha

0 Kudos
3,433 Views
igorpadykov
NXP Employee
NXP Employee

Hi Micha

what bsp used in the case, reason may be in compatible versions.

Recommended first to try with linux, for example for L4.19.35 should be used below atf

linux, uboot versions from nxp  source.codeaurora.org/external/imx/linux-imx  repository:

imx-atf - i.MX ARM Trusted firmware 

linux-imx - i.MX Linux kernel 

uboot-imx - i.MX U-Boot 

Documentation:

i.MX Software and Development Tools | NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
3,433 Views
micha_m_EB
Contributor IV

Hi Igor,

we are using Android p9.0.0_2.3.3-auto release:

https://source.codeaurora.org/external/imx/imx-manifest.git 

commit ca83c060c31cd58f9938f3909ad6fc64676a4173
Author: Jindong <jindong.yue@nxp.com>
Date: Thu Feb 13 14:14:30 2020 +0800

Update manifest for p9.0.0_2.3.3-auto release

So you are saying that I should first try with a Linux build before using Android Auto?

BR,

#micha

0 Kudos
3,433 Views
igorpadykov
NXP Employee
NXP Employee

Hi Micha

>are saying that I should first try with a Linux build before using Android Auto?

yes please try with that option, build steps can be found in linux documentation on

i.MX Software and Development Tools | NXP 

Best regards
igor

0 Kudos
3,433 Views
micha_m_EB
Contributor IV

Hi Igor,

while Yocto is still compiling I continued looking into ATF on Android. Meanwhile by using Lauterbach/Trace32 I've managed to further nail down the issue. It seems that an UART register (0x5a060000 + 0x14, LPUART status) isn't readable in:

$AOSP/vendor/nxp-opensource/arm-trusted-firmware/plat/imx/common/lpuart_console.S 

func console_lpuart_putc

...

ldr w2, [x1, #STAT]

...

Here is X1 = 0x5a060000.

Best regards,

Micha

0 Kudos
3,433 Views
igorpadykov
NXP Employee
NXP Employee

Hi Micha

>we are using Android p9.0.0_2.3.3-auto release:

it is based on L4.14.98-2.0.0_ga release and one can follow

Linux L4.14.98_2.0.0 Documentation

Best regards
igor

0 Kudos