Keil Logo

MDK MIDDLEWARE: How to redirect Network debug output via ITM


Information in this knowledgebase article applies to:

  • ARM-MDK v5.x
  • Middleware Network Component v6.x, v7.x or newer versions

QUESTION

My program using Middleware Network component doesn't work properly. I know it is possible to enable network debug mode to get certain network debugging output to help me to debug my program. I'm also using SWO or ETM trace to debug my program.

How can I redirect network debug output via ITM Stimulus Port 0 using SWO or ETM trace?

ANSWER

Follow these steps to turn on the network debug output and redirect it to ITM Stimulus Port 0:

  1. Open Manage Run-Time Environment - Compiler - I/O - STDOUT, select ITM as variant.
  2. Open Manage Run-Time Environment - Network - COR, select IPv4/IPv6 Debug STDI as the variant. Afterwards, a Net_Debug.c file will be added to your project automatically.
  3. In Net_Debug.c enable the debug options as you need.
  4. Enable SWO or ETM trace in Options for Target - Debug - Settings, and include a proper *.ini file to initialize the corresponding trace pins if necessary. For more information, please see: Trace Configuration
  5. In a debug session, make sure the trace status bar shows Trace: Running... without any trace error: Trace Status
  6. Open the Debug (printf) Viewer window in the debug session to see the network debug info.

Below is an example of the redirected debug output:

008.36 TCP:Connect Socket 2, LocPort 12850
008.36 TCP: Rem_IP : 192.168.120.20
008.36 TCP: RemPort: 9100
008.36 TCP: RTO=4000ms (sa=0, sv=400)
008.36 TCP:Socket 2, Sending Control
008.36 TCP: Ports  : Src=12850, Dst=9100
008.36 TCP: Segment: Seq=0x38953E47, Ack=0x0
008.36 TCP: Control: [SYN] Win=4380, Cks=0x4888
008.36 TCP:*** Processing frame ***
008.36 TCP: Ports  : Src=9100, Dst=12850
008.36 TCP: Segment: Seq=0x9FE9A1E5, Ack=0x38953E48
008.36 TCP: Control: [SYN,ACK] Win=384, Cks=0x1644
008.36 TCP: Mapped to Socket 2, state SYN_SENT
008.36 TCP:Process Options, 4 bytes
008.36 TCP: Opt-MSS: 1460
008.36 TCP: cwnd=4380, ssth=65535
008.36 TCP: SendWin: 384
008.36 TCP: Next state CONNECT
008.36 TCP:Socket 2, Sending Control
008.36 TCP: Ports  : Src=12850, Dst=9100
008.36 TCP: Segment: Seq=0x38953E48, Ack=0x9FE9A1E6
008.36 TCP: Control: [ACK] Win=4380, Cks=0x1E65
008.36 TCP:Send Socket 2, 9 bytes
008.36 TCP:Socket 2, Sending Data
008.36 TCP: Ports  : Src=12850, Dst=9100
008.36 TCP: Segment: Seq=0x38953E48, Ack=0x9FE9A1E6
008.36 TCP: Control: [PSH,ACK] Win=4380, Cks=0x93E6
008.36 TCP: Length : 9 bytes

MORE INFORMATION

SEE ALSO

Last Reviewed: Thursday, February 7, 2019


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.