[i.MX8M EVK]Uboot Jtag debug with OpenOCD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[i.MX8M EVK]Uboot Jtag debug with OpenOCD

3,495 Views
jhpark_vine
Contributor III

Using  Olimex Jtag Probe,  i am debugging u-boot binary of i.MX8M EVK . 

with eclipse-CDT  debugging , there is  breakpoint errors like below.

breakpoint lines  are not the ones that source code indicates and there is some mismatches like  a breakpoint offset error.

 

openocd binary is from  https://github.com/ntfreak/openocd

run as

###  ./openocd -f interface/ftdi/olimex-arm-usb-ocd-h.cfg -f board/nxp_mcimx8m-evk.cfg

command logs are

####

Open On-Chip Debugger 0.10.0+dev-01517-g7b641d3d4-dirty (2020-12-04-18:39)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : JTAG tap: imx8mq.cpu tap/device found: 0x5ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x5)
Info : imx8mq.a53.0: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for imx8mq.a53.0 on 3333
Info : Listening on port 3333 for gdb connections
Info : starting gdb server for imx8mq.m4 on 3334
Info : Listening on port 3334 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : imx8mq.a53.0 cluster 0 core 0 multi core
imx8mq.a53.0 halted in AArch64 state due to debug-request, current mode: EL2H
cpsr: 0x600002c9 pc: 0xfff5162c
MMU: enabled, D-Cache: enabled, I-Cache: enabled
Info : New GDB Connection: 1, Target imx8mq.a53.0, state: halted
Warn : Prefer GDB command "target extended-remote 3333" instead of "target remote 3333"

 

=== Here is Eclipse Debug ====

eclipse debug window 

 uboot breakpointsuboot breakpoints

 

  u-boot Debug Configuration 

debug config_1debug config_1debug config_2debug config_2debug config_3debug config_3

-- symbol offset is same as  uboot relocaddr 

u-boot board infou-boot board info

 

 

 

0 Kudos
6 Replies

3,470 Views
tamdo
Contributor I

Hi @jhpark_vine 

Thanks for topic.

I'm a newbie in using jtag to debug uboot on iMX8M.

Could you share me some informations about jtag debugger and adapter which need to be ordered to completely debug iMX8M EVK, as well as necessary document ? I guess that the combo will include at least Olimex Jtag probe

BR

Tam

0 Kudos

3,448 Views
jhpark_vine
Contributor III
 

3,437 Views
tamdo
Contributor I

Thank @jhpark_vine

0 Kudos

3,419 Views
jhpark_vine
Contributor III

 

I think you also should buy  Jtag connectors and adapters because there are three kinds .

You can buy similiar products. 

Sorry for Korean words. 

For Jtag debug probe 

1. Jtag Cable 7set and adapter board( option) 

https://www.coupang.com/vp/products/1958523626?itemId=3328646403&vendorItemId=71315491841&src=103203...

2. 20 Pin 2.54mm To 20 Pin 1.27mm Jtag 20 P To 20 Pin Converter Adapter Board

https://shopee.ph/20-Pin-2.54mm-To-20-Pin-1.27mm-Jtag-20-P-To-20-Pin-Converter-Adapter-Board-i.25240... 

3. Jtag probe  

https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD-H/ 

4. Eclipse Debug IDE &&  OpenOCD binary 

Eclipse -  eclipse-cpp-2018-12-R-linux-gtk-x86_64.tar.gz for Ubuntu 18.04

Debugging  -  https://eclipse-embed-cdt.github.io/debug/openocd/     

OpenOCD -  https://github.com/ntfreak/openocd  

GNU ARM Eclipse Plugin

https://m.blog.naver.com/PostView.nhn?blogId=opusk&logNo=220985229211&proxyReferer=https:%2F%2Fwww.g...

5. Olimex Arm-US-OCD  Setup  

USB driver should be installed. 

refer to attached pdf.- chapter 3 

6. Chipset configuration 

For I.MX8MQ case , slightly modified as   Jtag circuits differ

jhpark@jhpark-smcu-multi-VirtualBox:/data/work/ntfreak/openocd/tcl$ more board/nxp_mcimx8m-evk.cfg
#
# configuration file for NXP MC-IMX8M-EVK
#

# only JTAG supported
transport select jtag

# set a safe JTAG clock speed, can be overridden
adapter speed 1000

# default JTAG configuration has only SRST and no TRST
#reset_config srst_only srst_push_pull - fail
#reset_config trst_only trst_push_pull
reset_config trst_and_srst trst_push_pull

# delay after SRST goes inactive
#adapter srst delay 70
adapter srst delay 270
jtag_ntrst_delay 270

# board has an i.MX8MQ with 4 Cortex-A53 cores
set CHIPNAME imx8mq
set CHIPCORES 4

# source SoC configuration
source [find target/imx8m.cfg]

 

 Thanks.

 

 

 

 

 

3,482 Views
jhpark_vine
Contributor III

=== Here is the u-boot compile problem !!!! ==== 

Following the  uboot compilatiuon guide from openocd-with-eclipse-debug-kernel-of.html ,  

there is some building problems. 

disable OPTIMIZE_FOR_SIZE

ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
else

# jhpark, modify, jtag debug
#KBUILD_CFLAGS += -O2
KBUILD_CFLAGS += -O0 -g  -fno-omit-frame-pointer -fno-optimize-sibling-calls
endif 

 

### make 

....

 

CC lib/ctype.o
CC lib/div64.o
CC lib/hang.o
CC lib/linux_compat.o
CC lib/linux_string.o
CC lib/lmb.o
CC lib/membuff.o
CC lib/slre.o
CC lib/string.o
CC lib/tables_csum.o
CC lib/time.o
CC lib/hexdump.o
CC lib/uuid.o
lib/uuid.c: In function ‘gen_rand_uuid’:
lib/uuid.c:238:2: warning: converting a packed ‘struct uuid’ pointer (alignment 1) to a ‘unsigned int’ pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
238 | unsigned int *ptr = (unsigned int *)&uuid;
| ^~~~~~~~
In file included from include/part.h:11,
from include/common.h:33,
from lib/uuid.c:6:
include/uuid.h:10:8: note: defined here
10 | struct uuid {
| ^~~~
CC lib/rand.o
CC lib/panic.o
CC lib/vsprintf.o
In file included from include/efi_loader.h:13,
from lib/vsprintf.c:16:
include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
include/efi_api.h:802:18: warning: taking address of packed member of ‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned pointer value [-Waddress-of-packed-member]
802 | (u16_strlen(blk->string_text) + 1) * 2;
| ~~~^~~~~~~~~~~~~
CC lib/strto.o
CC lib/strmhz.o
LD lib/built-in.o
CC net/checksum.o
CC net/arp.o
CC net/bootp.o
In file included from include/efi_loader.h:13,
from net/bootp.c:13:
include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
include/efi_api.h:802:18: warning: taking address of packed member of ‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned pointer value [-Waddress-of-packed-member]
802 | (u16_strlen(blk->string_text) + 1) * 2;
| ~~~^~~~~~~~~~~~~
net/bootp.c: In function ‘check_reply_packet’:
net/bootp.c:133:40: warning: taking address of packed member of ‘struct bootp_hdr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
133 | else if (!bootp_match_id(net_read_u32(&bp->bp_id)))
| ^~~~~~~~~~
net/bootp.c: In function ‘bootp_request’:
net/bootp.c:804:15: warning: taking address of packed member of ‘struct bootp_hdr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
804 | net_copy_u32(&bp->bp_id, &bootp_id);
| ^~~~~~~~~~
net/bootp.c: In function ‘dhcp_send_request_packet’:
net/bootp.c:1011:15: warning: taking address of packed member of ‘struct bootp_hdr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
1011 | net_copy_u32(&bp->bp_id, &bp_offer->bp_id);
| ^~~~~~~~~~
net/bootp.c:1011:27: warning: taking address of packed member of ‘struct bootp_hdr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
1011 | net_copy_u32(&bp->bp_id, &bp_offer->bp_id);
| ^~~~~~~~~~~~~~~~
CC net/eth-uclass.o
net/eth-uclass.c: In function ‘eth_post_probe’:
net/eth-uclass.c:528:32: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘unsigned char *’ [-Wformat=]
528 | printf(" env_enetaddr ### %06X \n" , env_enetaddr );
| ~~~^ ~~~~~~~~~~~~
| | |
| | unsigned char *
| unsigned int
| %06hhn
CC net/eth_common.o
CC net/net.o
CC net/nfs.o
net/nfs.c: In function ‘rpc_req’:
net/nfs.c:199:18: warning: taking address of packed member of ‘struct rpc_t’ may result in an unaligned pointer value [-Waddress-of-packed-member]
199 | p = (uint32_t *)&(rpc_pkt.u.call.data);
| ^~~~~~~~~~~~~~~~~~~~~~
net/nfs.c: In function ‘nfs_readlink_reply’:
net/nfs.c:631:46: warning: taking address of packed member of ‘struct rpc_t’ may result in an unaligned pointer value [-Waddress-of-packed-member]
631 | nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
| ~~~~~~~~~~~~~~~^~~~~
net/nfs.c: In function ‘nfs_read_reply’:
net/nfs.c:692:46: warning: taking address of packed member of ‘struct rpc_t’ may result in an unaligned pointer value [-Waddress-of-packed-member]
692 | nfs3_get_attributes_offset(rpc_pkt.u.reply.data);
| ~~~~~~~~~~~~~~~^~~~~
CC net/ping.o
CC net/tftp.o
In file included from include/efi_loader.h:13,
from net/tftp.c:11:
include/efi_api.h: In function ‘efi_hii_sibt_string_ucs2_block_next’:
include/efi_api.h:802:18: warning: taking address of packed member of ‘struct efi_hii_sibt_string_ucs2_block’ may result in an unaligned pointer value [-Waddress-of-packed-member]
802 | (u16_strlen(blk->string_text) + 1) * 2;
| ~~~^~~~~~~~~~~~~
LD net/built-in.o
CC examples/standalone/hello_world.o
CC examples/standalone/stubs.o
LD examples/standalone/libstubs.o
LD examples/standalone/hello_world
OBJCOPY examples/standalone/hello_world.srec
OBJCOPY examples/standalone/hello_world.bin
LDS u-boot.lds
LD u-boot
arch/arm/lib/built-in.o: in function `relocate_code':
/data/work/uboot2/uboot-imx/arch/arm/lib/relocate_64.S:46:(.text+0xa4): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol `__image_copy_end' defined in .rela.dyn section in u-boot
arch/arm/lib/built-in.o: in function `copy_loop':
/data/work/uboot2/uboot-imx/arch/arm/lib/relocate_64.S:57:(.text+0xbc): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol `__rel_dyn_start' defined in .rela.dyn section in u-boot
/data/work/uboot2/uboot-imx/arch/arm/lib/relocate_64.S:58:(.text+0xc0): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol `__rel_dyn_end' defined in .bss_start section in u-boot
Makefile:1512: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1

 

 

 

0 Kudos