安装stlink

必须安装libusb-1.0-0-dev, 其他安装不起作用

sudo apt-get install libusb-1.0--dev
git clone https://github.com/texane/stlink.git
cd stlink/
make clean
make
cd build/Release/
sudo make install

安装openocd

tar zxvf openocd-0.10..tar.gz
cd openocd-0.10./
./configure
make
sudo make install

Update 2018-05-11: 在Ubuntu18.04下, 无法使用tar包编译安装, 如果带 --enable-stlink会报错误 configure: error: libusb-1.x is required for the ST-Link JTAG Programmer, 但是不带这个参数一样无法通过编译, 经apt-cache show openocd发现版本是 0.10.0-4, 于是直接通过apt-get install安装

安装 gcc-arm-none-eabi

tar xvf gcc-arm-none-eabi-5_4-2016q3--linux.tar.bz2
cd /opt/
sudo mkdir gcc-arm
cd gcc-arm/
sudo mv ~/Backup/linux/gcc-arm-none-eabi-5_4-2016q3/ .
sudo chown -R root:root gcc-arm-none-eabi-5_4-2016q3/
/opt/gcc-arm/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gcc -v

Update 2018-05-11: 在Ubuntu18.04下, 自带的版本是 Version: 15:6.3.1+svn253039-1build1, 这个应该是比2016q4还更新的版本, 从官方下载的版本是 https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 . 使用2017q4这个版本编译安装后工作正常

将gcc-arm-none-eabi executables添加到PATH

edit ~/.profile, edit the last line

PATH="$HOME/bin:$HOME/.local/bin:/opt/gcc-arm/gcc-arm-none-eabi-5_4-2016q3/bin/:$PATH"

then run: source .prifle to make it take effect

硬件准备

.

硬件连接
st-link pin to STM32F103C8T6 mini board(SWD)
GND     G
SWCLK   CLK
SWDIO   IO
3.3V    V3

连接到PC后的dmesg输出

[10371.046367] usb -1.2: new full-speed USB device number  using ehci-pci
[10371.157440] usb -1.2: New USB device found, idVendor=, idProduct=
[10371.157448] usb -1.2: New USB device strings: Mfr=, Product=, SerialNumber=
[10371.157453] usb -1.2: Product: STM32 STLink
[10371.157457] usb -1.2: Manufacturer: STMicroelectronics
[10371.157461] usb -1.2: SerialNumber: VÿkIfHV'Fg

写入

$:~/ArmProjects/simple-gcc-stm32-project$ openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg  -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c init -c halt -c "flash write_image erase LED_project.hex" -c reset -c shutdown
Open On-Chip Debugger 0.10.
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: kHz
adapter_nsrst_delay:
none separate
Info : Unable to match requested speed kHz, using kHz
Info : Unable to match requested speed kHz, using kHz
Info : clock speed kHz
Info : STLINK v2 JTAG v21 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.256122
Info : stm32f1x.cpu: hardware has breakpoints, watchpoints
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x0800026e msp: 0x200003f0
auto erase enabled
Info : device id = 0x20036410
Info : flash size = 64kbytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x200003f0
wrote bytes from file LED_project.hex in .431739s (16.213 KiB/s)
shutdown command invoked

.

Ubuntu16.04下的stm32环境配置的更多相关文章

  1. Ubuntu 16.04下的LAMP环境配置

    在学习开发过程中,每当遇到新的问题时,通常都能在网上搜到解决的方法,但是网上的方法千千万,有些是已经过时了的,有些是跟自己开发环境不同的,总是不能第一时间能找到答案. 而当时遇到的问题可能在今后的开发 ...

  2. 联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明

    目录 联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明 联盛德 HLK-W806 (二): Win10下的开发环境配置, 编译和烧录说明 联盛德 HLK-W ...

  3. Ubuntu16.04安装后开发环境配置和常用软件安装

    Ubuntu16.04安装后1.安装常用软件搜狗输入法+编辑器Atom+浏览器Chome+视频播放器vlc+图像编辑器GIMP Image Editor安装+视频录制软件RcordMyDesktop安 ...

  4. Ubuntu16.04下搭建开发环境及编译tiny4412 Android系统【转】

    本文转载自:http://blog.csdn.net/songze_lee/article/details/72808631 版权声明:本文为博主原创文章,未经博主允许不得转载. 1.安装ssh服务器 ...

  5. Ubuntu16.04下安装virtualbox,配置及卸载

    我是通过添加源的方式安装 将下边的命令添加到/etc/apt/source.list中 deb https://download.virtualbox.org/virtualbox/debian xe ...

  6. ubuntu16.04下zabbix安装和配置

    介绍 Zabbix是用于网络和应用的开源监控软件. 它提供从服务器,虚拟机和任何其他类型的网络设备收集的数千个度量的实时监控. 这些指标可以帮助您确定IT基础架构的当前运行状况,并在客户投诉之前检测硬 ...

  7. Ubuntu16.04下伪分布式环境搭建之hadoop、jdk、Hbase、phoenix的安装与配置

    一.准备工作 安装包链接: https://pan.baidu.com/s/1i6oNmOd 密码: i6nc 环境准备 修改hostname: $ sudo vi /etc/hostname why ...

  8. Ubuntu16.04的PHP开发环境配置

    \3c a { text-decoration: none } 自从换了php开发之后发现还是开源语言才是长久之道,开发环境搭建方便,支持的平台也多,性能也好,考虑到这些,其他一些不如意也就不足为虑了 ...

  9. ubuntu16.04下hive安装与配置

    Hive是什么? 由Facebook开源用于解决海量 结构化日志的数据统计: Hive是基于Hadoop的一个 数据仓库工具,可以将结构化的数据文件映射 成一张表,并提供类SQL查询功能: 构建在Ha ...

随机推荐

  1. Eclipse自定义的透视图如何删除掉?

  2. JQuery Ajax 在asp.net中使用总结

    自从有了JQuery,Ajax的使用变的越来越方便了,但是使用中还是会或多或少的出现一些让人短时间内痛苦的问题.本文暂时总结一些在使用JQuery Ajax中应该注意的问题,如有不恰当或者不完善的地方 ...

  3. C#利用tabControl控件实现多窗体嵌入及关闭

    创建一个主窗体(Formmain).两个副窗体(Form1,Form2);在主窗体中分别添加一个menuStrip控件.tabControl控件,并在menu控件上添加一个主菜单和两个子菜单   继而 ...

  4. 【LeetCode】Number of Islands

    Number of Islands 问题描写叙述 Given a 2d grid map of '1's (land) and '0's (water), count the number of is ...

  5. Android -- getWidth()与getMeasuredWidth()

    getWidth() Return the width of the your view. Returns The width of your view, in pixels. 源代码: public ...

  6. Android -- TypedArray

    当我们自定义View的时候,在给View赋值一些长度宽度的时候,一般都是在layout布局文件中进行的.,比如android:layout_height="wrap_content" ...

  7. ssh tunnel

    https://peppoj.net/2012/10/tunnel-http-traffic-encrypted-using-polipo-and-ssh/ --------------------- ...

  8. RateLimiter 限流

    @RestControllerpublic class RateLimiterController { private RateLimiter rateLimiter = RateLimiter.cr ...

  9. XE6入门(二)项目中的文件

    XE6中项目文件为DPR,查看方法请参考一下以前写过的博文: "Delphi项目构成之项目文件DPR" 项目文件DPR 通过主菜单[Project | View Source],就 ...

  10. 如何让windows更高效?

    首先解释一下个标题: "让windows更高效,既指让windows更友好更优化,也指可以让使用windows来工作或学习的人更高效的工作学习." 解释下本文的动机: 指导我自己或 ...