Skip to content

Commit c5f430f

Browse files
committed
Keep Serial from being linked when disabled
Even with MY_DISABLED_SERIAL defined, the linker is still adding the Serial object to the binary. That's because a) the MySensors *.cpp files are actually included into the sketch and compiled as part of it (and not compiled separately and then linked) and b) due the the default(?) behavior of the linker (https://github.com/arduino/Arduino/issues/4579).
1 parent 59337b1 commit c5f430f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hal/architecture/MyHwAVR.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ uint16_t hwFreeMem()
301301
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
302302
}
303303

304+
#ifdef MY_DISABLED_SERIAL
305+
#define hwDebugPrint(fmt,...)
306+
#else
304307
void hwDebugPrint(const char *fmt, ... )
305308
{
306309
char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
@@ -328,3 +331,4 @@ void hwDebugPrint(const char *fmt, ... )
328331
MY_SERIALDEVICE.print(fmtBuffer);
329332
MY_SERIALDEVICE.flush();
330333
}
334+
#endif

0 commit comments

Comments
 (0)