8000 Generate warnings if Pico STDIO init called (#1467) · esphome/arduino-pico@e93bd14 · GitHub
[go: up one dir, main page]

Skip to content

Commit e93bd14

Browse files
Generate warnings if Pico STDIO init called (earlephilhower#1467)
Warn the user that the Pico SDK STDIO calls (stdio_init_all, stdio_usb_init, stdio_uart_init) are not supported or needed at compile time. See multiple issues earlephilhower#1433 earlephilhower#1347 earlephilhower#1273 earlephilhower#1251 and others.
1 parent 652f9f9 commit e93bd14

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cores/rp2040/Arduino.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,14 @@ constexpr uint32_t __bitset(const int (&a)[N], size_t i = 0U) {
129129
return i < N ? (1L << a[i]) | __bitset(a, i + 1) : 0;
130130
}
131131
#endif
132+
133+
// Warn users trying to use Pico SDK's STDIO implementation
134+
#include <pico/stdio.h> // Ensure it won't be re-included elsewhere
135+
#undef stdio_uart_init
136+
#define stdio_uart_init(...) static_assert(0, "stdio_uart_init is not supported or needed. Either use Serial.printf() or set the debug port in the IDE to Serial/1/2 and use printf(). See https://github.com/earlephilhower/arduino-pico/issues/1433#issuecomment-1540354673 and https://github.com/earlephilhower/arduino-pico/issues/1433#issuecomment-1546783109")
137+
#undef stdio_init_all
138+
#define stdio_init_all(...) static_assert(0, "stdio_init_all is not supported or needed. Either use Serial.printf() or set the debug port in the IDE to Serial/1/2 and use printf(). See https://github.com/earlephilhower/arduino-pico/issues/1433#issuecomment-1540354673 and https://github.com/earlephilhower/arduino-pico/issues/1433#issuecomment-1546783109")
139+
#undef stdio_usb_init
140+
#define stdio_usb_init(...) static_assert(0, "stdio_usb_init is not supported or needed. Either use Serial.printf() or set the debug port in the IDE to Serial/1/2 and use printf(). See https://github.com/earlephilhower/arduino-pico/issues/1433#issuecomment-1540354673 and https://github.com/earlephilhower/arduino-pico/issues/1433#issuecomment-1546783109")
141+
142+

0 commit comments

Comments
 (0)
0