Hi,
After some initial struggling I managed to get OpenOCD 0.6.1 (and now upgraded to 0.7) running on OSX and programming my custom Freescale k20 based boards using JTAG and a bus blaster. On a fresh chip I would have to take the reset pin to GND to be able to halt the chip, but after the initial erase everything worked very well. I could halt the chip and flash program fine after that. I’m using .elf files compiled out of the teensy 3.0 variant of arduino since its the same chip.
Now I’ve added in the EEPROM library which uses the FlexRAM on the k20 chip to emulate EEPROM and while the code works fine, whenever I go to flash fresh code on I get a fault partway through the write. Then the chip is unresponsive and I have to again take the Reset pin low to halt it, so I can get code on once more. Its obviously killing my workflow.
I’m pretty sure the problem is with openOCD trying to write fresh code into the FlexRAM, but the Flex is either protected or the partition bit that says whether the flex is program memory vs. eeprom is causing issues. I know the teensy itself issues the chip’s flash controller’s “Erase All Blocks” (command 0x44) when it writes fresh code. Ideally I could get openOCD to do this or to otherwise overwrite everything so that fresh code would go on fine. Here is the log of a successful flash write and then a bad one after trying to write to a chip that is configured to use EEPROM
flash write_image erase programs/PX2_077.cpp.elf 0 elf
auto erase enabled
flash configuration field erased, please reset the device
wrote 35840 bytes from file programs/PX2_077.cpp.elf in 3.216008s (10.883 KiB/s)
Then a bad write:
flash write_image erase programs/PX2_077a.cpp.elf 0 elf
auto erase enabled
flash configuration field erased, please reset the device
JTAG-DP STICKY ERROR
MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x14000018
JTAG-DP STICKY ERROR
MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x1400001c
Block write error address 0x14000000, wcount 0x100
target_write_memory failed
error writing to flash at address 0x00000000 at offset 0x00000000
in procedure ‘flash’
FlashRam starts at 0x14000000, anyone who can shed some light on this, it would be greatly appreciated.