概述
Ubuntu18.04 :cubeMx + vscode+stLink
- cubemx 安装
- vscode 安装
- cubemx 生成项目
- 1. 编译
- 更新: 重启终端后失效
- 2 安装openocd
- 3 安装stlink
- 4 烧录bin文件
cubemx 安装
无错误
vscode 安装
无错误
cubemx 生成项目
正常
1. 编译
出现 /bin/sh: 1: arm-none-eabi-gcc: not found
安装交叉编译:https://blog.csdn.net/u013491946/article/details/72782344
sudo apt-get install gcc-arm-linux-gnueabi
出现 gcc-arm-linux-gnueabi : 依赖: gcc-7-arm-linux-gnueabi (>= 7.3.0-12~) 无法安装
sudo apt-get install gcc-arm-none-eabi
正常安装
编译,出现
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o: Conflicting CPU architectures 13/1
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/crt0.o
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-atexit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-atexit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-fini.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-fini.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-impure.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-impure.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-init.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-init.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memset.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-memset.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__atexit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__atexit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__call_atexit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-__call_atexit.o)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build/test_spi.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(_exit.o) does not
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libnosys.a(_exit.o)
collect2: error: ld returned 1 exit status
Makefile:173: recipe for target 'build/test_spi.elf' failed
make: *** [build/test_spi.elf] Error 1
解决
按照 https://segmentfault.com/a/1190000039929141
新增PPA的方式进行安装arm-none-eabi-gcc
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded
出现错误
正准备解包 .../gcc-arm-embedded_7-2018q2-1~bionic1_amd64.deb ...
正在解包 gcc-arm-embedded (7-2018q2-1~bionic1) ...
dpkg: 处理归档 /var/cache/apt/archives/gcc-arm-embedded_7-2018q2-1~bionic1_amd64.deb (--unpack)时出错:
正试图覆盖 /usr/bin/arm-none-eabi-addr2line,它同时被包含于软件包 binutils-arm-none-eabi 2.27-9ubuntu1+9
dpkg-deb: 错误: 粘贴 子进程被信号(断开的管道) 终止了
在处理时有错误发生:
/var/cache/apt/archives/gcc-arm-embedded_7-2018q2-1~bionic1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
卸载 sudo apt-get remove gcc-arm-none-eabi
执行make,编译居然成功。。。。
至于原因,未知
更新: 重启终端后失效
需要源码安装版本 GNU Tools for Arm Embedded Processors 7-2018-q2-update ,更改/etc/profile 后重启生效,问题解决
下载地址
https://developer.arm.com/downloads/-/gnu-rm
2 安装openocd
sudo apt-get install openocd
无错误
3 安装stlink
https://github.com/stlink-org/stlink 下载deb
安装 无错误
4 烧录bin文件
st-flash write ./build/你的目标文件.bin 0x08000000
出现错误
st-flash: symbol lookup error: /usr/lib/libstlink.so.1: undefined symbol: libusb_set_option
源码安装stlink 无错误
执行烧录,出现错误
st-flash 1.7.0
Failed to parse flash type or unrecognized flash type
2022-06-14T20:59:06 ERROR common.c: Can not connect to target. Please use 'connect under reset' and try again
Failed to connect to target
按住reset烧录,出现:
Unknown memory region
解决办法:需要额外给芯片供电
至此,踩坑完毕
最后
以上就是眯眯眼牛排为你收集整理的Ubuntu18.04 :cubeMx + vscode+stLink 踩坑cubemx 安装vscode 安装cubemx 生成项目的全部内容,希望文章能够帮你解决Ubuntu18.04 :cubeMx + vscode+stLink 踩坑cubemx 安装vscode 安装cubemx 生成项目所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复