Skip to content

ESP32C3 and C6: Stack protection fault on IDF 5.2.2 #15667

@mzakharocsc

Description

@mzakharocsc

Port, board and/or hardware

PORT: esp32, BOARD: esp32c6-devkitc-1

MicroPython version

v1.24.0-preview. forked at e9814e987bcc816fb67e38748a5afce466c45606. with #11869 applied for C6 support.

https://github.com/mzakharocsc/micropython/tree/c6

Reproduction

Code:
https://github.com/mzakharocsc/micropython/blob/c6/ports/esp32/modules/main.py

Edit file with your wifi SSID/PASSWORD. Start your MQTT broker ( I used mosquitto). Edit config['server'] = '192.168.50.31' with your broker IP address. Connect the board to UART port, Inside ports/esp32, make BOARD=ESP32_GENERIC_C6 deploy and monitor.

Code has to be run from main.py on board startup for some reason to reproduce this.

Expected behaviour

Expecting the board on startup to connect to a broker and publish continously without crashing. Code does not crash on IDF 5.1.4. On IDF 5.2.2, code crashes after a few minutes of runtime.

Observed behaviour

A fatal error occurred. The crash dump printed below may be used to help
determine what caused it. If you are not already running the most recent
version of MicroPython, consider upgrading. New versions often fix bugs.

To learn more about how to debug and/or report this crash visit the wiki
page at: https://github.com/micropython/micropython/wiki/ESP32-debugging

MPY version : v1.24.0-preview.209.gb5f390386.dirty on 2024-08-16
IDF version : v5.2.2
Machine     : ESP32C6 module with ESP32C6

Guru Meditation Error: Core  0 panic'ed (Stack protection fault). 

Detected in task "mp_task" at 0x4200e4fc
0x4200e4fc: nlr_jump at /home/mzakharo/station/micropythonc6x/py/nlrrv32.c:55

Stack pointer: 0x4082e8a0
Stack bounds: 0x40826d5c - 0x4082ed50


Core  0 register dump:
Stack dump detected
MEPC    : 0x420196f8  RA      : 0x40803aac  SP      : 0x4082e8a0  GP      : 0x40818e94  
0x420196f8: mp_obj_is_subclass_fast at /home/mzakharo/station/micropythonc6x/py/objtype.c:1364
0x40803aac: mp_execute_bytecode at /home/mzakharo/station/micropythonc6x/py/vm.c:1382 (discriminator 1)

TP      : 0x407ecb7c  T0      : 0x40022494  T1      : 0x4081321c  T2      : 0x0000003f  
0x40022494: multi_heap_internal_unlock in ROM
0x4081321c: vTaskSuspend at /home/mzakharo/esp-idf2/components/freertos/FreeRTOS-Kernel/tasks.c:1977

S0/FP   : 0x40838518  S1      : 0x40838558  A0      : 0x4219e010  A1      : 0x4219e010  
A2      : 0x00000000  A3      : 0x00000100  A4      : 0x0000000e  A5      : 0x4082e9a0  
A6      : 0x00000001  A7      : 0x00000002  S2      : 0x421a09f4  S3      : 0x408385b0  
S4      : 0x0000003c  S5      : 0x4219e000  S6      : 0x00000068  S7      : 0x4219e2d0  
S8      : 0x4081c000  S9      : 0x4219e000  S10     : 0x421a8b20  S11     : 0x421a8b1b  
T3      : 0x00000000  T4      : 0x00002b3a  T5      : 0x00000003  T6      : 0x00000001  
MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x0000001b  MTVAL   : 0x00001101  
0x40800001: _vector_table at ??:?

MHARTID : 0x00000000  


Backtrace:


mp_obj_is_subclass_fast (object=0x4219e010 <mp_type_StopIteration>, classinfo=0x4219e010 <mp_type_StopIteration>) at /home/mzakharo/station/micropythonc6x/py/objtype.c:1364
1364	bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo) {
#0  mp_obj_is_subclass_fast (object=0x4219e010 <mp_type_StopIteration>, classinfo=0x4219e010 <mp_type_StopIteration>) at /home/mzakharo/station/micropythonc6x/py/objtype.c:1364
#1  0x40803aac in mp_execute_bytecode (code_state=code_state@entry=0x40838518, inject_exc=inject_exc@entry=0x0) at /home/mzakharo/station/micropythonc6x/py/vm.c:1382
#2  0x4201257a in mp_obj_gen_resume (self_in=0x40838510, send_value=<optimized out>, throw_value=throw_value@entry=0x0, ret_val=ret_val@entry=0x4082e96c) at /home/mzakharo/station/micropythonc6x/py/objgenerator.c:210
#3  0x420126f4 in gen_resume_and_raise (raise_stop_iteration=true, throw_value=0x0, send_value=<optimized out>, self_in=<optimized out>) at /home/mzakharo/station/micropythonc6x/py/objgenerator.c:259
#4  gen_instance_send (self_in=<optimized out>, send_value=<optimized out>) at /home/mzakharo/station/micropythonc6x/py/objgenerator.c:286
#5  0x408040b8 in mp_execute_bytecode (code_state=code_state@entry=0x408347c0, inject_exc=inject_exc@entry=0x0) at /home/mzakharo/station/micropythonc6x/py/vm.c:1042
#6  0x4201207a in fun_bc_call (self_in=<optimized out>, n_args=1, n_kw=0, args=0x4082eb08) at /home/mzakharo/station/micropythonc6x/py/objfun.c:267
#7  0x00000000 in ?? ()
Backtrace stopped: frame did not save the PC
ELF file SHA256: aa26cad08

Rebooting...

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions