puts "load MT76x7 configuration" source [find mico-os/makefiles/OpenOCD/interface/swj-dp.tcl] # Setup variables set CHIP_RAM_START 0x20000000 set _CHIPNAME MT76x7 set _TARGETNAME $_CHIPNAME.cm4 set _CPUTAPID 0x2ba01477 # Create DAP instance swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID # Create target instance target create $_TARGETNAME cortex_m -endian little -chain-position $_CHIPNAME.cpu # Setup SWD frequence adapter_khz 3000 # Setup reset signals #reset_config srst_only # Hook for GDB attach, to bring target into debug mode $_TARGETNAME configure -event gdb-attach { targets $_TARGETNAME reset halt } # Hook for GDB detach, to free target from debug mode $_TARGETNAME configure -event gdb-detach { targets $_TARGETNAME resume shutdown } # MT7687 JTAG initialization, unlock SWD lock proc unlock_swd {} { global _TARGETNAME mem2array rom_code 32 0x0 1 if { $rom_code(0) == 0 } { # unlock SWD puts ">>>>>>>> unlock MT76x7 SWD lock" targets $_TARGETNAME mww 0x8300F050 0x76371688 mww 0x8300F050 0x76371688 mww 0x8300F050 0x76371688 } } #disable WDT proc disabel_wdt {} { mww 0x83080030 0x00002200 } #Issued as the final step in reset processing. $_TARGETNAME configure -event reset-end { # SWD is locked after reset unlock_swd } #The target has halted $_TARGETNAME configure -event halted { disabel_wdt } init unlock_swd puts "load MT76x7 configuration done"