|
58 | 58 | //! }
|
59 | 59 | //! ```
|
60 | 60 | //!
|
61 |
| -//! ### `_stack_start` |
| 61 | +//! ### `_stack_start` / `_stack_end` |
62 | 62 | //!
|
63 |
| -//! This optional symbol can be used to indicate where the call stack of the program should be |
64 |
| -//! placed. If this symbol is not used then the stack will be placed at the *end* of the `RAM` |
65 |
| -//! region -- the stack grows downwards towards smaller address. This is generally a sensible |
66 |
| -//! default and most applications will not need to specify `_stack_start`. |
| 63 | +//! The `_stack_start` optional symbol can be used to indicate where the call stack of the program |
| 64 | +//! should be placed. If this symbol is not used then the stack will be placed at the *end* of the |
| 65 | +//! `RAM` region -- the stack grows downwards towards smaller address. This is generally a sensible |
| 66 | +//! default and most applications will not need to specify `_stack_start`. The same goes for |
| 67 | +//! `_stack_end` which is automatically placed after the end of statically allocated RAM. |
| 68 | +//! |
| 69 | +//! **NOTE:** If you change `_stack_start`, make sure to also set `_stack_end` correctly to match |
| 70 | +//! new stack area if you are using it, e.g for MSPLIM. The `_stack_end` is not used internally by |
| 71 | +//! `cortex-m-rt` and is only for application use. |
67 | 72 | //!
|
68 | 73 | //! For Cortex-M, the `_stack_start` must always be aligned to 8 bytes, which is enforced by
|
69 | 74 | //! the linker script. If you override it, ensure that whatever value you set is a multiple
|
70 |
| -//! of 8 bytes. |
| 75 | +//! of 8 bytes. The `_stack_end` is aligned to 4 bytes. |
71 | 76 | //!
|
72 | 77 | //! This symbol can be used to place the stack in a different memory region, for example:
|
73 | 78 | //!
|
|
85 | 90 | //! }
|
86 | 91 | //!
|
87 | 92 | //! _stack_start = ORIGIN(CCRAM) + LENGTH(CCRAM);
|
| 93 | +//! _stack_end = ORIGIN(CCRAM); /* Optional, add if used by the application */ |
88 | 94 | //! ```
|
89 | 95 | //!
|
90 | 96 | //! ### `_stext`
|
|
187 | 193 | //!
|
188 | 194 | //! ## `paint-stack`
|
189 | 195 | //!
|
190 |
| -//! Everywhere between `__sheap` and `___stack_start` is painted with the fixed value |
| 196 | +//! Everywhere between `__sheap` and `_stack_start` is painted with the fixed value |
191 | 197 | //! `STACK_PAINT_VALUE`, which is `0xCCCC_CCCC`.
|
192 | 198 | //! You can then inspect memory during debugging to determine how much of the stack has been used -
|
193 | 199 | //! where the stack has been used the 'paint' will have been 'scrubbed off' and the memory will
|
|
0 commit comments