Menu

Debugging

Mike Jones

Debugging the Sample Application

This section will cover two methods of debugging, one with PEEDI and one with JLink. Before going through the details, it is useful to know the limitations of each.

PEEDI

PEEDI can debug multiple cores. The GDB Server presents it self to GDB as a single core. When a breakpoint is reached, it stops all four cores. From the point of view of GDB, there is only one core. The only way to know what core the breakpoint is at is to read it from registers.

Code Confidence Thread Spy can be used if desired. When debugging startup code, like files like vectors.S, it is better to use GDB directly. For debugging applications, Thread Spy is quite useful.

In theory, if you write scripts for JLink, you can run multiple instances of the debugger on different cores. In practice, it is easy to debug on one core. The best way to debug with JLink is to set SMP to a single core and debug the application. When done, enable the application for multiple cores.

Debugging Startup of Cores

To debug startup of multiple cores, the only practical of these two solutions is to use PEEDI, at least until someone writes JLink scripts or Segger supports SMP.

General Debugging Considerations

The iMX6 only runs from RAM and uses a memory manager. Therefore, the JTAG tool must configure memory before loading the application. There are two ways this can be done. Either the JTAG unit must do it for you, or you do it from GDB/Eclipse. In the following two cases, PEEDI will configure for you, and JLink will rely on GDB.

Setting up and using PEEDI

PEEDI requires a configuration file. The file can reside on a computer and be fetched by TFTP, or it can reside on an SD card. There is a working configuration file on this web site that I use from an SD card. The PEEDI documentation explains how to this up properly. The supplied file contains the data to initialize memory and it also directs RS232 data to TCP port 2023 so that you can debug remotely and see debug_printf output, etc.

Setting up Eclipse for PEEDI is the same as any JTAG debugger. So refer to PEEDI documentation.

Using Thread Spy also works in the normal manner. However, it has to have the right register configuration.

In the Initialization Commands box, enter:

monitor threadspy -EL --regs=0x00,0x00,0x3c --regs=0x40,0xa4,0x04 --regs=0x40,0x3c,0x04
monitor reset init

And in the Run Commands box, enter:

set Cyg_Scheduler_Base::current_thread[0]=0
set Cyg_Scheduler_Base::current_thread[1]=0
set Cyg_Scheduler_Base::current_thread[2]=0
set Cyg_Scheduler_Base::current_thread[3]=0

To see JLink, the setup data must be part of the Initialization Commands. Here is an example for debugging on a Sabre SD board. You can look at the PEEDI config file and convert it to this format if you want to debug a Wandboard with JLink.

monitor reset
monitor sleep 1000
monitor memU32 0x020bc000 = 0x30
monitor memU32 0x020c4068 = 0xffffffff
monitor memU32 0x020c406c = 0xffffffff
monitor memU32 0x020c4070 = 0xffffffff
monitor memU32 0x020c4074 = 0xffffffff
monitor memU32 0x020c4078 = 0xffffffff
monitor memU32 0x020c407c = 0xffffffff
monitor memU32 0x020c4080 = 0xffffffff
monitor memU32 0x020c4084 = 0xffffffff
monitor memU32 0x020e0798 = 0x000C0000
monitor memU32 0x020e0758 = 0x00000000
monitor memU32 0x020e0588 = 0x00000030
monitor memU32 0x020e0594 = 0x00000030
monitor memU32 0x020e056c = 0x00000030
monitor memU32 0x020e0578 = 0x00000030
monitor memU32 0x020e074c = 0x00000030
monitor memU32 0x020e057c = 0x00000030
monitor memU32 0x020e058c = 0x00000000
monitor memU32 0x020e059c = 0x00000030
monitor memU32 0x020e05a0 = 0x00000030
monitor memU32 0x020e078c = 0x00000030
monitor memU32 0x020e0750 = 0x00020000
monitor memU32 0x020e05a8 = 0x00000030
monitor memU32 0x020e05b0 = 0x00000030
monitor memU32 0x020e0524 = 0x00000030
monitor memU32 0x020e051c = 0x00000030
monitor memU32 0x020e0518 = 0x00000030
monitor memU32 0x020e050c = 0x00000030
monitor memU32 0x020e05b8 = 0x00000030
monitor memU32 0x020e05c0 = 0x00000030
monitor memU32 0x020e0774 = 0x00020000
monitor memU32 0x020e0784 = 0x00000030
monitor memU32 0x020e0788 = 0x00000030
monitor memU32 0x020e0794 = 0x00000030
monitor memU32 0x020e079c = 0x00000030
monitor memU32 0x020e07a0 = 0x00000030
monitor memU32 0x020e07a4 = 0x00000030
monitor memU32 0x020e07a8 = 0x00000030
monitor memU32 0x020e0748 = 0x00000030
monitor memU32 0x020e05ac = 0x00000030
monitor memU32 0x020e05b4 = 0x00000030
monitor memU32 0x020e0528 = 0x00000030
monitor memU32 0x020e0520 = 0x00000030
monitor memU32 0x020e0514 = 0x00000030
monitor memU32 0x020e0510 = 0x00000030
monitor memU32 0x020e05bc = 0x00000030
monitor memU32 0x020e05c4 = 0x00000030
monitor memU32 0x021b0800 = 0xa1390003
monitor memU32 0x021b080c = 0x001F001F
monitor memU32 0x021b0810 = 0x001F001F
monitor memU32 0x021b480c = 0x001F001F
monitor memU32 0x021b4810 = 0x001F001F
monitor memU32 0x021b083c = 0x43270338
monitor memU32 0x021b0840 = 0x03200314
monitor memU32 0x021b483c = 0x431A032F
monitor memU32 0x021b4840 = 0x03200263
monitor memU32 0x021b0848 = 0x4B434748
monitor memU32 0x021b4848 = 0x4445404C
monitor memU32 0x021b0850 = 0x38444542
monitor memU32 0x021b4850 = 0x4935493A
monitor memU32 0x021b081c = 0x33333333
monitor memU32 0x021b0820 = 0x33333333
monitor memU32 0x021b0824 = 0x33333333
monitor memU32 0x021b0828 = 0x33333333
monitor memU32 0x021b481c = 0x33333333
monitor memU32 0x021b4820 = 0x33333333
monitor memU32 0x021b4824 = 0x33333333
monitor memU32 0x021b4828 = 0x33333333
monitor memU32 0x021b08b8 = 0x00000800
monitor memU32 0x021b48b8 = 0x00000800
monitor memU32 0x021b0004 = 0x00020036
monitor memU32 0x021b0008 = 0x09444040
monitor memU32 0x021b000c = 0x555A7975
monitor memU32 0x021b0010 = 0xFF538F64
monitor memU32 0x021b0014 = 0x01FF00DB
monitor memU32 0x021b0018 = 0x00001740
monitor memU32 0x021b001c = 0x00008000
monitor memU32 0x021b002c = 0x000026d2
monitor memU32 0x021b0030 = 0x005A1023
monitor memU32 0x021b0040 = 0x00000027
monitor memU32 0x021b0000 = 0x831A0000
monitor memU32 0x021b001c = 0x04088032
monitor memU32 0x021b001c = 0x00008033
monitor memU32 0x021b001c = 0x00048031
monitor memU32 0x021b001c = 0x09408030
monitor memU32 0x021b001c = 0x04008040
monitor memU32 0x021b0020 = 0x00005800
monitor memU32 0x021b0818 = 0x00011117
monitor memU32 0x021b4818 = 0x00011117
monitor memU32 0x021b0004 = 0x00025576
monitor memU32 0x021b0404 = 0x00011006
monitor memU32 0x021b001c = 0x00000000


Related

Wiki: Getting Started with iMX6 and eCos SMP

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.