How to debug SBC/SoM using WinDbg

  • How to debug SBC/SoM using WinDbg

    This guide assumes you already have WinDbg installed. For instructions on how to install windbg see: https://learn.microsoft.com/en…ardware/drivers/debugger/

    Connecting to the SBC/SoM via Serial

    1) Locate the correct serial-port

    Boot messages are usually output on COM1:. COM1: is normally assigned to Serial_A.

    Connect a ttl-serial cable to the serial port.

    2) Verify the Debug Serial Port

    On your computer use a serial terminal application like Tera Term to connect to the serial port on the computer side.

    Use these settings to set up the serial connection:

    • 115200Baud
    • 8 Data bits
    • no parity bit
    • 1 stop bit

    Or in short: 115200 8n1

    The COM1: will output boot messages, which will show up in Tera Term if configured correctly. Apply power to the board and observe the serial output.

    Uboot should output boot messages starting with a line similar to the following:

    Code
    1. U-Boot SPL 2020.04-00327-g5c97678d5-dirty (Aug 24 2023 - 11:37:21 +0200)

    After a while the Windows 10 IoT kernel should attempt to initiate a debugging session by sending cryptic text via serial:


    If you see these messages (or similar ones) you have successfully located the serial debug port.

    Setting up WinDbg

    1) Enable debug messages

    Connect to your SBC/SoM via RemoteDesktop. Open regedit by right clicking on the "Start" button and selecting "Run" from the menu. Enter regedit and click on OK.

    Navigate to (you can paste this into the address bar of regedit:

    Code
    1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager


    Right click on the right window pane and select "New -> Key"


    Name the Key Debug Print Filter.



    Open the key and create a "New -> DWORD (32-bit) Value". Name it DEFAULT and set "Base" to Hexadecimal and "Value data" to f.


    Shut down and power off the SBC/SoM.


    For additional information refer to the blog entry "Where Are My DbgPrints?" from OSR


    2) Prepare WinDbg

    Open WinDbg. Select File -> Kernel Debug. Select COM and enter the Baud Rate 115200.

    Do not click OK yet.


    3) Connecting WinDbg
    To connect WinDbg to to board successfully,

    correct timing is essential

    . Connecting too early when U-Boot is still running will interrupt the boot process. If this happens power cycle the SBC/SoM.

    When connecting too late, Windows IoT KD will not answer. In this case shut down the SBC/SoM via RemoteDesktop.


    Connect a display to your SBC/SoM.


    Power on the SBC/SoM and wait for the Windows logo to appear:


    Now click on OK in the WinDbg window.

    WinDbg should now connect successfully.