Compiling and Running Applications on an ARM Processor

A first step in application development is to cross-compile your application code to run on the target platform. Every platform included in the SDSoC environment includes a pre-built SD card image from which you can boot and run cross-compiled application code. When you do not select any functions for hardware in your project, this pre-built image is used.

When you make code changes, including changes to hardware functions, it is valuable to rerun a software-only compile to verify your changes did not adversely change your program. A software-only compile is much faster than a full system compile, and software-only debugging is a much quicker way to detect logical program errors than hardware/software debugging.

The SDSoC environment includes two distinct toolchains for the ARM® Cortex™-A9 CPU within Zynq®-7000 SoCs.
  1. arm-linux-gnueabihf- for developing Linux applications
  2. arm-none-eabi- for developing standalone ("bare-metal") and FreeRTOS applications
For the ARM Cortex-A53 CPUs within the Zynq UltraScale+™ MPSoCs, the SDSoC environment includes two toolchains:
  • aarch64-linux-gnu- for developing Linux applications
  • aarch64-none-elf- for developing standalone ("bare-metal") applications
For the ARM Cortex-R5 CPU provided in the Zynq UltraScale+ MPSoCs, the following toolchain is include in the SDSoC environment:
  • armr5-none-eabi- for developing standalone ("bare-metal") applications

The underlying GNU toolchain is defined when you select the operating system during project creation. The SDSoC system compilers (sdscc/sds++) automatically invoke the corresponding toolchain when compiling code for the CPUs, including all source files not involved with hardware functions.

The SDSoC system compilers generate an SD card image by default in a project subdirectory named sd_card. For Linux applications, this directory includes the following files:
  • README.TXT- contains brief instructions on how to run the application
  • BOOT.BIN- the boot image contains first stage boot loader (FSBL), boot program (U-Boot), and the FPGA bitstream
  • image.ub- contains the Linux boot image (platforms can be created that includeuImage,devicetree.dtb, anduramdisk.image.gzfiles)
  • .elf- the application binary executable

To run the application, copy the contents ofsd_carddirectory onto an SD card and insert into the target board. Open a serial terminal connection to the target and power up the board (for more information seeIntroduction). Linux boots, automatically logs you in as root, and enters a bash shell. The SD card is mounted at/mnt, and from that directory you can run.elf.

For standalone applications, the ELF, bitstream, and board support package (BSP) are contained withinBOOT.BIN, which automatically runs the application after the system boots.