Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
HelloWorld
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZhongJianfu
HelloWorld
Commits
f718a6d9
Commit
f718a6d9
authored
Jun 17, 2022
by
ZhongJianfu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:备份
parent
a8e4360d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
2 deletions
+122
-2
launch.json
.vscode/launch.json
+4
-1
README.md
README.md
+114
-0
scp_auto.sh
scp_auto.sh
+1
-1
strat_gdbserver.sh
shell/strat_gdbserver.sh
+3
-0
No files found.
.vscode/launch.json
View file @
f718a6d9
...
...
@@ -21,6 +21,8 @@
"ignoreFailures"
:
true
,
"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
README.md
View file @
f718a6d9
...
...
@@ -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,就可以实现方便的嵌入式的在线程序测试了。
```
scp_auto.sh
View file @
f718a6d9
...
...
@@ -21,7 +21,7 @@ project_name="${project_path##*/}"
cd
$project_path
#配置目标设备的地址和文件还有密码
expect
-c
"
spawn scp -r Build/bin/helloworld root@192.168.
0.1
15:/home/root/zjftest
spawn scp -r Build/bin/helloworld root@192.168.
2.
15:/home/root/zjftest
expect {
\"
yes/no
\"
{send
\"
yes
\r\"
;}
}
...
...
shell/strat_gdbserver.sh
0 → 100755
View file @
f718a6d9
#! /bin/sh
./gdbserver 192.168.2.15:2222 ./helloworld
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment