Affinic Debugger
http://www.affinic.com/
Code::Blocks 20.03
1.) Run command to add the PPA repository:
sudo add-apt-repository ppa:codeblocks-devs/release sudo apt update
#codeblocks-contrib 修改快捷键必须要安装 sudo apt install codeblocks codeblocks-contrib
nightly-build codeblocks (不建议安装,直接使用stable版本)
https://wxstuff.xaviou.fr/article/debian-repository.html
sudo -s apt install apt-transport-https gvim /etc/apt/sources.list ##check version of Debian cat /etc/debian_version ##For Debian 9 (Stretch): deb https://apt.xaviou.fr/oldstable/ stretch main deb-src https://apt.xaviou.fr/oldstable/ stretch main ##And for Debian 10 (Buster): deb https://apt.xaviou.fr/stable/ buster main deb-src https://apt.xaviou.fr/stable/ buster main wget -O- https://apt.xaviou.fr/key.asc | apt-key add - touch /etc/apt/preferences.d/codeblocks gvim codeblocks Package: * Pin: origin apt.xaviou.fr Pin-Priority: 999 apt update apt install codeblocks
1)“File -> New -> Project”,选择“Empty Project”并创建。
2)选中 Project,右键,选择“Add files”,将 c/c++ 和 head files 加入工程。
3)选中 Project,右键,选择“Properties”,“Project settings”选项卡中的“Makefile”填入Makefile 文件名,并勾选“This is a custom Makefile”。
4)选中 Project,右键,选择“Build options”,删除“"Make" command”选项卡中所有的“$target”。 (可以修改为执行脚本 sh build.sh)
Selected compiler 需要选择系统已有的compiler(GNU GCC Compiler) 即使Makefile使用的是别的Compiler
Code::Blocks自定义文件代码高亮和自动补全
代码高亮简单的步骤说明:
Settings --> Editor... --> Syntax hignlighting... --> Syntax hignlighting for: MASM Assembly --> Filemasks...;
在编辑框中加上你要高亮的代码后缀,比如我的就是*.s(中间逗号分割)。
C/C++ 文件 自动补全简单的步骤说明:
Settings --> Editor... --> Code completion --> C/C++ parser(adv.);
在“File extentions to parse as source files...”下面编辑框中加入你要代码自动完成的C/C++文件代码后缀。
Eclipse
远程手动运行方式
1、在目标板上运行 gdbserver,
2、配置CDT的Debug选项,步骤如下:
-
选中项目→菜单栏 ”Run“→Debug Configurations…
-
双击 C/C++ Remote Application 新建一个配置,Eclipse会根据当前选择的项目初始化大部分配置,这里只需修改Debugger配置页
-
在右下方点击“Select other”,选择“GDB(DSF) Manual Remote Debugging Launcher”,确认
-
选择进入Debugger配置页,在Main标签中,GDB debugger 填写 arm-linux-gdb,如果未加入PATH环境变量则应该填入绝对路径, Stop on startup at (调试uboot填reset, 调试linux_kernel填start_kernel)
-
在Debugger配置页的Shared Libraries标签中,可以添加库路径,比如调试过程中要步入外部函数,就必须在这里给出带调试信息的库文件路径,否则会找不到该函数的定义
-
在Debugger配置页的Connection标签中,Type选“TCP”,并填写目标板上gdbserver监听的IP和端口号
-
所有配置完成后,点 Debug调试
Eclipse 的DevStyle主题安装
https://www.genuitec.com/products/devstyle/download/
help---->install new software---->Add---->输入名字、输入网址:
http://www.genuitec.com/updates/devstyle/ci/
等待Eclipse右下角Installing Software 100%, 安装完毕后重启即可
VS CODE
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/u-boot", "args": [], "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "targetArchitecture": "arm", "miDebuggerPath":"/usr/bin/gdb-multiarch", "miDebuggerServerAddress": "localhost:1234", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
-exec add-symbol-file u-boot 0x7ff7f000
[answered Y; input not from terminal]
-exec set confirm off