嵌入式Linux之旅——環境搭建篇之燒寫裸機程序


  本小節將介紹如何使用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

  下一小節,將會介紹如何燒寫整個系統。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM