Hi Michael, On 15/02/12 04:40, Michael Bergandi wrote: >>> As of OpenOCD v0.5.0, I see no support and only a quick mention the >>> TODO. However, I did find one posting while Googling, that claimed >>> that OpenOCD had added support...unfortunately, they provided no >>> details. >> >> I use OpenOCD + JLink with the board, but you need to build OpenOCD from >> git, as the support for Kinetis TWR was only added quite recently. > > Does the free Segger JLinkGDBServer not work for you?
I works, but it has limited functionality, most noticeably it will not let you load programs into flash, and OpenOCD seems to work just as well once you get it going. (But the JLink command tool that also comes with the free Segger tools is invaluable if you ever screw up the security bytes on the flash; it has a handy command to fix those.) There are a couple issues I run into with OpenOCD: 1. if you are using a newer version of gdb, there is a mismatch between the number of registers OpenOCD reports and gdb expects, and gdb will just exit with an error. Building OpenOCD from source something like this with fix it http://www.mail-archive.com/openocd-development@lists.berlios.de/msg14805.html. But I decided to patch gdb instead to just warn rather then error. 2. JLink has to be started at 100kHz for the initial handshake between the server and gdb, and only then can be speeded up. The Segger server seems to do this automatically, with OpenOCD you have to tweak the config file to achieve the same. (I have attached my cfg file, in case it is of any use). Tomas
# 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