Hi all!
I am having trouble loading ELF data across GDB (using the ‘load’ command) to the iMX27 on the LogicPD LITEKIT.
Background: The LITEKIT FLASH contains a monitor/shell that allows loading executables across the RS232 port. It boots from this flash and drops to a shell that supports many functions. If I connect OpenOCD to the LITEKIT and do a ‘reset halt’ command then it complains that “srst pulls trst - can not reset into halted mode. Issuing halt after reset.” The “srst pulls trst” mode is set in the standard iMX27 config file that comes with OpenOCD. The actual halt is not at PC=0x00000000, but ends up halting early in FLASH loading @0xc0000044. If I change reset config to “reset_config trst_and_srst separate” then doing a “reset halt” will drop me at pc=0x00000000. However, from reading this mailing list, I think that “separate” mode may not work well for the iMX27.
Now to the ELF problem. After the “reset halt” command I would like to load the executable data from GDB to RAM and start debugging. This fails with the following errors:
OpenOCD:
...
Debug: 921 34699 arm9tdmi.c:522 arm9tdmi_write_xpsr(): xpsr: 200000d3, spsr: 0
Debug: 922 34699 arm7_9_common.c:1756 arm7_9_restore_context(): writing PC with value 0xffff4c00
Debug: 923 34699 embeddedice.c:451 embeddedice_write_reg(): 0: 0x00000004
Debug: 924 34702 target.c:829 target_call_event_callbacks(): target event 23 (debug-resumed)
Debug: 925 34702 arm7_9_common.c:1983 arm7_9_resume(): target resumed
Debug: 926 34705 embeddedice.c:451 embeddedice_write_reg(): 5: 0xea000012
Debug: 927 34705 embeddedice.c:451 embeddedice_write_reg(): 5: 0xe1a00000
Debug: 928 34705 arm7_9_common.c:1319 arm7_9_halt(): target->state: debug-running
Debug: 929 34705 embeddedice.c:451 embeddedice_write_reg(): 0: 0x00000006
Debug: 930 34709 target.c:1957 target_wait_state(): waiting for target
halted...
Error: 932 35210 target.c:1968 target_wait_state(): timed out while
waiting for target halted
Error: 940 35212 gdb_server.c:1143 gdb_error(): unexpected error -4
GDB:
[npalmer@ws50 dbg]$ arm-none-eabi-gdb uart_test.debug.elf
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0xc0000044 in ?? ()
(gdb) monitor reset init
JTAG tap: imx27.bs tap/device found: 0x1b900f0f (mfg: 0x787, part:
0xb900, ver: 0x1)
JTAG tap: imx27.cpu tap/device found: 0x07926121 (mfg: 0x090, part:
0x7926, ver: 0x0)
srst pulls trst - can not reset into halted mode. Issuing halt after reset.
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0xc0000048
MMU: disabled, D-Cache: disabled, I-Cache: disabled
(gdb) load uart_test.debug.elf
Loading section .reset, size 0x1e0 lma 0xa0100000
Load failed
(gdb)
However, If I let the LITEKIT’s monitor program load completely before halting the board, then the GDB load command is successful every time. I am confused about why the OpenOCD transfer algorithm depends on something that the LITEKIT is configuring. Can anyone tell me what must be initialized on the board to allow the GDB load command to successfully complete? If so then I can build that in to the OpenOCD config file to initialize the board out of reset.
This is my very straight forward openocd.cfg file:
source [find interface/flyswatter.cfg]
source [find board/logicpd_imx27.cfg]
gdb_flash_program disable
gdb_memory_map enable
gdb_report_data_abort enable
Questions:
-
Should I resist the urge to use “reset_config trst_and_srst separate” on the iMX27 LITEKIT?
-
What needs to be configured on the iMX27 to allow the GDB load procedure to work?
BTW, I am using the latest 0.3.0svn version of OpenOCD, however I have seen the same thing on 0.2.0
Thanks!