OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 157|回复: 0

[XILINX] ov5640 v4l2驱动开发系统宕机

[复制链接]

2

主题

4

帖子

0

精华

新手入门

积分
19
金钱
19
注册时间
2022-5-26
在线时间
4 小时
发表于 2025-11-27 23:54:21 | 显示全部楼层 |阅读模式
我遇到了一个BUG,请教高手略微执教。
我使用petalinux-config -c kernel配置Device Driver 使能DMA engine\Media contorller\v4l2 media core\xilinx video ip等驱动后,编译内核启动,启动过程中加载xlinx-vipp驱动时空指针解引用导致宕机。设备树为:
/ {
    v4l2_cap0: v4l2-cap-pipeline {
        compatible = "xlnx,video";
        status = "okay";


        #address-cells = <1>;
        #size-cells = <0>;


        dmas = <&axi_vdma_0 1>;
        dma-names = "vdma0";


        xlnx,video-format = <0x300c>;//RGGBraw8
        xlnx,width = <800>;
        xlnx,height = <480>;


        ports {
            #address-cells = <1>;
            #size-cells = <0>;
            port@0 {
                reg = <0>;
                direction = "input";
                vipp_in: endpoint {
                    remote-endpoint = <&ov5640_out>;
                };
            };
        };
    };
};


&i2c0{  
    status = "okay";


    ov5640: camera@3c {
        compatible = "ovti,ov5640";
        status = "okay";
        reg = <0x3c>;      
        clocks = <&clkc 38>;
        clock-names = "xvclk";
        /*pwdn-gpios = <&gpio0 61 GPIO_ACTIVE_HIGH>;
        reset-gpios = <&gpio0 62 GPIO_ACTIVE_LOW>;*/
        pwdn-gpios = <&gpio0 61 1>;
        reset-gpios = <&gpio0 62 0>;      
        #address-cells = <1>;
        #size-cells = <0>;
        port@0{
            reg = <0>;
            ov5640_out: endpoint {
                remote-endpoint = <&vipp_in>;
                bus-width = <8>;
                hsync-active = <1>;
                vsync-active = <1>;
                data-active = <1>;
            };
        };
    };

};
系统宕机死亡讯息为:

Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
[00000000] *pgd=00000000
Internal error: Oops - BUG: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.10-xilinx-g0a0f70e531c7 #1
Hardware name: Xilinx Zynq Platform
PC is at frmbuf_find_chan+0x3c/0x84
LR is at arch_atomic_cmpxchg_relaxed+0xc/0x28
pc : [<c03d1e74>]    lr : [<c0151ac4>]    psr: 60000013
sp : f0819d28  ip : 00000000  fp : c1308848
r10: c1308b60  r9 : 00000000  r8 : 00000001
r7 : c1308b78  r6 : 00000000  r5 : 00000000  r4 : c0c2172c
r3 : c0c217a4  r2 : 00000000  r1 : c10b0000  r0 : c10b0000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 18c5387d  Table: 0000404a  DAC: 00000051
Register r0 information: slab task_struct start c10b0000 pointer offset 0 size 2176
Register r1 information: slab task_struct start c10b0000 pointer offset 0 size 2176
Register r2 information: NULL pointer
Register r3 information: non-slab/vmalloc memory
Register r4 information: non-slab/vmalloc memory
Register r5 information: NULL pointer
Register r6 information: NULL pointer
Register r7 information: slab kmalloc-2k start c1308800 pointer offset 888 size 2048
Register r8 information: non-paged memory
Register r9 information: NULL pointer
Register r10 information: slab kmalloc-2k start c1308800 pointer offset 864 size 2048
Register r11 information: slab kmalloc-2k start c1308800 pointer offset 72 size 2048
Register r12 information: NULL pointer
Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
Stack: (0xf0819d28 to 0xf081a000)
9d20:                   00000080 00000000 c1308bd4 c03d1ec8 c1308b60 c05800c8
9d40: 00000001 c18010c0 c18010c0 c1308b78 00000001 00000000 c1308b60 c056d570
9d60: c1308b60 00000000 00000009 c126e840 00000001 c056d5e0 c1308840 00000000
9d80: 00000009 c058086c ef7f2040 c1308800 00000000 c1308c10 ffffffff c01f6644
9da0: 00000800 00000000 00000000 00000000 00000000 f3d2a6e7 c1308840 c126e840
9dc0: ff8fa11c ef7f2040 c1100010 c126e898 c1100000 00000009 c126ea6c c05817d8
9de0: 00000000 00000000 ef7f1f1c c1308840 00000000 ff8fa11c 00000000 f3d2a6e7
9e00: 00000001 00000000 c1100010 c0c31cb0 00000000 c100b700 c09b2d40 c10b0000
9e20: 00000000 c04451ec 00000000 c1100010 c0c31cb0 c0443340 c1100010 c0c31cb0
9e40: c1100010 00000000 c100b700 c0443610 c0c31cb0 c1100010 c0c5da48 c0c31cb0
9e60: c1100010 00000000 c100b700 c10b0000 00000000 c04436b4 c1100010 c0c31cb0
9e80: 00000000 c04437ec c100b700 c04438d4 c11a9734 c100b700 c0c31cb0 c04437ec
9ea0: c100b700 c044159c c0b36834 c100b758 c11a9734 f3d2a6e7 c100b76c c0c31cb0
9ec0: 00000000 c1825500 c1825538 c0442560 c0998abb 00000000 c0c31cb0 c1032780
9ee0: 00000006 c0b36834 c0b22ca4 c044409c c0c3e000 c1032780 00000006 c0101500
9f00: c0b004c8 c10327d5 c098bb2d 00000000 00000000 00000000 00000000 00000000
9f20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9f40: 00000000 00000000 00000000 f3d2a6e7 00000097 000000ef c1032780 00000006
9f60: c0b36834 c0b36854 c09b2d40 c0b410b0 00000000 c0b01240 00000006 00000006
9f80: 00000000 c0b004c8 c0c03e00 c078cce4 00000000 00000000 00000000 00000000
9fa0: 00000000 c078ccf8 00000000 c010014c 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
Call trace:
frmbuf_find_chan from xilinx_xdma_set_mode+0xc/0x18
xilinx_xdma_set_mode from xvip_dma_s_ctrl+0x98/0x178
xvip_dma_s_ctrl from __v4l2_ctrl_handler_setup+0xac/0xfc
__v4l2_ctrl_handler_setup from v4l2_ctrl_handler_setup+0x20/0x34
v4l2_ctrl_handler_setup from xvip_dma_init+0x2b8/0x524
xvip_dma_init from xvip_composite_probe+0x190/0x420
xvip_composite_probe from platform_probe+0x58/0xa8
platform_probe from really_probe+0x128/0x28c
really_probe from __driver_probe_device+0x16c/0x18c
__driver_probe_device from driver_probe_device+0x38/0xb4
driver_probe_device from __driver_attach+0xe8/0xfc
__driver_attach from bus_for_each_dev+0x84/0xc4
bus_for_each_dev from bus_add_driver+0xd0/0x1d8
bus_add_driver from driver_register+0xb8/0x100
driver_register from do_one_initcall+0x70/0x1cc
do_one_initcall from kernel_init_freeable+0x19c/0x1e0
kernel_init_freeable from kernel_init+0x14/0x12c
kernel_init from ret_from_fork+0x14/0x28
Exception stack(0xf0819fb0 to 0xf0819ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Code: e59f0044 eb0ef5b6 e3560000 1a000005 (e5953000)
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
个人初步排查原因是内核中的driver/media/platform/xilinx/xilinx-dma.c执行xvip_dma_init函数时,没有正确初始化dma->dma导致在frmbuf_find_chan函数中进行错误判断时解引用了dma->dma导致系统崩溃。但是为什么frmbuf_find_chan为什么不能成功执行,进入错误判断,我不得而知。设备树不知道是否错误了。另外DMA engine是成功probed,xilinx-vipp.c初始化dma是失败的。后面我修改了frmbuf_find_chan代码,使其不会解引用空指针,使得系统能正常启动了,但是xilinx-vipp.c加载DMA是失败的,问题还是出现在frmbuf_find_chan中,不能成功执行。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


关闭

原子哥极力推荐上一条 /1 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-12-13 14:13

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表