ubuntu下安装stm32开发环境 秒杀keil和IAR

2019-12-09 19:13发布

本帖最后由 godsend 于 2014-1-30 17:37 编辑

在windowns下开发stm32刚开始学最烦的就是创建工程模板,都不知道为什么要那样设置,而且步骤繁多。现在我告诉大家一个好消息,在linux下配置stm32开发环境包括创建工程,使用JLink仿真简单到我都不知道怎么写教程了,什么固件库,OPENOCD,都成了浮云。
        先上我自己整理软件,包括eclipse, arm-none-eabi-gcc, stm32 m3 3.5固件库(备用),stm32 for eclipse插件, JLink 4.78驱动,JLink固件(在 JLink 4.78驱动下不丢固件,但要下进去以后在windowns下面升个级),还有stlink驱动,以及串口下载软件都是linux下的,足够让玩stm32的linux用户爽一阵了。
        下载地址   http://pan.baidu.com/s/1c0GJiLE
        
        1.安装arm-none-eabi-gcc:
        直接解压复制到自己的安装目录下。我是在用户目录下建了一个software文件夹,直接放到里面就可以了。
        设置好路径:Ctrl+Alt+T
        键入命令 sudo gedit ~/.profile
        在password:输入自己的密码,不显示。
        在打开的文件最后面添加自己的路径。我的是/home/godsend/software/arm-none-eabi-gcc/bin所以我自己的路径就是        export PATH=$PATH:"/opt/microchip/xc8/v1.21/bin:/home/godsend/software/arm-none-eabi-gcc/bin:/home/godsend/software/opt/FriendlyARM/toolschain/4.4.3/bin:/home/godsend/software/jdk1.7.0/bin:/home/godsend/software/stlink-master:/home/godsend/software/stm32flash"        由于我的软件比较多就是这样,在这要注意一下,不同路径之间用冒号隔开。完了以后重启一下系统,使刚才设置的路径生效。
        打开终端,运行arm-none-eabi-gcc -v  
        如果出现下面的内容就说明arm-none-eabi-gcc已经安装成功。
GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20121207-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
godsend@godsend-Vostro-1088:~$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/home/godsend/software/arm-none-eabi-gcc/bin/../lib/gcc/arm-none-eabi/4.7.3/lto-wrapper
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-7-build/src/gcc/configure --target=arm-none-eabi --prefix=/home/build/work/GCC-4-7-build/install-native --libexecdir=/home/build/work/GCC-4-7-build/install-native/lib --infodir=/home/build/work/GCC-4-7-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-7-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-7-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-7-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-lto --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-7-build/install-native/arm-none-eabi --build=i686-linux-gnu --host=i686-linux-gnu --with-gmp=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-mpfr=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-mpc=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-ppl=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-cloog=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-libelf=/home/build/work/GCC-4-7-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r
Thread model: single
gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305] (GNU Tools for ARM Embedded Processors) 2.安装JLink驱动首先在ubuntu软件中心安装gdebi,右击JLink.deb选择open with的GDebPackage installer来安装(32位系统就选i386,64位系统就选x86_64)。
3.安装eclipse直接解压,复制到自己的安装目录,我的是/home/godsend/software,进入eclipse目录双击eclipse打开,单击菜单栏Help下的Install New Software.打开Install窗口,点击Add,在Name处填STM32(可以随意),在Location右边点击Archive,选择刚下载好的ilg.gnuarmeclipse.repository-1.8.1-201401111229.zip,点击OK arduino.png (29.44 KB, 下载次数: 1) 下载附件 2014-1-30 02:48 上传

写这么多好累,如果哪里有不对的希望各位能够指出,我会及时更正。在linux下真不容易。祝大家好运!

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。