|
LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
|

Go to the source code of this file.
Data Structures | |
| struct | StackchkStruct |
Macros | |
| #define | STACKCHKFILLBYTE (0x5A) |
| The Byte Pattern used for Filling. More... | |
Functions | |
| void | Stackchk (void) |
| Fills the stackchk Struct. More... | |
Variables | |
| StackchkStruct | stackchk |
| Stores the results of Stackchk(). Always call Stackchk() before using this values! More... | |
| #define STACKCHKFILLBYTE (0x5A) |
The Byte Pattern used for Filling.
| void Stackchk | ( | void | ) |
Fills the stackchk Struct.
It walks through the free RAM to find the probable end of the heap and the beginning of the stack. Note that there is no guarantee that heap nor stack cannot grow more than this but it can give you an idea of how many spare bytes you have before heap and stack collide.
Heap end is detected if four consecutive fill bytes are found. In extreme cases this may happen inside the heap as well. Also, the last bytes on the stack may accidentally be the same than the fill byte and the real stack size would not be correctly found. You might want to use different fill bytes to get more exact results. You must decide yourself ho probable the fill byte is in your application.
You can calculate the reserve before heap and stack would collide as
stackchk.stackmin-stackchk.heapmax-1
References __bss_end, StackchkStruct::heapmax, stackchk, STACKCHKFILLBYTE, and StackchkStruct::stackmin.
Referenced by DoTflags(), and ShowScreen().

| StackchkStruct stackchk |
Stores the results of Stackchk(). Always call Stackchk() before using this values!
Referenced by ShowScreen(), Stackchk(), and StackchkFill().
1.8.15