01.Ubuntu下开发STM32--软件搭建

16 篇文章 1 订阅

记事本用习惯了,论坛写帖子的时候动不动Ctrl+S一下。。。

在Ubuntu下开发STM32,两个常用软件是必须的。
  • 我们的交叉编译器,arm-none-eabi-xxx。
  • st-link的驱动。这里的st-link并不像我们windows下面用的那样,一路点Next就好了。这里我们需要从github上面下载源码,自己编译,安装。st-link不仅仅是我们下载代码的工具,更是我们使用gdb调试的基础。
linux对USB虚拟串口的支持

linux下自带虚拟串口的驱动。不需要手动安装。linux对串口的命名不同于windows。像CP2102之类的USB转串口,是ttyUSBx,虚拟串口之类的是ttyACMx。我们先来找一下串口的编号。所有的设备都在/dev目录下。那么插Nucleo前后/dev中的新增项就是Nucleo的串口。

  • 在未插Nucleo之前,保存所有的设备名字到before.txt---->ls /dev >before.txt
  • 在插上Nucleo之后,保存所有的设备名字到after.txt------>ls /dev >after.txt
  • 使用diff查看改动—>diff before.txt after.txt
  • 看到新增项,ttyACM0就是我们Nucleo的串口编号。
常用的串口软件:

在linux下工作,串口软件我更喜欢minicom。他小巧,使用控制台窗口。有多种模式可以选择。当然,putty也是一个不错的选择。

  • 安装minicom: sudo apt-get install minicom
  • 或者安装putty: sudo apt-get install putty
  • 安装完minicom之后,需要简单的配置一下。比如串口号,波特率,通信协议等等。可以使用sudo minicom -s 进行配置。
st-link的安装:

在github上有st-link在linux下的源代码。为了操作简便,还是在使用st-link之前将它升级为v2。

  • 在http://github.com/texane/stlink 下下载源码。
  • 在README Markdown文件中,有详细的安装说明。按照他的要求做就行啦。
  • ./autogen.sh ./configure sudo make install
  • 如果你在执行 ./autogen.sh的时候,出现错误,可以打开这个文件:autoreconf --install --force --verbose 。其实错误的原因还是autoreconf命令没有安装。在Ubuntu下使用sudo apt-get install autoconf安装完就可以了。
  • 安装完st-link之后,记得将他的路径添加到PATH中。具体的方法请参考Google。
  • 具体的使用方法,可以参阅 st-flash --help。这个命令是下载使用的。如果想配合gdb调试使用,需要使用st-util。
arm-none-eabi-xxx的安装

arm-none-eabi-xxx不仅仅包含gcc,g++,而是一整套完整的工具链。像CoIDE,RIDE,TrueStudio这些都是使用它作为编译工具的。只不过在命令行的基础上,套上了一个Eclipse的壳子罢了。

  • Step1: Inside Ubuntu, open a terminal and input
    “sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded”
  • Step2: Continue to input
    ​ “sudo apt-get update”
  • Step3: Continue to input to install toolchain
    “sudo apt-get install gcc-arm-none-eabi”
  • To remove installed toolchain, just input “sudo apt-get remove gcc-arm-none-eabi”.
  • To update the toolchain, just repeat above step2 and step3.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
W: http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://archive.ubuntu.com/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed. W: http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://security.ubuntu.com/ubuntu jammy-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed. W: http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://archive.ubuntu.com/ubuntu jammy-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed. W: http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://archive.ubuntu.com/ubuntu jammy-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed. E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true' E: Sub-process returned an error code
06-07

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值