Debugging iMX6 with JTAG BDI3000

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

Debugging iMX6 with JTAG BDI3000

Jump to solution
4,378 Views
AlanSouza
Contributor III

I'm having issues trying to debug a custom iMX6 board with BDI3000. The state after powering up with BDI attached seems good to me:

IMX6#0>info

    Core number       : 0

    Core state        : debug mode (ARM)

    Debug entry cause : Debug Request

    Current PC        : 0x2780ad40

    Current CPSR      : 0x600001d3 (Supervisor)

    Current SPSR      : 0xca0c196d

 

However, I can't correctly read and write from memory.

Example:

 

IMX6#0>md 0x8a000000 1          

8a000000 : 0x00000071          113  q...

 

IMX6#0>mm 0x8a000000 0x1234abcd 1

 

IMX6#0>md 0x8a000000 1          

8a000000 : 0x00000061           97  a...

 

IMX6#0>mm 0x8a000000 0x12345678 1

 

IMX6#0>md 0x8a000000 1          

8a000000 : 0x04000071     67108977  q...

 

Apparently, it is not writing what is expected to. I need to make this process consistent an then load the u-boot into memory.

 

Does anyone know what is happening?

 

I'm using the attached configuration file. Any help would greatly appreciated.

Original Attachment has been moved to: regCortex-A9.def.zip

Original Attachment has been moved to: imx6.cfg.zip

Labels (1)
1 Solution
2,772 Views
sinanakman
Senior Contributor III

Hi Alan

I am just e-mailing you a BDI3000 conifg file that includes DDR

init for sabresd board. You just need to modify according to

your needs. Let me know if you need anything else.

Regards

Sinan Akman

View solution in original post

14 Replies
2,773 Views
sinanakman
Senior Contributor III

Hi Alan

I am just e-mailing you a BDI3000 conifg file that includes DDR

init for sabresd board. You just need to modify according to

your needs. Let me know if you need anything else.

Regards

Sinan Akman

2,772 Views
AlanSouza
Contributor III

Sinan,

Thank you so very much. The script has solved my issue. It is working very well right now.

My best regards,

Jose Alan

0 Kudos
2,772 Views
sinanakman
Senior Contributor III

Hi Jose

Happy to hear the config file helped you

with your custom design. Perhaps I'll

put that config file as a new document here

at the community site to help other developers as

well. I'll send you the link to the document when I

create one so that you can add your comments.

Let me know if you have other questions

regarding BDI3000 and bringing up your new

board.

Regards

Sinan Akman

2,770 Views
AlanSouza
Contributor III

Hi Sinan,

I have a question regarding issues while trying to debug u-boot-2009.08 with GDB trought the BDI.

First:

- I can successfully init memory

- I can successfully load u-boot.

The problem is: the PC is not going forward.

Although I try to go forward in the execution (stepi or continue) the PC keeps the same position.

Look:

(gdb) source init.txt

"Connecting to target board...

"0x276006bc in ?? ()

"Resetting cpu...

""Loading u-boot...

"Loading section .text, size 0x1f614 lma 0x27800000

Loading section .text.init, size 0x138 lma 0x2781f614

Loading section .rodata, size 0x86d7 lma 0x2781f74c

Loading section .data, size 0x1444 lma 0x27827e28

Loading section .u_boot_cmd, size 0x690 lma 0x2782926c

Start address 0x278006e0, load size 170231

Transfer rate: 178 KB/sec, 1340 bytes/write.

"Target cpu is ready."

(gdb) stepi

Stopped due to shared library event

(gdb) where

#0  0x278006e0 in _start ()

(gdb) c

Continuing.

^CStopped due to shared library event

Quit

(gdb) where

#0  0x278006e0 in _start ()

(gdb)

##########   init.txt     ###########

file u-boot

#connect to bdi3000

echo "Connecting to target board...\n"

target remote 192.168.0.139:2001

#reset target cpu

echo "Resetting cpu...\n"

monitor reset halt

#load u-boot

echo "Loading u-boot...\n"

load

#set pc to initial address

#echo "setting PC to initial address...\n"

#set $pc = 0x27800000

#stepi

echo "Target cpu is ready."

###############################

As this is happening on our custom board as well as on the SabreSD Board, it seems like I'm missing something.

If you have any suggestion I'd appreciate to hear from you.

Regards,

Jose Alan Souza

0 Kudos
2,770 Views
sinanakman
Senior Contributor III

Hi Jose

Before you start single stepping check where the code

is and make sure it is where it is supposed to be and PC

is not set to an irrelevant address.

In general I would recommend to debug using the telnet

interface first. Load your image manually via the telnet then

set a break point early on and execute at the right entry

address of your image. Once the break point is hit see if

you can successfully single step. After this you can compare

your steps to that of gdb init script and have it working the

same way.

In a related note, it seems you are loading a u-boot image

and running it after setting the memory via BDI init. You need

to make sure that this is a u-boot version that can run without

initializing the memory itself. A regular u-boot image may not

run correctly if the some of the initialization is not done by u-boot.

Test things out via telnet as I suggested and let me know how

it looks.

Hope this helps.

Regards

Sinan Akman

2,770 Views
AlanSouza
Contributor III

I did debug with the telnet interface and the PC seemed to be moving forward correctly. So I found out that the problem was the gdb. I downloaded the source code of the newest version of gdb and compiled it. It seems to be working now.

Thanks,

0 Kudos
2,770 Views
philippevillet
Contributor I

Alan,

Can you give me some guidance on how to load u-boot with BDI3000 (On sabresd):
I cross compile u-boot, I am able to load the u-boot.imx file with the binary "imx_usb" through the USB OTG interface. I am also able to start my sabresd board by flashing the u-boot.imx file on an SD card.
Now i would like do download the u-boot with a BDI3000.
I config the debugger with the file posted by Sinan, but i can not load u-boot ELF file:
(I've opened the u-boot file with a hex-editor, the ELF header Seems to be ok)
Thanks for your help.
Pv


- SETUP: Passed loading configuration
- SETUP: loading register definition Passed
- TARGET: processing reset request
- TARGET: BDI executed scan chain init string
- TARGET: Bypass check 0x00000001 => 0x00000004
- TARGET: JTAG exists check Passed
- Core # 0: ID code is 0x4BA00477
- Core # 0: DP-CSW is 0xF0000000
- Core # 0: DBG-AP at 0x82150000
- Core # 0: Didr is 0x3513702A
- TARGET: Reset sequence Passed
- TARGET: resetting target Passed
- TARGET: processing target startup ....
- TARGET: processing target startup Passed
IMX6 # 0> load home01 / pvillet / mts3000 / u-boot ELF
Loading home01 / pvillet / mts3000 / u-boot, please wait ....
# Invalid file format
IMX6 # 0>

0 Kudos
2,770 Views
sinanakman
Senior Contributor III

Hi Philippe

BDI checks more than just a single header.

How did you generate that file that you

are trying to load with BDI ?

Regards

Sinan Akman

0 Kudos
2,770 Views
philippevillet
Contributor I

Sinan,

I just manage to load the ELF file correctly; You're right BDI3000 verifies more than the header, the problem comes from the byte at offset 0x10, the value is 0x03 (file 'u-boot' generated by the command "make mx6dlsabresd_config; make").

According to ELF standard, this field is e_type. 0X03 stand for ‘Shared object file’. By changing this byte to 0x02 ‘Executable’, I’m now able to load the modified file with the BDI3000.

Then changing the PCSR register value, I’m able to execute u-boot with success.

Below are BDI3000 telnet traces.

I’m a newbie in the ARM world, but have a good experience e with u-boot and PowerPC and never met this problem before.

It’s also the first time I use a tool-chain based on yocto to compile u-boot (generated with ‘bitbake meta-toolchain command’).

Did you met this problem ?

Thanks.

Philippe.

IMX6#0>config

    BDI Firmware: 1.19

    BDI CPLD ID : 01285043

    BDI CPLD UES: bd080064

    BDI MAC     : 00-0c-01-33-55-63

    BDI IP      : 10.33.17.160

    BDI Subnet  : 255.255.252.0

    BDI Gateway : 10.33.16.1

    Config IP   : 10.33.17.16

    Config File : xxxxxx/BDI/sabresd.cfg

IMX6#0>reset

- TARGET: processing reset request

- TARGET: BDI executes scan chain init string

- TARGET: Bypass check 0x00000001 => 0x00000004

- TARGET: JTAG exists check passed

- Core#0: ID code is 0x4BA00477

- Core#0: DP-CSW  is 0xF0000000

- Core#0: DBG-AP  at 0x82150000

- Core#0: DIDR    is 0x3513702A

- TARGET: Reset sequence passed

- TARGET: resetting target passed

- TARGET: processing target startup ....

- TARGET: processing target startup passed

IMX6#0>load xxxxx/u-boot.modif

Loading xxxxx/u-boot.modif , please wait ....

- File offset 0x00008000 to address 0x17800000 size 453025

Loading program file passed

IMX6#0>verify

Verifying xxxxxxx/u-boot.modif , please wait ....

- File offset 0x00008000 to address 0x17800000 size 453025

Verifying target memory passed

IMX6#0>RM CPSR 0X1D3

IMX6#0>go

0 Kudos
2,770 Views
sinanakman
Senior Contributor III

Hi Philippe

Thanks for the update. I am not sure type 0x03 is valid

there but I will double check. This is perhaps a linking problem

with that yocto build. I don't think I had this with mainline

u-boot before.

Could you give this a try with the mainline u-boot.

Just clone the mainline u-boot git tree directly and

see if you can load the generated elf file.

Regards

Sinan Akman

0 Kudos
2,770 Views
sinanakman
Senior Contributor III

I added the config file under the document :

BDI3000 config file with iMX6 DDR initialization

Regards

Sinan Akman

0 Kudos
2,770 Views
Yuri
NXP Employee
NXP Employee

  It is needed to init memory. Please refer to the following

resources about it.

DDR Script Aid tools :

https://community.freescale.com/docs/DOC-94987

https://community.freescale.com/docs/DOC-99450

https://community.freescale.com/docs/DOC-95089

https://community.freescale.com/docs/DOC-94917

  1. i.MX6 DDR Stress Test Tool V1.0.3

"DDR3 Porting Guide"

https://community.freescale.com/docs/DOC-101708

Have a great day,

Yuri

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------

2,770 Views
AlanSouza
Contributor III

Thanks Yuri. This was very helpful on understanding my issue.

0 Kudos
2,770 Views
AlanSouza
Contributor III

After a while I have figured out which registers I was setting wrongly.

0 Kudos