circuitpython: CIRCUITPY_PYSTACK_SIZE=4000 crashes ESP32S3 boards to safe mode

CircuitPython version

Adafruit CircuitPython 8.1.0-alpha.2-17-g00a03c323 on 2023-02-23; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Adafruit CircuitPython 8.1.0-alpha.2-17-g00a03c323 on 2023-02-23; BPI-PicoW-S3 with ESP32S3

Code/REPL

No code.py file is executed.

Behavior

On esp32s3 boards setting CIRCUITPY_PYSTACK_SIZE=4000 causes a crash into safe mode.

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Fault detected by hardware.
Please file an issue with your program at https://github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.

A value of 3500 works fine.

Description

I’ve used values up to 7000 on a board with the raspberry pi RP2040 micro controller without a similar crash.

This may be a total red herring but building with micropy_stackless=1 prevents the crash, however setting CIRCUITPY_PYSTACK_SIZE > 3500 still doesn’t seem to improve the stack limitations (EDIT: I’m not sure about this now, my stack depth test may have been faulty). I remember @bill88t mentioning that on some boards the parameter had an effective upper limit but I can’t find the note right now. Perhaps the ESP32S3 was one of those boards.

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 27 (4 by maintainers)

Commits related to this issue

Most upvoted comments

On S2 I could go up to a megabyte before I added checks. I assumed I hit some interger limit there.

The effective upper limit is 3700 for S2, 7000 for rp2.

Currently I have covid and I am pretty much unable to fix this. However can you please find the exact value it fails on?

The fix would pretty much be defining an upper limit for every mcu. If the value set is higher than that, lower it to the maximum.