openocd debug boot loader to stext of linux

in uboot os

Hit any key to stop autoboot: 0

=> bdinfo //type this

arch_number = 0x00000F8C

boot_params = 0x10000100

DRAM bank = 0x00000000

→ start = 0x10000000

→ size = 0x40000000

eth0name = FEC

ethaddr = (not set)

current eth = FEC

ip_addr =

baudrate = 115200 bps

TLB addr = 0x4FFF0000

relocaddr = 0x4FF04000 // get this

reloc off = 0x3DF04000

irq_sp = 0x4F501EE0

sp start = 0x4F501ED0

FB base = 0x00000000

then in gdb

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

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

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

kernel_entry(0, machid, r2);

watch value

kernel_entry = 0x14008000

then stop gdb

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

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

.text

continue

and type “boot” in uboot os

done~~~

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

__enter_kernel:

mov r0, #0 @ must be 0

ARM( mov pc, r4 ) @ call kernel

watch value r4 = 0x10008000

then stop gdb

another head.S

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

break at

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

ENTRY(stext)

bug fixed

use command [arm-eabi-nm]

/root/project_board/free_imx/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-nm -a /root/project_board/free_imx/out/matrix_io/kernel/vmlinux | grep .text

813db454 t .exit.text

80008000 t .head.text —>need

81385260 t .init.text

800081c0 t .text —>need

80c90344 t .text.head

0x800081c0 change to 0x100081c0 for .text

0x80008000 change to 0x10008000 for .head.text

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/vmlinux 0x100081c0 -s .head.text 0x10008000

continue to debug and trace code

will done at correct break position

demo:

https://picasaweb.google.com/1061855410 … 9385486178