Forum Discussion
Hi Akash
Below is the step. the hwlib need to clone in order to use it compiler.
git clone https://github.com/altera-opensource/intel-socfpga-hwlib
cd intel-socfpga-hwlib/tools
./install_linaro.sh
./generate_doxygen.sh
export PATH=`pwd`/gcc/bin:$PATH
Below is complete step from hardware build until uboot and create qspi
########################################
# create top folder
########################################
rm -rf artifacts
mkdir artifacts
cd artifacts
export TOP_FOLDER=`pwd`
########################################
# compile hardware design
########################################
cd $TOP_FOLDER
rm -rf ghrd-socfpga-QPDS-22.3pro-21.1std QPDS-22.3pro-21.1std.zip cv_soc_devkit_ghrd
wget https://github.com/altera-opensource/ghrd-socfpga/archive/refs/tags/QPDS-22.3pro-21.1std.zip
unzip QPDS-22.3pro-21.1std.zip
mv ghrd-socfpga-QPDS-22.3pro-21.1std/cv_soc_devkit_ghrd .
rm -rf ghrd-socfpga-QPDS-22.3pro-21.1std QPDS-22.3pro-21.1std.zip
cd cv_soc_devkit_ghrd
rm -rf software
~/intelFPGA/21.1/nios2eds/nios2_command_shell.sh \
make generate_from_tcl
~/intelFPGA/21.1/nios2eds/nios2_command_shell.sh \
make rbf
########################################
# get hwlibs, install toolchain
########################################
cd $TOP_FOLDER
git clone https://github.com/altera-opensource/intel-socfpga-hwlib
cd intel-socfpga-hwlib/tools
./install_linaro.sh
./generate_doxygen.sh
export PATH=`pwd`/gcc/bin:$PATH
########################################
# build u-boot
########################################
cd $TOP_FOLDER/cv_soc_devkit_ghrd
mkdir -p software/bootloader
~/intelFPGA/20.1/embedded/embedded_command_shell.sh \
bsp-create-settings \
--type spl \
--bsp-dir software/bootloader \
--preloader-settings-dir "hps_isw_handoff/soc_system_hps_0" \
--settings software/bootloader/settings.bsp
cd software/bootloader
rm -rf u-boot-socfpga
git clone https://github.com/altera-opensource/u-boot-socfpga
cd u-boot-socfpga
# comment out next line to use the latest U-Boot branch
git checkout -b test-bootloader -t origin/socfpga_v2022.07
./arch/arm/mach-socfpga/qts-filter.sh cyclone5 ../../../ ../ ./board/altera/cyclone5-socdk/qts/
export CROSS_COMPILE=arm-eabi-
make socfpga_cyclone5_qspi_defconfig
make -j 48
########################################
# build application
########################################
cd $TOP_FOLDER
cd intel-socfpga-hwlib/examples/CVAV/Altera-SoCFPGA-HardwareLib-Timer-CV-GNU/
# build once to bring hwlibs code
make SEMIHOSTED=0 MEMORY=ddr
# cleanmak
make clean
# change hwlibs link address to match what U-Boot wants
sed -i 's/0x00100040/0x01000040/g' hwlib/src/linkerscripts/cvav-ddr.ld
# move stack out of the way just in case
sed -i 's/0x80000/0x00200000/g' hwlib/src/linkerscripts/cvav-ddr.ld
# build again with the new address
make SEMIHOSTED=0 MEMORY=ddr
# create binary file
arm-eabi-objcopy -O binary application.elf application.bin
# create img file
$TOP_FOLDER/cv_soc_devkit_ghrd/software/bootloader/u-boot-socfpga/tools/
mkimage -A arm -T standalone -C none -a 0x01000040 -e 0x01000040 -n "bare-metal image" -d application.bin application.img
########################################
# build QSPI image
########################################
cd $TOP_FOLDER
cat cv_soc_devkit_ghrd/software/bootloader/u-boot-socfpga/spl/u-boot-splx4.sfp \
intel-socfpga-hwlib/examples/CVAV/Altera-SoCFPGA-HardwareLib-Timer-CV-GNU/application.img \
> qspi-image.bin
Hi.
I followed the solution step by step with Quartus 20.1.
I got an error while executing "arm-eabi-objcopy -O binary application.elf application.bin". So I executed "arm-eabi-objcopy -O binary application.axf application.bin" instead as there was an axf file present. Finally, I was able to generate application.bin and application.img.
QSPI part did not work and threw "cat: qspi-image.bin: No such file or directory".
Now I have u-boot.img, application.img and soc_system.rbf. Should I put these files on the sdcard as (Embedded Linux Beginners Guide | Documentation | RocketBoards.org) had suggested? Then, u-boot.scr still needs to generated.
Your earlier solution suggested using "gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu" with bitbake which is a different way. In case, you are following any approach, please elaborate.