Skip to content

[M6] Increase STACK_AUDIO from 256 to 384 words - #47

Open
bsatrom wants to merge 1 commit into
mainfrom
fix/firmware/m6-audio-stack
Open

bsatrom wants to merge 1 commit into
mainfrom
fix/firmware/m6-audio-stack

Conversation

@bsatrom

@bsatrom bsatrom commented Jul 2, 2026

Copy link
Copy Markdown
Member

Finding M6

STACK_AUDIO was 256 words / 1KB (SongbirdConfig.h:88-94). AudioTask drives the Qwiic buzzer over I2C (Wire TX/RX buffers) and walks the melody tables via audioPlayEvent() / audioPlayTone() — a deep enough call chain that 256 words left very little headroom, especially with DEBUG_SERIAL printing in debug builds. Stack exhaustion in FreeRTOS is silent and corrupting.

Fix

Bump STACK_AUDIO to 384 words (1.5KB). This is within the 384-512 range recommended by the review and adds meaningful margin at trivial RAM cost (+512 bytes; total RAM usage stays ~11%).

Note: the stack high-water-mark instrumentation in tasksLogStackUsage() is #ifdef DEBUG_MODE only, so tight margins were not observable in production builds — this is a defensive sizing change rather than a response to a measured overflow.

Build

pio run — both envs pass (blues_cygnet + cygnet_debug SUCCESS).

Closes review finding M6

AudioTask drives the Qwiic buzzer over I2C (Wire TX/RX buffers) and
walks the melody tables via audioPlayEvent()/audioPlayTone(). At 256
words (1KB) the stack had very little headroom for that call chain plus
any DEBUG_SERIAL output. Bump to 384 words (1.5KB) for margin. The
existing stack high-water-mark check is DEBUG_MODE-only, so tight
margins were not observable in production builds.

Closes review finding M6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant