I'm trying to build ARM Trusted Firmware and U-Boot for the i.MX8M Plus on a Phytec phyCORE-i.MX 8M Plus/phyBOARD-Pollux dev kit.
When I attempt to run it, I find that execution hangs after the U-Boot SPL executes the bl31 component of ATF.
Console output looks like this (there's no output from bl31, but the SPL works):
U-Boot SPL 2024.10 (Jan 02 2025 - 11:24:26 -0800)
SoM: PCM-070-0F3243I.A6 PCB rev: 3
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout)
Trying to boot from BOOTROM
Boot Stage: Primary boot
image offset 0x8000, pagesize 0x200, ivt offset 0x0
After this point, nothing else happens and the system does not boot.
I've narrowed it down to these lines in Arm Trusted Firmware's include/arch/aarch64/el3_common_macros.S:
/* ---------------------------------------------------------------------
* Set the exception vectors.
* ---------------------------------------------------------------------
*/
adr x0, \_exception_vectors
msr vbar_el3, x0
isb
I tried adding some debugging code just before the msr
instruction, and my code was executed, but code inserted after that line is not executed. I'm at a bit of a loss to explain what is causing this - one idea is that some exception is happening right away when the vectors are set, but how to determine what that is?
I have a pre-built binary blob of bl31.bin, obtained from Phytec's BSP, and it works correctly when inserted into my image. So I believe that my U-Boot SPL and my packaging of the firmware images is correct. The issue only occurs when I build bl31.bin myself. I'm following the build instructions provided by ATF [1] and U-Boot [2] documentation, which seem very straightforward, so it's unclear what could go wrong.
This same issue occurs whether I use the mainline ATF source, or the customized imx-atf from NXP's Github.
Any suggestions for next steps to debug this would be appreciated. Unfortunately I don't currently have a suitable JTAG adapter for this processor.
[1] https://trustedfirmware-a.readthedocs.io/en/latest/plat/imx8m.html#how-to-build [2] https://docs.u-boot.org/en/latest/board/phytec/phycore-imx8mp.html
The issue turned out to be incorrect configuration of the console UART. It seems that if the wrong UART is selected then bl31 gets stuck (and of course no console output appears in this case).
By default, ATF defines IMX_BOOT_UART_BASE=0x30890000
which is the address for UART2. This aligns with the block diagram supplied by Phytec 1, which incorrectly shows the serial debug console wired to UART2. In fact, the console is wired to UART1 (0x30860000).
Setting IMX_BOOT_UART_BASE=0x30860000
enables ATF to access the console and allows the boot process to continue.
Thanks to @Frant for the helpful suggestions - while the issue turned out to be something else, the suggestion to print the contents of x0 on the UART led me down the right path to find the real problem.