Intel® Arria® 10 SoC UEFI Boot Loader User Guide

ID 683536
Date 12/15/2017
Public
Document Table of Contents

1.5.4.3. Compile the Bare Metal Application Source Code

This task describes how to modify and build the HelloWorld BareMetal application example that comes with the SoC FPGA EDS 15.0. The HelloWorld application writes an output to the first serial interface.

  1. Open a terminal.
  2. Make a copy of the HelloWorld BareMetal application example code into your working directory. For example, if your working directory is /data/<username>/GSRD, type:
    $ cd /data/<username>/GSRD
    
    $ cp -r ~/altera/15.0/embedded/examples/software/Altera-SoCFPGA-HelloWorld-Baremetal-ARMCC.tar.gz/ .
  3. Extract the compressed HelloWorld project from archive.
    $ tar -xvf Altera-SoCFPGA-HelloWorld-Baremetal-ARMCC.tar.gz
    Figure 39. HelloWorld Application Extraction
  4. When complete, change to the Altera-SoCFPGA-HelloWorld-Baremetal-ARMCC folder and edit the Makefile.
    $ cd Altera-SoCFPGA-HelloWorld-Baremetal-ARMCC
    
    $ gedit Makefile
  5. Change line 6 in the Makefile from BOARD=cycloneV to BOARD=arria10.
    Figure 40. Makefile Edit
  6. Click the Save icon and exit the Makefile.
  7. Open the arria10_scatter.scat file by typing:
    $ gedit arria10_scatter.scat
  8. Modify the arria10_scatter.scat file as shown in the screenshots below to make the Bare Metal application compile for DDR SDRAM instead of on-chip RAM.
    The text that you must change in the arria10_scatter.scat is highlighted in orange:
    Figure 41. Original arria10_scatter.scat File
    The replacement text is shown below:
    Figure 42. Modified arria10_scatter.scat File
  9. Click the Save icon and exit arria10_scatter.scat file.
  10. Open the helloworld.c source file.
    $ gedit hello.c
  11. Edit the file according to your own custom code. Below is an example of a HelloWorld program that allows you to see "Hello World from Baremetal Application!" messages displaying on the board.
    Figure 43. Original hello.c File
    The screenshot below shows the modified hello.c file.
    Figure 44. Modified hello.c File
  12. Click the Save icon and exit the hello.c file.
  13. Type make at the prompt to start the compilation.
  14. Convert the .axf file to .elf file format.
    $ fromelf  --bin Altera-SoCFPGA-HelloWorld-Baremetal-ARMCC.axf --output=bootimage.bin
    Figure 45.  .axf to .elf File Conversion