2007年11月2日 星期五

Open-OCD - Open On-Chip Debug

Real Checko's Blog

OpenOCD , test run


得知 有這個工具
是一個透過 jtagwriter 可以 debug的工具

原始網站

Open On-Chip Debugger

binary 下載位置

下載下來是一個安裝執行檔
我自己裝在
D:\openocd-2007re204
取代原本的 c:\programfile底下
沒什麼太大的原因
只希望打開D:後
可以很快打開該目錄而已

form readme.txt
可以得知目前 support
This version of openocd supports the following ARM7/9 cores:
- ARM7TDMI(-s)
- ARM9TDMI
- ARM920t
- ARM922t
- ARM926ej-s
- ARM966e
- Cortex-M3
Support for Intel XScale CPUs is also included:
- PXA25x
- PXA27x
- IXP42x

cpu是 arm920t
試了
//////////////
D:\openocd-2007re204\bin>openocd-pp -f .\configs\arm9_ft2232.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Info: configuration.c:50 configuration_output_handler(): Command ft2232_devi
e_desc not found
Info: configuration.c:50 configuration_output_handler(): Command ft2232_layo
t not found
Info: configuration.c:50 configuration_output_handler(): Command ft2232_vid_
id not found
Error: jtag.c:1461 jtag_init(): No valid jtag interface found (ft2232)
Error: jtag.c:1462 jtag_init(): compiled-in jtag interfaces:
Error: jtag.c:1465 jtag_init(): 0: parport

D:\openocd-2007re204\bin>openocd-pp -f .\configs\arm9_ft2232.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Info: configuration.c:50 configuration_output_handler(): Command ft2232_devi
e_desc not found
Info: configuration.c:50 configuration_output_handler(): Command ft2232_layo
t not found
Info: configuration.c:50 configuration_output_handler(): Command ft2232_vid_
id not found
Error: jtag.c:1461 jtag_init(): No valid jtag interface found (ft2232)
Error: jtag.c:1462 jtag_init(): compiled-in jtag interfaces:
Error: jtag.c:1465 jtag_init(): 0: parport

//////////////

失敗

在try看看

透過Facebook分享

6 則留言:

checko 提到...

是cfg 的設定呀:
-f .\configs\arm9_ft2232.cfg

要設成用printer port.

鍾志均 提到...

參考 "OpenOCD , test run"

拿arm9_ft2232.cfg來改
#interface
interface ft2232
ft2232_device_desc "Amontec JTAGkey A"
ft2232_layout "jtagkey"
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 1
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst
修改成
#interface
interface parport
parport_port 0x378
parport_cable sjf
jtag_speed 8
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst

在run一次
D:\openocd-2007re204\bin>openocd-pp -f .\configs\arm9_parportnelson.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Error: parport.c:332 parport_init(): No matching cable found for sjf

鍾志均 提到...

charles makd source code 把 sjf加到jtag/parport.c

我把 sjf 拿掉
D:\openocd-2007re204\bin>openocd-pp -f .\configs\arm9_parportnelson.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Warning: parport.c:317 parport_init(): No parport cable specified, using default
'wiggler'
Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check con
nection, JTAG interface, target power etc.
Error: jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anywa
y...
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1448 jtag_init(): Could not validate JTAG chain, exit

改用 wiggler
D:\openocd-2007re204\bin>openocd-pp -f .\configs\arm9_parportnelson.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check con
nection, JTAG interface, target power etc.
Error: jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anywa
y...
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR
mismatch, scan returned 0x3f
Error: jtag.c:1448 jtag_init(): Could not validate JTAG chain, exit
不行
不知道有沒有動態的方式
可以把 charles 處理好的 { "sjf", 0x80, 0x00, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 } 給 dynamic 載入使用

鍾志均 提到...

charles說 我們的pin腳對應跟chameleon一樣
所以拿他的來用
從\bin\configs\chameleon.cfg的內容

改成
#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface parport
parport_cable chameleon
jtag_speed 0

#jtag scan chain
# format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 5 0x01 0x1f 0x01

改成chares此篇文章
"openocd + arm-elf-insight"
修改成
#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface parport
parport_port 0x378
parport_cable chameleon
jtag_speed 8

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst #srst_pulls_trst

#jtag scan chain
# format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
#jtag_device 5 0x01 0x1f 0x01
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup attach
#target
target arm920t little reset_run 0 arm920t
#working_area 0 0x200000 0x4000 backup
run_and_halt_time 0 5000
就會出現
D:\openocd-2007re204\bin>openocd-pp -f openocd-rtk.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)

在修改期間
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst #srst_pulls_trst
and
這個
#target configuration
daemon_startup attach
#target
target arm920t little reset_run 0 arm920t
#working_area 0 0x200000 0x4000 backup
run_and_halt_time 0 5000
還沒有加入之前
有出現過 some message
D:\openocd-2007re204\bin>openocd-pp -f openocd-rtk.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Warning: gdb_server.c:1430 gdb_init(): no gdb ports allocated as no target has b
een specified
也紀錄一下

有出現

鍾志均 提到...

用pietty連線 出現
Open On-Chip Debugger
>

Open On-Chip Debugger
> halt
requesting target halt...
> Target 0 halted
target halted in ARM state due to debug request, current mode: Supervisor
cpsr: 0xa0000013 pc: 0x33802f60
MMU: disabled, D-Cache: disabled, I-Cache: disabled
> resume
Target 0 resumed
>

鍾志均 提到...

把轉板的switch撥給multi-ice用
而不給jtag用
啟動open-ocd會有下列error
D:\openocd-2007re204\bin>openocd-pp -f openocd-rtk.cfg
Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Error: arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG
instruction failed, debugging is likely to be broken
Error: embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE ve
rsion (comms ctrl: 0xffffffff)
Error: target_request.c:127 target_request(): unknown target request: 79
Error: target_request.c:127 target_request(): unknown target request: 79
Error: target_request.c:127 target_request(): unknown target request: 79
Error: target_request.c:127 target_request(): unknown target request: ff
Error: target_request.c:127 target_request(): unknown target request: ff
Error: armv4_5.c:186 armv4_5_mode_to_number(): invalid mode value encountered
Error: arm7_9_common.c:1075 arm7_9_debug_entry(): cpsr contains invalid mode v
alue - communication failure
Error: target.c:1157 handle_target(): couldn't poll target, exiting
也紀錄一下