您的位置:首页 > 运维架构 > Linux

嵌入式Linux之旅——环境搭建篇之烧写裸机程序

2016-02-02 22:32 357 查看
  本小节将介绍如何使用oflash和openjtag烧写裸机程序。oflash也支持并口烧写,方法与openjtag类似。如果你想使用jlink烧写,需要安装SEGGER的J-Flash的工具,这里我们就不多介绍。

  首先需要先安装oflash,oflash由开发板厂商提供或者从网上下载。将oflash加上可执行权限,拷贝到“/usr/bin”目录下即可。命令如下:

    sudo cp oflash /usr/bin/ && sudo chmod +x /usr/bin/oflash

  下面就是具体的烧录过程了,我们以烧写 u-boot 为例。首先, u-boot 是一个大一点的裸机程序;第二,烧好 u-boot 为我们下一小节烧写系统会提供便利。我们需要切换到 u-boot.bin 所在的路径,执行如下命令:

    sudo oflash u-boot.bin

  执行结果如下:

+---------------------------------------------------------+
| Flash Programmer v1.3 for OpenJTAG of www.100ask.net |
| OpenJTAG is a USB to JTAG & RS232 tool based FT2232 |
| This programmer supports both of S3C2410X & S3C2440 |
| Author: Email/MSN(thisway.diy@163.com), QQ(17653039) |
+---------------------------------------------------------+
Usage:
1. oflash, run with cfg.txt or prompt
2. oflash [file], write [file] to flash with prompt
3. oflash [-f config_file]
4. oflash [jtag_type] [cpu_type] [flash_type] [read_or_write] [offset] [file]
Select the JTAG type:
0. OpenJTAG
1. Dongle JTAG(parallel port)
Enter the number: 0

  如上所示,我选择OpenJTAG,让我们接着选择:

Select the CPU:
1. S3C2410X
2. S3C2440X
Enter the number: 2


  如上所示,我选择S3C2440X,让我们接着选择:

'ft2232' interface using libftdi with 'USB<=>JTAG&RS232' layout (1457:5118)
current latency timer: 2
FTDI chip type: 2 "2232C"
S3C24X0 detected, cpuID = 0x0032409d

[Main Menu]
0:Nand Flash prog     1:Nor Flash prog   2:Memory Rd/Wr     3:Exit
Select the function to test:0


  选择烧写在Nand Flash中,当然也可以选择烧写在Nor Flash中,接着会选择:

[NAND Flash JTAG Programmer]
Scan nand flash:
Device 0: NAND 256MiB 3,3V 8-bit, sector size 128 KiB
Total size: 256 MiB
0:Nand Flash Program      1:Nand Flash Print BlkPage   2:Exit
Select the function to test :0


  选择烧写在Nand Flash中,选项一是读取Nand Flash的某一部分,接着选择:

[NAND Flash Writing Program]

Source size: 0x306ac

Available target block number: 0~2047
Input target block number:0


  出现了我们要烧写的bin文件的大小,以及让我们选择烧写在哪个块里面,选择烧写在第0块,刚开始的地方。接着就开始烧写了,稍等片刻即可烧写成功。

  当然,如果比较熟悉烧写的过程,可以将上述过程一起放在一个命令里:

    sudo oflash 0 2 0 0 0 u-boot.bin

  下一小节,将会介绍如何烧写整个系统。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: