From e661c35b295dcdb9a9d43beab9341e3c043b04b4 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 21 Apr 2026 22:05:51 +0100 Subject: [PATCH] dircache: increase stack size to avoid stack overflows On FS#13821, a test build with -fstack-protector-all (which adds 4 bytes of stack to each function, roughly) overflowed the dircache stack on the Hifiwalker H2. In my own testing, the dircache thread hit 94% stack use on the Fiio M3K using the same settings. That seems a bit too close to the limit, especially since the dircache uses recursion and might consume more stack space for deeply nested directories. Adding 768 bytes should provide enough of a safety margin. This increases the stack size from 1.25k to 2k on most targets, including all X1000 targets. Change-Id: I900c19da9fb33f539d02b00830aedeb15c7449e2 --- firmware/include/dircache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h index 2cf838e539..d610c63245 100644 --- a/firmware/include/dircache.h +++ b/firmware/include/dircache.h @@ -44,7 +44,7 @@ the limiting factor is the scanning thread stack size, not the implementation -- tune the two together */ #define DIRCACHE_MAX_DEPTH 15 -#define DIRCACHE_STACK_SIZE (DEFAULT_STACK_SIZE + 0x100) +#define DIRCACHE_STACK_SIZE (DEFAULT_STACK_SIZE + 0x400) /* memory buffer constants that control allocation */ #define DIRCACHE_RESERVE (1024*64) /* 64 KB - new entry slack */