esp-idf/tools/test_apps/system/longjmp_test
Jakob Hasse fc22e3c645 [system]: Made longjmp save for context switch
* Patched longjmp to be context-switch safe
  longjmp modifies the windowbase and windowstart
  registers, which isn't safe if a context switch
  occurs during the modification. After a context
  switch, windowstart and windowbase will be
  different, leading to a wrongly set windowstart
  bit due to longjmp writing it based on the
  windowbase before the context switch. This
  corrupts the registers at the next window
  overflow reaching that wrongly set bit.

  The solution is to disable interrupts during
  this code. It is only 6 instructions long,
  the impact shouldn't be significant.

  The fix is implemented as a wrapper which
  replaces the original first instructions of
  longjmp which are buggy. Then, it jumps back
  to execute the rest of the original longjmp
  function.

  Added a comparably reliable test to the
  test apps.
2021-04-23 15:55:31 +08:00
..
main [system]: Made longjmp save for context switch 2021-04-23 15:55:31 +08:00
app_test.py [system]: Made longjmp save for context switch 2021-04-23 15:55:31 +08:00
CMakeLists.txt [system]: Made longjmp save for context switch 2021-04-23 15:55:31 +08:00
Makefile [system]: Made longjmp save for context switch 2021-04-23 15:55:31 +08:00
README.md [system]: Made longjmp save for context switch 2021-04-23 15:55:31 +08:00
sdkconfig.defaults [system]: Made longjmp save for context switch 2021-04-23 15:55:31 +08:00

Supported Targets ESP32 ESP32-S2 ESP32-S3

Building

Example building for ESP32:

idf.py set-target esp32
cp sdkconfig.defaults sdkconfig
idf.py build

Running

All the setup needs to be done as described in the test apps README.