AnsweredAssumed Answered

openocd debug u-boot to stext of kernel

Question asked by jesse stone on Feb 15, 2016
Latest reply on Feb 15, 2016 by jesse stone

1.

In Eclipse right click project

Debug As -> Debug Configurations -> GDB Hardware Debugging

 

2.

click Startup tab

uncheck the all items on startup page

add those lines under [Halt] box but do not check [Halt]

add-symbol-file /root/project_board/free_imx/out/matrix_io/uboot/u-boot 0x4FF04000

start debugging and trace code

(ps: in u-boot os keyin [bdinfo] show relocaddr = 0x4FF04000)

 

3.

file /root/project_board/free_imx/myandroid/bootable/bootloader/uboot-imx/arch/arm/lib/bootm.c

in function boot_jump_linux(bootm_headers_t *images, int flag)

//break at
kernel_entry = (void (*)(int, int, uint))images->ep;

run step to next line

[Expressions] window show kernel_entry is 0x14008000

 

4.

Press [Terminate] to stop debug

 

5.

click Startup tab

uncheck the all items on startup page

add those lines under [Halt] box but do not check [Halt]

add-symbol-file /root/project_board/free_imx/out/matrix_io/kernel/arch/arm/boot/compressed/vmlinux 0x14008000

continue to debug and trace code

 

6.

file /root/project_board/free_imx/myandroid/kernel_imx/arch/arm/boot/compressed/head.S

//break at

__enter_kernel:

mov r0, #0 @ must be 0

ARM( mov pc, r4 ) @ call kernel

[Registers] window show r4 = 0x10008000

 

7.

Press [Terminate] to stop debug

 

8.

click Startup tab

uncheck the all items on startup page

add those lines under [Halt] box but do not check [Halt]

add-symbol-file /root/project_board/free_imx/out/matrix_io/kernel/arch/arm/kernel/head.o 0x80008000 -s .head.text 0x10008000

continue to debug and trace code

 

9.

file /root/project_board/free_imx/myandroid/kernel_imx/arch/arm/kernel/head.S

//break at

ENTRY(stext)

THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.

THUMB( bx r9 ) @ If this is a Thumb-2 kernel,

THUMB( .thumb ) @ switch to Thumb now.

THUMB(1: )

 

#ifdef CONFIG_ARM_VIRT_EXT

bl __hyp_stub_install

#endif

@ ensure svc mode and all interrupts masked

safe_svcmode_maskall r9

 

//done ~~~

 

 

 

demo:

Picasa Web Albums - Jesse Stone - i.mx6

Outcomes