This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62A-LP: Re-build U-Boot for the SK-AM62A-LP starter kit

Part Number: SK-AM62A-LP


Hello,

I am trying to build U-Boot for SK-AM62A-LP (AM62A HS-FS). I don't want to make any changes, I just want to build U-Boot using my locally installed toolchain.

I am following the instructions for the Processor SDK (AM62A): https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-edgeai/AM62AX/09_00_00/exports/docs/linux/Foundational_Components/U-Boot/UG-General-Info.html

When I try to boot with my compiler output I get an early bl31 crash:

U-Boot SPL 2023.04 (Sep 14 2023 - 12:49:14 -0400)
SYSFW ABI: 3.1 (firmware rev 0x0009 '9.0.7--v09.00.07 (Kool Koala)')
am62a_init: board_init_f done
SPL initial stack usage: 17056 bytes
am62a_init: spl_boot_device: devstat = 0x243 bootmedia = 0x8 bootindex = 0
Trying to boot from MMC2
am62a_init: spl_boot_device: devstat = 0x243 bootmedia = 0x8 bootindex = 0
Authentication passed
am62a_init: spl_boot_device: devstat = 0x243 bootmedia = 0x8 bootindex = 0
Authentication passed
am62a_init: spl_boot_device: devstat = 0x243 bootmedia = 0x8 bootindex = 0
Authentication passed
am62a_init: spl_boot_device: devstat = 0x243 bootmedia = 0x8 bootindex = 0
Authentication passed
am62a_init: spl_boot_device: devstat = 0x243 bootmedia = 0x8 bootindex = 0
Authentication passed
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.7(release):v2.7.0-359-g1309c6c80
NOTICE:  BL31: Built : 11:06:23, Sep 14 2023
Unhandled Exception in EL3.
x30            = 0x000000009e785e44
x0             = 0x0000000000000001
x1             = 0x000000009e78a010
x2             = 0x000000009e78a000
x3             = 0x000000009e78a050
x4             = 0x0000000032401000
x5             = 0x0000000000000040
x6             = 0x000000009e7919c8
x7             = 0x0000000000000000
x8             = 0x000000009e79ffff
x9             = 0x000000009e791b98
x10            = 0x0000000032c80000
x11            = 0x0000000000000000
x12            = 0xc6c82e4d1a8443b7
x13            = 0x5b528844802023e9
x14            = 0x0c0a11f60368e022
x15            = 0x891561c608ab3c48
x16            = 0xbe22aa089e893e46
x17            = 0x000000009e780684
x18            = 0x0000000000000004
x19            = 0x000000009e789234
x20            = 0x000000009e78b330
x21            = 0x0000000000000000
x22            = 0x0000000000000000
x23            = 0x0000000000000000
x24            = 0x2d1850828df098a1
x25            = 0x00428a205a5ee464
x26            = 0x04ca0122bfe66b59
x27            = 0x00108421d2eb5191
x28            = 0x21c0bd31dce73294
x29            = 0x000000009e78b2c0
scr_el3        = 0x0000000000000238
sctlr_el3      = 0x0000000030cd183f
cptr_el3       = 0x0000000000000000
tcr_el3        = 0x0000000080803520
daif           = 0x00000000000003c0
mair_el3       = 0x00000000004404ff
spsr_el3       = 0x00000000600002cc
elr_el3        = 0x000000009e782ddc
ttbr0_el3      = 0x000000009e791cc0
esr_el3        = 0x0000000096000010
far_el3        = 0x0000000032401000
spsr_el1       = 0x0000000002368902
elr_el1        = 0x051a06009ffec522
spsr_abt       = 0x00000000860454b8
spsr_und       = 0x000000000e100300
spsr_irq       = 0x0000000004060159
spsr_fiq       = 0x0000000036100a0a
sctlr_el1      = 0x0000000000c50838
actlr_el1      = 0x0000000000000000
cpacr_el1      = 0x0000000000000000
csselr_el1     = 0x0000000000000000
sp_el1         = 0x12edfbdbd4479fae
esr_el1        = 0x000000000d071754
ttbr0_el1      = 0x0402268686000040
ttbr1_el1      = 0x200510400181a502
mair_el1       = 0x44e048e000098aa4
amair_el1      = 0x0000000000000000
tcr_el1        = 0x0000000000000000
tpidr_el1      = 0xa0000840c2c02020
tpidr_el0      = 0x0108414040200094
tpidrro_el0    = 0x0000001009100840
par_el1        = 0x0200004043290403
mpidr_el1      = 0x0000000080000000
afsr0_el1      = 0x0000000000000000
afsr1_el1      = 0x0000000000000000
contextidr_el1 = 0x0000000000000000
vbar_el1       = 0x0000000000000000
cntp_ctl_el0   = 0x0000000000000002
cntp_cval_el0  = 0x40002a8252893f07
cntv_ctl_el0   = 0x0000000000000002
cntv_cval_el0  = 0xff6875c9ffcd4889
cntkctl_el1    = 0x0000000000000000
sp_el0         = 0x000000009e78b2c0
isr_el1        = 0x0000000000000000
dacr32_el2     = 0x000000000d508141
ifsr32_el2     = 0x0000000000000001
cpuectlr_el1   = 0x0000000000000040
cpumerrsr_el1  = 0x000000001800028a
l2merrsr_el1   = 0x0000000012044820
cpuactlr_el1   = 0x00001000090ca000

My full compile log is here: /cfs-file/__key/communityserver-discussions-components-files/791/u_2D00_boot_2D00_62a_2D00_build.log

My first question is that the main documentation page lists the desired ARM trusted firmware version to be:  arm-trusted-firmware Commit: 2fcd408bb3a6756767a43c073c597cef06e7f2d5

However, on the ATF build page (linked on the same documentation page), it specifies:

Getting the ATF Source Code

$ git clone git.trustedfirmware.org/.../trusted-firmware-a.git
$ git checkout 1309c6c805190bd376c0561597653f3f8ecd0f58

Which version should I use? (It doesn't appear either works for me).

My general build process is build the dependencies:

mkdir -p "$DEPENDDIR" || die "Can't create dependency directory $DEPENDDIR. Is the path writable?"
git -C "$DEPENDDIR" clone https://git.ti.com/git/security-development-tools/core-secdev-k3.git -b master
git -C "$DEPENDDIR" clone https://git.ti.com/git/k3-image-gen/k3-image-gen.git
git -C "$DEPENDDIR" clone https://git.ti.com/git/processor-firmware/ti-linux-firmware.git --branch=ti-linux-firmware
git -C "$DEPENDDIR" clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
git -C "$DEPENDDIR" clone https://github.com/OP-TEE/optee_os.git
# Build tee-pager_v2.bin (from: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/latest/exports/docs/linux/Foundational_Components_OPTEE.html)
cd "$OPTEE_DIR"
git checkout 3bc3809afe372ca7e8216fc5d7a64e965bb4ad70
make -j"$(nproc)" CROSS_COMPILE64=aarch64-none-linux-gnu- CROSS_COMPILE=arm-none-linux-gnueabihf- PLATFORM=k3-am62x CFG_ARM64_core=y

# Build bl31.bin (from: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/latest/exports/docs/linux/Foundational_Components_ATF.html)
cd "$TFA_DIR"
git checkout 1309c6c805190bd376c0561597653f3f8ecd0f58
make -j"$(nproc)" ARCH=aarch64 CROSS_COMPILE=aarch64-none-linux-gnu- PLAT=k3 TARGET_BOARD=generic SPD=opteed

Then,  build the r5 and a53 binaries:


# Build R5 u-boot. tiboot3.bin
make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O="$R5_BUILDDIR" "${MACHINE}_r5_defconfig" 
make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- O="$R5_BUILDDIR" BINMAN_INDIRS=$TI_LINUX_FW_DIR


# Build A53 u-boot
# To build tispl.bin and u-boot.img. Saved in <path-to-u-boot-a53>/a53. Requires bl31.bin, tee-pager_v2.bin, and ipc_echo_testb_mcu1_0_release_strip.
make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- O="$A53_BUILDDIR" "${MACHINE}_a53_defconfig"
make -j"$(nproc)" "$MV" ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- BL31="$TFA_DIR/build/k3/generic/release/bl31.bin" TEE="$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin" O="$A53_BUILDDIR" BINMAN_INDIRS=$TI_LINUX_FW_DIR

This matches the documentation from what I can see, although I did have to change the path to the BL31 binary to use "generic" instead of "lite" to get the final command to build.

Do you see anything wrong with my process?

Thanks!