JLink-Utils

来源:互联网 发布:以下哪些淘宝禁售商品 编辑:程序博客网 时间:2024/05/22 11:39

PowerPC系列仿真器的价格让人望而却步,从我个人的情况来开其实只有20%的几率是在用它调试程序,大多的时候都是在烧写Bootloader,于是我利用JLink的硬件环境,实现了一个简单的Flash编程的小工具,

这样就不用再担心loaderImage被破坏了。其实类似的东西很早以前就有了,例如:Jflash-s3c2410,只是他只能烧录s3c2410

 

目前实现的功能有:

1.         菊花链扫描,判断环链上的设备

2.         BYPASS的测试,用于判断信号线连接是否正常

3.         读取Flash Chip ID

4.         Flash指定区域的数据回显出来

5.         实现对flash的擦操作

6.         实现对flash的编程

7.         设置JLinkTCK速率

 

下面是Console Log

 

$ ./JLinkUtils.exe

 

 

    ************************************************************

    **                                                        **

    **         JLink Utils                                    **

    **                                                        **

    **         VERSION: 0.1                                   **

    **         Release Date:    02/06/2010                    **

    **         Build Date  :    Feb  9 2010, 21:09:11         **

    **                                                        **

    ************************************************************

 

File:[jlink.c] Line:[629] J-Link initialization started / target CPU reset initiated

File:[jlink.c] Line:[822] J-Link ARM V7 compiled Apr  1 2009 12:02:10

File:[jlink.c] Line:[835] JLink caps 0x39ff7bbf

File:[jlink.c] Line:[854] JLink hw version 70000

File:[jlink.c] Line:[870] JLink max mem block 9120

File:[jlink.c] Line:[783] Vref = 2.866 TCK = 1 TDI = 1 TDO = 0 TMS = 0 SRST = 0 TRST = 0

 

File:[jlink.c] Line:[642] J-Link JTAG Interface ready

File:[jlink.c] Line:[728] trst: 0, srst: 0

File:[jlink.c] Line:[233] File:[jlink.c] Line:[585] [Jerry debug] Set JCK to : 12000kHz

JLinkUtils-0.1$

JLinkUtils-0.1$ jlink

init    jlink device init

speed   Set Jlink TCK Speed

dcScan  Scan Daisy chain

bypass  BYPASS Test

JLinkUtils-0.1$ jlink dcScan

Found Chip [MPC8247]

JLinkUtils-0.1$ jlink bypass

BYPASS Test Passed! Read Back [0x55555554]

JLinkUtils-0.1$ flash

readId   Read Flash Vendor and Device ID

dump     Dump a buffer from flash address

erase    Erase Flash by sectors

program  Program Flash

JLinkUtils-0.1$ flash

JLinkUtils-0.1$ flash > readId

BdType = System Control Board

Global variables updated.

Use file [./data/pq27e_a.bsdl] to init BSR... Done

Filling array... Done

Manufacturer code Correct: [0xBF]

Device code Correct: [0xD7]

JLinkUtils-0.1$ flash dump 520192 128

BdType = System Control Board

Global variables updated.

Use file [./data/pq27e_a.bsdl] to init BSR... Done

Filling array... Done

00000000: 66746f6d 30286363 6829302c 3a74736f    motfcc(0,0)host:

00000010: 6f777876 2e736b72 3d65205a 2e323931    vxworks.Z e=192.

00000020: 2e383631 30322e31 66663a30 66666666    168.1.200:ffffff

00000030: 68203030 3239313d 3836312e 332e312e    00 h=192.168.1.3

00000040: 313d6720 312e3239 312e3836 7520312e     g=192.168.1.1 u

00000050: 6d73633d 3d777020 316d7363 74203332    =csm pw=csm123 t

00000060: 53433d6e 2041314d 006c3d6f ffffffff    n=CSM1A o=l.....

00000070: ffffffff ffffffff ffffffff ffffffff    ................

JLinkUtils-0.1$ flash> erase 0 127

BdType = System Control Board

Global variables updated.

Use file [./data/pq27e_a.bsdl] to init BSR... Done

Filling array... Done

Flash Erase [0:127] Done

JLinkUtils-0.1$ flash> program u-boot.bin

BdType = System Control Board

Global variables updated.

Use file [./data/pq27e_a.bsdl] to init BSR... Done

Filling array... Done

Start Program flash offset addr 0x0, dataLen 0x431ac

flashProgram Done! 274860 bytes data write

JLinkUtils-0.1$ flash> /q

JLinkUtils-0.1$

Bye