Enable LWIP debug messages in ArduinoCore-mbed

Dear community,

I am working on a project with the Arduino OPTA (similar to Portenta H7). I am running into an issue where the OPTA comes into a state where the network interface becomes unresponsive (crashes) when DHCP is enabled, and the ethernet cable is repeatedly removed and re-inserted from the RJ-45 port. (More detailed description of the issue here: https://github.com/arduino/ArduinoCore-mbed/issues/891)

I am trying to debug this problem, but I cannot seem to find out how to enable LWIP debug logging to USB serial (the only available method on the OPTA).

I have re-compiled libmbed.a with this mbed_app.json:

{
  "target_overrides": {
    "*": {
      "lwip.debug-enabled":1,
      "target.printf_lib": "std",
      "platform.stdio-buffered-serial": false,
      "platform.stdio-baud-rate": 115200,
      "platform.default-serial-baud-rate": 115200,
      "platform.callback-nontrivial": true,
      "platform.all-stats-enabled": true,
      "platform.memory-tracing-enabled": true,
      "rtos.main-thread-stack-size": 32768,
      "cordio.max-connections": 5,
      "target.mbed_app_start": "0x8040000",
      "target.macros_add": [
        "METAL_INTERNAL",
        "VIRTIO_DRIVER_ONLY",
        "NO_ATOMIC_64_SUPPORT",
        "METAL_MAX_DEVICE_REGIONS=2",
        "RPMSG_BUFFER_SIZE=512",
        "LWIP_DEBUG=0",
	"LWIP_DBG_MIN_LEVEL=0",
 	"LWIP_DEBUGF=0x80",
 	
      ]
    }
  }
}

I also tried “LWIP_DEBUG=0”.

And in my main function I use this macro:

REDIRECT_STDOUT_TO(Serial)

However, when I compile the program no output is shown on the Serial.

What would be a proper way to set this up, do i need to give some compile flags in platformio?

1 Like