pw_system: Make blatant that SystemStart() clobbers the stack On FreeRTOS, the target-specific port may reset the machine stack pointer register to reclaim the memory that is "wasted" by a call that never returns. This can be bad if the stack contains C or C++ values that are referenced by other systems, as effectively those values will be overwritten. The low level manipulation also means C++ destructors are not invoked. It's safe to assume that FreeRTOS is not unique in this regard, so let's make it blatantly clear that pw::SystemStart() will trash the existing stack by deprecating the existing function name, and using a new eye-catching one: "pw::system::StartAndClobberTheStack". Unfortunately there is no good way to detect this automatically. Some stack use by the compiler is almost inevitable, and we don't control how `SystemStart()` is invoked. All we can do it call it out, and give some guidance on how to best prepare for this happening. This patch does the rename, documents why, and adjust the examples and tests to match. Bug: 382073705 Change-Id: I31dc3800efa269af3cd2a7357df5bd5820a27463 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/335555 Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Reviewed-by: Wyatt Hepler <hepler@google.com> Commit-Queue: Lloyd Pique <lpique@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.