安装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. NOI2015滚粗记

    我的第一次也是最后一次NOI 好像写的晚了许多……可能一谈到退役总会有些伤感,并不愿去面对…… 一路走来已有5年,虽然我总在说“其实我好好学的时间只有半年”,但那也不过是给自己是蒟蒻找的借口吧...一 ...

  2. Excel VBA 从一个工作簿查找另一个一个工作簿中的一些内容复制到另外一个工作簿

    帮朋友来写个Excel VBA 以前写过ASP,所以对vb略微熟悉,但VBA 没有仔细研究过. 以前只研究过 vba 写一个 计算个人所得税的程序. 这次写的功能也算是简单,但也耗费了两天的功夫. 需 ...

  3. google chrome 删除重复的书签 about sync

    之前 由于 谷歌 同步的不智能,且不询问用户同步方法和细节,导致我的书签包括了大量重复的书签,想去除重复的书签. 由于谷歌书签文件 存储在:C:\Documents and Settings\Admi ...

  4. [leetcode]Distinct Subsequences @ Python

    原题地址:https://oj.leetcode.com/problems/distinct-subsequences/ 题意: Given a string S and a string T, co ...

  5. ORM数据库框架 SQLite ORMLite MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  6. 对Kalman(卡尔曼)滤波器的理解@@zz

    1.简介(Brief Introduction) 在学习卡尔曼滤波器之前,首先看看为什么叫“卡尔曼”.跟其他著名的理论(例如傅立叶变换,泰勒级数等等)一样,卡尔曼也是一个人的名字,而跟他们不同的是,他 ...

  7. php7安装mongoDB扩展

    本文我们使用pecl命令来安装 首先来到php7的安装目录 $ /usr/local/php7/bin/pecl install mongodb 回车,执行成功后,会输出以下结果: …… Build ...

  8. Flask传递中文URL时的问题

    在非IE浏览器上都很好,几乎不用处理,但IE不行,学习了半天,有以下要点: 1.Meta如果设置了编码,如UTF8,浏览器都将中文转码发送,但IE不会! <meta http-equiv=&qu ...

  9. Hdfs dfs命令使用

    如果是把数据放在了hdfs系统,那么我们如何访问他们呢? 1.hdfs查看文件夹 ./hdfs dfs -ls hdfs://mycluster/output/online/ 2.hdfs创建目录df ...

  10. [Algorithm] Find merge point of two linked list

    Assume we have two linked list, we want to find a point in each list, from which all the the nodes s ...