Page 1 of 1

Stack Smashing from the BT stack/ROM code

Posted: Mon Oct 31, 2022 1:50 pm
by ThomasBit
Hi

I get stack smashing from time to time. It is detected during task switch, so the call stack does no reveal that much.

I can see it is related to the BT stack and happens with in some hours of usage of the BT connection.

Stack smashing protect failure!
abort() was called at PC 0x4015dc53 on core 0


I am using Bluetooth Classic and LW (only one at a time) in my project.
This issue happens at random intervals. It could take 1h to happen or a day. It happens regardless of the Bluetooth connection status.

I am using esp-idf version 4.4.1 and I also tried version 4.4.2 with it crashes less often. But that could be a coincidences.

Decoding the backtrace gives the following:
MicrosoftTeams-image.png
MicrosoftTeams-image.png (31.12 KiB) Viewed 2525 times
I tried to store the task name before the task switch is completed.
This is what I got:
smashing with task name.png
smashing with task name.png (9.28 KiB) Viewed 2525 times
The btControll must be somewhere in the ROM code, so I have no way of debugging way this is happens.

Anyone has any suggestion on how to procede?

Best regards Thomas

Re: Stack Smashing from the BT stack/ROM code

Posted: Tue Nov 01, 2022 12:13 am
by ESP_Sprite
There seem to be two knobs in menuconfig to change the stack size allocated to the BT tasks: BT_BTC_TASK_STACK_SIZE and BT_BTU_TASK_STACK_SIZE. Perhaps increasing those helps?

Re: Stack Smashing from the BT stack/ROM code

Posted: Tue Nov 01, 2022 9:52 am
by ThomasBit
Hi, yes. That i tried. We doubled the stack size with the same result. Eventually we get a stack smash

Thomas