LX2160 JTAG with OpenOCD
The LX2160A SoC features a standard ARM CoreSight Debug Interfaces, which can be used with OpenOCD and generic debug probes in place of NXP’s own CodeWarrior Tap and Software.
A range of quirks are needed to accomplish this, most of which deserves thanks to the general community.
SolidRun Boards JTAG Connectors
JTAG Adapters
General purpose JTAG Adapters should be usable, this section lists those that were actually tested.
J-Link
SEGGER J-Link can connect to SolidRun LX2160 & LX2162 boards by using any of two adapters:
See end of page the attached OpenOCD example configuration file openocd_jlink_lx2160a.cfg for connecting to an LX2160 board with OpenOCD and J-Link.
On Linux this is as simple as:
sudo openocd -f openocd_jlink_lx2160a.cfgOn Windows the WinUSB driver may be necessary, see SEGGER Documentation for details.
Enable Debugging Fused (Secure-Boot) SoCs
If LX2160/LX2162 eFuses were blown to enable secure boot, debugging through JTAG is disabled by default.
This can be overridden by setting SDBGEN bit in RCW to 1, requiring installation of a special signed debug image. See this patch for pointers on where this bit can be set.
Halt Cortex-A72 Core 0
Once connected to the OpenOCD command-line (telnet), the core can be stopped by a set of direct commands sent to the DAP. At the time of writing the “halt” command did not operate as intended:
poll off
lx2160a.dap apreg 0 0 0x23000002
lx2160a.dap apreg 0 4 0x01010310
lx2160a.dap apreg 0 0xc 0x00000009
lx2160a.dap apreg 0 4 0x01010FB0
lx2160a.dap apreg 0 0xc 0xC5ACCE55
lx2160a.dap apreg 0 4 0x01010300
lx2160a.dap apreg 0 0xc 0x00000000
lx2160a.dap apreg 0 4 0x01010088
lx2160a.dap apreg 0 0xc 0x00004000
lx2160a.dap apreg 0 4 0x01020FB0
lx2160a.dap apreg 0 0xc 0xC5ACCE55
lx2160a.dap apreg 0 4 0x01020000
lx2160a.dap apreg 0 0xc 0x00000001
lx2160a.dap apreg 0 4 0x010200A0
lx2160a.dap apreg 0 0xc 0x00000001
lx2160a.dap apreg 0 4 0x0102001C
lx2160a.dap apreg 0 0xc 0x00000001
lx2160a.dap apreg 0 4 0x01010088
lx2160a.dap apreg 0 0xcThe final command should print a value similar to 0x03007f13. Here the least significant bit indicates whether the core is halted (bit set), or still running (bit cleared).
Now automatic control of dap can be re-activated:
poll onlx2160a.cpu0 cluster 0 core 0 multi core
lx2160a.cpu0 halted in AArch64 state due to debug-request, current mode: EL3H
cpsr: 0x800003cd pc: 0x1800d000
MMU: disabled, D-Cache: disabled, I-Cache: enabledOpenOCD has detected the halted state, and other commands may be used to inspect all state, e.g. to print all registers:
regOr to print memory at the program counter to find where execution halted:
mdw [dict get [get_reg pc] pc] 40x1800d000: 14000000 aa0003f4 aa0103f5 aa0203f6Here it was halted at an infinite loop, a branch with offset 0.
Note: The halt sequence above has been included in example openocd config file (end of the page) as lx2160_halt_core0 command.