Skip to content

Small hardcoded stack size #11891

@Ariakenom

Description

@Ariakenom

Board

N/A

Device Description

N/A

Hardware Configuration

N/A

Version

latest stable Release (if not listed below)

Type

Bug

IDE Name

N/A

Operating System

N/A

Flash frequency

N/A

PSRAM enabled

yes

Upload speed

N/A

Description

Enabling debug level esp logs crashes due to the hardcoded stack size linked below.

https://github.com/espressif/arduino-esp32/blob/ea382dfac5a91454dd722d16fb77be454570bbfd/cores/esp32/HWCDC.cpp#L63C82-L63C93

Probably affects ESPUSB as well. Maybe more?

Expected behavior:
Don't stack overflow.

Sketch

# platformio.ini
platform = espressif32 @ ^6.8.0
framework = espidf, arduino

# ESP menuconfig
change CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT to n
change CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE to y

# Code
Do USB activity after setting:
esp_log_level_set("*", ESP_LOG_VERBOSE);

Debug Message

# everything working fine, normal logs

# set log level = verbose

D (23201) event: running post ARDUINO_HW_CDC_EVENTS:3 with handler 0x42018ee0 and context 0x3fced83c on loop 0x3fcecd80

***ERROR*** A stack overflow in task arduino_hw_cdc_ has been detected.


Backtrace: 0x40378346:0x3fcecda0 0x4037ee3d:0x3fcecdc0 0x40382c1d:0x3fcecde0 0x40380fde:0x3fcece60 0x4037eef4:0x3fcece80 0x4037eeea:0x3fcece78 |<-CORRUPTED




ELF file SHA256: x

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)

# addr2line
0x40378346: panic_abort at C:/Users/x/.platformio/packages/[email protected]/components/esp_system/panic.c:408                                        
0x4037ee3d: esp_system_abort at C:/Users/x/.platformio/packages/[email protected]/components/esp_system/esp_system.c:137
0x40382c1d: vApplicationStackOverflowHook at C:\Users\x\.platformio\packages\[email protected]\components\freertos\port\xtensa/port.c:407
0x40380fde: vTaskSwitchContext at C:\Users\x\.platformio\packages\[email protected]\components\freertos/tasks.c:3616
0x4037eef4: _frxt_dispatch at C:\Users\x\.platformio\packages\[email protected]\components\freertos\port\xtensa/portasm.S:436
0x4037eeea: _frxt_int_exit at C:\Users\x\.platformio\packages\[email protected]\components\freertos\port\xtensa/portasm.S:231

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions