AM6442: Change ATF console to main_uart3 from main_uart0

Part Number: AM6442
Other Parts Discussed in Thread: TMDS64EVM

Tool/software:

Hi Team,

I am trying to change ATF console from UART0 to UART3 on TMDS64EVM.

I could change boot console from UART0 to UART3 according to https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1452385/am6442-change-boot-console-to-main_uart5-from-main_uart0.

I am using SDK 10.01, so I have changed K3_USART to 3 from 0 in plat_common.mk in the trusted firmware source tree and compiled trusted firmware with the following command.

make ARCH=aarch64 CROSS_COMPILE="$CROSS_COMPILE_64" PLAT=k3 TARGET_BOARD=generic SPD=opteed

Then, I copied bl31.bin to prebuild image directory and make u-boot.

When I tried to boot, trusted firmware was crashed with the following log.

Could you please advise how to fix this problem?

Thanks

  • Sorry,

    I am missed to copy the log.

    log:

    U-Boot SPL 2024.04-dirty (Feb 04 2025 - 16:30:17 +0900)
    Resetting on cold boot to workaround ErrataID:i2331
    Please resend tiboot3.bin in case of UART/DFU boot
    resetting ...

    U-Boot SPL 2024.04-dirty (Feb 04 2025 - 16:30:17 +0900)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.8--v10.01.08 (Fiery Fox)')
    SPL initial stack usage: 13392 bytes
    Trying to boot from MMC2
    Authentication passed
    Authentication passed
    Loading Environment from nowhere... OK
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...

    NOTICE: BL31: v2.11.0(release):v2.11.0-906-g58b25570c-dirty
    NOTICE: BL31: Built : 07:26:44, Feb 4 2025
    Unhandled Exception in EL3.
    x30 = 0x00000000701c6e38
    x0 = 0x0000000000000001
    x1 = 0x00000000701cc098
    x2 = 0x00000000701cc000
    x3 = 0x00000000701cc0d8
    x4 = 0x0000000032401000
    x5 = 0x0000000000000040
    x6 = 0x00000000701d801e
    x7 = 0x0000000000000000
    x8 = 0x00000000701c0000
    x9 = 0x00000000701d0650
    x10 = 0x0000000032e00000
    x11 = 0x0000000000000000
    x12 = 0x00000000701ca1f0
    x13 = 0x00000000701ca1f0
    x14 = 0x0000000000000004
    x15 = 0x0000000041033020
    x16 = 0xbce190546ce50a74
    x17 = 0x485d00c0e183713e
    x18 = 0x5b2cfa91a447272f
    x19 = 0x00000000701cd638
    x20 = 0x00000000701cd5d0
    x21 = 0xb4a0cd3122f44dcf
    x22 = 0x05dbc817569db2ed
    x23 = 0xa90935fa00128ac0
    x24 = 0x00000000701d8000
    x25 = 0x25fc504f886116b9
    x26 = 0x70d41667e8126b82
    x27 = 0x2b7a1511a44465a2
    x28 = 0x0639f8b6cb04207b
    x29 = 0x00000000701cd540
    scr_el3 = 0x0000000000000238
    sctlr_el3 = 0x0000000030cd183f
    cptr_el3 = 0x0000000080000400
    tcr_el3 = 0x0000000080803520
    daif = 0x00000000000003c0
    mair_el3 = 0x00000000004404ff
    spsr_el3 = 0x00000000600002cc
    elr_el3 = 0x00000000701c3bd8
    ttbr0_el3 = 0x00000000701d30c0
    esr_el3 = 0x0000000096000010
    far_el3 = 0x0000000032401000
    spsr_el1 = 0x000000000e002b49
    elr_el1 = 0x3ee6086c4480c911
    spsr_abt = 0x000000009213b30a
    spsr_und = 0x000000000a002f4e
    spsr_irq = 0x000000003011875d
    spsr_fiq = 0x00000000861a7383
    sctlr_el1 = 0x0000000000c50838
    actlr_el1 = 0x0000000000000000
    cpacr_el1 = 0x0000000000000000
    csselr_el1 = 0x0000000000000000
    sp_el1 = 0x1caa3e028ee6829f
    esr_el1 = 0x00000000db8e985d
    ttbr0_el1 = 0x23c44931046a22f8
    ttbr1_el1 = 0x8443808090a95218
    mair_el1 = 0x44e048e000098aa4
    amair_el1 = 0x0000000000000000
    tcr_el1 = 0x0000000000000000
    tpidr_el1 = 0x0953512423400020
    tpidr_el0 = 0x84c1200084148004
    tpidrro_el0 = 0x0428188100690900
    par_el1 = 0x0500008080021402
    mpidr_el1 = 0x0000000080000000
    afsr0_el1 = 0x0000000000000000
    afsr1_el1 = 0x0000000000000000
    contextidr_el1 = 0x0000000000000000
    vbar_el1 = 0x0000000000000000
    cntp_ctl_el0 = 0x0000000000000000
    cntp_cval_el0 = 0xf5900300008419d5
    cntv_ctl_el0 = 0x0000000000000002
    cntv_cval_el0 = 0xfaddfbebc60d198f
    cntkctl_el1 = 0x0000000000000000
    sp_el0 = 0x00000000701cd540
    isr_el1 = 0x0000000000000000
    dacr32_el2 = 0x000000000000604c
    ifsr32_el2 = 0x0000000000000014
    cpuectlr_el1 = 0x0000000000000040
    cpumerrsr_el1 = 0x0000000009080300
    l2merrsr_el1 = 0x0000000012305268
    cpuactlr_el1 = 0x00001000090ca000

  • Hi Shigemi,

    I will look try to reproduce the issue tomorrow and look into it.

  • Hi Shigemi-san,

    I am able to build ATF with console configured to UART3 but don't see the unhandled exception error.

    NOTICE: BL31: v2.11.0(release):v2.11.0-906-g58b25570c-dirty

    I noticed your BL31 version signature has "g58b25570c-dirty", which is shorter than mine:

    NOTICE:  BL31: v2.11.0(release):v2.11.0-906-g58b25570c9ef-dirty

    I am not sure what causes the difference. Do you use the same toolchain provided in the SDK10.1 package?

  • Hi Bin,

    Yes, I confirmed the toolchain settings.

    The above part of the message is created by shell in line 175 in Makefile.

    175: BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null)
    177: VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}

    In my SDK environment, git describe command returns 'v2.11.0-906-g58b25570c-dirty' like following.

    $ git describe --always --dirty --tags
    v2.11.0-906-g58b25570c-dirty

    So, repository's tag is different from yours. Could give me the correct tag name of the repository? 

  • Hi Shigemi,

    The git tag is the same, but yours is just shorter by 3 letters. Maybe it is due to your git configurations, but it should not be related to the unhandled exception issue you have. But I am not sure what would cause it, I am unable to reproduce it on my side.

    Can you please describe the exact details how did you rebuild ATF and U-Boot? The ensure console log would be helpful.

  • Hi Bin,

    First, I editted plat_common.mk, following is the git diff image.

    diff --git a/plat/ti/k3/common/plat_common.mk b/plat/ti/k3/common/plat_common.mk
    index 8db732cb6..7cde62bf7 100644
    --- a/plat/ti/k3/common/plat_common.mk
    +++ b/plat/ti/k3/common/plat_common.mk
    @@ -39,7 +39,7 @@ ENABLE_PIE            :=      1
     TI_16550_MDR_QUIRK     :=      1
     $(eval $(call add_define,TI_16550_MDR_QUIRK))
     
    -K3_USART               :=      0
    +K3_USART               :=      3
     $(eval $(call add_define,K3_USART))
    

    2nd, set environment variable with the following file. (/home/mikayama/sdk101 is the sdk root.)

    export SDK_INSTALL_DIR=/home/mikayama/sdk101
    export CROSS_COMPILE_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-"
    export SYSROOT_64="${SDK_INSTALL_DIR}/linux-devkit/sysroots/aarch64-oe-linux"
    export CC_64="${CROSS_COMPILE_64}gcc --sysroot=${SYSROOT_64}"
    export CROSS_COMPILE_32="${SDK_INSTALL_DIR}/k3r5-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-eabi/arm-oe-eabi-"

    Then, make trusted firmware as follows.

    mikayama@nuc03:08:31:25$ make ARCH=aarch64 CROSS_COMPILE="$CROSS_COMPILE_64" PLAT=k3 TARGET_BOARD=generic SPD=opteed 
    Including services/spd/opteed/opteed.mk
    Building k3
      MD      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/libc
      CC      lib/libc/abort.c
      CC      lib/libc/assert.c
      CC      lib/libc/exit.c
      CC      lib/libc/memchr.c
      CC      lib/libc/memcmp.c
      CC      lib/libc/memcpy.c
      CC      lib/libc/memcpy_s.c
      CC      lib/libc/memmove.c
      CC      lib/libc/memrchr.c
      CC      lib/libc/printf.c
      CC      lib/libc/putchar.c
      CC      lib/libc/puts.c
      CC      lib/libc/snprintf.c
      CC      lib/libc/strchr.c
      CC      lib/libc/strcmp.c
      CC      lib/libc/strlcat.c
      CC      lib/libc/strlcpy.c
      CC      lib/libc/strlen.c
      CC      lib/libc/strncmp.c
      CC      lib/libc/strnlen.c
      CC      lib/libc/strrchr.c
      CC      lib/libc/strtok.c
      CC      lib/libc/strtoul.c
      CC      lib/libc/strtoll.c
      CC      lib/libc/strtoull.c
      CC      lib/libc/strtol.c
      CC      lib/libc/memset.c
      AS      lib/libc/aarch64/setjmp.S
      MD      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/lib
      AR      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/lib/libc.a
      MD      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/bl31
      CC      bl31/bl31_context_mgmt.c
      CC      bl31/bl31_main.c
      CC      bl31/bl31_traps.c
      CC      bl31/interrupt_mgmt.c
      CC      common/bl_common.c
      CC      common/runtime_svc.c
      CC      common/tf_log.c
      CC      drivers/arm/gic/v3/arm_gicv3_common.c
      CC      drivers/arm/gic/v3/gic-x00.c
      CC      drivers/arm/gic/v3/gicdv3_helpers.c
      CC      drivers/arm/gic/v3/gicrv3_helpers.c
      CC      drivers/arm/gic/v3/gicv3_helpers.c
      CC      drivers/arm/gic/v3/gicv3_main.c
      CC      drivers/console/multi_console.c
      CC      lib/compiler-rt/builtins/popcountdi2.c
      CC      lib/compiler-rt/builtins/popcountsi2.c
      CC      lib/cpus/errata_common.c
      CC      lib/cpus/errata_report.c
      CC      lib/el3_runtime/aarch64/context_mgmt.c
      CC      lib/el3_runtime/cpu_data_array.c
      CC      lib/el3_runtime/simd_ctx.c
      CC      lib/extensions/mpam/mpam.c
      CC      lib/extensions/pmuv3/aarch64/pmuv3.c
      CC      lib/extensions/spe/spe.c
      CC      lib/extensions/sve/sve.c
      CC      lib/locks/bakery/bakery_lock_coherent.c
      CC      lib/psci/psci_common.c
      CC      lib/psci/psci_main.c
      CC      lib/psci/psci_mem_protect.c
      CC      lib/psci/psci_off.c
      CC      lib/psci/psci_on.c
      CC      lib/psci/psci_setup.c
      CC      lib/psci/psci_suspend.c
      CC      lib/psci/psci_system_off.c
      CC      lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
      CC      lib/xlat_tables_v2/xlat_tables_context.c
      CC      lib/xlat_tables_v2/xlat_tables_core.c
      CC      lib/xlat_tables_v2/xlat_tables_utils.c
      CC      plat/common/aarch64/plat_common.c
      CC      plat/common/plat_bl_common.c
      CC      plat/common/plat_gicv3.c
      CC      plat/common/plat_log_common.c
      CC      plat/common/plat_psci_common.c
      CC      plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
      CC      plat/ti/k3/common/drivers/ti_sci/ti_sci.c
      CC      plat/ti/k3/common/k3_bl31_setup.c
      CC      plat/ti/k3/common/k3_console.c
      CC      plat/ti/k3/common/k3_gicv3.c
      CC      plat/ti/k3/common/k3_psci.c
      CC      plat/ti/k3/common/k3_topology.c
      CC      services/arm_arch_svc/arm_arch_svc_setup.c
      CC      services/spd/opteed/opteed_common.c
      CC      services/spd/opteed/opteed_main.c
      CC      services/spd/opteed/opteed_pm.c
      CC      services/std_svc/std_svc_setup.c
      AS      bl31/aarch64/bl31_entrypoint.S
      AS      bl31/aarch64/crash_reporting.S
      AS      bl31/aarch64/runtime_exceptions.S
      AS      common/aarch64/debug.S
      AS      drivers/ti/uart/aarch64/16550_console.S
      AS      lib/aarch64/cache_helpers.S
      AS      lib/aarch64/misc_helpers.S
      AS      lib/cpus/aarch64/cortex_a53.S
      AS      lib/cpus/aarch64/cortex_a72.S
      AS      lib/cpus/aarch64/cpu_helpers.S
      AS      lib/cpus/aarch64/dsu_helpers.S
      AS      lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S
      AS      lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
      AS      lib/el3_runtime/aarch64/context.S
      AS      lib/el3_runtime/aarch64/cpu_data.S
      AS      lib/locks/exclusive/aarch64/spinlock.S
      AS      lib/psci/aarch64/psci_helpers.S
      AS      lib/xlat_tables_v2/aarch64/enable_mmu.S
      AS      plat/common/aarch64/platform_helpers.S
      AS      plat/common/aarch64/platform_mp_stack.S
      AS      plat/ti/k3/common/k3_helpers.S
      AS      services/spd/opteed/opteed_helpers.S
      MD      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/bl31/bl31
      PP      bl31/bl31.ld.S
      LD      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/bl31/bl31.elf
      BIN     /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/bl31.bin
    
    Built /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/bl31.bin successfully
    
      OD      /home/mikayama/sdk101/board-support/trusted-firmware-a-2.11+git/build/k3/generic/release/bl31/bl31.dump

    Then, copy bl31.bin onto prebuilt-image/am64xx-evm/.

    mikayama@nuc03:08:45:07$ ls -l build/k3/generic/release/bl31.bin ../prebuilt-images/am64xx-evm/bl31.bin
    -rw-rw-r-- 1 mikayama mikayama 52856 Feb 13 08:31 build/k3/generic/release/bl31.bin
    -rw-r--r-- 1 mikayama mikayama 52856 Feb 13 08:45 ../prebuilt-images/am64xx-evm/bl31.bin

    I also edited the u-boot device tree source as follows and return to sdk top directory and make u-boot (with 'make u-boot' command).

    diff --git a/arch/arm/dts/k3-am642-evm.dts b/arch/arm/dts/k3-am642-evm.dts
    index 50e80436b06..7699e7c1bf9 100644
    --- a/arch/arm/dts/k3-am642-evm.dts
    +++ b/arch/arm/dts/k3-am642-evm.dts
    @@ -18,7 +18,7 @@
            model = "Texas Instruments AM642 EVM";
     
            chosen {
    -               stdout-path = &main_uart0;
    +               stdout-path = &main_uart3;
            };
     
            aliases {
    @@ -320,8 +320,8 @@
     
            main_uart1_pins_default: main-uart1-default-pins {
                    pinctrl-single,pins = <
    -                       AM64X_IOPAD(0x0248, PIN_INPUT, 0)               /* (D16) UART1_CTSn */
    -                       AM64X_IOPAD(0x024c, PIN_OUTPUT, 0)              /* (E16) UART1_RTSn */
    +                       // AM64X_IOPAD(0x0248, PIN_INPUT, 0)            /* (D16) UART1_CTSn */
    +                       // AM64X_IOPAD(0x024c, PIN_OUTPUT, 0)           /* (E16) UART1_RTSn */
                            AM64X_IOPAD(0x0240, PIN_INPUT, 0)               /* (E15) UART1_RXD */
                            AM64X_IOPAD(0x0244, PIN_OUTPUT, 0)              /* (E14) UART1_TXD */
                    >;
    @@ -337,6 +337,14 @@
                    >;
            };
     
    +       main_uart3_pins_default: main-uart3-default-pins {
    +               bootph-all;
    +               pinctrl-single,pins = <
    +                       AM64X_IOPAD(0x0248, PIN_INPUT, 4)               /* (D16) UART3_RXD */
    +                       AM64X_IOPAD(0x024c, PIN_OUTPUT, 4)              /* (E16) UART3_TXD */
    +               >;
    +       };
    +
            main_spi0_pins_default: main-spi0-default-pins {
                    pinctrl-single,pins = <
                            AM64X_IOPAD(0x0210, PIN_INPUT, 0) /* (D13) SPI0_CLK */
    @@ -496,6 +504,14 @@
            current-speed = <115200>;
     };
     
    +&main_uart3 {
    +       bootph-all;
    +       status = "okay";
    +       pinctrl-names = "default";
    +       pinctrl-0 = <&main_uart3_pins_default>;
    +       current-speed = <115200>;
    +};
    +
     /* main_uart1 is reserved for firmware usage */
     &main_uart1 {
            status = "reserved";
    diff --git a/arch/arm/dts/k3-am642-r5-evm.dts b/arch/arm/dts/k3-am642-r5-evm.dts
    index 548cfce8f99..8950a534df4 100644
    --- a/arch/arm/dts/k3-am642-r5-evm.dts
    +++ b/arch/arm/dts/k3-am642-r5-evm.dts
    @@ -143,7 +143,12 @@
      * Delete clock/power-domain properties to avoid
      * UART init failure
      */
    -&main_uart0 {
    +// &main_uart0 {
    +//     /delete-property/ power-domains;
    +//     /delete-property/ clocks;
    +//     /delete-property/ clock-names;
    +// };
    +&main_uart3 {
            /delete-property/ power-domains;
            /delete-property/ clocks;
            /delete-property/ clock-names;
    

  • Hi Shigemi-san,

    > Then, make trusted firmware as follows.
    > mikayama@nuc03:08:31:25$ make ARCH=aarch64 CROSS_COMPILE="$CROSS_COMPILE_64" PLAT=k3 TARGET_BOARD=generic SPD=opteed 

    The make option "TARGET_BOARD=generic" should be "TARGET_BOARD=lite". Please delete the build/ directory in ATF source code directory, and build and again to see if the unhandled exception problem still happens.

  • Hi Bin,

    I build ATF with "TARGET_BOARD=lite." The result is that ATF was stuck just after ATF version message.

    U-Boot SPL 2024.04-dirty (Feb 14 2025 - 13:13:21 +0900)                                                             
    Resetting on cold boot to workaround ErrataID:i2331                                                                 
    Please resend tiboot3.bin in case of UART/DFU boot                                                                  
    resetting ...                                                                                                       
                                                                                                                        
    U-Boot SPL 2024.04-dirty (Feb 14 2025 - 13:13:21 +0900)                                                             
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.8--v10.01.08 (Fiery Fox)')                                                
    SPL initial stack usage: 13392 bytes                                                                                
    Trying to boot from MMC2                                                                                            
    Authentication passed                                                                                               
    Authentication passed                                                                                               
    Loading Environment from nowhere... OK                                                                              
    Authentication passed                                                                                               
    Authentication passed                                                                                               
    Starting ATF on ARM64 core...                                                                                       
                                                                                                                        
    NOTICE:  BL31: v2.11.0(release):v2.11.0-906-g58b25570c-dirty                                                        
    NOTICE:  BL31: Built : 04:12:06, Feb 14 2025
    

    What should I do next?

  • Hi Shigemi-san,

    Now you are on the right track. Next you need to rebuild OPTEE (bl32.bin) with UART configured to UART3.

    In the <SDK>/board-support/optee-os-4.2.0+git/ directory, setup the compile environment similar to what you did when compiling ATF, then

    $ make CROSS_COMPILE="CROSS_COMPILE_32" CROSS_COMPILE64="CROSS_COMPILE_64" PLATFORM=k3-am64x CFG_ARM64_core=y CFG_CONSOLE_UART=3

    The last option "CFG_CONSOLE_UART=3" changes the UART for OPTEE.

    Please note that the toolchain provided in SDK 10.x has issues in compiling OPTEE, you would have to download the toolchain from the ARM website as documented in the link below.

    https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/10_01_10_04/exports/docs/linux/Overview/GCC_ToolChain.html#yocto-toolchain

    Since my PC already has SDK9.2 installed, so I just directly set the compile environment pointing the toolchain to the one provided in SDK9.2.

  • Hi Bin,

    Thank you for your assistance!

    ATF and OPTEE console successfully changed to UART3 from UART0.

    Best regards,