Commit f718a6d9 by ZhongJianfu

update:备份

parent a8e4360d
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
"ignoreFailures": true, "ignoreFailures": true,
"text1": "-gdb-set follow-fork-mode child" "text1": "-gdb-set follow-fork-mode child"
} }
] ],
"miDebuggerPath": "/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gdb",
"miDebuggerServerAddress": "192.168.2.15:2222"
}] }]
} }
\ No newline at end of file
...@@ -91,3 +91,117 @@ export PATH=/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_lin ...@@ -91,3 +91,117 @@ export PATH=/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_lin
``` ```
## VSCODE远程调试arm
### 参考这个教程再虚拟机安装了NFS的服务器
```
https://blog.csdn.net/yangxueyangxue/article/details/122318745
1.安装 nfs-kernel-server
apt-get install nfs-kernel-server
2.我在/home/lkt 下创建一个名为 nfs 的文件夹
mkdir nfs
3.打开配置文件添加 nfs 共享目录
vi /etc/exports
在配置文件里面添加一下代码:
/home/lkt/nfs/ *(rw,sync,no_root_squash)
共享的目录
rw:是可读写权限
sync:是资料同步写入内存和硬盘
no_root_squash:当登录 NFS 主机使用共享目录的使用者是 root 时, 其权限将被转换成为一名使用者,通常它的 UID 与 GID 都会变成 nobody 身份。
4.重启 nfs 服务
/etc/init.d/nfs-kernel-server restart
然后在板子里面输入
mount -t nfs -o nolock,nfsvers=3 192.168.2.9:/home/lkt/nfs /mnt/
这样板子里的/mnt/目录就和虚拟机里面的/home/lkt/nfs/目录共享了。
```
看这教程需要我编译一个gdbserver (就是各种报错,最后也没解决)
```
https://www.freesion.com/article/3763162732/
gdbserver
本地虚拟机的gdb版本是9.2,所以我也下了一个9.2的源码
参考这个教程编译的:https://blog.csdn.net/weixin_45829566/article/details/108925998
wget https://ftp.gnu.org/gnu/gdb/gdb-9.2.tar.gz
解压
tar -zxvf gdb-9.2.tar.gz
编译gdb的时候我报错了。
cd gdb-9.2/
mkdir build
./configure --target=arm-linux
/home/lkt/Soft_packet/gdb-9.2/configure --target=arm-none-linux-gnueabi --prefix=/home/lkt/Soft_packet/gdb-7.8.1/build_install
make -j16
出现错误:
checking for library containing waddstr... no
configure: WARNING: no enhanced curses library found; disabling TUI
checking for library containing tgetent... no
configure: error: no termcap library found
Makefile:8370: recipe for target 'configure-gdb' failed
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory '/home/sam/Work/gdb/gdb-7.5'
Makefile:844: recipe for target 'all' failed
make: *** [all] Error 2
安装libncureses5-dev:
sudo apt-get install libncurses5-dev
再次
make -j16
gdb-7.5$ sudo apt-get install libncurses5-dev
mkdir tmp
make install prefix=$pwd/tmp
把arm-linux-gdb复制到/bin目录
调试 /bin/arm-linux-gdb ./test
试一下编译,gdbserver
cd gdb/gdbserver/
./configure --host=arm-linux --prefix=/home/lkt/Soft_packet/gdb-9.2/gdb/gdbserver/build
make -j16
cp gdbserver /work/nfs_root/fs_mini
新的教程
https://www.bilibili.com/read/cv8134380/
./configure --target=arm-none-linux-gnueabi --prefix=/home/lkt/Soft_packet/gdb-7.8.1/build_install
gdbserver
./configure --target=arm-linux --host=arm-linux --prefix=/home/lkt/Soft_packet/gdb-7.8.1/build_install
make -j16
make CC=/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc -j16
报错
gdb_proc_service.h:25:26: fatal error: proc_service.h: 没有那个文件或目录
export PATH=/LIB32:$PATH
```
### 使用若格提供的gdb和gdbserver实现对盒子程序的debug
```
1.将压缩包中的gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux\arm-linux-gnueabihf\debug-root\usr\bin\gdbserver 放到盒子中,与可执行文件同一个目录。
如下
root@linkorTech:/mnt# ls
gdbserver helloworld myeasylog.log
执行指令,gdb的服务器就启动了
root@linkorTech:/mnt# ./gdbserver 192.168.2.15:2222 ./helloworld
Process ./helloworld created; pid = 504
Listening on port 2222
将交叉编译gdb需要用到的动态库.tar中的4个共享库放到/lib32下
libncurses.so.5 libncurses.so.5.9 libtinfo.so.5 libtinfo.so.5.9
这4个库是从若格提供的虚拟机镜像/lib32中复制出来的。
vscode中修改lanch.json的配置
"miDebuggerPath": "/home/lkt/Soft_packet/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gdb",
"miDebuggerServerAddress": "192.168.2.15:2222"
直接按F5 就可以开启编译了。
结合第一点的NFS,就可以实现方便的嵌入式的在线程序测试了。
```
...@@ -21,7 +21,7 @@ project_name="${project_path##*/}" ...@@ -21,7 +21,7 @@ project_name="${project_path##*/}"
cd $project_path cd $project_path
#配置目标设备的地址和文件还有密码 #配置目标设备的地址和文件还有密码
expect -c " expect -c "
spawn scp -r Build/bin/helloworld root@192.168.0.115:/home/root/zjftest spawn scp -r Build/bin/helloworld root@192.168.2.15:/home/root/zjftest
expect { expect {
\"yes/no\" {send \"yes\r\";} \"yes/no\" {send \"yes\r\";}
} }
......
#! /bin/sh
./gdbserver 192.168.2.15:2222 ./helloworld
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment