Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10807418
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:31:41

描述:
基于openwince中的jtag子项目()
加入对新的JTAG器件和JTAG cable的支持。在原有的基础上,加入了对s3c44b0x的
支持,加入了对所谓的cfly.org JTAG cable的支持。(为何打不开?)

openwince中的jtag项目有很多好的特性:
1. 九分好的程序结构加上合理的目录结构:方便扩展JTAG cable和JTAG-aware device。
之所以不说十分好,是我发现其Flash探测部分还不够好,程序使用一个统一的函数探测flash,
而最好的方式应该像linux的pci或usb子系统那样,把probe()做为驱动的一部分。
2. 支持脚本。
3. 支持对Flash的烧写。
4. 提供了一个bsdl文件的解析器,只要IC厂商提供bsdl文件,就能自动生成对应的配置文件。

使用方法:
看INSTALL和README。下面有个在我的44b0x上使用时的屏幕输出.(/**/之间为注释)
编译采用基本步骤:解压,  make,
可执行文件生成在/src目录中,运行时必须在此目录中运行,否则找不到/data目录。

jtag> script jtaginit.rc /* jtaginit.rc是一个初始化的脚本 */
Initializing Cfly JTAG Cable on parallel port at 0x378
IR length: 4
Chain length: 1
Device Id: 00011111000011110000111100001111
Manufacturer: Samsung
Part: S3C44B0X
Stepping: V1
Filename: ../data/samsung/s3c44b0x/s3c44b0x
11011000011110110110111111111111111111101101101101101101101101101101101111101101 10110110110110110110110110110110110110110110101010101010101101010101010101000000 00000010001010101100111000010000110101011010101001010101011101011111111110100101 11111110111110111
No. Manufacturer Part Stepping Instruction Register
-------------------------------------------------------------------------------- -------------
0 Samsung S3C44B0X V1 SAMPLE/PRELOAD BSR
*0: Samsung S3C44B0X compatible bus driver via BSR (JTAG part No. 0)
jtag> script erasechip.rc /* 擦除整个Flash, Flash芯片为SST39VF1601 */
jtag> peek 0x00 /* 读地址0x0处的值, 可见擦除后为0 */
bus_read(0x00000000) = 0x0000FFFF (65535)
jtag> peek 0x02 /* s3c44b0x的A1接到Flash的A0, 所以第2个单元的地址为0x2 */
bus_read(0x00000002) = 0x0000FFFF (65535)
jtag> script wordprogram.rc /* 执行word program命令 */
jtag> poke 0x00 0x1245 /* 在0x0处写0x1245 */
jtag> script wordprogram.rc /* 单字写入时,每次写入之前都必须执行word program命令 */
jtag> poke 0x02 0xac3e /* 在0x2处写0xac3e */
jtag> peek 0x00
bus_read(0x00000000) = 0x00001245 (4677) /* 看看是否写入了正确的值。BINGO! */
jtag> peek 0x02
bus_read(0x00000002) = 0x0000AC3E (44094)
jtag>


继续开发:
可惜这个sourceforge上的项目很久没有进展了,程序也基本没什么文档。
doc/source_comment.txt是我写的一点点。

//////////////////////////////////////////////////////////////////////////////////////////////////
//-- Nov 30, 2005更新, 增加对SST39VF1601 Flash的支持,可将bin文件写入flash

jtag> detectflash 0x0
jedec_detect: mid bf, did 234b
Query identification string:
Primary Algorithm Command Set and Control Interface ID Code: 0x00BF (SST Standard Command Set)
Alternate Algorithm Command Set and Control Interface ID Code: 0x0000 (null)
Query system interface information:
Vcc Logic Supply Minimum Write/Erase or Write voltage: 0 mV
Vcc Logic Supply Maximum Write/Erase or Write voltage: 0 mV
Vpp [Programming] Supply Minimum Write/Erase voltage: 0 mV
Vpp [Programming] Supply Maximum Write/Erase voltage: 0 mV
Typical timeout per single byte/word program: 0 us
Typical timeout for maximum-size multi-byte program: 0 us
Typical timeout per individual block erase: 0 ms
Typical timeout for full chip erase: 0 ms
Maximum timeout for byte/word program: 0 us
Maximum timeout for multi-byte program: 0 us
Maximum timeout per individual block erase: 0 ms
Maximum timeout for chip erase: 0 ms
Device geometry definition:
Device Size: 2097152 B (2048 KiB, 2 MiB)
Flash Device Interface Code description: 0x0001 (x16)
Maximum number of bytes in multi-byte program: 0
Number of Erase Block Regions within device: 1
Erase Block Region Information:
Region 0:
Erase Block Size: 4096 B (4 KiB)
Number of Erase Blocks: 512
jtag> flashmem 0x0 hello.bin /*将hello.bin写入Flash地址0x0开始的空间*/
sst_flash_autodetect8...bus_width: 2..
sst_flash_autodetect16...bus_width: 2..
Chip: SST Flash
Manufacturer: SST
Chip: SST39VF1601
Protected: 0000
program:
flash_unlock_block 0x00000000 IGNORE

block 0 unlocked
sst_flash_erase_block 0x00000000
.flash_erase_block 0x00000000 DONE
erasing block 0: 0
flash_unlock_block 0x00001000 IGNORE

block 1 unlocked
sst_flash_erase_block 0x00001000
.flash_erase_block 0x00001000 DONE
erasing block 1: 0
flash_unlock_block 0x00002000 IGNORE

block 2 unlocked
sst_flash_erase_block 0x00002000
.flash_erase_block 0x00002000 DONE
erasing block 2: 0
flash_unlock_block 0x00003000 IGNORE

block 3 unlocked
sst_flash_erase_block 0x00003000
.flash_erase_block 0x00003000 DONE
erasing block 3: 0
flash_unlock_block 0x00004000 IGNORE

block 4 unlocked
sst_flash_erase_block 0x00004000
.flash_erase_block 0x00004000 DONE
erasing block 4: 0
flash_unlock_block 0x00005000 IGNORE

block 5 unlocked
sst_flash_erase_block 0x00005000
flash_erase_block 0x00005000 DONE
erasing block 5: 0
flash_unlock_block 0x00006000 IGNORE

block 6 unlocked
sst_flash_erase_block 0x00006000
.flash_erase_block 0x00006000 DONE
erasing block 6: 0
addr: 0x00006348 (done)
verify:
addr: 0x00006346
Done.

阅读(1395) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~