描述
How can I debug a Linux application running on a Zynq UltraScale QEMU?
解决方案
This Answer Record details all the steps needed to achieve this.
Note: This Answer Record assumes that PetaLinux is pre-installed.
- Download the 2016.x ZCU102 BSP here
- Use the Petalinux commands below to build the Linux image:
- petalinux-create -t project -s Xilinx-ZCU102-v2016.1-final.bsp
- cd Xilinx-ZCU102-v2016.1-final
- petalinux-config -c rootfs
- Select Filesystem Packages -> base -> tcf-agent -> [*] tcf-agent
- petalinux-build
- Launch QEMU using the command below:
- petalinux-boot --qemu --kernel --qemu-args "-redir tcp:1540:10.0.2.15:1534"
- Launch SDK, and create a new Linux application
- Select File -> New -> Application Project
- OS Platform: Linux
- Processor Type: psu_cortexa53
- Click Next, Select the Linux Hello World template and then Finish.
- Under the target connections, select Linux TCF Agent -> Linux Agent:
- Target Name: Linux Agent
- Host: This should be the same network as the one running QEMU. Run ipconfig to find this IP address.
- Port: 1540
- Next, right click on the Linux application and select Debug As -> Debug Configurations.
Double click on the Xilinx C/C++ application (System Debugger) to create a new debug configuration. - Under the Target Setup tab, set the following:
- Debug Type: Linux Application Debug
- Connection: Linux Agent
- On the Application tab:
- Under Project Name, browse to the Linux application created above
- Under the Local File path, browse to the ELF of the Linux application created above.
- Set the Remote File path to /tmp/test.elf
- Select Apply, and debug to continue.