Petalinux快速入门向导 (9) 第八章.驱动开发的一些小技巧

1.前提

              具备c语言背景

              基本的linux命令

2    如何找到驱动对应的源代码

2.1 怎么找到dts目录

                     find -name zynq*.dtsi

                     ./arch/arm/boot/dts/zynq-7000.dtsi

2.2 打开dtsi,找到驱动名称

                     compatible = "xlnx,zynq-can-1.0";

2.3 搜索驱动名称找到对应的c文件

              grep "zynq-can-1.0" * -nR |grep "\.c"

              drivers/net/can/xilinx_can.c

3.  驱动代码中需要关注的重点

              static struct platform_driver xcan_driver

              static int xcan_probe(struct platform_device *pdev)

              static const struct net_device_ops xcan_netdev_ops

                     .ndo_open    = xcan_open,

                     .ndo_stop     = xcan_close,

                     .ndo_start_xmit    = xcan_start_xmit,

                     .ndo_change_mtu      = can_change_mtu,

4. 反复修改却没生效?怎么判断

              查看.o文件的修改日期是否变化

5.  如何调试

              用printk输出log信息

project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

grep "system-user.dtsi" * -nR |grep "\.dts"

grep "system-user.dtsi" * -nR |grep "\.dtsi"

你可能感兴趣的:(Xilinx软件开发,-Master,Wang,xilinx,petalinux,fpga,zynq,driver)