| ??? 01/19/04 08:18 Read: times |
#62867 - RE: To Dan Henry - stack question Responding to: ???'s previous message |
The simple test is to try it! Realise that as soon as you call a function, the stack pointer has changed (as the return address has been pushed onto the stack) therefore the test that you have will fail. If you are worried about the stack over or underflowing, you can put 'sentinels' which are a magic value that you put in various places in the stack that you regularly test for. If these tests fail, it means that the sentinel was overwritten by stack activity. In the 8051, the stack is even more critical as it is constrained to internal memory of which you never have enough therefore you have to keep your code fairly 'flat' ie do not have too many nested subroutine calls. Along with interrupt activity it can sometimes be hard to gauge how much stack headroom you have so having some sentinels placed in the stack can give you an idea of how much is being used. Spare a thought for your PIC bretheren as they only have (I think) 8 levels of stack. Also be aware that in the 8051, the stack grows up (ascending addresses) whereas in most other cpus the stack grows down. What happens when your stack over or underflows? Weird shite is the answer! |
| Topic | Author | Date |
| Keil software - stack question | 01/01/70 00:00 | |
| RE: Keil software - stack question | 01/01/70 00:00 | |
| RE: Keil software - stack question | 01/01/70 00:00 | |
| RE: Keil software - stack question | 01/01/70 00:00 | |
| RE: Keil software - stack question | 01/01/70 00:00 | |
RE: stack pertubation | 01/01/70 00:00 | |
| RE: To Dan Henry - stack question | 01/01/70 00:00 | |
| RE: To Dan Henry - stack question | 01/01/70 00:00 | |
| RE: To Dan Henry - stack question | 01/01/70 00:00 | |
| RE: To Dan Henry - stack question | 01/01/70 00:00 | |
| RE: Keil software - stack question | 01/01/70 00:00 |



