CW4 Debug Linux Kernel on Ls1012a

cancel
Showing results for 
Search instead for 
Did you mean: 

CW4 Debug Linux Kernel on Ls1012a

173 Views
reginaldstjohn
Contributor II

We are trying to debug an OpenWrt linux kernel (V5.4.143).  I am following the steps from the Armv8_Targeting_Manual.pdf section 8.3.2 about how to debug a linux kernel.

I make sure that the kernel is being compiled with debug symbols. I import the vmlinux file, though there are also vmlinux.elf and vmlinux.debug files in a lower directory.

I setup all the options as they are shown in the document and then hit debug.

After doing this I don't get the same screen to browse for source code and it is not stopping at my initial breakpoint (0x8008000).  I can pause the debugger but it seems like it is lost somewhere.

Any ideas or help?

reginaldstjohn_0-1642112513786.png

 

0 Kudos
13 Replies

159 Views
reginaldstjohn
Contributor II

thank you, I will ty that. I did see that forum question but it seemed like the same instructions i was following. I will try your suggestion and get back to you.

In the instructions it uses "BitBake" do we need to use that to get debugging working?

0 Kudos

167 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please add "nokaslr" in bootargs as the following in u-boot.

=> setenv bootargs "console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 nokaslr"

=> saveenv

For Linux Kernel debugging, you could refer to the attached document in the following link.

https://community.nxp.com/t5/CodeWarrior-for-QorIQ-Knowledge/Use-CodeWarrior-for-ARMv8-to-Debug-U-bo...

0 Kudos

156 Views
reginaldstjohn
Contributor II

OK, I tried following that document, which is basically the same thing as what i had done.  I also tried the nokaslr.

However, I can't actually even try the steps because as soon I hit debug in codewarrrior I can't type anything in the UBoot console. It seems frozen like the JTAG has taken control. Codewarrior says that it is running but if I hit "Suspend" it doesn't really look like it is suspending anything.

We have been using the JTAG to program the flash so I know it works that much at least.

0 Kudos

142 Views
yipingwang
NXP TechSupport
NXP TechSupport

On the target board, after setting up u-boot and entering into u-boot prompt. In CodeWarrior IDE,
click “Debug” to connect to the target board to attach to u-boot. After CodeWarrior connect to the
target board, please click “Suspend” button in CodeWarrior IDE to stop the running u-boot, and
enter “break _text” in the gdb console to set the breakpoint at the start of Linux Kernel.

Then in CodeWarrior IDE resume the program, in the target console, type the command under u-boot prompt to boot up Linux Kernel.

0 Kudos

134 Views
reginaldstjohn
Contributor II

Here are the steps i take, following your directions, and the outcomes that I see.

 - Go into u-boot and stop it from booting to the kernel

- load kernel image into RAM

reginaldstjohn_0-1642434147671.png

- Connect to the device by clicking "debug", NOTE: the middle window seems to indicate we are broke at some address 0x87b8cc5c.

reginaldstjohn_1-1642434230533.png

- Click Suspend in Codewarrior. NOTE: The suspend button is greyed out but the resume button is not enabled.

reginaldstjohn_3-1642434377376.png

 

- After about 20 seconds An error box comes up.

reginaldstjohn_2-1642434353714.png

- At this point I am stuck since I cannot type in the u-boot terminal or resume the processor.

 

0 Kudos

123 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please configure Debugger and Startup panels carefully following the document which I mentioned. After connecting to the target and click suspend button, you should get the IDE similar as the following.

yipingwang_1-1642583840164.png

 

 

 

Tags (1)
0 Kudos

114 Views
reginaldstjohn
Contributor II

Thank you for taking time to help. However, I must be missing a step becasue I have repeated the steps you outline in your document, several times, and I still cannot get it to debug the linux kernel.

Do I need to use a special u-boot? I am using the u-boot from our distribution OpenWrt.

I get to the uboot command. Attach with the debugger and it stops but it apears to be lost. I can set the break point and resume but I cannot then type anything into u-boot. It is frozen.

reginaldstjohn_0-1642617734507.png

I get the following in the debug console after attaching.

reginaldstjohn_1-1642617946403.png

 

 

 

0 Kudos

91 Views
yipingwang
NXP TechSupport
NXP TechSupport

No need special u-boot.

Please type "enter" to enter u-boot prompt "=>".

Then connect and attach CodeWarrior to u-boot, after click "suspend" button, please set the breakpoints in the debugger console, then click Resume in CW IDE, you could enter commands under u-boot prompt "=>".

 

Probably you could send your CW workspace without source code to me, I use it to do verification on my side.

0 Kudos

42 Views
reginaldstjohn
Contributor II

I cannot get to the u-boot prompt after resuming. The processor seems lost or frozen.

0 Kudos

36 Views
yipingwang
NXP TechSupport
NXP TechSupport

Would you please send your CW workspace without source code to me?

0 Kudos

26 Views
reginaldstjohn
Contributor II

private message sent

0 Kudos

14 Views
yipingwang
NXP TechSupport
NXP TechSupport

You workspace doesn't include CodeWarrior debug project. Please check it.

0 Kudos

5 Views
reginaldstjohn
Contributor II

OK, I am going to need more detailed directions then

I only have one workspace, the one I sent you.  The project I was using to debug shows up in the project explorer as shown below. It was created by following the document you pointed me to. I "Imported" the vmlinux image I want to debug and set up the project as specified in the document. What is it you want me to send you?

Attached you will find exported Debug and Project settings

reginaldstjohn_0-1643211887226.png

 

0 Kudos