Page MenuHomePhabricator

TF-A build fails on Arch Linux in include/lib/mmio.h
Open, Needs TriagePublic

Description

flash-image.bin build for MACCHIATObin Single Shot, on Arch Linux x86_64, fails in include/lib/mmio.h.

To re-produce:

  • pacman -Sy aarch64-linux-gnu-gcc - currently it's aarch64-linux-gnu-gcc (GCC) 12.2.0.
  • export CROSS_COMPILE=aarch64-linux-gnu-
  • git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
  • Clone the binaries-marvell and mv-ddr-marvell Git repos alongside the trusted-firmware-a, and check out revisions as recommeded in TF-A build instructions for Armada80x0.
  • Build u-boot.bin:
    • git clone https://source.denx.de/u-boot/u-boot.git alongside the binaries-marvell and mv-ddr-marvell repos.
    • cd u-boot
    • git checkout v2023.01 - the latest release.
    • make mvebu_mcbin-88f8040_defconfig
    • Change CONFIG_DEFAULT_DEVICE_TREE to "armada-8040-mcbin-singleshot" (inspired by this SolidRun doc).
    • Add arch/arm/dts/armada-8040-mcbin-singleshot.dts. Can be obtained from the latest Marvell kernel sources.
    • make, built fine, cool.
  • Trying to build TF-A:
    • cd ../trusted-firmware-a/
    • git checkout v2.8.0 - the latest release, as per changelog.
    • make PLAT=a80x0_mcbin MV_DDR_PATH=../mv-ddr-marvell SCP_BL2=../binaries-marvell/mrvl_scp_bl2.img BL33=../u-boot/u-boot.bin mrvl_flash - error:
\nBuilding DRAM driver
  CC      ddr3_training_leveling.c
In file included from mv_ddr_atf_wrapper.h:232,
                 from ddr3_init.h:105,
                 from ddr3_training_leveling.c:98:
In function 'mmio_read_32',
    inlined from 'mv_ddr_rl_dqs_burst' at ddr3_training_leveling.c:1980:5:
/home/dane/devel/Marvell_Armada_8040_u-boot/trusted-firmware-a/include/lib/mmio.h:46:16: error: array subscript 0 is outside array bounds of 'volatile uint32_t[0]' {aka 'volatile unsigned int[]'} [-Werror=array-bounds]
   46 |         return *(volatile uint32_t*)addr;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
In function 'mmio_read_64',
    inlined from 'mv_ddr_rl_dqs_burst' at ddr3_training_leveling.c:1978:5:
/home/dane/devel/Marvell_Armada_8040_u-boot/trusted-firmware-a/include/lib/mmio.h:56:16: error: array subscript 0 is outside array bounds of 'volatile uint64_t[0]' {aka 'volatile long unsigned int[]'} [-Werror=array-bounds]
   56 |         return *(volatile uint64_t*)addr;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:473: /home/dane/devel/Marvell_Armada_8040_u-boot/trusted-firmware-a/build/a80x0_mcbin/release/ble/ddr3_training_leveling.o] Error 1
make: *** [plat/marvell/armada/a8k/common/ble/ble.mk:35: /home/dane/devel/Marvell_Armada_8040_u-boot/trusted-firmware-a/build/a80x0_mcbin/release/ble/mv_ddr_lib.a] Error 2

master TF-A branch fails to build as well, with the same error.

Event Timeline

czka created this task.Sun, Feb 19, 2:32 PM
czka updated the task description. (Show Details)Sun, Feb 19, 3:00 PM
czka added a comment.Sun, Feb 19, 3:34 PM

https://developer.trustedfirmware.org/T984 suggests it's a problem with GCC, which was supposed to be fixed in GCC 12.1, but my GCC version is 12.2.0, and I can also reproduce those array subscript 0 is outside array bounds build errors in include/lib/mmio.h using the latest Arm GNU Toolchain from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads, which is based on GCC 12.2:

$ aarch64-none-elf-gcc --version
aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 2022120
czka added a comment.Sun, Feb 19, 4:05 PM

Only know I found https://trustedfirmware-a.readthedocs.io/en/latest/getting_started/prerequisites.html.

So with arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-elf the build went fine.
It might make sense to close this ticket then.