Chinaunix首页 | 论坛 | 博客
  • 博客访问: 655925
  • 博文数量: 185
  • 博客积分: 1875
  • 博客等级: 上尉
  • 技术积分: 2107
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-23 23:21
个人简介

有时候,就是想窥视一下不知道的东东,因为好奇!

文章分类

全部博文(185)

文章存档

2024年(1)

2023年(3)

2020年(1)

2019年(1)

2018年(1)

2017年(2)

2016年(69)

2015年(53)

2014年(14)

2013年(1)

2012年(5)

2011年(25)

2010年(9)

分类: LINUX

2015-07-14 21:25:37

ubuntu环境下stm32开发环境搭建过程记录.

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.  新建工程
    过程如下图
     
     
     
     
     
     

6. 修改代码
   新建原始工程中, 原代码会让GPC.12控制LED闪烁, 并且低电平点亮LED.
   我手上的板子GPC.12引脚没LED,  GPA.0有LED, 高电平点亮LED.
   对应修改修改如下图:
     
7. 指定目标格式
     
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.

  运行r后成功,后面的擦除及写入操作才成功成功.
  各步骤输出如下:
     
     
     
10. 让板子跑起来看结果
   GPA.0对应引脚以H/L=668ms/332ms的波形输出使LED闪烁.
阅读(5023) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~