top of page
  • Zach Pfeffer

Why don't I see PMUFW XPfw_Printfs: A Debug Story


This post list my debug of why I don't see XPfw_Print() output from PMUFW included in PetaLinux Tools 2017.4.

TL;DR

There's no UART output because the PS UART is not on when I load PMUFW.

Related

Symptom

I don't see this print from XPfw_Main():

File:

Hypothesis 1

I don't see XPfw_Printf because there's a missing DEBUG define

Info

Where is XPfw_Printf?

Grep:

Output:

Relevant Lines in xpfw_debug.h:

Test Hypothesis 1

Are XPFW_DEBUG_DETAILED, XPFW_DEBUG_ERROR and XPFW_PRINT?

Method

Use #error's in the code and recompile. See link for how to recompile PMUFW.

Compile

Compile Output

Who defines XPFW_PRINT?

Its not defined on the command line, no -DXPFW_PRINT

Grep

Output

Defined in xpfw_config.h

Which is included in xpfw_default.h as seen here

Grep

Output

...which was referenced in the debug output.

Hypothesis 1 Conclusion

Hypothesis 1 is not true. There is a define that should allow me to see DEBUG_PRINT_ALWAYS.

Hypothesis 2

I never get to the print.

Method

Use an infinite loop before the print and break in with xsct over JTAG.

Change:

Recompile

Add the path to it to PATH in a local window:

Check it:

Run it, look at xsct output

Find XPfw_Main

In xsct

Run targets

Read the registers

The PC matches the bri line from above. So that shows we can get to this line of code.

Do I get into the print, does the print do anything?

Look for any XPfw_Printf's

Empty! Weird.

If I remove the spin loop, will the XPfw_Printf's still be present?

Yes:

Start stepping into prints

Set a breakpoint on 0xffdc7270

To set the breakpoint:

Enumerate targets

Select the PMU and dump registers

Set the breakpoint

Hmm... can't set a hardware breakpoint, set a software breakpoint instead:

Reset unit via external power suppy

Continue setting breakpoints until the the UART FIFO gets written

See the breakpoint on 0xffdc7270, the call to xil_printf, get hit

Step one instruction

Look at the backtrace

Step one instruction and disassemble

Correlate addresses with instructions

Set a breakpoint on outbyte, continued, dissemble, look at the backtrace

Correlate addresses with instructions

Get the address

Set a breakpoint on the instruction that actually writes to the UART hardware ands continue until you get to that line

Decode swi r6, r5, 48 with the Registers

r6 (rD) is 0x50

r5 (rA) is 0xff000000

IMM is 48 or 0x30

Replacing text: Store 0x50 (Ascii 'P') to 0xff000030

The P comes from "PMU Firm...":

0xff000030 is the TX FIFO of UART 0

Try reading and writing to of ff000030 from xsct

Bingo!

There is no output because the UART is not on at this point! I'm loading the PMUFW first with:

And the other systems are reporting:

So I either need to wait longer to see these prints, print them to UART1 or figure out something else.

References

  • The Xilinx graphic is from link

  • MicroBlaze Processor Reference Guide UG984 (v2018.1) April 4, 2018 @ link

  • ASCII Table @ link

  • UART0 register spec @ link

bottom of page