1. 安装JDK sudo apt-get install openjdk-6-jre-headless
2. 安装eclipse
先从网址:下载安装包eclipse-cpp-mars-R-linux-gtk-x86_64.tar.gz.
以下命令安装 sudo tar xf eclipse-cpp-mars-R-linux-gtk-x86_64.tar.gz -C /opt/
启动eclipse后安装gnuarmeclipse插件
cd /opt/eclipse
./eclipse Help → Install New Software… → Add… fill in Name: with GNU ARM Eclipse Plug-ins fill in Location: with />
以"sudo apt-get install eclipse"的方式安装后, 安装cdt插件时会出现如下错误: "Cannot complete the install because one or more required items could not be found. Software being installed: GNU ARM C/C++ STM32Fx Project Templates 2.2.5.201504061754 (ilg.gnuarmeclipse.templates.stm.feature.group 2.2.5.201504061754) Missing requirement: GNU ARM C/C++ Core 2.8.1.201504061754 (ilg.gnuarmeclipse.core 2.8.1.201504061754) requires 'bundle org.eclipse.core.jobs 3.5.300' but it could not be found Cannot satisfy dependency: From: GNU ARM C/C++ STM32Fx Project Templates 2.2.5.201504061754 (ilg.gnuarmeclipse.templates.stm.feature.group 2.2.5.201504061754) To: ilg.gnuarmeclipse.core [2.8.1.201504061754]"
懒办法, 能跳的坑就跳过吧!
3. 安装交叉编译工具arm-none-eabi-gcc
先下载: />
sudo tar xf gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2 -C /opt/
修改/etc/environment, 将/opt/gcc-arm-none-eabi-4_9-2015q2/bin加入其中
4. 安装JLink驱动
先下载: />
在"Software for Linux"栏选择
Software and documentation pack for Linux V5.00e, DEB Installer 64-bit version(jlink_5.0.5_x86_64.deb)
安装
sudo dpkg -i jlink_5.0.5_x86_64.deb
5. 新建工程
过程如下图
8. 编译
Project->Build All
9. 烧录
过程如下:
a. JLinkExe
b. si 1
c. Device STM32F103RB
d. r
e. erase
f. loadbin /home/hr/Eclipseworkspace/LED_test/Debug/LED_test.bin 0x8000000
g. verifybin /home/hr/Eclipseworkspace/LED_test/Debug/LED_test.bin 0x8000000
其中的r似乎很重要. erase及loadbin操作中多次失败, 并输出以下信息:
****** Error: Failed to download RAMCode!
ERROR: Erase returned with error code -1.