Ubuntu22.04下的问题
Ubuntu22.04使用的python3版本是python3.10, 使用上面的方法直接链接为3.6m已经无法使用. 需要使用新的arm gcc版本.
从 https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads 下载 arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz. 这个版本使用的是 python3.8.
解压后查看gdb版本, 会提示这样的错误
/opt/gcc-arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb --version
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
sys.base_prefix = '/usr'
sys.base_exec_prefix = '/usr'
sys.executable = '/usr/local/bld-tools/bld-tools-virtual-env/bin/python'
sys.prefix = '/usr'
sys.exec_prefix = '/usr'
sys.path = [
'/usr/lib/python38.zip',
'/usr/lib/python3.8',
'/usr/lib/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007faa8ac87c00 (most recent call first):
<no Python frame>
可以通过ppa直接安装python3.8
# 添加仓库
sudo add-apt-repository ppa:deadsnakes/ppa
# 安装, 不会替代系统的python3.10
sudo apt install python3.8
# 检查版本
python3.8 --version
再次查看gdb version就不再提示错误信息
/opt/gcc-arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb --version
GNU gdb (Arm GNU Toolchain 11.3.Rel1) 12.1.90.20220802-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
和 MRS Linux_x64_V1.60 携带的libtinfo.so.5 冲突的问题
在 Ubuntu22.04下, 安装 MRS Linux_x64_V1.60 需要将 libtinfo.so.5 复制到 /usr/lib, 但是这样会导致公版的 arm-none-eabi-gdb无法使用, 具体错误为
s:~$ /opt/gcc-arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb --version
/opt/gcc-arm/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb: /usr/lib/wch/libtinfo.so.5: version `NCURSES_TINFO_6.2.20211010' not found (required by /lib/x86_64-linux-gnu/libncursesw.so.5)
$ /opt/gcc-arm/arm-gnu-toolchain-12.2.mpacbti-bet1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb --version
/opt/gcc-arm/arm-gnu-toolchain-12.2.mpacbti-bet1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb: /usr/lib/wch/libtinfo.so.5: version `NCURSES_TINFO_6.2.20211010' not found (required by /lib/x86_64-linux-gnu/libncursesw.so.5)
删除 /usr/lib/wch/libtinfo.so.5 并运行ldconfig
后工作正常.
使用
点击 Run And Debug 中的绿色运行图标启动Debug, F10 下一步, F11 进入, Shift + F11 跳出. 左侧能观察到变量值和寄存器值. 操作方法和其它IDE基本一致.
参考