admin管理员组

文章数量:1558103

目 录

一、 使用vivado设计带wifi的ultra96v2硬件平台
二、 使用vitis设计hello程序,验证平台
三、 用户设备树:修改system-user.dtsi无线SD,增加有关virtIO的openamp.dtsi
四、 u-boot:增加recipes-bsp/u-boot文件,platform.h指示装载kernel device tree位置和有关DHCP的bsp.cfg
五、 用户应用:增加蓝牙无线recipes-bsp/ultra96-misc和wilc3000-fw
六、 kernel:增加recipes-kernel文件,有关USB和SPI的 bsp.cfg,无线上电复位patch,直接配置有关APF和CMA的user.cfg
七、 根文件模块:创建和编译led-brightness 和wilc模块
八、 根文件配置:拷贝rootfs_config文件,直接配置根文件
九、 根文件库:应用sds-lib创建、库拷贝、编译
十、 第八步 根文件通配:网卡启动recipes-core, 鼠标键盘屏幕recipes-graphics和网络及启动配置recipes-utils
十一、 根文件用户配置:直接增加上一步配置user-rootfsconfig和改变petalinuxbsp.conf
十二、 启动Kernel panic分析解决

以下所有软件硬件代码均可从下面的网址下载:
xilinx petalinux2019.2开发的ultra96v2 BSP,含硬件设计和软件配置.docx-Linux代码类资源-CSDN下载
https://download.csdn/download/u010879745/12307621

一、 使用vivado设计带wifi的ultra96v2硬件平台

加AXI Interconnect、RST、GPIO、UART16650、BRAM IP模块并按照下图连接:

建立限制文件:

set_property PACKAGE_PIN B5 [get_ports BT_HCI_CTS]
set_property PACKAGE_PIN B7 [get_ports BT_HCI_RTS]

/# Fan control

----------------------------------------------------------------------------

/# Bank 65
set_property PACKAGE_PIN F4 [get_ports FAN_PWM]
set_property DRIVE 8 [get_ports FAN_PWM]

----------------------------------------------------------------------------

/# Low-speed expansion connector

----------------------------------------------------------------------------

/# Bank 65
set_property PACKAGE_PIN D7 [get_ports {HD_GPIO[0]}]
set_property PACKAGE_PIN F8 [get_ports {HD_GPIO[1]}]
set_property PACKAGE_PIN F7 [get_ports {HD_GPIO[2]}]
set_property PACKAGE_PIN G7 [get_ports {HD_GPIO[3]}]
set_property PACKAGE_PIN F6 [get_ports {HD_GPIO[4]}]
set_property PACKAGE_PIN G5 [get_ports {HD_GPIO[5]}]
set_property PACKAGE_PIN A6 [get_ports {HD_GPIO[6]}]
set_property PACKAGE_PIN A7 [get_ports {HD_GPIO[7]}]
set_property PACKAGE_PIN G6 [get_ports {HD_GPIO[8]}]
set_property PACKAGE_PIN E6 [get_ports {HD_GPIO[9]}]
set_property PACKAGE_PIN E5 [get_ports {HD_GPIO[10]}]
set_property PACKAGE_PIN D6 [get_ports {HD_GPIO[11]}]
set_property PACKAGE_PIN D5 [get_ports {HD_GPIO[12]}]
set_property PACKAGE_PIN C7 [get_ports {HD_GPIO[13]}]
set_property PACKAGE_PIN B6 [get_ports {HD_GPIO[14]}]
set_property PACKAGE_PIN C5 [get_ports {HD_GPIO[15]}]

/# Set the bank voltage for IO Bank 26 to 1.8V
set_property IOSTANDARD LVCMOS18 [get_ports -of_objects [get_iobanks 26]]

/# Set the bank voltage for IO Bank 65 to 1.2V
set_property IOSTANDARD LVCMOS12 [get_ports -of_objects [get_iobanks 65]]

导入项目:

编译运行:

二、 使用vitis设计hello程序,验证平台

打开vitis

选择第一步生成的硬件文件

改变BSP

修改成psu_uart_1


编译运行

创建应用程序

选择刚建的硬件平台

选择应用程序


编译应用程序


如果出现下面的问题,是因为你的硬件平台未编译

如果出现下面的乱码,说明你的串口未正确配置


出现下面的问题,说明你的库文件路径未能正确配置
Release 2019.2 Mar 25 2020 - 21:27:59
PMU-FW is not running, certain applications may not be supported.



正确输出:


john@john-virtual-machine:~/ultra96v2_1-master$ petalinux-create --type project --template zynqMP --name ultra96v2_1OS

john@john-virtual-machine:~/ultra96v2_1-master/ultra96v2_1OS$ petalinux-config --get-hw-description ./

• Subsystem AUTO Hardware Settings → Serial Settings → Primary stdin/stdout → (psu_uart_1)
• DTG Settings → MACHINE_NAME → (avnet-ultra96-rev1)
• u-boot Configuration → u-boot config target → (avnet_ultra96_rev1_defconfig)
• Image Packaging Configuration → Root filesystem type → (SD card)
• Yocto Settings → YOCTO_MACHINE_NAME → (ultra96-zynqmp)



三、 用户设备树:修改system-user.dtsi无线SD,增加有关virtIO的openamp.dtsi

system-user.dtsi增加内容:WILC3000无线与SD设备
增加openamp.dtsi文件:openamp库提供虚拟模块共享内存IO标准(virtIO: OpenAMP library implements virtIO standard for shared memory management),增加AMBA (Advanced Microcontroller Bus Architecture) protocols, 高级微处理器总线 power demain电源域和reserved-memory保留内存
device-tree.bbappend增加内容:file://openamp.dtsi
SDHC interface node for the ATWILC3000 chip:
&sdhci1 {
bus-width= <0x4>;
disable-wp;
max-frequency = <50000000>;
/delete-property/cap-power-off-card;
mmc-pwrseq = <&sdio_pwrseq>;
status = “okay”;
#address-cells = <1>;
#size-cells = <0>;
wilc_sdio@1 {
compatible = “microchip,wilc3000”, “microchip,wilc3000”;
reg = <0>;
bus-width= <0x4>;
status = “okay”;
};
// Remove TI child node from U96 V1 DT
/delete-node/wifi@2;
};
SD card slot:
/* SD0 only supports 3.3V, no level shifter */
&sdhci0 {
no-1-8-v;
disable-wp;
};

四、 u-boot:增加recipes-bsp/u-boot文件,platform.h指示装载kernel device tree位置和有关DHCP的bsp.cfg

增加platform.h(指示装载kernel device tree) 和bsp.cfg(DHCP选项),修改bbappend文件。
platform.h file to tell u-boot where to load the kernel and device tree from after the first stage boot loader passes control off to u-boot. A bsp.cfg file enables a few more options needed by the Ultra96 such as DHCP and ping mode.


五、 用户应用:增加蓝牙无线recipes-bsp/ultra96-misc和wilc3000-fw

/project-spec/meta-user/recipes-bsp/ directory wilc3000-fw and ultra96-misc directories

六、 kernel:增加recipes-kernel文件,有关USB和SPI的 bsp.cfg,无线上电复位patch,直接配置有关APF和CMA的user.cfg

增加 the bsp.cfg和fix_u96v2_pwrseq_simple.patch文件,前者为USB和SPI配置使能,后者为 WILC3000上电复位顺序,增加user.cfg配置文件,省略petalinux-config -c kernel时间
按照下面的指令配置kernel:

解释:user.cfg 中的active power filter (APF)
john@john-virtual-machine:~/ultra96v2_1-master/ultra96v2_1OS$ petalinux-config -c kernel
NOTE: Executing RunQueue Tasks
Currently 1 running tasks (373 of 373) 99% |####################################### |
0: linux-xlnx-4.19-xilinx-v2019.2+git999-r0 do_menuconfig - 2005s (pid 20124)
如果你发现未打开kernel config,很可能它已经在另一个tab里已经打开,详见
https://forums.xilinx/t5/Embedded-Linux/quot-petalinux-config-c-kernel-quot-stuck-and-config-window/td-p/1027178









将文件bsp.cfg和fix_u96v2_pwrseq_simple.patch拷到/project-spec/meta-user/recipes-kernel/linux/linux-xlnx
前者为USB和SPI配置使能,后者为 ATWILC3000的上电复位顺序

七、 根文件模块:创建和编译led-brightness 和wilc模块

petalinux-create -t modules --name led-brightness --enable

petalinux-create -t modules --name wilc –enable

只有led-brightness需要拷贝源程序

petalinux-build -c wilc
petalinux-build -c led-brightness


八、 根文件配置:拷贝rootfs_config文件,直接配置根文件

九、 根文件库:应用sds-lib创建、库拷贝、编译

john@john-virtual-machine:~/ultra96v2_1-master/ultra96v2_1OS$ petalinux-build -c sds-lib


十、 第八步 根文件通配:网卡启动recipes-core, 鼠标键盘屏幕recipes-graphics和网络及启动配置recipes-utils

拷贝recipes-core(网卡启动), recipes-graphics(鼠标键盘屏幕)和 recipes-utils(网络及启动配置)拷入 /project-spec/meta-user/。

十一、 根文件用户配置:直接增加上一步配置user-rootfsconfig和petalinuxbsp.conf 改变

将文件user-rootfsconfig拷入/project-spec/meta-user/conf。
在petalinuxbsp.conf增加以下内容:
MACHINE_FEATURES_remove_ultra96-zynqmp = “mipi”
DISTRO_FEATURES_append = " bluez5 dbus"
PREFERRED_VERSION_wilc-firmware = “15.2”
IMAGE_INSTALL_remove = “ultra96-ap-setup”

存盘退出

john@john-virtual-machine:~/ultra96v2_1-master/ultra96v2_1OS$ petalinux-config
[INFO] generating Kconfig for project
[INFO] menuconfig project

*** End of the configuration.
*** Execute ‘make’ to start the build or try ‘make help’.

[INFO] sourcing bitbake
[INFO] generating plnxtool conf
[INFO] generating meta-plnx-generated layer
[INFO] generating user layers
[INFO] generating workspace directory
[INFO] generating bbappends for project . This may take time !
[INFO] generating u-boot configuration files
[INFO] generating kernel configuration files
[INFO] generating kconfig for Rootfs
[INFO] silentconfig rootfs
[INFO] generating petalinux-user-image.bb

编译build the project as a whole:
petalinux-build

打包
petalinux-package --boot --fsbl ./images/linux/zynqmp_fsbl.elf --fpga ./images/linux/system.bit --pmufw ./images/linux/pmufw.elf --u-boot

十二、 启动Kernel panic分析解决

拷入SD,启动后发现Kernel panic

[ 22.987830] Starting init: /bin/sh exists but couldn’t execute it (error -13)
[ 22.994963] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 23.056710] —[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]—

经过漫长的原因查找后,发现是由于解压缩至SD卡时,发生了libc-2.28.so文件错误,

在这里插入图片描述
改正后:

另一文件,同样发生拷贝错误

改正后:


自动获得了IP地址:

已能通过无线wifi和MobaXterm操作ultra96v2上的文件系统:

实物照片,可以看到wifi灯和blue灯正常点亮:

本文标签: 软件包petalinuxbspwifi