public inbox for
 help / color / mirror / Atom feed
* Re: [ECOS] Re: Flash memory not accessible via Redboot on Kinetis TWR_K60N512_KIT
       [not found]   ` <>
@ 2012-02-15  7:59     ` Tomas Frydrych
  0 siblings, 0 replies; only message in thread
From: Tomas Frydrych @ 2012-02-15  7:59 UTC (permalink / raw)
  To: ecos-devel

[-- Attachment #1: Type: text/plain, Size: 1569 bytes --]

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
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).


[-- Attachment #2: openocd.cfg --]
[-- Type: text/plain, Size: 1493 bytes --]

# 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] } {

# these have to be called before init
    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 { } {

    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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-02-15  7:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
     [not found] ` <>
     [not found]   ` <>
2012-02-15  7:59     ` [ECOS] Re: Flash memory not accessible via Redboot on Kinetis TWR_K60N512_KIT Tomas Frydrych

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).