rust-embedded / cortex-m

Low level access to Cortex-M processors
Apache License 2.0
832 stars 152 forks source link

cortex-m-rt: Added `_stack_end` symbol for use with MSPLIM #565

Closed korken89 closed 3 weeks ago

korken89 commented 4 weeks ago

I have added the _stack_end as discussed in the meeting.

What I'm not 100% sure on is how this interacts with __sheap, as I can't really find documentation for what its guarantees are - plus that the symbol is private so no user code and safely use it.

Closes #564

adamgreig commented 3 weeks ago

Thanks! I think lining up with __sheap should be fine; by default that's what you'd want MSPLIM etc to be set to anyway.

My only outstanding concern is that the new docs say users must specify _stack_end if they set _stack_start, but a lot of people are already setting stack_start and this isn't meant to be a breaking change. In particular it ended up in a lot of templates and examples so has been copied to memory.x far and wide, annoyingly usually with _stack_start = ORIGIN(RAM) + LENGTH(RAM); which is the default anyway! Perhaps the documentation around setting _stack_start could be clearer about when you must also set _stack_end and what will happen if you don't?

korken89 commented 3 weeks ago

Thanks for the comment @adamgreig, I've updated the wording to be more clear.