Has anyone tried to flash a TI LM4F device (specifically I am using an EK-LM4F232 board) using OpenOCD and the TI ICDI interface? When I try it I get the following:
Open On-Chip Debugger 0.7.0-dev-00145-gd631b2e (2013-01-23-09:38)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : ICDI Firmware version: 8790
Info : lmf423x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000642 msp: 0x20001418
auto erase enabled
Error: timed out while waiting for target halted
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x20000016 msp: 0x20001418
Error: error waiting for target flash write algorithm
…and I end up needing the ^C to get out. Below is my OpenOCD configuration/command file:
source [find interface/ti-icdi.cfg]
set WORKAREASIZE 0x8000
set CHIPNAME lmf423x
source [find target/stellaris_icdi.cfg]
gdb_port 3332
init
reset halt
flash write_image erase firmware.bin 0
reset
exit
Thanks for the information Spen. I have updated my OpenOCD command/configuration files to the following…
erase.cfg:
source [find board/ek-lm4f232.cfg]
init
reset halt
flash erase_sector lm4f23x.flash 0 last
shutdown
flash.cfg:
source [find board/ek-lm4f232.cfg]
init
reset halt
flash write_image FIRMWARE.bin 0 bin
shutdown
I can’t provide the binary that I am using, but what I can tell you is that it DOES WORK if the binary is less than 128k (or, at least I tested up to 127k). At 128k flashing starts to fail. The binary I WAS working with is 152k in size. This device has 256k flash and when I run ‘flash info 0’ I do get 256 flash pages, each 1k in size.
For actual testing, to determine what size files I could flash, I simply created binary files that where completely zeroed out but of the specified size. I used a simple little Python function:
def gen_file(sz):
with open('zero-{0}k.bin'.format(sz), 'w') as f:
f.write('\x00' * 1024 * sz)
With the above function, simply execute gen_file(1) to create a file called ‘zero-1k.bin’ that is 1kbytes in size that is completely zeroed out.