Skip to contentSkip to conversation

question about using x86 gdb to debug the remote ppc target (kgdb)

Q kotaeji 6 participants 12 messages Jan 9, 2004 – Jan 14, 2004

lore
Share & tools
lore

kotaeji

author
#0 lore raw

Hi, I have a question about using kgdb on PowerPC (8245)

Is it possible that the host is x86, and the remote target is powerpc as following picture ?

HOST(x86) ----------------------------- TARGET(ppc)
gdb serial line kgdb patch

When I connect to target by gdb on x86 and do "info registers" to show target registers, it shows x86 registers.

(gdb) info registers

eax            0x2000   8192
ecx            0xc3c6dd00       -1010377472
edx            0xc3c6c000       -1010384896
ebx            0xc0341540       -1070328512
esp            0xc0341400       0xc0341400
ebp            0xc3c6dd80       0xc3c6dd80
esi            0xc3c6de4c       -1010377140
edi            0x280008e8       671090920
eip            0x0      0x0
eflags         0x2      2
cs             0x0      0
ss             0xc5000000       -989855744
ds             0xfed2a80        267201152
es             0x10020300       268567296
fs             0x0      0
gs             0x0      0

Is there any way that I can use x86 gdb to debug remote ppc target? Should I use powerpc gdb (like YellowDog) in order to debug ppc target?

Any comments appreciated.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw

Maybe you should use ppc_82xx-gdb to connect remote target.

Regards,
John

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of kotaeji
Sent: Friday, January 09, 2004 1:41 PM
To: [email protected]
Subject: [Q] question about using x86 gdb to debug the remote ppc target (kgdb)

Hi, I have a question about using kgdb on PowerPC (8245)

Is it possible that the host is x86, and the remote target is powerpc as following picture ?

HOST(x86) ----------------------------- TARGET(ppc)
gdb serial line kgdb patch

When I connect to target by gdb on x86 and do "info registers" to show target registers, it shows x86 registers.

(gdb) info registers

eax            0x2000   8192
ecx            0xc3c6dd00       -1010377472
edx            0xc3c6c000       -1010384896
ebx            0xc0341540       -1070328512
esp            0xc0341400       0xc0341400
ebp            0xc3c6dd80       0xc3c6dd80
esi            0xc3c6de4c       -1010377140
edi            0x280008e8       671090920
eip            0x0      0x0
eflags         0x2      2
cs             0x0      0
ss             0xc5000000       -989855744
ds             0xfed2a80        267201152
es             0x10020300       268567296
fs             0x0      0
gs             0x0      0

Is there any way that I can use x86 gdb to debug remote ppc target? Should I use powerpc gdb (like YellowDog) in order to debug ppc target?

Any comments appreciated.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to kotaeji

You need to do a special "target" build of the gdb host side support. When you get the gdb sources, run the configure script something like this:

./configure --target=powerpc-405-linux-gnu --prefix=<locatin of cross compile tools> --program-prefix=powerpc-405-linux-gnu-

This is what I do (obviously for the 405 processor). --target tells gdb that your target is embedded Linux on a 405. --prefix is used to figure out where the cross compilation tools are installed (like gcc, ld, etc.) --program-prefix creates the executables with a special prefix on the filenames, which is quite important since you probably don't want to replace your normal intel gdb program. That way I end up running something called powerpc-405-linux-gnu-gdb.

If you want gdbserver on the target machine, there's even more fun to get that built right.

Hope this helps...

cj

Quoted 30 lines · kotaeji

Hi, I have a question about using kgdb on PowerPC (8245)

Is it possible that the host is x86, and the remote target is powerpc as following picture ?

HOST(x86) ----------------------------- TARGET(ppc)
gdb serial line kgdb patch

When I connect to target by gdb on x86 and do "info registers" to show target registers, it shows x86 registers.

(gdb) info registers

eax            0x2000   8192
ecx            0xc3c6dd00       -1010377472
edx            0xc3c6c000       -1010384896
ebx            0xc0341540       -1070328512
esp            0xc0341400       0xc0341400
ebp            0xc3c6dd80       0xc3c6dd80
esi            0xc3c6de4c       -1010377140
edi            0x280008e8       671090920
eip            0x0      0x0
eflags         0x2      2
cs             0x0      0
ss             0xc5000000       -989855744
ds             0xfed2a80        267201152
es             0x10020300       268567296
fs             0x0      0
gs             0x0      0
Quoted 8 lines

Is there any way that I can use x86 gdb to debug remote ppc target? Should I use powerpc gdb (like YellowDog) in order to debug ppc target?

Any comments appreciated.

--
Christopher R. Johnson
Principal Software Engineer
GCC Printers

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#3 lore raw

TLB and CSSBAR problems with MPC8540 and BDI2000

Hi,

I have a customer trying to get kernel debugging working with the BDI2000, currently he is experiencing this problem:

My board is crashing on this particular piece of code:

/* invalidate MMU L1/L2 */
/* Note: before invalidate MMU L1/L2, we read TLB1 Entry 0 and then
* write it back immediately to fixup a bug(Errata CPU4) for this initial
* TLB1 entry 0,otherwise the TLB1 entry 0 will be invalidated. */

#if defined(CONFIG_MPC85xx_REV1)
	lis	r2,0x1000
	mtspr	MAS0,r2
	tlbre
	tlbwe
	isync
	li      r2, 0x001e
	mtspr   MMUCSR0, r2
	isync

#endif

I think my problem is all centered around TLB's and the CCSRBAR. I don't know if the above code is part of the problem but at reset the cpu has the CCSRBAR at 0xff700000 and there is a TLB entry mapped to its location. My init code is moving the CCSRBAR and mapping a TLB to its new location. I tried just moving the CCSRBAR back to its default location. Do I also need to remap a TLB address to default location?

Thanks,
Matthew

Does anyone know the answer to this problem?

thanks,

Fahd

begin 666 ATT00010.htm M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#,N,B\O M14XB/@T*/$A434P^#0H\2$5!1#X-"CQ-151!($A45% M15%5258](D-O;G1E M;G0M5'EP92(@0T].5$5.5#TB=&5X="]H=&UL.R!C:&%R<V5T/7=I;F1O=W,M M,3(U,B(^#0H\345402!.04U%/2)'96YE<F%T;W(B($-/3E1%3E0](DU3($5X M8VAA;F=E(%-E<G9E<B!V97)S:6]N(#8N,"XV,C0Y+C$B/@T*/%1)5$Q%/E1, M0B!A;F0@0U-30D%2('!R;V)L96US('=I=&@@35!#.#4T,"!A;F0@0D1),C P M,#PO5$E43$4^#0H\+TA%040^#0H\0D]$63X-"CPA+2T@0V]N=F5R=&5D(&9R M;VT@=&5X="]P;&%I;B!F;W)M870@+2T^#0H-"CQ0/CQ&3TY4(%-)6D4],CY( M:2P\+T9/3E0^#0H\+U ^#0H-"CQ0/CQ&3TY4(%-)6D4],CY)(&AA=F4@82!C M=7-T;VUE<B!T<GEI;F<@=&\@9V5T(&ME<FYE;"!D96)U9V=I;F<@=V]R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86)O=F4@8V]D92!I<R!P87)T(&]F('1H92!P<F]B;&5M(&)U="!A="!R M97-E="!T:&4@8W!U(&AA<SPO1D].5#X-"@T*/$)2/CQ&3TY4(%-)6D4],CYT M:&4@0T-34D)!4B!A=" P>&9F-S P,# P(&%N9"!T:&5R92!I<R!A(%1,0B!E M;G1R>2!M87!P960@=&\@:71S/"]&3TY4/@T*#0H\0E(^/$9/3E0@4TE:13TR M/FQO8V%T:6]N+B!->2!I;FET(&-O9&4@:7,@;6]V:6YG('1H92!#0U-20D%2 M(&%N9"!M87!P:6YG(&$@5$Q"('1O(&ET<SPO1D].5#X-"@T*/$)2/CQ&3TY4 M(%-)6D4],CYN97<@;&]C871I;VXN($D@=')I960@:G5S="!M;W9I;F<@=&AE M($-#4U)"05(@8F%C:R!T;R!I=',@9&5F875L=#PO1D].5#X-"@T*/$)2/CQ& M3TY4(%-)6D4],CYL;V-A=&EO;BX@1&\@22!A;'-O(&YE960@=&\@<F5M87 @ M82!43$(@861D<F5S<R!T;R!D969A=6QT(&QO8V%T:6]N/R \+T9/3E0^#0H\
M+U ^#0H-"CQ0/CQ&3TY4(%-)6D4],CY4:&%N:W,L/"]&3TY4/@T*#0H\0E(^ M/$9/3E0@4TE:13TR/DUA='1H97<\+T9/3E0^#0H\+U ^#0H-"CQ0/CQ&3TY4 M(%-)6D4],CY$;V5S(&%N>6]N92!K;F]W('1H92!A;G-W97(@=&\@=&AI<R!P M<F]B;&5M/SPO1D].5#X-"CPO4#X-"@T*/% ^/$9/3E0@4TE:13TR/G1H86YK M<RP\+T9/3E0^#0H\+U ^#0H-"CQ0/CQ&3TY4(%-)6D4],CY&86AD/"]&3TY4 ;/@T*/"]0/@T*#0H\+T)/1%D^#0H\+TA434P^
`
end

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#4 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

Quoted 1 line · Fahd Abidi

I think my problem is all centered around TLB's and the CCSRBAR.

Yes, it is.

The debug control registers are part of the CCSRBAR space. The BDI2000 tracks modifications it makes if the space is moved, however, if your software moves that space the BDI2000 doesn't know it and can't access the registers.

If you are debugging code, like u-boot here, you have to make several code modifications so the CCSR space isn't moved during your debugging (among other things).

	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#5 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

So more specifically, if the bdi2000 init section moves the CCSRBAR and
maps a TLB to the location the CCSRBAR was moved too you can't just moved the CCSRBAR back to its default location? One would also need to remap the TLB entry to CCSRBAR?

Could anyone familiar with that workaround listed below verify
that
this could be causing the CPU to freeze/crash?

Thanks,
Matthew

Quoted 11 lines · Dan Malek
Quoted 1 line · Fahd Abidi

I think my problem is all centered around TLB's and the CCSRBAR.

Yes, it is.

The debug control registers are part of the CCSRBAR space. The BDI2000 tracks modifications it makes if the space is moved, however, if your software moves that space the BDI2000 doesn't know it and can't access the registers.

Quoted 8 lines

If you are debugging code, like u-boot here, you have to make several code modifications so the CCSR space isn't moved during your debugging (among other things).

	-- Dan

--
Matthew S. McClintock <[email protected]>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#6 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

Quoted 3 lines · Matthew S. McClintock

So more specifically, if the bdi2000 init section moves the CCSRBAR and
maps a TLB to the location the CCSRBAR was moved too you can't just moved the CCSRBAR back to its default location?

No, because the BDI2000 doesn't know that _you_ have done that in your code. If you do it in the BDI init secion, it will know.

Quoted 2 lines

.... One would also need to
remap the TLB entry to CCSRBAR?

Yes, but that isn't the problem.

Quoted 3 lines

Could anyone familiar with that workaround listed below verify
that
this could be causing the CPU to freeze/crash?

I've been there and done it. The CCSRBAR can't be changing while you are using the BDI2000 for debug. The debug registers the BDI2000 is trying to access are in this space. If you move the space without the BDI2000 knowing (i.e. in your code), the BDI2000 doesn't seem to be able to track those changes and continues to try and access the debug registers in the last known space.

So, what you have to do is (simply :-) ensure the CCSRBAR isn't changing when you are debugging the software.

-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#7 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

Quoted 16 lines

Yes, but that isn't the problem.

Quoted 3 lines

Could anyone familiar with that workaround listed below verify
that
this could be causing the CPU to freeze/crash?

I've been there and done it. The CCSRBAR can't be changing while you are using the BDI2000 for debug. The debug registers the BDI2000 is trying to access are in this space. If you move the space without the BDI2000 knowing (i.e. in your code), the BDI2000 doesn't seem to be able to track those changes and continues to try and access the debug registers in the last known space.

Quoted 2 lines

So, what you have to do is (simply :-) ensure the CCSRBAR isn't changing when you are debugging the software.

That leaves me with one question. When I don't do anything in the init section of the bdi2000 except one command which is to remove the L2SRAM from the initial MMU page and then I proceed with booting the board boots fine. If I halt the board examine the CCSRBAR it has moved from the default location.

I must be missing something, any ideas?

Thanks

--
Matthew S. McClintock <[email protected]>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#8 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

Quoted 5 lines · Matthew S. McClintock

That leaves me with one question. When I don't do anything in the init section of the bdi2000 except one command which is to remove the L2SRAM from the initial MMU page and then I proceed with booting the board boots fine. If I halt the board examine the CCSRBAR it has moved from the default location.

Hmmmmm....interesting.

Quoted 1 line

I must be missing something, any ideas?

Maybe I am :-) I'll experiment some more and see. I was just describing my experince. It could be the boot rom initializes far enough during the BDI2000 power up delay that by the time the BDI2000 asks the cpu core for the CCSRBAR it has the new one? I'll ask Abatron and post the response.

Thanks.

	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#9 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

Quoted 2 lines · Dan Malek

..... I'll ask
Abatron and post the response.

I received their response. Here it is in my words.

The BDI2000 doesn't care if the CCSRBAR is changed by software. It uses SPRs for debug control, and if it needs to access anything in the CCSR space, it will fetch the address from the part.

So, I guess there is something else that is incorrect when we change the CCSRBAR.

Thanks.

	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#10 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

So that leaves us back at the original question. Why does configuring the cpu via bdi2000 prevent me from using my u-boot image? Any other ideas?

Thanks,
Matthew

Quoted 11 lines · Dan Malek
Quoted 2 lines · Dan Malek

..... I'll ask
Abatron and post the response.

I received their response. Here it is in my words.

The BDI2000 doesn't care if the CCSRBAR is changed by software. It uses SPRs for debug control, and if it needs to access anything in the CCSR space, it will fetch the address from the part.

Quoted 9 lines

So, I guess there is something else that is incorrect when we change the CCSRBAR.

Thanks.

	-- Dan

--
Matthew S. McClintock <[email protected]>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#11 lore raw

Re: TLB and CSSBAR problems with MPC8540 and BDI2000

Quoted 3 lines · Matthew S. McClintock

So that leaves us back at the original question. Why does configuring the cpu via bdi2000 prevent me from using my u-boot image? Any other ideas?

Yep. I have one now. Make sure your u-boot image also has a TLB1 entry for your "default" CCSRBAR. Further, make sure your BDI init section doesn't move the CCSRBAR from the default value assumed by your u-boot image. I had the latter correct, just didn't realize that a "TLB1 flash invalidate" command to the MMUCSR0 doesn't seem to honor the 'invalidate protect' in the TLB entry. Everything works fine when you get all of the ducks in a row :-)

Of course, we should be discussing this on the u-boot list, not on this one........

	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/