I’m trying to get OpenOCD and GDB working with a K20-based dev board (TWR-K20D50M) from freescale. The board uses a P&E Micro USB debug interface, which I believe is supported in OpenOCD (using interface/osbdm.cfg).
Here is the openocd.cfg file I’m using:
source [find interface/osbdm.cfg]
gdb_memory_map disable
gdb_flash_program enable
source [find board/twr-k60f120m.cfg]
I seem to be able to examine memory using GDBs x command, but when I try and load a binary I always get “Load failed”.
Thanks ntfreak, that got me one step further. Now when I attempt a load with gdb, I get these errors in my openOCD terminal:
Warn : flash configuration field erased, please reset the device
Error: gdb requested a non-existing register
Info : dropped ‘gdb’ connection
I think it could be the way I’m defining the flash banks in openOCD; I really don’t know what I’m doing in that area.
flash bank pflash.0 kinetis 0x00000000 0x40000 0 4 $_TARGETNAME
flash bank pflash.1 kinetis 0x00040000 0x40000 0 4 $_TARGETNAME
flash bank pflash.2 kinetis 0x00080000 0x40000 0 4 $_TARGETNAME
flash bank pflash.3 kinetis 0x000c0000 0x40000 0 4 $_TARGETNAME
If I include just the first two lines, I get the error I mentioned above. If I use all four lines, I get another error from openOCD before I can even attempt a load:
Info : Probing flash info for bank 0
Info : Probing flash info for bank 1
Info : Probing flash info for bank 2
Error: FlexRAM support not yet implemented
Error: auto_probe failed
Can anyone point me in the right direction to fix this problem?
Looking through my chip’s datasheet, I think there is just one bank of 128Kb of flash. I changed the configuration in openOCD so that there’s just one bank like this:
flash bank pflash.0 kinetis 0x00000000 0x20000 0 4 $_TARGETNAME
And I can erase the flash using:
monitor flash erase_address 0x0 0x20000
But still when I attempt to load my .elf file I get:
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Warn : flash configuration field erased, please reset the device
Error: gdb requested a non-existing register
Info : dropped ‘gdb’ connection
And if I examine the memory using gdb it’s all set to 0xff.