In this demo we shall discuss how to test the FreeRTOS application running on the Zynq QEMU
It is assumed that the user has Petalinux 2017.4 installed.

Step 1: Create the Hardware:

Here, Vivado 2017.4 was used targeting the ZC702 board. I added a Block Design (BD), added the Zynq PS and used Block Automation.
I generated the Output Products and exported to SDK to create the HDF file.

Step 2: Create the DTB:

First, we need to create the DTS. Then compile this to create the DTB
launch HSI, source the TCL file below and run the command gen_dtb <HDF FILE>.hdf

proc gen_dts {hdf} {
   open_hw_design $hdf
   set_repo_path ./repo
   create_sw_design device-tree -os device_tree -proc ps7_cortexa9_0
   generate_target -dir my_dts
Use the command below to build the DTB:
  • dtc -I dts -O dtb -o my_dts/system.dtb my_dts/system.dts

Step 3: Create the SDK Application:

Create the FreeRTOS Hello World:

As a sanity check, I ran this on the board:
Right Click on the BSP in project explorer, and select Board Support Package Settings, and set the use_freertos_asserts to False:

Step 4: Launch QEMU:

The QEMU command is seen here:
<path to Petalinux>/tools/linux-i386/petalinux/bin/qemu-system-aarch64 -M arm-generic-fdt-7series -machine linux=on -serial /dev/null -serial mon:stdio -display none -dtb my_dts/system.dtb -gdb tcp::9000 -S
Launch XSCT from SDK (Xilinx -> XSCT Console), and use the commands below:
  • gdbremote connect localhost:9000
  • connect -l
  • targets X
    • Where X is the first CPU. Use the targets command to see this
  • dow FreeRTOS.elf
In the Target connections, create a new Hardware Server connection using the port connection obtain by the connect -l:
Right Click on the application, and select Debug As -> Debug Configurations. In the Targets setup, select the Debug Type as Attach to Running Target.
User, can debug as normal… For example, if I run I would see the same expected results as when I ran on HW:

Related Links