Hi,
i’m debugging an LPC2378 using OpenOCD, connected by an Amontec JTAGkey-tiny.
Running own binaries works fine as long as I dont hard-reset the board:
flash erase 0 0 26
flash write 0 myprog.bin 0
soft_reset_halt
resume
When i enter ‘reset’ or power off/on the board, it dosn’t start my binary any more. It gets stuck in the boot code. It is even impossible to get the JTAG connection any more; commands like ‘halt’ or ‘soft_reset_halt’ have no effect, they result in a timeout. The only way (afaik) to recover the board from this state is:
0. plug out everything
1. plug in the JTAGkey
2. power on the board
3. plug in the USB cable to the JTAGkey
4. start openocd
5. now it gets connected and i can do
telnet> halt
telnet> flash erase 0 0 26
telnet> flash write 0 firmware.bin 0
telnet> reset
Any ideas why the LPC refuses to boot my binary? Is it possible to debug the LPC’s boot-up code which cannot be overwritten?
Regarding the checksum at address 0x14: it seems to be right at least for the firmware. When I write the firmware back to the flash with ‘calc_checksum’ enabled, it works fine after an reset.
When i disable ‘calc_checksum’ in openocd.cfg, edit the firmware binary to contain a wrong checksum and write it to the flash, it fails to boot, just like my own binary fails. So the checksum might be a reason; but at least for the firmware, openocd calculates it correctly.
Are any other reasons known why the LPC might refuse to boot a binary?
cheers,
- dc
my openocd.cfg:
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface ft2232
ft2232_device_desc "Amontec JTAGkey A"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 2
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
#target configuration
#daemon_startup reset
daemon_startup attach
#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little reset_run 0 arm7tdmi-s_r4
working_area 0 0x40000000 0x40000 nobackup
#flash configuration
flash bank lpc2000 0x0 0x7d000 0 0 lpc2000_v2 0 12000 calc_checksum