fpga:petalinux
差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录前一修订版 | |||
| fpga:petalinux [2026/10/13 22:06] – 外部编辑 127.0.0.1 | fpga:petalinux [2026/10/13 22:51] (当前版本) – 外部编辑 127.0.0.1 | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| # petalinux | # petalinux | ||
| ## - create project | ## - create project | ||
| - | < | + | |
| + | ```bash | ||
| source / | source / | ||
| petalinux-create -t project --template zynq -n xxx_name | petalinux-create -t project --template zynq -n xxx_name | ||
| petalinux-config --get-hw-description . | petalinux-config --get-hw-description . | ||
| + | ``` | ||
| - | </ | ||
| 行 13: | 行 14: | ||
| 相当于创建linux模块驱动 | 相当于创建linux模块驱动 | ||
| - | < | + | |
| + | ```bash | ||
| petalinux-create -t modules -n xxx_module --enable | petalinux-create -t modules -n xxx_module --enable | ||
| - | </ | + | ``` |
| 行 21: | 行 24: | ||
| 创建一个linux平台下的app可执行程序 | 创建一个linux平台下的app可执行程序 | ||
| - | < | + | |
| + | ```bash | ||
| petalinux-create -t apps -n xxx_app | petalinux-create -t apps -n xxx_app | ||
| - | </ | + | ``` |
| 然后进入recipes-apps/ | 然后进入recipes-apps/ | ||
| 行 30: | 行 35: | ||
| ## - build | ## - build | ||
| - | < | + | |
| + | ```bash | ||
| petalinux-build -c rootfs | petalinux-build -c rootfs | ||
| petalinux-build -c xxx_module | petalinux-build -c xxx_module | ||
| 行 38: | 行 44: | ||
| petalinux-build | petalinux-build | ||
| - | </ | + | ``` |
| ## - app单独编译& | ## - app单独编译& | ||
| - | < | + | |
| + | ```bash | ||
| petalinux-build -c xxx_app -x do_compile | petalinux-build -c xxx_app -x do_compile | ||
| ls build/ | ls build/ | ||
| 行 47: | 行 55: | ||
| # 然后可以将此文件通过scp的方式,copy到zynq设备,修改权限chmod 777 ./myapp3, 执行程序./ | # 然后可以将此文件通过scp的方式,copy到zynq设备,修改权限chmod 777 ./myapp3, 执行程序./ | ||
| # 这样的方式不用每次app修改后都烧写到flash, 通过scp的方式加快app开发调试速度。 | # 这样的方式不用每次app修改后都烧写到flash, 通过scp的方式加快app开发调试速度。 | ||
| + | ``` | ||
| - | </ | ||
| ## - package to BOOT.BIN | ## - package to BOOT.BIN | ||
| - | < | + | |
| + | ```bash | ||
| petalinux-package --boot --fsbl zynq_fsbl.elf --u-boot --kernel --fpga system.bit --force | petalinux-package --boot --fsbl zynq_fsbl.elf --u-boot --kernel --fpga system.bit --force | ||
| # --boot, 打包成BOOT.BIN文件 | # --boot, 打包成BOOT.BIN文件 | ||
| 行 58: | 行 67: | ||
| # --fpga, 指定FPGA bits文件。 | # --fpga, 指定FPGA bits文件。 | ||
| # | # | ||
| - | </ | + | ``` |
| ## - 一个简单的驱动开发例程——GPIO流水灯(Petalinux部分) | ## - 一个简单的驱动开发例程——GPIO流水灯(Petalinux部分) | ||
| 行 71: | 行 81: | ||
| 参考: https:// | 参考: https:// | ||
| - | < | + | |
| + | ```bash | ||
| 行 126: | 行 137: | ||
| 完成后进行petalinux-build,使用新生成的镜像,下次就可以开机自启动了。 | 完成后进行petalinux-build,使用新生成的镜像,下次就可以开机自启动了。 | ||
| + | ``` | ||
| - | </ | ||
| 开机启动执行log example: | 开机启动执行log example: | ||
| - | < | + | |
| + | ```bash | ||
| Hello PetaLinux World, startup test.... | Hello PetaLinux World, startup test.... | ||
| blink: loading out-of-tree module taints kernel. | blink: loading out-of-tree module taints kernel. | ||
| 行 197: | 行 209: | ||
| PetaLinux 2018.3 petalinux_boot_from_flash /dev/ttyPS0 | PetaLinux 2018.3 petalinux_boot_from_flash /dev/ttyPS0 | ||
| - | petalinux_boot_from_flash login: | + | petalinux_boot_from_flash login: |
| + | ``` | ||
| - | </ | ||
| 从上面的执行log看出来,很明显获取IP地址是在开机启动执行程序完成之后才开始的,所以一定要注意这一点。 | 从上面的执行log看出来,很明显获取IP地址是在开机启动执行程序完成之后才开始的,所以一定要注意这一点。 | ||
| 行 209: | 行 221: | ||
| 在zynq fpga运行过程。 | 在zynq fpga运行过程。 | ||
| - | < | + | |
| + | ``` | ||
| root@petalinux_boot_from_flash:/ | root@petalinux_boot_from_flash:/ | ||
| 行 220: | 行 233: | ||
| ls / | ls / | ||
| blinkapp | blinkapp | ||
| + | ``` | ||
| - | </ | ||
| ## - linux 加载module | ## - linux 加载module | ||
| - | < | + | |
| + | ```bash | ||
| insmod blink.ko | insmod blink.ko | ||
| # 如果有同名文件module已经加载,可以先lsmode查看 | # 如果有同名文件module已经加载,可以先lsmode查看 | ||
| 行 233: | 行 247: | ||
| rmmod blink.ko | rmmod blink.ko | ||
| + | ``` | ||
| - | |||
| - | </ | ||
| 行 242: | 行 255: | ||
| 主要描述用户数据和内核数据之间如何互通,因为不能直接访问,需要通过copy_to_user & copy_from_user函数来完成。 | 主要描述用户数据和内核数据之间如何互通,因为不能直接访问,需要通过copy_to_user & copy_from_user函数来完成。 | ||
| - | < | + | |
| + | ```c | ||
| 行 292: | 行 306: | ||
| return SUCCESS; | return SUCCESS; | ||
| } | } | ||
| + | ``` | ||
| - | |||
| - | </ | ||
| 行 301: | 行 314: | ||
| 驱动部分: | 驱动部分: | ||
| - | < | + | |
| + | ```c | ||
| #include < | #include < | ||
| #include < | #include < | ||
| 行 417: | 行 431: | ||
| MODULE_LICENSE(" | MODULE_LICENSE(" | ||
| + | ``` | ||
| - | </ | ||
| 应用程序app部分: | 应用程序app部分: | ||
| - | < | + | |
| + | ```c | ||
| #include < | #include < | ||
| #include < | #include < | ||
| 行 457: | 行 472: | ||
| return 0; | return 0; | ||
| } | } | ||
| + | ``` | ||
| - | |||
| - | </ | ||
fpga/petalinux.1791900372.txt.gz · 最后更改: 由 127.0.0.1
