码迷,mamicode.com
首页 > 其他好文 > 详细

debian下使用ft232为stm32f429i-discovery烧写uboot和uImage

时间:2014-06-11 13:18:21      阅读:792      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   java   http   

操作系统:debian

软件: openocd  minicom

硬件:  MiniUSB线、stm32f429i-discovery, WaveShare FT232串口模块(可以在淘宝上买到)

关于openocd的配置可以参看我的博文: 《debian下烧写stm32f429I discovery裸机程序

u-boot源码下载:

bubuko.com,布布扣
git clone https://github.com/EmcraftSystems/u-boot.git
bubuko.com,布布扣

linux源码下载:

bubuko.com,布布扣
git clone https://github.com/EmcraftSystems/linux-emcraft.git
bubuko.com,布布扣

将u-boot和linux源码下载下来后进行编译可以得到uboot和linux二进制文件。

也可以直接下载已经编译好的uboot和linux内核(下载地址)。

我暂时先选择直接下载编译好的uboot(u-boot.bin)和linux内核(下载地址,名为networking.uImage),然后下载到/home/host/soft/stm32f429i-discovery/文件夹下。

 

将FT232的USB口与pc相连。

然后将stm32f429i-discovery与FT232连接(参考链接),连线方式如下:

VDD与VDD相连,GND与GND相连。 PA10(USART_RX)连接FT232的TXD,PA9(USART_TX)链接FT232的RXD。

 

连好后,执行下面命令:

bubuko.com,布布扣
$ dmesg | tail -n 18
[ 7875.657099] pl2303 5-2:1.0: device disconnected
[ 7937.764668] usb 1-1.1: USB disconnect, device number 6
[ 7950.012188] usb 1-1.1: new full-speed USB device number 12 using ehci_hcd
[ 7950.126301] usb 1-1.1: New USB device found, idVendor=0403, idProduct=6001
[ 7950.126308] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7950.126312] usb 1-1.1: Product: FT232R USB UART
[ 7950.126316] usb 1-1.1: Manufacturer: FTDI
[ 7950.126320] usb 1-1.1: SerialNumber: A603T3WV
[ 7950.234911] USB Serial support registered for FTDI USB Serial Device
[ 7950.234981] ftdi_sio 1-1.1:1.0: FTDI USB Serial Device converter detected
[ 7950.235018] usb 1-1.1: Detected FT232RL
[ 7950.235020] usb 1-1.1: Number of endpoints 2
[ 7950.235022] usb 1-1.1: Endpoint 1 MaxPacketSize 64
[ 7950.235024] usb 1-1.1: Endpoint 2 MaxPacketSize 64
[ 7950.235026] usb 1-1.1: Setting MaxPacketSize 64
[ 7950.235595] usb 1-1.1: FTDI USB Serial Device converter now attached to ttyUSB0
[ 7950.235614] usbcore: registered new interface driver ftdi_sio
[ 7950.235616] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
bubuko.com,布布扣

红色字体部分是插入ft232模块后的系统信息,现在可以通过/dev/ttyUSB0来访问ft232串口。

 

参考文章《debian下烧写stm32f429I discovery裸机程序

在一个控制台执行sudo minicom,配置成/dev/ttyUSB0,115200,8N1,No Harware Flow Control,No Software Flow Control.

另一个控制台下执行下面命令:

bubuko.com,布布扣
sudo openocd -f  interface/stlink-v2.cfg -f board/stm32f429discovery.cfg 
bubuko.com,布布扣

再开一个控制台执行下面的命令:

bubuko.com,布布扣
telnet localhost 4444
halt
flash probe 0

flash info 0
flash write_image erase  /home/host/soft/stm32f429i-discovery/u-boot.bin 0x08000000 bin
reset run
bubuko.com,布布扣

其中可以用flash banks查看flash信息:

bubuko.com,布布扣
> flash banks
#0 : stm32f4x.flash (stm32f2x) at 0x08000000, size 0x00200000, buswidth 0, chipwidth 0
bubuko.com,布布扣

flash映射地址位于0x08000000,前面的命令用来将uboot也烧写到这个位置。

 

再参考文章《Loading Linux Images over UART》将内核下载到内存中。

然后就可以在运行minicom的控制台下按任意键看到下面的信息:

bubuko.com,布布扣
U-Boot 2010.03-linux-cortexm-1.12.1 (Jan 21 2014 - 10:22:44)

CPU  : STM32F4 (Cortex-M4)
Freqs: SYSCLK=180MHz,HCLK=180MHz,PCLK1=45MHz,PCLK2=90MHz
Board: STM32F429-DISCOVERY Rev 1.A
DRAM:   8 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   STM32_MAC
Hit any key to stop autoboot:  0 
STM32F429-DISCO> 
bubuko.com,布布扣

 在uboot下执行loady,然后按下快捷键ctrl+A,再按下z键,再按下S键,选择ymodem,然后按g键,输入文件夹路径/home/host/soft/stm32f429i-discovery,多次按下‘向下’键,

直到光标到networking.uImage处,然后按下空格键,同时要保证最下面的光标位于Okay处(如果不在Okay处,可以左右键找到将其移动到Okay处),然后按下回车键,

就会开始传输文件了,等传输完毕后,屏幕中间会显示下面的信息:

bubuko.com,布布扣
Transfer complete                                       
READY: press any key to continue...      
bubuko.com,布布扣

按下任意键,显示下面信息:

bubuko.com,布布扣
## Ready for binary (ymodem) download to 0xD0007FC0 at 115200 bps...                                                       
Cdem - CRC mode, 12442(SOH)/0(STX)/0(CAN) packets, 5 retries
## Total Size      = 0x00184ba0 = 1592224 Bytes
bubuko.com,布布扣

然后在uboot下执行下面命令:

bubuko.com,布布扣
STM32F429-DISCO> bootm 0xd0007fc0
## Booting kernel from Legacy Image at d0007fc0 ...
   Image Name:   Linux-2.6.33-arm1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1592160 Bytes =  1.5 MB
   Load Address: d0008000
   Entry Point:  d0008001
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Linux version 2.6.33-arm1 (vlad@ocean.emcraft.com) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #4 Fri Jan 24 14:49:11 MSK 2014
CPU: ARMv7-M Processor [410fc241] revision 1 (ARMv7M)
CPU: NO data cache, NO instruction cache
Machine: STMicro STM32
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 2032
Kernel command line: stm32_platform=stm-disco console=ttyS0,115200 panic=10 ip=172.17.4.206:172.17.0.1:::stm-disco:eth0:off ethaddr=C0:B1:3C:88:88:85
PID hash table entries: 32 (order: -5, 128 bytes)
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 8MB = 8MB total
Memory: 6496k/6496k available, 1696k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00001000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
    lowmem  : 0xd0000000 - 0xd0800000   (   8 MB)
    modules : 0xd0000000 - 0xd0800000   (   8 MB)
      .init : 0xd0008000 - 0xd0092000   ( 552 kB)
      .text : 0xd0092000 - 0xd017d000   ( 940 kB)
      .data : 0xd017e000 - 0xd018cb60   (  59 kB)
Hierarchical RCU implementation.
NR_IRQS:90
Calibrating delay loop... 36.45 BogoMIPS (lpj=182272)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
Switching to clocksource cm3-systick
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP reno registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: STM32 USART driver
stm32serial.0: ttyS0 at MMIO 0x40011000 (irq = 37) is a STM32 USART Port
console [ttyS0] enabled
blackfin-eth: Using SRAM for DMA buffers from 20001000
blackfin-eth: found MAC at 0x40028000, irq 61
blackfin_mii_bus: probed
found PHY id 0x0 addr 0
eth0: using MII interface
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=00:00, irq=-1)
TCP cubic registered
NET: Registered protocol family 17
ARMv7-M VFP Extension supported
IP-Config: Failed to open eth0
IP-Config: Device `eth0‘ not found.
Freeing init memory: 552K
init started: BusyBox v1.17.0 (2014-01-24 14:46:25 MSK)
~ # ls
bin    dev    etc    httpd  init   mnt    proc   root   sys    usr    var

bubuko.com,布布扣

 

现在uboot和uImage都已经下载成功了,尽情的hack吧!

 

 

debian下使用ft232为stm32f429i-discovery烧写uboot和uImage,布布扣,bubuko.com

debian下使用ft232为stm32f429i-discovery烧写uboot和uImage

标签:style   class   blog   code   java   http   

原文地址:http://www.cnblogs.com/qiaoqiao2003/p/3772057.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!