Software application of ZYNQ Foundation-->linux

Source: Internet
Author: User
Tags gz file using git vivado

Operating system: Ubuntu 16.04 LTS

Application software: Vivado 2016.2 + petalinux 2016.2

Refer to the Official Application manual: Ug1144-petalinux-tools-reference-guide.pdf

1. Software Installation 1.1 Basic software Installation

Before installing the application software, you need to install the necessary basic software for the ZYNQ development environment, which is clearly indicated on page 11 of the manual.

Note: The TFTP software uses TFTP-HPA as follows:

#1, installing sudo apt-get install TFTP-HPA tftpd-hpa#2, setting up the directory sudo mkdir/tftpbootsudo chmod 777/tftpboot#3, configuring sudo vim/etc/default /tftpd-hpa# Modify the following two items tftp_directory= "/tftpboot" tftp_options= "-l-c-S" #4, start sudo service tftpd-hpa restart

Based on this, the Java Development environment and support libraries need to be installed in order to start eclipse:

sudo apt-get install openjdk-8-jresudo apt-get install lib32z1sudo apt-get install lib32ncurses5sudo apt-get Install Lib32 bz2-1.0 (official said to install, but actually did not find this library) sudo apt-get install lib32stdc++6
1.2 Installation Configuration

After completing the 1.1 steps, you need to open the TFTP server and later can update the code directly via Petalinux to Zynq

1.3 Installing the Application software

Refer to the Official Handbook

Note: Open all readable writable executable permissions for the installation directory!

1.4 Application software Configuration

In order to successfully launch Vivado, SDK, and Petalinux, the following steps are required:

1. Increase in/opt/xilinx/sdk/2016.2/.settings64-software_development_kit__sdk_.sh

Export swt_gtk3=0

2. Create a new file in the home directory:. Bash_aliases,

When the console header is launched, Bash automatically calls the. bash_aliases content. Make the following settings:

echo <----Auto-start settings----> Echo 1. Set the shortcut command "############################ #重命名 ########################## #echo" 2. Set ZYNQ SDK Environment "############################ #自动运行 ###########################
Export Extern_compiler=/opt/xilinx/petalinux/petalinux-v2016.2-final/tools/linux-i386/gcc-arm-linux-gnueabi/bin /source/opt/xilinx/petalinux/petalinux-v2016.2-final/settings.shsource/opt/xilinx/vivado/2016.2/settings64.sh

3, install the application software directory many of the default requires root permissions, if you are using ordinary users to operate the application software, you need to add permissions for many directories.

4. Fix awk Error

The official bug report has the following description:

If you aren't using the AXI BFM IP, you can remove the Ld_library_path setting from settings64.sh

awk errors can be fixed by masking the assignment of "Ld_library_path" in settings64-vivado.sh.

5. Link to new library

Some libraries in the official package are obsolete and need to be re-linked to the system's library.

#先做更新sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get updatesudo apt-get upgradesudo apt-get dist-upgrade# then link cd/opt/xilinx/sdk/2016.2/lib/lnx64.o/mv libstdc++.so.6 libstdc++.so.6.old ln-s/usr/lib/x86_64- Linux-gnu/libstdc++.so.6 libstdc++.so.6

2. Generate embedded file 2.1 Generate hardware description file

Based on system requirements, use Vivado to generate a hardware description file and launch the SDK to generate the hardware description folder.

Note: Under Linux, you need to actively install the driver in the <xilnix installation directory >/vivado/2016.2/data/xicom/cable_drivers/lin64/install_scripts/install_ drivers/

Run:

sudo install_drivers

Restart your computer when you are finished.

2.2 Build Petalinux project based on existing BSP
#生成工程bsppetalinux-create-t project-s <path-to-bsp><path-to-bsp>= petalinux structure of the BSP folder

about version control:

You need to ignore three folders in the project directory using git:

1,. petalinux

2. Build

3, Images

2.3 New Petalinux Project from scratch

Use the command in the Petalinux project directory:

Petalinux-create--type Project--template <CPU_TYPE>--name <project_name>cpu_type = ZYNQMP or Zynq or Microbla Zeproject_name is the new project name

Petalinux-config--get-hw-description=<path-to-directory-which-contains-hardware-description-file> Path-to-directory-which-contains-hardware-description-file: The folder that contains the. HDF

In this procedure, the configuration interface is called automatically. After the configuration is complete, generate fsbl,u-boot, kernel, device tree, root file system, etc.

Problem:

During the generation of the device tree, a warning appears:

WARNING:ps7_ethernet_0:No Reset found

WARNING:ps7_usb_0:No Reset found

This warning will cause the Ethernet port to not be used!

Solve:

2.4 Compiling a Build image file

Use the command in the Petalinux project directory:

Petalinux-build-x Distcleanlang=c Petalinux-build

Generate Uimage file using commands

Petalinux-package--image-c kernel--format uimage
2.5 Generating a startup file

Use the command in the Petalinux project directory:

Petalinux-package--boot--FSBL <fsbl image>--fpga <fpga bitstream>--u-bootfsbl image:fsbl file location, located in./images /LINUXFPGA bitstream:bit: File, located in./images/linux

After the command is executed, the Boot.bin file is generated in the project directory.

After configuring the boot mode for the SD card to boot, the file and Image/linux under the Image.ub copy into the SD card, you can start the Linux

2.6 Generating a packaged file

Use the command in the Petalinux project directory:

Petalinux-package--prebuilt--FPGA <FPGA bitstream>

In the project directory, generate the pre-built folder, which has all the files required by the system.

The default login name and password are root

2.7 booting the SD card as a hard drive Linux

In this case, the changes made under Linux will be saved on the SD card.

1, the SD card will be divided into two zones under Linux, the first zone at least 40M bytes and formatted as FAT32, the other zone at least 4G and formatted as EXT4.

2. Using the "petalinux-config" command, go to "Image packaging con?guration", "Root lesystem type" and select the SD card and save the configuration.

3. Recompile and generate Boot.bin and image files

4. Use the following command to generate the file system compression package:

#生成文件名为 Rootfs.cpio, located under Image/linux petalinux-package--image-c rootfs--format Initramfs

5. Copy the Boot.bin and Image.ub into the first partition of the SD card

6. Copy the Rootfs.cpio into the second partition of the SD card, and use the following command to extract

sudo pax-rvf Rootfs.cpio
3. Software application

The use of the specified command is used in the Petalinux project root directory!

Using Petalinux to start the ZYNQ, you can select 3 stages.

Phase 1: Just download the bit stream file for FPGA

Phase 2: Boot to Uboot

Phase 3: Full boot

3.1 Emulation Start

Use the following command to invoke software emulation:

Petalinux-boot--qemu--prebuilt  33 represents a start level of 3, which is all started. The 1 and 2 respectively represent boot to FSBL and u-boot.
Software emulation can only use 2 and 3!

Exit software emulation Use "CTRL + a" to release and press "X" on it.

Note: If you reconfigure the system code, you will need to re -update the pre-built folder after compiling the system files (refer to section 2.6)

You can also specify a new file for emulation:

#调用./images/linux/u-boot.elfpetalinux-boot--qemu--u-boot# call./images/linux/zimagepetalinux-boot--qemu--kernel# or specify the kernel path, the device tree path (extract the device tree file from Zimage) petalinux-boot--qemu--image./images/linux/zimage--DTB./images/linux/system.dtb
3.2 Jtga Start

You first need to change the startup mode to JTAG boot.

Similar to the 3.1 command, simply replace "Qemu" with "Jtag" to

Petalinux-boot--jtag--prebuilt 3

In addition, you can download some code separately:

#下载bit文件 petalinux-boot--jtag--FPGA--bitstream <BITSTREAM> #下载uboot代码 (image/linux/u-boot.elf) petalinux-boot --jtag--u-boot# Download kernel file (image/linux/zimage) petalinux-boot--jtag--kernel# view boot details petalinux-boot--jtag--u-boot-v# Download PMU firmware petalinux-boot--jtag--pmufw <PATH_TO_PMUFW_ELF>--u-boot# get xmd log information petalinux-boot--jtag--prebuilt 3-- Tcl Test.txt
3.3 Starting the target board with TFTP

On the basis of configuring the TFTP server, you need to run the command:

petalinux-config# into "Image packaging Configuration". #选中  "Copy final images to Tftpboot" #默认服务器文件位于 "/tftpboot", You also need to set up "Tftpboot directory" if different

The target board needs to be connected to the network cable, and the U-boot is already running (via SD card loading, etc.). Under U-boot, make the following settings:

#设置服务器ip set ServerIP 
3.3 Firmware Package

Firmware packaging is used to package the project file (Fsbl+bit+ssbl+linux) as a. tar.gz file

Petalinux-package--firmware--bootbin=<boot_bin>--linux#boot_bin-> boot.bin file is in the same location #linux auto Reference./images/ Linux/image.ub file
3.4 BSP Package

Package the current project as a BSP file, forming the same structure as the BSP package provided by other development boards.

Execute commands outside the project package:

Petalinux-package--bsp-p <plnx-proj-root>--output <name>#<name> is the BSP package name (for example, name = Exercise, The exercise.bsp file will be generated)

3.5 Engineering Configuration

The Petalinux provides a Kconfig configuration interface that allows you to configure many of the system's parameters in detail. Use the command:

Petalinux-config

Specific configuration instructions and operations are described in the manual from page 52nd.

3.6 Petalinux-based app development

To generate a project using a command:

Petalinux-create-t apps [--template type]--name <user-application-name>--enable--template Type: You can select the template types < User-application-name>: Project Name # Create a C-template app petalinux-create-t apps--template C--name MyApp--enable# Create a C + + Template app Petalinux-create-t apps--template C + +--name MyApp--enable

The generated project is located in./components/apps, which edits the source code based on this project template, and when there is a new file needs to modify the makefile in the current directory.

1, when you want to add more source files, you can simply and rudely add the corresponding. o File name

2, when you want to add additional configuration files, under the "Install" Target to join

#将myfile. conf cured into/etc directory $ (targetinst) myfile.conf  /etc# string "Some text here" cured into/etc/system.conf under $ (targetinst)-A "Some test here"/etc/system.conf

This also appears in the Petalinux configuration menu, and you can configure the app options by modifying the Kconfig.

#进入配置界面后, the Applications option can find the app and enable Petalinux-config-c rootfs# to recompile with the command compilation and solidify the bin file into the file system Petalinux-build

When you need to fully compile the entire system, use:

Lang=c Petalinux-build

When you only need to modify the root file system, use it in the Petalinux project directory:

#假设app工程名为myapp petalinux-build-c rootfs-x do_gen_sysroot petalinux-build-c rootfs/myapp lang=c petalinux-build-x Pack Age

The app is added to the file system, and you can use the following command to choose whether the app is compiled

Petalinux-config-c Rootfs
3.7 Adding libraries to the file system

3.8 Automatic Login (auto-run app on boot)

Create a new app and make the following changes:

#修改app内容 # include <unistd.h> #include <stdio.h>int main () {   EXECLP ("login", "Login", "-F", "root", 0);} #修改makefile Install target content so that it can be powered on automatically (targetinst)-d-p 0755 autologin/etc/init.d/autologin$ (targetinst)-s/etc/ Init.d/autologin/etc/rc5.d/s99autologin

Note: When you need to set up an app to run and not quit, you should start it as a daemon.

3.9 Debugging the Kernel

Use GDB to debug with the support of QEMU emulation

#1. Start the emulation kernel Petalinux-boot--qemu--kernel#2. In the first few lines of the QEMU startup output, you can find the TCP port number of GDB-gdb tcp:<tcp_port> #3. Start Linux Another command-line window, enter Images/linux directory # #. Start gdb debug Petalinux-util--gdb vmlinux#5. Use the port number (GDB) target remote:9000# that you just displayed in GDB 6. Then debug it, toss it.

Note: You can open the Kernel debugging option in the configuration menu:

Petalinux-config--kernel > Kernel hacking > Kernel debugging


3.10 Debugging the app via the TCF tool under the SDK (not verified)

Generate the execution file first

#1. Enter the root file configuration interface petalinux-config-c rootfs#2. Enter the Base submenu in Filesystem Packages. Enable Tcf-agent option # #. Go to the upper  Console/network submenu # #. Enable Dropbear-openssh-sftp-server submenu. Recompile

And then do the debugging.

#1. Start the system by using QEMU or hardware # # # Start the SDK and create a new project # #. Select the hardware descriptor file in the new project, located in the "<plnx-proj-root>#/subsystems/linux/hw-description/ SYSTEM.HDF "#4. Debug for new Linux type

3.11 Modifying the device tree

Editing of the device tree under File System-top.dts, this file is located under the Subsystems/linux/configs/device-tree folder.

The documentation for the device tree is located in the kernel and directory: Documentation/devicetree

3.12 U-boot Configuration

If you need to open certain commands or options under U-boot, the official recommendation is to edit the./subsystems/linux/configs/u-boot/platform-top.h file and recompile the U-boot

#编译u-bootpetalinux-build-c u-boot# generate u-boot.binpetalinux-package--boot--fsbl <FSBL image>--FPGA <FPGA Bitstream>--u-boot
3.13 Deep Customization

About the need to modify the bottom of the drive, source code and so on, you need to build their own uboot, Linux source code and so on in the current project root directory of the operating directory .

4 Petalinux Work Flow

4.1 Based on an official BSP development

In official BSP development you can increase the speed of development by using the following command to correlate the BSP:

#关联bsp, and create a project in the current directory petalinux-create-t project-s <path-to-bsp> #编译生成最终的镜像文件LANG =c petalinux-build

There is a specific compilation log in./build/build.log, and a copy is also made in the./images file, in the/tftpboot (TFTP service Area folder, which is the default for this path).

Software application of ZYNQ Foundation-->linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.