工程网盘链接:https://pan.baidu.com/s/1vFRpzmbifXt7GypU9aKjeg
提取码:0ylh
首先需要使用与petalinux相同版本的vivado创建工程,与之前不同的是在创建硬件设计时需要勾选上添加bit文件,所以要在生成bit文件之后再创建硬件设计文件
打开装有对应版本的linux系统,设置petalinux的环境变量,在petalinux的安装目录中找到settings.sh,使用下面这条命令设置环境变量
source ./settings.sh
创建petalinux工程相关的命令我都会提供在工程目录的file文件夹中
创建petalinux工程,demoname为工程名称
把在vivado中创建的硬件配置文件,复制到上面的工程文件中
进入到工程目录中,配置petalinux
配置不作修改,摁右箭头选择Exit点击enter保存退出
等待配置完成后编译项目
修改设备树
设备树的内容如下,文件我也会放在file文件夹中
// SPDX-License-Identifier: GPL-2.0+
/*
* dts file for Xilinx ZynqMP ZCU102 Rev1.0
* (C) Copyright 2016 - 2018, Xilinx, Inc.
*
* Michal Simek <michal.simek@xilinx.com>
*/
/ {
model = "ZynqMP ZCU102 Rev1.0";
compatible = "xlnx,zynqmp-zcu102-rev1.0", "xlnx,zynqmp-zcu102", "xlnx,zynqmp";
gpio-keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
autorepeat;
sw19 {
label = "sw19";
gpios = <&gpio 22 0>;
linux,code = <108>; /* down */
gpio-key,wakeup;
autorepeat;
};
};
leds {
compatible = "gpio-leds";
heartbeat_led {
label = "heartbeat";
gpios = <&gpio 23 0>;
linux,default-trigger = "heartbeat";
};
};
};
&can1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_can1_default>;
};
&gem3 {
phy-handle = <&phyc>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gem3_default>;
phyc: phy@c {
reg = <0xc>;
ti,rx-internal-delay = <0x8>;
ti,tx-internal-delay = <0xa>;
ti,fifo-depth = <0x1>;
ti,rxctrl-strap-worka;
};
};
&gpio {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_default>;
};
&pinctrl0 {
status = "okay";
pinctrl_i2c0_default: i2c0-default {
mux {
groups = "i2c0_3_grp";
function = "i2c0";
};
conf {
groups = "i2c0_3_grp";
bias-pull-up;
slew-rate = <1>;
io-standard = <1>;
};
};
pinctrl_i2c0_gpio: i2c0-gpio {
mux {
groups = "gpio0_14_grp", "gpio0_15_grp";
function = "gpio0";
};
conf {
groups = "gpio0_14_grp", "gpio0_15_grp";
slew-rate = <1>;
io-standard = <1>;
};
};
pinctrl_i2c1_default: i2c1-default {
mux {
groups = "i2c1_4_grp";
function = "i2c1";
};
conf {
groups = "i2c1_4_grp";
bias-pull-up;
slew-rate = <1>;
io-standard = <1>;
};
};
pinctrl_i2c1_gpio: i2c1-gpio {
mux {
groups = "gpio0_16_grp", "gpio0_17_grp";
function = "gpio0";
};
conf {
groups = "gpio0_16_grp", "gpio0_17_grp";
slew-rate = <1>;
io-standard = <1>;
};
};
pinctrl_uart0_default: uart0-default {
mux {
groups = "uart0_4_grp";
function = "uart0";
};
conf {
groups = "uart0_4_grp";
slew-rate = <1>;
io-standard = <1>;
};
conf-rx {
pins = "MIO18";
bias-high-impedance;
};
conf-tx {
pins = "MIO19";
bias-disable;
};
};
pinctrl_uart1_default: uart1-default {
mux {
groups = "uart1_5_grp";
function = "uart1";
};
conf {
groups = "uart1_5_grp";
slew-rate = <1>;
io-standard = <1>;
};
conf-rx {
pins = "MIO21";
bias-high-impedance;
};
conf-tx {
pins = "MIO20";
bias-disable;
};
};
pinctrl_usb0_default: usb0-default {
mux {
groups = "usb0_0_grp";
function = "usb0";
};
conf {
groups = "usb0_0_grp";
slew-rate = <1>;
io-standard = <1>;
};
conf-rx {
pins = "MIO52", "MIO53", "MIO55";
bias-high-impedance;
};
conf-tx {
pins = "MIO54", "MIO56", "MIO57", "MIO58", "MIO59",
"MIO60", "MIO61", "MIO62", "MIO63";
bias-disable;
};
};
pinctrl_gem3_default: gem3-default {
mux {
function = "ethernet3";
groups = "ethernet3_0_grp";
};
conf {
groups = "ethernet3_0_grp";
slew-rate = <1>;
io-standard = <1>;
};
conf-rx {
pins = "MIO70", "MIO71", "MIO72", "MIO73", "MIO74",
"MIO75";
bias-high-impedance;
low-power-disable;
};
conf-tx {
pins = "MIO64", "MIO65", "MIO66", "MIO67", "MIO68",
"MIO69";
bias-disable;
low-power-enable;
};
mux-mdio {
function = "mdio3";
groups = "mdio3_0_grp";
};
conf-mdio {
groups = "mdio3_0_grp";
slew-rate = <1>;
io-standard = <1>;
bias-disable;
};
};
pinctrl_can1_default: can1-default {
mux {
function = "can1";
groups = "can1_6_grp";
};
conf {
groups = "can1_6_grp";
slew-rate = <1>;
io-standard = <1>;
};
conf-rx {
pins = "MIO25";
bias-high-impedance;
};
conf-tx {
pins = "MIO24";
bias-disable;
};
};
pinctrl_sdhci1_default: sdhci1-default {
mux {
groups = "sdio1_0_grp";
function = "sdio1";
};
conf {
groups = "sdio1_0_grp";
slew-rate = <1>;
io-standard = <1>;
bias-disable;
};
mux-cd {
groups = "sdio1_cd_0_grp";
function = "sdio1_cd";
};
conf-cd {
groups = "sdio1_cd_0_grp";
bias-high-impedance;
bias-pull-up;
slew-rate = <1>;
io-standard = <1>;
};
mux-wp {
groups = "sdio1_wp_0_grp";
function = "sdio1_wp";
};
conf-wp {
groups = "sdio1_wp_0_grp";
bias-high-impedance;
bias-pull-up;
slew-rate = <1>;
io-standard = <1>;
};
};
pinctrl_gpio_default: gpio-default {
mux-sw {
function = "gpio0";
groups = "gpio0_22_grp", "gpio0_23_grp";
};
conf-sw {
groups = "gpio0_22_grp", "gpio0_23_grp";
slew-rate = <1>;
io-standard = <1>;
};
mux-msp {
function = "gpio0";
groups = "gpio0_13_grp", "gpio0_38_grp";
};
conf-msp {
groups = "gpio0_13_grp", "gpio0_38_grp";
slew-rate = <1>;
io-standard = <1>;
};
conf-pull-up {
pins = "MIO22", "MIO23";
bias-pull-up;
};
conf-pull-none {
pins = "MIO13", "MIO38";
bias-disable;
};
};
};
&qspi {
is-dual = <1>;
flash@0 {
compatible = "m25p80"; /* 32MB */
#address-cells = <1>;
#size-cells = <1>;
reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>; /* FIXME also DUAL configuration possible */
spi-max-frequency = <108000000>; /* Based on DC1 spec */
partition@qspi-fsbl-uboot { /* for testing purpose */
label = "qspi-fsbl-uboot";
reg = <0x0 0x100000>;
};
partition@qspi-linux { /* for testing purpose */
label = "qspi-linux";
reg = <0x100000 0x500000>;
};
partition@qspi-device-tree { /* for testing purpose */
label = "qspi-device-tree";
reg = <0x600000 0x20000>;
};
partition@qspi-rootfs { /* for testing purpose */
label = "qspi-rootfs";
reg = <0x620000 0x5E0000>;
};
};
};
&sata {
/* SATA OOB timing settings */
ceva,p0-cominit-params = /bits/ 8 <0x18 0x40 0x18 0x28>;
ceva,p0-comwake-params = /bits/ 8 <0x06 0x14 0x08 0x0E>;
ceva,p0-burst-params = /bits/ 8 <0x13 0x08 0x4A 0x06>;
ceva,p0-retry-params = /bits/ 16 <0x96A4 0x3FFC>;
ceva,p1-cominit-params = /bits/ 8 <0x18 0x40 0x18 0x28>;
ceva,p1-comwake-params = /bits/ 8 <0x06 0x14 0x08 0x0E>;
ceva,p1-burst-params = /bits/ 8 <0x13 0x08 0x4A 0x06>;
ceva,p1-retry-params = /bits/ 16 <0x96A4 0x3FFC>;
phy-names = "sata-phy";
phys = <&lane3 1 1 1 125000000>;
};
/* SD1 with level shifter */
&sdhci1 {
//pinctrl-names = "default";
//pinctrl-0 = <&pinctrl_sdhci1_default>;
no-1-8-v;
disable_wp;
};
/*
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart0_default>;
};
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1_default>;
};
*/
/* ULPI SMSC USB3320 */
&usb0 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usb0_default>;
};
&dwc3_0 {
dr_mode = "host";
snps,usb3_lpm_capable;
phy-names = "usb3-phy";
phys = <&lane2 4 0 2 26000000>;
};
&zynqmp_dpsub {
//status = "disabled";
status = "okay";
};
&pcie {
//status = "okay";
status = "disabled";
};
修改完成后保存,再次编译
编译完成后生成启动文件
8把工程文件->images->linux 下的BOOT.bin和image.ub拷贝到SD卡中,我也会把这两个文件放到file文件夹中,需要测试的可以自取
把SD卡插入开发板,启动模式设置为SD卡启动,连接好串口线与电源线,打开串口开启电源
等待串口打印信息结束,在显示工程和login时表示启动成功
在串口输入账号和密码即可进入系统,我的这里的账号和密码都是root。或者在开发板上插入键盘和DP显示器也可以进行操作
File中的文件