zoukankan      html  css  js  c++  java
  • debian下烧写stm32f429I discovery裸机程序

    需要安装openocd软件.如果已安装默认的openocd,需要先卸载系统默认的openocd(默认版本是0.5.0,版本太低),然后再安装.

    在安装前需要安装libusb库文件:

     sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 automake autconf libtool pkg-config

    然后执行安装:

        git clone git://git.code.sf.net/p/openocd/code openocd
        cd openocd
        ./bootstrap
        ./configure --prefix=/usr/local 
            --enable-stlink --enable-jlink
        echo -e "all:
    install:" > doc/Makefile
        make
        sudo make install

    默认情况下openocd会安装到/usr/local/bin文件夹下,有可能会无法执行openocd命令,如果无法执行,可以将/usr/local/bin加入到PATH变量即可。

    安装交叉编译器,下载地址:https://sourcery.mentor.com/sgpp/lite/arm/portal/package7813/public/arm-none-eabi/arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

                                     或者https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2

    本来我想自己写个stm32f429的裸机程序,所以要安装交叉编译器,但是后来考虑到写起来比较慢,还是下篇博文中再讲述如何为stm32f429写裸机程序。

    linux下stm32f429可用的开发库有官方固件库libopencm3两种可以选择.如果选用libopencm3,可以参考libopencm3例程,交叉编译器应选择gcc-arm-embedded。

    可惜的是libopencm3例程中没有stm32f429i-discovery的例子,在其基础上写代码还是有不少难度的。

    我将官方固件库中用于stm32f429i-discovery的hex文件解压,然后压缩成zip文件生成到博客上,可以在这里下载,也可以下载官方固件库后将该文件提取出来。

    将该文件改名为f429.hex(要在命令行下输入名称,太长了不好输入)。

    用miniusb线(通常我们手机的充电线使用microusb,miniusb头要大一些)连接开发板和pc,然后执行下面的步骤。

    然后打开一个控制台,输入下面命令:

    $ sudo openocd -f interface/stlink-v2.cfg  -f board/stm32f429discovery.cfg 

    会得到下面的显示信息:

    Open On-Chip Debugger 0.9.0-dev-00024-g930e41a (2014-06-01-18:50)
    Licensed under GNU GPL v2
    For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
    Warn : Interface already configured, ignoring
    Error: already specified hl_layout stlink
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    Info : This adapter doesn't support configurable speed
    Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
    Info : using stlink api v2
    Info : Target voltage: 2.903844
    Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : accepting 'telnet' connection on tcp/4444
    target state: halted
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x21000000 pc: 0x080001d4 msp: 0x2001fff8
    flash write image erase ~/soft/f429.hex: command requires more arguments
    in procedure 'flash'
    flash write image erase /home/host/soft/f429.hex: command requires more arguments
    in procedure 'flash'
    auto erase enabled
    Info : device id = 0x10036419
    Info : flash size = 2048kbytes
    target state: halted
    target halted due to breakpoint, current mode: Thread 
    xPSR: 0x61000000 pc: 0x20000042 msp: 0x2001fff8
    wrote 1179648 bytes from file /home/host/soft/f429.hex in 44.677387s (25.785 KiB/s)

    然后另外打开一个控制台,执行下面的命令:

    telnet localhost 4444
    halt
    flash write_image erase /home/host/soft/f429.hex
    reset run

    其中,/home/host/soft/f429.hex是我的f429.hex的绝对路径,需要修改成自己的文件的真实路径。

    将开发板复位之后,可以看到需要重新矫正屏幕,矫正之后就可以进入到跟以前一模一样的图形界面。

  • 相关阅读:
    spring-mvc-继续学习
    springMVC学习
    spring-jdbc及事务
    Spring-MVC配置思路
    spring入门-注解的使用
    spring入门
    Spring MVC——数据校验(分组校验)
    Spring MVC——数据校验(数据回显)
    Spring MVC——数据检验步骤
    Spring MVC——参数装填方式
  • 原文地址:https://www.cnblogs.com/qiaoqiao2003/p/3763660.html
Copyright © 2011-2022 走看看