Skip to contentSkip to conversation

Debugging U-Boot Under DDD

U-Boot-Users Talib Alim 3 participants 13 messages Jul 12, 2004 – Jul 14, 2004

lore
Share & tools
lore
#1 lore raw
In reply to Talib Alim

See: http://www.denx.de/twiki/bin/view/DULG/DebuggingTricks

Matthew

Quoted 18 lines · Talib Alim

This may be a trivial question, but I hope that someone can answer me. I am bring up u-boot on 8xx.

While doing source level debugging under ddd, whenever I do step, stepi, next or nexti I see green instruction pointer jump all over the code. e.g. it would go to first line, than third line, than 7 line. If I look at machine code window, it is running in normal predictable way.

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Signature · 1 line
Matthew McClintock <[email protected]>

Talib Alim

author
#0 lore raw

This may be a trivial question, but I hope that someone can answer me. I am bring up u-boot on 8xx.

While doing source level debugging under ddd, whenever I do step, stepi, next or nexti I see green instruction pointer jump all over the code. e.g. it would go to first line, than third line, than 7 line. If I look at machine code window, it is running in normal predictable way.

#2 lore raw
Quoted 1 line · In message <[email protected]> you wrote:

This may be a trivial question, but I hope that someone can answer me.

It's not a trivial question, but a FAQ.

Quoted 4 lines

While doing source level debugging under ddd, whenever I do step, stepi, next or nexti I see green instruction pointer jump all over the code. e.g. it would go to first line, than third line, than 7 line. If I look at machine code window, it is running in normal predictable way.

See http://www.denx.de/twiki/bin/view/DULG/DebuggingTricks

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
When it is incorrect, it is, at least *authoritatively* incorrect.
                                    - Hitchiker's Guide To The Galaxy
author
#3 lore raw

Thanks for the link.

I have debugged u-boot to a point, it has relocated code, setup execptions / interrrupts etc and in main_loop().

At this point if I "Cont", I get pop-up from ddd

/.../u-boot-1.1.1/serial.c: No such file or directory.

There are 23 serial.c files in the tree. Those possibly relavent to me are

./cpu/mpc8xx/serial.c
./tools/gdb/serial.c
./drivers/serial.c

Just before relocating the code, I typed following statements

(gdb) symbol-file
(gdb) add-symbol-file u-boot 0xbda000
(gdb) dir cpu/mpc8xx
(gdb) dir board/fads
(gdb) dir tools/gdb/serial.c
(gdb) dir drivers/serial.c

Well, my question is why I am getting "No such file or directory" from ddd and how can I fix this problem.

Usman

Quoted 27 lines · --- Wolfgang Denk

In message <[email protected]> you

Quoted 2 lines · wrote:

This may be a trivial question, but I hope that someone can answer me.

It's not a trivial question, but a FAQ.

Quoted 5 lines

While doing source level debugging under ddd, whenever I do step, stepi, next or nexti I see green instruction pointer jump all over the code. e.g. it would go to first line, than third line, than 7 line. If I look at machine code window, it is running in normal predictable way.

See http://www.denx.de/twiki/bin/view/DULG/DebuggingTricks

Best regards,

Wolfgang Denk

Signature · 7 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded
Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email:
wd at denx.de
When it is incorrect, it is, at least *authoritatively* incorrect.
                                    - Hitchiker's Guide To The
Galaxy
#4 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

At this point if I "Cont", I get pop-up from ddd /.../u-boot-1.1.1/serial.c: No such file or directory.

Sounds like a toolchain or user problem to me.

Quoted 4 lines

Just before relocating the code, I typed following statements

(gdb) symbol-file
(gdb) add-symbol-file u-boot 0xbda000

How did you start gdb / DDD? Did you really load "u-boot" (i. e. the ELF file)?

Quoted 4 lines

(gdb) dir cpu/mpc8xx
(gdb) dir board/fads
(gdb) dir tools/gdb/serial.c
(gdb) dir drivers/serial.c

None of these should be necessary. Which toolchain are you using?

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Old programmers never die, they just become managers.
author
#5 lore raw

I am using eldk

[root at lab1 eldk]# cat version
ELDK version 3.0
ppc_8xx: Build 2004-02-16

I am starting ddd with following command line

ddd --debugger /opt/eldk/usr/bin/ppc_8xx-gdb
target remote bdi:2001
symbol u-boot
set $pc = 0x02000100 # my flash is mapped @ 0x02000000
I am using bin {& not elf}, apart from this problem, it seems to be doing fine.

TA

Quoted 47 lines · --- Wolfgang Denk

In message <[email protected]> you

Quoted 3 lines · wrote:

At this point if I "Cont", I get pop-up from ddd /.../u-boot-1.1.1/serial.c: No such file or directory.

Sounds like a toolchain or user problem to me.

Quoted 4 lines

Just before relocating the code, I typed following statements

(gdb) symbol-file
(gdb) add-symbol-file u-boot 0xbda000

How did you start gdb / DDD? Did you really load "u-boot" (i. e. the
ELF file)?

Quoted 4 lines

(gdb) dir cpu/mpc8xx
(gdb) dir board/fads
(gdb) dir tools/gdb/serial.c
(gdb) dir drivers/serial.c

None of these should be necessary. Which toolchain are you using?

Best regards,

Wolfgang Denk

Signature · 16 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded
Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email:
wd at denx.de
Old programmers never die, they just become managers.


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
author
#6 lore raw

[U-Boot-Users] Strange Problem Debugging U-Boot

I am bringing up u-boot-1.1.1 on 852T.

I used "make FADS860T_config" for configuration. Since this is the closet
match I could find.

I was given FADS board with 852T, with working cpu, sdram and flash under BDI2000. I took values from bdi configuration and applied to u-boot.

If I single step starting from 0x02000100 (my flash starts @ 0x02000000) through to function void cpu_init_f (volatile immap_t * immr) line # 177. It works ok, but if I "Cont" after starting from 0x02000100, I get SIGABRT at line 177 of file u/mpc8xx/cpu_init.c.

{ line 177 is the actual line from u-boot-1.1.1 tree, line 181 which it
claims below is after I added few lines}

Program received signal SIGABRT, Aborted.
0x02002540 in cpu_init_f (immr=0xff000000) at cpu_init.c:181 /home/uansari/sw/bootcode/u-boot-1.1.1/cpu/mpc8xx/cpu_init.c:181:5157:beg:0x2002540

Actual line is code:

    /* now restrict to preliminary range */
    memctl->memc_br0 = CFG_BR0_PRELIM;

--->memctl->memc_or0 = CFG_OR0_PRELIM;

 #if (defined(CFG_OR1_PRELIM) && defined(CFG_BR1_PRELIM))
    memctl->memc_or1 = CFG_OR1_PRELIM;
    memctl->memc_br1 = CFG_BR1_PRELIM;

#endif

Any idea what is going on here ?

Thanks for the help.

#8 lore raw
In reply to Talib Alim
Quoted 1 line · In message <[email protected]> you wrote:

I am using eldk

OK.

Quoted 2 lines

I am using bin {& not elf}, apart from this problem, it seems to be doing fine.

Try loading the ELF file instead - then GDB will automatically load all required information about source files.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
The human mind treats a new idea the way the body  treats  a  strange
protein - it rejects it.                                 - P. Medawar
#7 lore raw

[U-Boot-Users] Strange Problem Debugging U-Boot

In reply to Talib Alim
Quoted 5 lines · In message <[email protected]> you wrote:

If I single step starting from 0x02000100 (my flash starts @ 0x02000000) through to function void cpu_init_f (volatile immap_t * immr) line # 177. It works ok, but if I "Cont" after starting from 0x02000100, I get SIGABRT at line 177 of file u/mpc8xx/cpu_init.c.

This probably means that your BDI2000 config file is not OK.

Quoted 2 lines

{ line 177 is the actual line from u-boot-1.1.1 tree, line 181 which it
claims below is after I added few lines}

Such reports are useless. Always quote the exact lines in text.

Quoted 5 lines

Actual line is code:

    /* now restrict to preliminary range */
    memctl->memc_br0 = CFG_BR0_PRELIM;

--->memctl->memc_or0 = CFG_OR0_PRELIM;

This is much better.

Quoted 1 line

Any idea what is going on here ?

Read the comment in lines 127...141.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
If you fail to plan, plan to fail.
author
#9 lore raw
In reply to Wolfgang Denk

I tried loading elf file, this is what I get

BDI>erase 0x02000000 chip
Erasing flash at 0x02000000
Erasing flash passed
BDI>prog 0x02000000 u-boot elf
Programming u-boot , please wait ....
- File offset 0x00000078 to address 0x04000000 size 131408 # Programming flash memory failed at 0x04000040

TA

Quoted 39 lines · --- Wolfgang Denk

In message <[email protected]> you

Quoted 1 line · wrote:

I am using eldk

OK.

Quoted 1 line

I am using bin {& not elf}, apart from this problem, it seems to

be

Quoted 1 line

doing fine.

Try loading the ELF file instead - then GDB will automatically load
all required information about source files.

Best regards,

Wolfgang Denk

Signature · 19 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded
Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email:
wd at denx.de
The human mind treats a new idea the way the body  treats  a 
strange
protein - it rejects it.                                 - P.
Medawar


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
#10 lore raw
Quoted 9 lines · In message <[email protected]> you wrote:

I tried loading elf file, this is what I get

BDI>erase 0x02000000 chip
Erasing flash at 0x02000000
Erasing flash passed
BDI>prog 0x02000000 u-boot elf
Programming u-boot , please wait ....
- File offset 0x00000078 to address 0x04000000 size 131408 # Programming flash memory failed at 0x04000040

You misunderstood. I was talking about loading the ELF file in GDB, not about programming it to flash using the BDI's telnet interface. These are completely different things.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Always leave room to add an explanation if it doesn't work out.
author
#11 lore raw

Now I am confuse. I am running code which is stored on the flash. I am using ddd (gdb in background) to do source level debugging. If I load elf binary gdb, than I am not really running code on the 852t, but on by Linux / Intell based PC.

TA

Quoted 40 lines · --- Wolfgang Denk

In message <[email protected]> you

Quoted 9 lines · wrote:

I tried loading elf file, this is what I get

BDI>erase 0x02000000 chip
Erasing flash at 0x02000000
Erasing flash passed
BDI>prog 0x02000000 u-boot elf
Programming u-boot , please wait ....
- File offset 0x00000078 to address 0x04000000 size 131408 # Programming flash memory failed at 0x04000040

You misunderstood. I was talking about loading the ELF file in GDB,
not about programming it to flash using the BDI's telnet interface.
These are completely different things.

Best regards,

Wolfgang Denk

Signature · 16 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded
Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email:
wd at denx.de
Always leave room to add an explanation if it doesn't work out.


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
#12 lore raw
Quoted 4 lines · In message <[email protected]> you wrote:

Now I am confuse. I am running code which is stored on the flash. I am using ddd (gdb in background) to do source level debugging. If I load elf binary gdb, than I am not really running code on the 852t, but on by Linux / Intell based PC.

No. This is a cross debugger. Loading a file into GDB and running it on the target are completely separate things.

Best regards,

Wolfgang Denk

Signature · 6 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Lady Nancy Astor:
    "Winston, if you were my husband, I'd put poison in your coffee."
Winston Churchill:
    "Nancy, if you were my wife, I'd drink it."