Closed justbuchanan closed 1 year ago
I mostly enable it on a file by file basis by manually making DEBUG_print
be defined appropriately.
diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.c b/ports/raspberrypi/common-hal/socketpool/Socket.c
index 37c37445de..1c73eb23e4 100644
--- a/ports/raspberrypi/common-hal/socketpool/Socket.c
+++ b/ports/raspberrypi/common-hal/socketpool/Socket.c
@@ -56,8 +56,8 @@
#define MICROPY_PY_LWIP_SOCK_RAW (1)
-#if 0 // print debugging info
-#define DEBUG_printf DEBUG_printf
+#if 1 // print debugging info
+#define DEBUG_printf(...) mp_printf(&mp_plat_print, __VA_ARGS__)
#else // don't print debugging info
#define DEBUG_printf(...) (void)0
#endif
I don't see any documentation from us or micropython on how to actually enable MICROPY_DEBUG_PRINTERS "correctly". This is one way that does at least build:
diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
index 58a291b18b..95304699ed 100644
--- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
+++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
@@ -3,3 +3,6 @@
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1)
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1)
+
+#undef MICROPY_DEBUG_PRINTERS
+#define MICROPY_DEBUG_PRINTERS (1)
diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.c b/ports/raspberrypi/common-hal/socketpool/Socket.c
index 37c37445de..479fed2f9e 100644
--- a/ports/raspberrypi/common-hal/socketpool/Socket.c
+++ b/ports/raspberrypi/common-hal/socketpool/Socket.c
@@ -56,7 +56,7 @@
#define MICROPY_PY_LWIP_SOCK_RAW (1)
-#if 0 // print debugging info
+#if 1 // print debugging info
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
#define DEBUG_printf(...) (void)0
If you find out more about how Micropython intends debug printers to "work" in terms of enabling them, I'd sure be happy to incorporate PRs that bring us closer to upstream.
Thanks for the quick response! I'll give that a try.
Yes, don't use CFLAGS=...
on the command line; that will probably mess up other uses of CFLAGS
, which is used all over the place.
CircuitPython version
Code/REPL
Behavior
(there's more, but I truncated the output)
Description
No response
Additional information
Is this the correct way to enable debug printing? I'm interested in debugging a wifi-related issue on the picow (I'm aware this is under active development) and would like to see the output of the various
DEBUG_printf()
calls.