From f4bc37093d520b149cabbe5e242715838e7feebf Mon Sep 17 00:00:00 2001 From: ladyada Date: Tue, 15 Sep 2026 10:47:52 -0400 Subject: [PATCH] Release SD logger setup stack before logging Prevent setup from being inlined into main so SD initialization temporaries are released before loop runs. Uno disassembly confirms main no longer retains a 129-byte local frame and two saved registers. Co-authored-by: Limor Fried --- examples/shield_sdlog/shield_sdlog.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/shield_sdlog/shield_sdlog.ino b/examples/shield_sdlog/shield_sdlog.ino index 8ca473d..55b7b6f 100644 --- a/examples/shield_sdlog/shield_sdlog.ino +++ b/examples/shield_sdlog/shield_sdlog.ino @@ -74,6 +74,8 @@ void error(uint8_t errno) { } } +// Keep SD initialization buffers off the stack once logging starts. +void setup() __attribute__((noinline)); void setup() { // for Leonardos, if you want to debug SD issues, uncomment this line // to see serial output