De1-SoC: Running bare-metal from SD Card

Hi Guys, I am stuck in running a bare-metal program from SD Card. I would highly appreciate if somebody could suggest whats going wrong.
Here’s what I’ve done sofar:

  1. Created basic HPS design with UART and SDMMC peripherals enabled but I have also tried with De1-SoC Computer system that’s shipped as an example design in Intel SOC FPGA program.

  2. Built hardware design to .SOF without error and converted SOF to RBF so that it can be loaded by pre-loader

  3. Using the ‘hps_isw_handoff’, created the spl_bsp with bsp-editor and in the settings, I checked “boot from SDMMC”.

  4. Compiled preloader using ‘make’ which generated preloader-mkpimage.bin without error

  5. Ran alt-boot-disk-util to update pre-loader image on special partition of SD card ( Type ‘a2’)

  6. Created C LED blinking eclipse project in SoC EDS application. Verified the working of the program in Bare-metal debugger. Works fine using debugger script and BTW preloader is also working while showing all the preloader booting messages on my serial terminal.

  7. Compiled example C project to .AXF with no errors using baremetal compiler. Then convert it to .bin using fromelf command and then convert it in .img with mkimage tool.
    (mkimage -A arm -O u-boot -T standalone -C none -a 0x02100000 -e 0 -n “baremetal
    image” -d blink.bin blink.img) [[Am I using the correct load address (hex)??]]

  8. Copied BIN file and .RBF file to SD card FAT partition and inserted SD card into board

  9. Load .sof file on De1-SoC board (because .rbf file was not able to program FPGA by the preloader )

  10. Reset HPS by pressing reset button

Pre-loader uboot output is as follows:

U-Boot SPL 2013.01.01 (Aug 27 2019 - 08:37:10)

And it does nothing…

Am I missing something very basic? It’s strange that I could not found official documentation on it.

Best regards,
Adeel

Complete preloader output is as follows when I used u-boot and script but it doesn’t load my bare-metal program correctly;

U-Boot SPL 2013.01.01 (Nov 13 2019 - 12:02:25)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 925 MHz
CLOCK: DDR clock 400 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 370000 KHz
RESET: COLD
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 1024 MiB
ALTERA DWMMC: 0
reading u-boot.img
reading u-boot.img

U-Boot 2013.01.01 (Nov 12 2019 - 15:37:54)

CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone V Board
I2C: ready
DRAM: 1 GiB
MMC: ALTERA DWMMC: 0
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Skipped ethaddr assignment due to invalid EMAC address in EEPROM
Net: mii0
Warning: failed to set MAC address

Hit any key to stop autoboot: 0
reading u-boot.scr
230 bytes read in 5 ms (44.9 KiB/s)

Executing script at 02000000

** No boot file defined **
’ - try 'help’d ’
altera_load: Failed with error code -4
’ - try 'help’d ’

Starting application at 0x3FF795A4 …

Application terminated, rc = 0x0

’ - try 'help’d ’
reading baremetalapp.bin
3112 bytes read in 8 ms (379.9 KiB/s)
’ - try 'help’d ’

Starting application at 0x00100040 …