Stack underflow
ABB · ACS850 Standard Program Firmware
What does 3108 mean?
A fatal synchronous programming error indicating that the program tried to perform a 'pop' operation on an empty stack. This typically points to an imbalance in stack operations, where more items are being removed than were added, leading to program termination.
Common Causes
- A Mint program attempts to execute a 'RETURN' or similar stack-pop operation when there are no corresponding 'CALL' or push operations to balance it.
- Incorrect program flow where a function returns prematurely without matching its initial call, leaving the stack inconsistent.
- Corruption of the stack pointer due to an earlier memory access error.
- An attempt to retrieve data from an empty software-implemented stack data structure.
Repair Steps & Checklist
Click steps to track your progress.
- 1
Review the Mint program code for any unmatched 'RETURN' statements or jumps that bypass function calls, leading to an empty call stack.
- 2
Examine the program's control flow logic, especially conditional branches and error handling routines, to ensure all function calls are correctly balanced by returns.
- 3
If a custom stack data structure is implemented in Mint, verify the logic of 'PUSH' and 'POP' operations, ensuring 'POP' is only called when the stack is not empty.
- 4
Use debugging tools (if available) to trace the stack pointer and function call/return sequence to pinpoint the exact moment of underflow.
- 5
Ensure that interrupt service routines (ISRs) or event handlers correctly save and restore their context without disturbing the main program's stack.