FreeRTOS support for EL1 NS domU guest

The purpose of this page is to describe the build and execution of the FreeRTOS application as a Xen guest on Zynq UltraScale+ MPSoC using PetaLinux and Xilinx xsct Tools.

Table of Contents

Building the FreeRTOS Application

Steps to build the FreeRTOS applications as Xen guest are as given below,

  • Source Vitis

  • xsct

  • set WORKSPACE .

  • setws -switch $WORKSPACE

  • app create -name <app name> -template {template app name} -proc psu_cortexa53_0 -hw {xsa path} -os freertos10_xilinx

  • bsp config stdin psu_uart_1

  • bsp config stdout psu_uart_1

  • bsp config hypervisor_guest true

  •  Go to application source path and modify the linker script start address to 0x40000000 as shown below,

Note: Xen guest address space always starts from 0x40000000, so updating linker script to load executable sections starting from 0x40000000.

/* Define Memories in the system */ MEMORY { psu_ddr_0_MEM_0 : ORIGIN = 0x40000000, LENGTH = 0x100000 psu_ddr_1_MEM_0 : ORIGIN = 0x800000000, LENGTH = 0x80000000 psu_ocm_ram_0_MEM_0 : ORIGIN = 0xFFFC0000, LENGTH = 0x40000 psu_qspi_linear_0_MEM_0 : ORIGIN = 0xC0000000, LENGTH = 0x20000000 }
  • app build -name <application name>

  • Run command to generate BIN file from executable "aarch64-linux-gnu-objcopy -O binary --gap-fill 0  <elf path> BOOT.BIN"

Configuring Xen

As FreeRTOS uses UART1 for stdout/stdin and TTC0 as tick timer, both of them need to be marked as passthrough in xen-overlay.dtsi. Apart from UART1/TTC0, if application is using any other peripheral device, corresponding nodes also need to be updated with passthrough property.


UART1 and TTC0 device can be passthrough in xen-overlay.dtsi, as shown below.

&uart1 { xen,passthrough = <0x1>; }; &ttc0 { xen,passthrough = <0x1>; };

Config file for FreeRTOS hello world application would look like as given below.


# ===================================================================== # Example FreeRTOS Guest configuration # ===================================================================== # Guest name name = "freertos hello world" # Kernel image to boot kernel = "BOOT.BIN" # Kernel command line options - Allocate 8MB memory = 8 # Number of VCPUS vcpus = 1 # Pin to CPU 0 cpus = [1] irqs = [ 68, 69, 70, 54 ] iomem = [ "0xff010,1", "0xff110,1" ]

Note- ‘irq' parameter in config file specifies TTC0 (68-70) and UART1 interrupt ID’s , for specific peripheral in Zynq UltraScale+ MPSoC interrupt id can be found in “System Interrupts“ section of TRM

Executing the Application

Procedure is similar to baremetal domU guest as explained in .


© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy