Forum Discussion
Hello,
The following page shows you how to create your first Bare-Metal application and boot it from the SD card without any issue:
What you want is to copy the .bin file to the Fat partition of the SD card (see tab 3 Step 6), then you can load the bare metal application into memory from the FAT partition (See tab 3 step 10). Now you can execute the bare metal program as shown in the next step 11.
Note: The Cyclone V requires a pre-loader ot operate
This file shows how to get a Bare-Metal design running on CV/AV devices
https://github.com/cambridgehackers/Altera-SoCFPGA-HardwareLib-MPL/blob/master/README.txt
********************************
********************************
********************************
Building and Booting From SDMMC:
(1) Ensure the preloader header file '[SoCFPGA]/software/preloader/uboot-socfpga/board/altera/socfpga/build.h'
must match the boot selection below. For SDMMC the CONFIG_PRELOADER_BOOT_FROM_SDMMC must
be set to 1 in 'build.h'.
(2) Ensure the preloader header file '[SoCFPGA]/software/preloader/uboot-socfpga/board/altera/socfpga/sdram/sequencer_defines.h'
is either configured for Arria V SoC (set ARRIAV to 1) or Cyclone V SoC (set CYCLONEV to 1).
(3) Build mpl_A5_s-mkpimage.bin or mpl_C5_s-mkpimage.bin. In the following example
instructions will be given for the C5 variation.
(3.1) In DS-5, Clean Project; In Embedded Command Shell or Linux, type make clean.
(3.2) set correct values in <config.mk>:
BOOT_SOURCE ?= QSPI ( SDMMC = Boot from SDMMC, QSPI = Boot from QSPI )
DEVICE ?= C5 ( C5 = build code for C5, A5 = build code for A5 )
COMPILER ?= GNU ( GNU = GCC toolchain, ARM = ARM toolchain )
HANDOFF_BASE ?= [Root directory of FPGA project]
HANDOFF_SDRAM_DIR ?= [Quartus generated files with SDRAM data directory]
HANDOFF_DIR ?= [Preloader generated files directory]
Then in DS-5 click Build Project; in Embedded Command Shell or Linux, type make.
The above gives you a suitable MPL image for the BootROM for booting from SDMMC.
(4) Build your application binary and process it with the mkimage tool to create its image.
Please consult SoCEDS documentation for more information on this step. For the purposes of
this example, application.img will denote the application image.
(5) Open a SoCEDS Command Shell.
Follow the following commands to flash images:
(5.1) Plug in your SD card and determine which partition it is.
Linux: Type "dmesg | tail":
[2736576.121602] sd 15:0:0:0: [sdb] Attached SCSI removable disk
Windows: A new drive letter should be created
(5.2) Flash the MPL image to sdb3 using dd command:
Linux:
>>> sudo alt-boot-disk-util -p mpl_C5_s-mkpimage.bin -a write -d /dev/sdb
Windows: (assuming drive E was assigned)
>>> alt-boot-disk-util.exe -p mpl_C5_s-mkpimage.bin -a write -d e
(5.3) Flash the application.img also to sdb3 after the mpl_C5_s.bin
Linux:
>>> sudo alt-boot-disk-util -b application.img -a write -d /dev/sdb
Windows: (assuming drive E was assigned)
>>> alt-boot-disk-util.exe -b application.img -a write -d e
(6) Adjust the BOOTSEL Jumpers to SDMMC. This is as follows:
-- BOOTSEL0: . [. .]
-- BOOTSEL1: . [. .]
-- BOOTSEL2: [. .] .
(6) Insert the SDMMC card into the DevKit and power up the board.
*************************************