Compiling and Running Applications

This appendix contains the following topics:

Note: When you make code changes, including changes to hardware functions, it is valuable to rerun a software-only compile to verify that your changes did not adversely change your program. A software-only compile is much faster than a full-system compile.

Compiling and Running Applications on a MicroBlaze Processor

A MicroBlaze™ platform in the SDSoC™ environment is a standard MicroBlaze processor system built using the Vivado® tools and SDK that must be a self-contained system with a local memory bus (LMB) memory, MicroBlaze Debug Module (MDM), UART, and AXI timer.

The SDSoC environment includes the standard SDK toolchain for MicroBlaze processors, including microblaze-xilinx-elf for developing standalone ("bare-metal") and FreeRTOS applications.

By default, the SDSoC system compilers do not generate an SD card image for projects targeting a MicroBlaze platform. You can package the bitstream and corresponding ELF executable as needed for your application.

To run an application, the bitstream must be programmed onto the device before the ELF can be downloaded to the MicroBlaze core. The SDSoC environment includes Vivado tools and SDK facilities to create MCS files, insert an ELF file into the bitstream, and boot the system from an SD card.

Compiling and Running Applications on an Arm Processor

Note: When you make code changes, including changes to hardware functions, it is valuable to rerun a software-only compile to verify that 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 and software debugging.

The SDSoC environment includes two distinct toolchains for the Arm® Cortex™-A9 CPU within Zynq®-7000 SoC.

arm-linux-gnueabihf
For developing Linux applications
arm-none-eabi
For developing standalone (bare-metal) and FreeRTOS applications

For Arm Cortex-A53 CPUs within the Zynq devices, 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+™ MPSoC, the toolchain included in the SDSoC environment is the armr5-none-eabi. This develops 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++ referred to as 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 sub-directory 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
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 include the following:
  • uImage
  • devicetree.dtb
  • uramdisk.image.gz files
<app>.elf
Application binary executable

To run the application:

  1. Copy the contents of sd_card directory onto an SD card and insert into the target board.
  2. Open a serial terminal connection to the target and power up the board.

    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 <app>.elf.