# test_program **Repository Path**: harry_zing/test_program ## Basic Information - **Project Name**: test_program - **Description**: 测试v3s模块化的代码专用 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-03 - **Last Updated**: 2025-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # v3s测试程序 测试模块化的代码专用 # 摄像头调试记录 ## 手动控制补光灯 ```bash # 手动调试io # 导出GPIO152 echo 152 > /sys/class/gpio/export # 设置为输出模式 echo out > /sys/class/gpio/gpio152/direction # 控制输出高电平(打开补光灯) echo 1 > /sys/class/gpio/gpio152/value # 控制输出低电平(关闭补光灯) echo 0 > /sys/class/gpio/gpio152/value # 取消导出 echo 152 > /sys/class/gpio/unexport ``` ## 摄像头参数 ```bash # v4l2-ctl --list-formats-ext ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : Motion-JPEG Size: Discrete 1920x1080 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 800x600 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 1280x720 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 2048x1536 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 2592x1944 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 3840x2160 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 4000x3000 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 8000x6000 Interval: Discrete 0.067s (15.000 fps) Size: Discrete 4608x3456 Interval: Discrete 0.033s (30.000 fps) Index : 1 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2 Size: Discrete 1920x1080 Interval: Discrete 0.200s (5.000 fps) Size: Discrete 800x600 Interval: Discrete 0.040s (25.000 fps) Size: Discrete 1920x1080 Interval: Discrete 0.200s (5.000 fps) Size: Discrete 640x480 Interval: Discrete 0.050s (20.000 fps) ``` ```bash v4l2-ctl -d /dev/video0 --list-ctrls-menus brightness (int) : min=0 max=64 step=1 default=32 value=32 contrast (int) : min=0 max=64 step=1 default=34 value=34 saturation (int) : min=0 max=64 step=1 default=32 value=32 hue (int) : min=0 max=64 step=1 default=32 value=32 white_balance_temperature_auto (bool) : default=1 value=1 gamma (int) : min=0 max=64 step=1 default=32 value=32 power_line_frequency (menu) : min=0 max=2 default=1 value=0 0: Disabled 1: 50 Hz 2: 60 Hz white_balance_temperature (int) : min=2700 max=10000 step=1 default=6500 value=6500 flags=inactive sharpness (int) : min=0 max=64 step=1 default=32 value=32 focus_absolute (int) : min=0 max=127 step=1 default=63 value=82 focus_auto (bool) : default=1 value=0 zoom_absolute (int) : min=0 max=16384 step=1 default=0 value=0 ``` ## 调试方法 ### 调试前 目标板输入指令运行程序:`gdbserver 192.168.1.10:2000 test_program` `gdbserver 127.0.0.1:2000 test_program` ### 方法1 在开发机上输入指令`gdb-multiarch`,此时会进入gdb,并继续输入 ```bash target remote 192.168.1.10:2000 # 连接远程目标 ip 和端口 set sysroot /home/zh/nfs/rootfs # 设置根文件系统路径 handle SIGUSR1 nostop noprint # 设置遇到 SIGUSR1 信号量不要暂停 handle SIGUSR2 nostop noprint # 设置遇到 SIGUSR2 信号量不要暂停 continue # 继续运行程序 ``` 或者不想每次都输入以上指令的话,可以把指令写到一个.gdb 文件内,如:`gdb_commands.gdb` 然后直接使用指令 `gdb-multiarch -x gdb_commands.gdb` 就行了 ### 方法2 使用vscode调试(图形化更方便) 文件`launch.json`: ```json { "version": "0.2.0", "configurations": [ { "name": "v3s Debug", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/software/build/bin/test_program", "miDebuggerServerAddress": "192.168.1.10:2000", "miDebuggerPath": "/usr/local/arm/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb", "stopAtEntry": false, "cwd": "${workspaceFolder}", "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] } ```