Forum Discussion
Agilex5 HPS running bare-metal code does not access FPGA fabric
- 6 months ago
Hi,
I do not have time to look into it now, and will be out Monday But if you want to use FreeRTOS, see below the instructions on how to make it work there:# install cmake and ninja build tools sudo apt-get install cmake ninja-build # create a top folder sudo rm -rf artifacts && mkdir artifacts && cd artifacts export TOP_FOLDER=`pwd` # add quartus tool to path export QUARTUS_ROOTDIR=~/altera_pro/25.3.1/quartus/ export PATH=$QUARTUS_ROOTDIR/bin:$QUARTUS_ROOTDIR/linux64:$QUARTUS_ROOTDIR/../qsys/bin:$PATH # download toolchain and add to path cd $TOP_FOLDER wget https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/arm-gnu-toolchain-14.3.rel1-x86_64-aarch64-none-elf.tar.xz tar xf arm-gnu-toolchain-14.3.rel1-x86_64-aarch64-none-elf.tar.xz rm -f arm-gnu-toolchain-14.3.rel1-x86_64-aarch64-none-elf.tar.xz export PATH=`pwd`/arm-gnu-toolchain-14.3.rel1-x86_64-aarch64-none-elf/bin/:$PATH # get freertos cd $TOP_FOLDER git clone https://github.com/Ignitarium-Technology/freertos-socfpga cd freertos-socfpga git checkout -b test v25.4 git submodule update --init --recursive # get sof file cd $TOP_FOLDER wget -O ghrd_a5ed065bb32ae6sr0.sof https://releases.rocketboards.org/2026.01/gsrd/agilex5_dk_a5e065bb32aes1_gsrd.baseline-a55/baseline_a55_hps.sof # build the bridge example cd $TOP_FOLDER/freertos-socfpga/samples/bridge cmake -B build . -G Ninja -DSOF_PATH=$TOP_FOLDER/ghrd_a5ed065bb32ae6sr0.sof cmake --build build --parallel -t sd-imageOnce you build it,you will get the following files:
- JIC QSPI Image: $TOP_FOLDER/freertos-socfpga/samples/bridge/build/sd_atf_binaries/qspi_image.jic
- SD Card Image: $TOP_FOLDER/freertos-socfpga/samples/bridge/build/sd_atf_binaries/sd.img
Write the above images and boot the board. You will see this:
... NOTICE: DDR: Reset type is 'Power-On' NOTICE: IOSSM: Calibration success status check... NOTICE: IOSSM: All EMIF instances within the IO96 have calibrated successfully! NOTICE: DDR: Calibration success NOTICE: DDR: ECC is enabled NOTICE: IOSSM: Memory initialized successfully on IO96B NOTICE: ###DDR:init success### NOTICE: DFI interface selected successfully to SDEMMC NOTICE: SOCFPGA: SDMMC boot NOTICE: BL2: v2.13.0(release): NOTICE: BL2: Built : 20:29:07, Feb 13 2026 NOTICE: BL2: Booting BL31 NOTICE: SOCFPGA: Boot Core = 0 NOTICE: SOCFPGA: CPU ID = 0 NOTICE: SOCFPGA: Setting CLUSTERECTRL_EL1 NOTICE: BL31: v2.13.0(release): NOTICE: BL31: Built : 20:29:07, Feb 13 2026 Starting the bridge sample application Read 217000 bytes from sdmmc drive successfully Bitstream data send successfully bitstream configuration successful Bitstream loaded successfully Starting h2f sample Write data buffer 1 : 1111111111111111 buffer 2 : 2222222222222222 Writing data to memory 0x40000000 Writing data to memory 0x7ffffff8 Reading data from memory 0x40000000 Reading data from memory 0x7ffffff8 Read data buffer 1 : 1111111111111111 buffer 2 : 2222222222222222 Validating the buffers Buffer validation successful HPS2FPGA sample completed successfully Completed h2f sample Starting lwh2f sample SYSID_ID : 1 WRITE DATA write buffer : 11111111 READ DATA read buffer : 11111111 LWHPS2FPGA sample completed successfully Completed lwh2f sample Bridge sample completedI actually prefer using an RTOS versus pure bare-metal, as it offers a lot of convenience. If you do not need the features, you can just put all your code in a single task (like the above example) and ignore them.
Note the above example uses HPS First (the default for the GSRD) and it configures the fabric with the file core.rbf which it builds and puts in the SD card image. It also uses DDR instead of OCRAM.
Regards,
Radu
Hi Nhadzic,
Can you share more on why 1-task FreeRTOS doesn't meet your needs here but Bare Metal does?
FreeRTOS is a very thin scheduler, and when run with only 1 task is near identical to Bare Metal.
Thanks.
I admit I may be going about this the wrong way.
My goal is to be able to remotely update both the FPGA image and the test code through JTAG using quartus_pgm. So far, all OS examples I have seen require the sequence of "DIP switch to JTAG, burn the JIC file, DIP switch to AS4" + possible SD card burn. I've done that several times as I went through tutorials and it felt like an overkill for what I am trying to do. So through experimentation I was able to take the OCRAM "hello world" example, purely load it through the JTAG and execute the code. But the problem is I can't seem to access FPGA bridges with this method.
Is there a way to update both the image and the FreeRTOS code through JTAG (or any other fully remote method). If so, then I will gladly switch to FreeRTOS since it will likely help with other setup as well.
Thanks in advance.
- zamroodh6 months ago
New Contributor
Hi nhadzic ,
You could upload the JIC to the system with one command.
Run jtagconfig command, you will get something similar to the following$ jtagconfig 1) Agilex 5E065B Premium DK [1-10.1] 4BA06477 ARM_CORESIGHT_SOC_600 0364F0DD A5E(C065BB32AR0|D065BB32AR0) 020D10DD VTAP10here we can see that A5E is at index 2, now with that info we could directly load the JIC to the device with the following command
$ quartus_pgm -c 1 -m jtag -o "pvi;qspi_image.jic@2"this will upload qspi_image.jic to the device and it is expected in the current folder.
You can refer the steps RaduB_Altera posted to build FreeRTOS samples which will produce the JIC images for you if you are going that route.
PS:
Assuming that you are using Quartus version 25.3- nhadzic6 months ago
New Contributor
Thanks for the reply.
I am familiar with the QSPI burn process, however, I thought I needed to set the SW27 switch back to AS4 in order to boot the new image. That would mean I still need to be physically in the lab in order to update the image so the process is not completely remote.
Am I misunderstanding the process?
- zamroodh6 months ago
New Contributor
With above steps and the switchs in default position, we are able to program the device. But we need to perform a powercycle after the programming.
We use a network enabled power controller to toggle the device power.
- zamroodh6 months ago
New Contributor