Trim task stacks and buffers by measurement: +15 KB with IRC up

Peak stack use was measured through each task's worst case (an
ECDSA-checked install over Wi-Fi and from SD, get/put, a core dump
fetch, an IRC TLS handshake); stacks are now peak plus about 2 KB: loop
8 -> 6 KB, update 8 -> 5, storage 10 -> 6, irc 8 -> 6. The Debug Build's
console ring goes 6 -> 4 KB, serial TX 2 -> 1 KB, the GNSS UART buffer
1 KB -> 512 B.

On the device, with IRC on TLS: 46 KB free (was 31), an 18 KB low (was
9.4). The re-run of every worst case left at least 1.6 KB of stack free
in each task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-04 23:02:35 +02:00
co-authored by Claude Opus 5.5
parent 578a39d3c1
commit db265fb757
9 changed files with 14 additions and 11 deletions
+4 -1
View File
@@ -120,6 +120,9 @@ static StatusInfo currentStatus() {
// (UpdateService::tick) decides instead, and an unconfirmed image stays PENDING_VERIFY.
extern "C" bool verifyRollbackLater() { return true; } // C linkage, or the weak default wins
// The main loop's stack: Arduino's default is 8 KB; the measured peak is 3 KB (M2).
size_t getArduinoLoopTaskStackSize() { return 6144; }
static void setupSafeMode(int crashes);
void setup() {
@@ -128,7 +131,7 @@ void setup() {
int crashes = crash_report::noteBoot(nvs);
safeMode = SafeMode::active(crashes);
Serial.setRxBufferSize(2 * FileReceiver::kChunk); // before the port opens; sd put sends 1 chunk at a time
Serial.setTxBufferSize(2048); // the console skips Serial when it's full: room for a burst like `tasks`
Serial.setTxBufferSize(1024); // the console skips Serial when it's full: room for a burst like `tasks`
auto cfg = M5.config();
M5Cardputer.begin(cfg, true);