I have a custom board of AGFB027R25AR0. I want to bring it up, now I follow the article below and encounter the following problems:
#keywords. tags
agilex, fpga, u-boot, spl
Env setup
export CROSS_COMPILE=aarch64-none-linux-gnu- KCFLAGS=-DDEBUG
export ARCH=arm
export TOP_FOLDER=pwd
Build Arm Trusted Firmware
cd $TOP_FOLDER
rm -rf arm-trusted-firmware
git clone GitHub - altera-opensource/arm-trusted-firmware: Official Intel SOCFPGA Arm-TF repository. Note: (1) A "RC" labeled branch is for internal active development use and customer early access without official customer support. (2) Latest stable branch (no RC labeled) is strongly recommended for development and production use outside of Intel. (3) See README for Quartus and Device support.
cd arm-trusted-firmware
comment out next line to use the latest ATF branch
git checkout -b socfpga_v2.10.0 origin/socfpga_v2.10.0
make bl31 PLAT=agilex DEPRECATED=1
cd …
Build U-Boot
rm -rf u-boot-socfpga
git clone GitHub - altera-opensource/u-boot-socfpga: Official Intel SOCFPGA U-Boot repository. Note: (1) A "RC" labeled branch is for internal active development use and customer early access without official customer support. (2) Latest stable branch (no RC labeled) is strongly recommended for development and production use outside of Intel. (3) See doc/README.socfpga for Quartus and Device support.
cd u-boot-socfpga
comment out next line to use the latest default branch
git checkout -b socfpga_v2022.10 -t origin/socfpga_v2022.10
enable dwarf4 debug info, for compatibility with arm ds
sed -i ‘s/PLATFORM_CPPFLAGS += -D__ARM__/PLATFORM_CPPFLAGS += -D__ARM__ -gdwarf-4/g’ arch/arm/config.mk
use ‘Image’ for kernel image instead of ‘kernel.itb’
sed -i ‘s/kernel.itb/Image/g’ include/configs/socfpga_soc64_common.h
only boot from SD, do not try QSPI and NAND
sed -i ‘s/u-boot,spl-boot-order.*/u-boot,spl-boot-order = &flash0;/g’ arch/arm/dts/socfpga_agilex_socdk-u-boot.dtsi
disable NAND in the device tree
sed -i ‘/&nand {/!b;n;c\tstatus = “disabled”;’ arch/arm/dts/socfpga_agilex_socdk-u-boot.dtsi
remove the NAND configuration from device tree
sed -i ‘/images/,/binman/{/binman/!d}’ arch/arm/dts/socfpga_agilex_socdk-u-boot.dtsi
link to atf
ln -s $TOP_FOLDER/arm-trusted-firmware/build/agilex/release/bl31.bin .
Create configuration custom file.
cat << EOF > config-fragment-agilex
- Disable NAND/UBI related settings from defconfig.
CONFIG_NAND_BOOT=n
CONFIG_SPL_NAND_SUPPORT=n
CONFIG_CMD_NAND_TRIMFFS=n
CONFIG_CMD_NAND_LOCK_UNLOCK=n
CONFIG_NAND_DENALI_DT=n
CONFIG_SYS_NAND_U_BOOT_LOCATIONS=n
CONFIG_SPL_NAND_FRAMEWORK=n
CONFIG_CMD_NAND=n
CONFIG_MTD_RAW_NAND=n
CONFIG_CMD_UBI=n
CONFIG_CMD_UBIFS=n
CONFIG_MTD_UBI=n
CONFIG_ENV_IS_IN_UBI=n
CONFIG_UBI_SILENCE_MSG=n
CONFIG_UBIFS_SILENCE_MSG=n
- Disable distroboot and use specific boot command.
CONFIG_DISTRO_DEFAULTS=n
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT_HUSH_PS2="> "
Enable more QSPI flash manufacturers
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SPI_FLASH_ISSI=y
EOF
change ddr bank number to 1
vi configs/socfpga_agilex_defconfig
CONFIG_NR_DRAM_BANKS 1
change dtsi memory node to 1GB
vi arch/arm/dts/socfpga_agilex_socdk-u-boot.dtsi
memory {
/* 1GB */
reg = <0 0x00000000 0 0x40000000>;
};
build U-Boot
make clean && make mrproper
make socfpga_agilex_defconfig
Use created custom configuration file to merge with the default configuration obtained in .config file.
./scripts/kconfig/merge_config.sh -O ./ ./.config ./config-fragment-agilex
make -j 64
cd …
#package and program
quartus_pfg -c intel_prj.sof output_prj.sof -o hps_path=u-boot-spl-dtb.hex
quartus_pgm -c 1 -m jtag -o “p;output_prj.sof@2”
#terminal console output
“pte not found”, and then hang…
Version Info
:
- Quartus: 22.04
- u-boot: socfpga_v2022.10
- ATF: socfpga_v2.10.0
- Board: boot from QSPI(256M GIGADEVICE), no emmc, 1GB SDRAM(I don’t know why it can’t read 3GB SDRAM??? If I change it to 3GB in dtb, I will failed in sdram_mmr_init_full->
gd->ram_size > hw_size
->‘DDR: Error: DRAM size from device tree is greater than hardware size.’) - Memory Layout: follow the attached.