欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

busblaster-v3c调试hg255d的脚本代码

程序员文章站 2022-03-20 12:19:26
...

脚本代码分为4个文件:busblaster-ftdi-hg255d.cmd,mips_busblaster.cfg,openocd-ralink.cfg,run-telnet.bat,这4个文件在openocd-0.9.0/bin目录下。硬件连接好上电后,依次运行busblaster-ftdi-hg255d.cmd和run-telnet.bat。

脚本代码

busblaster-ftdi-hg255d.cmd

openocd.exe -f mips_busblaster.cfg -f openocd-ralink.cfg
pause

mips_busblaster.cfg

#
# Dangerous Prototyes - Bus Blaster v3
# The Bus Blaster has a configurable buffer between the FTDI and the
# JTAG header which allows it to emulate various debugger types.
#
# Bus Blaster V3c for MIPS Kit - http://www.seeedstudio.com/depot/Bus-Blaster-V3c-for-MIPS-Kit-p-2258.html
# Manufacture - http://dangerousprototypes.com/docs/Bus_Blaster
#
interface ftdi
transport select jtag
#ftdi_device_desc "Dual RS232-HS"
#ftdi_vid_pid 0x0403 0x6010
ftdi_device_desc "BUSBLASTERv3c"
ftdi_vid_pid 0x0403 0x7780

ftdi_layout_init 0x0908 0x0f1b
ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400
ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800

adapter_khz 1000

openocd-ralink.cfg

set  _CHIPNAME rt3052
set  _ENDIAN little

#daemon configuration
telnet_port 4444
gdb_port 3333

#jtag_speed 0
#adapter_khz 500
set _CPUTAPID 0x1335024F
adapter_nsrst_delay 100
jtag_ntrst_delay 100
reset_config trst_and_srst 



#jtag newtap rt30xx cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id 1

jtag newtap rt30xx cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id 0x1305224f
	
target create rt30xx.cpu mips_m4k -endian little -chain-position rt30xx.cpu

rt30xx.cpu configure -event reset-halt-post {
	#set memory
	mww 0x10000300 0xD1825272
	sleep 10
	mww 0x10000304 0xE0120600
	halt
}

rt30xx.cpu configure -event reset-init {
	halt
	#set memory
	mww 0x10000300 0xD1825272
	sleep 1 
	mww 0x10000304 0xE1110600

	sleep 10000                         ;# wait for lock
	halt
	sleep 1
	flash probe 0
}

proc ralink_init { } {
	halt
	sleep 10
	mww 0x10000300 0xD1825272
	sleep 1
	mww 0x10000304 0xE0120600       ;# Set Memory 32Mbyte in 32Bit(16MBx16bitx2)
	sleep 1                         ;# wait for lock

}

proc erase_uboot { } {
flash probe 0
flash erase_sector 0 0 4
}

proc flash_uboot { } {

ralink_init
sleep 1
flash probe 0
flash write_bank 0 uboot.bin 0x0

}



proc run_uboot { } {

#ralink_init
sleep 1
load_image uboot.bin 0x200000
#resume 0x00200000

}

proc run_uboot_command { } {

ralink_init
sleep 1
load_image uboot_command.bin 0x00200000
resume 0x00200000

}

# setup working area somewhere in RAM
#rt30xx.cpu configure \
#	-work-area-phys  0xa0600000 \
#	-work-area-size 65536 \
#	-work-area-backup 0


#rt30xx.cpu configure -work-area-phys 0xbf020000 -work-area-size 0x0010000  -work-area-backup 0
rt30xx.cpu configure -work-area-phys 0x00000000 -work-area-size 0x0010000  -work-area-backup 0
#rt30xx.cpu configure -work-area-phys 0xa0600000 -work-area-size 0x20000  -work-area-backup 0
#rt30xx.cpu configure -work-area-phys 0x00600000 -work-area-size 0x40000
# serial SPI capable flash
# flash bank <driver> <base> <size> <chip_width> <bus_width>

#flash bank rt30xx.flash cfi 0x1f000000 0x1000000 2 2  rt30xx.cpu
flash bank rt30xx.flash cfi 0xbf000000 0x1000000 2 2  rt30xx.cpu


#mips32 scan_delay 2000
#flash probe 0

run-telnet.bat

start "telnet" cmd.exe /K telnet localhost 4444