All tools
TOOL IDB-SWE-009
Stack size estimator

仅限桌面

工程工具仅在桌面屏幕上可用。

栈大小估算器

根据最坏情况下的调用深度、平均帧大小、ISR 嵌套和操作系统开销,估算推荐的任务/ISR 栈大小。请务必通过栈溢出保护进行验证。

栈增长 推荐 — B
SP top ↓ grows down PUSH SP bottom ↑ (overflow guard) OS overhead 0 B ISR frames 0 B Call frames 0 B Margin 0 B Recommended 0 B In words (32-bit) 0 Call depth 8 × 48 B ISR depth 2 × 96 B
工程笔记

数学

  • core = depth × frame + locals
  • isr_total = isr_depth × isr_frame
  • stack = (core + isr_total + os_overhead) × (1 + margin)

现实校验

  • 启用 -fstack-usage 和链接器 .su 文件,以获取每个函数的真实数值。
  • FreeRTOS 任务栈以字(4 B)为单位。传入前请先换算。
  • 启用 FPU → 每个使用浮点的任务增加 132 B。

结果

实时