Skip to content

Conversation

bugadani
Copy link
Contributor

@bugadani bugadani commented Oct 1, 2025

This PR reuses the results from #4207. Task stacks are now watched by the main task stack watchpoint. The software-based method has been disabled by default.

An unintended, but welcome consequence is that the scheduler is slightly faster without the software-based detection, if there is only a single thread to work with. This slightly improves performance of embassy when esp-radio (and thus, extra threads) is not present.

@bugadani bugadani added the skip-changelog No changelog modification needed label Oct 1, 2025
- value: false

- name: hw-task-overflow-detection
description: 'Enable hardware-based stack overflow detection. The stack watermark is based on the esp-hal stack-guard-offset configuration.'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've elected to not use the esp-hal config here - the more we have, the more tightly the crates are coupled. Since the stack-guard-* options are currently unstable, we really shouldn't rely on them in esp-rtos at all (we risk breaking compatibility in the future).

While the stack protector is in the process of getting stabilised, it isn't stable yet.

@bugadani bugadani added this pull request to the merge queue Oct 1, 2025
Merged via the queue into esp-rs:main with commit d4330d3 Oct 1, 2025
29 checks passed
@bugadani bugadani deleted the rtos-stack branch October 1, 2025 11:20
SergioGasquez added a commit to SergioGasquez/esp-hal that referenced this pull request Oct 2, 2025
* Allow setting a custom idle hook (esp-rs#4209)

* Document esp-rtos just a bit (esp-rs#4208)

* Slight MG touchup

* Document esp-rtos in migration guide

* Document things

* Apply suggestion from @Copilot

Co-authored-by: Copilot <[email protected]>

* Improve esp-rtos docs

---------

Co-authored-by: Copilot <[email protected]>

* refactor(ledc): introduce freq unset error and mode conversion (esp-rs#4214)

* feat: introduce freq unset error and mode conversion

* chore: format

* refactor

* refactor!: rename api

* fix

* fix docs

* Disable unusable pins for various chips (esp-rs#4202)

* ESP32: disable integrated SPI-connected pins

* remove unavailable/non-existent pins for esp32c2 and esp32h2

* address reviews, drop more user-unusable pins

* edit the changelog

* fix psram (esp32)

oi

* RTOS: Use simpler sync object for executor (esp-rs#4215)

* Use simpler sync object internally

* Update esp-rtos/src/task/mod.rs

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>

* Monitor the main stack's stack guard (esp-rs#4207)

* Monitor the main stack's stack guard

* CHANGELOG.md

* Clippy

* Save a bit of RAM

* Some some IRAM

* Avoid warning

* Hint on register names

* Protect the main stack on the second core, too

* Fix `rt` w/o main stack protection

* Use correct cfg gates

* Refactor

* Improvements

* More rt gating

* Stack-guard for second core

* Adapt examples and tests

* Bump somni-expr

* CHANGELOG and migration guide

* Fix doc-tests

* fmt

* Use ESP_HAL_CONFIG_STACK_GUARD_OFFSET for the second core

* Fix test

* Honor stack_guard_monitoring everywhere

* Fix rebased migration guide

* Fix doc-tests again

* Update esp-hal/src/debugger.rs

Co-authored-by: Dániel Buga <[email protected]>

* Write the stack guard value on the second core

---------

Co-authored-by: Dániel Buga <[email protected]>

* Move `multicore` from `esp-storage` to `esp-hal` (esp-rs#4188)

* Move multicore from esp-storage to esp-hal

* changelog

* reviews

* address review comments and clean up

* remove duplicated park_core() and split is_running() per chip

* cleanup

* Clean up blocking until deadline (esp-rs#4217)

* Hw-based RTOS stack overflow detection (esp-rs#4218)

* Respect the stack guard offset in thread stacks

* Use the hardware watchpoint to protect rtos thread stacks

* Use watchpoints for stack overflow detection

* Do not rely on the value of the stack guard (esp-rs#4220)

* Make BLE task configurable (esp-rs#4223)

* Redo config options (esp-rs#4224)

* Remove unused deps (esp-rs#4230)

* `esp-phy` the second (esp-rs#4228)

* Hopefully fixes it

* fmt

* Fix documentation link in Cargo.toml

---------

Co-authored-by: Dániel Buga <[email protected]>

* twai: do not abort transmissions on recoverable errors (esp-rs#4227)

* twai: do not abort transmissions on recoverable errors

The TWAI driver's interrupt handler currently aborts transmissions if
certain (error) interrupts were triggered. This causes the transmission
of frames to become unreliable, because the `transmit_async` operation
does not return any error codes if a transmission was aborted.

Additionally, the TWAI controller is designed to be a reliable and, with
the exception of the bus-off state, normally would simply try to
rentransmit a message on its own. Therefore, this commit removes
transmission abortion on errors and, instead, only aborts a transmission
if the controller changes into the bus-off state.

Fixes esp-rs#4222

* Update esp-hal/CHANGELOG.md

Co-authored-by: Juraj Sadel <[email protected]>

---------

Co-authored-by: Juraj Sadel <[email protected]>

* Change default wifi_max_burst_size (esp-rs#4231)

* Remove outdated limitation (esp-rs#4232)

* feat: Use github actions artifacts to store semver baseline

---------

Co-authored-by: Dániel Buga <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Ethan Wu <[email protected]>
Co-authored-by: Kirill Mikhailov <[email protected]>
Co-authored-by: Björn Quentin <[email protected]>
Co-authored-by: Juraj Sadel <[email protected]>
Co-authored-by: Simon Neuenhausen <[email protected]>
Co-authored-by: Harald Böhm <[email protected]>
Co-authored-by: Juraj Sadel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog No changelog modification needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants