# global variable MY_FLASH_ENABLED is used to controll whether gdb flashing # capabilites are enabled; defaults to disabled, to enable run openocd as: # # openocd -c "set MY_FLASH_ENABLED 1" -f openocd.cfg # # NB: the set command must preceed the the sourcing of this cfg file # # (To flash from gdb the server must supply gdb with a memory map; in order to # carry out the necessary flash probe to obtain this, the target must be halted # first). # set the default value for MY_FLASH_ENABLED if { ![info exists MY_FLASH_ENABLED] } { set MY_FLASH_ENABLED 0 } # these have to be called before init if { $MY_FLASH_ENABLED } { echo "Enabling GDB memory map and flash program" gdb_memory_map enable gdb_flash_program enable } else { echo "Disabling GDB memory map and flash program" gdb_memory_map disable gdb_flash_program disable } source [find interface/jlink.cfg] # 100k seems to be necessary to get things going, we increase it later adapter_khz 100 source [find board/twr-k60n512.cfg] #source [find board/kwikstik.cfg] # handler for the gdb-attach event; halts the target if flashing was enabled # ups the jtag speed proc my_gdb_attach_proc { } { global MY_FLASH_ENABLED if { $MY_FLASH_ENABLED } { echo "Reset so we can probe memory map ..." reset halt } else { echo "GDB attached; flash capability disabled." } echo "Setting jtag speed to 4MHz" adapter_khz 4000 } $_TARGETNAME configure -event gdb-attach my_gdb_attach_proc