Debugging Stack/heap problems with VisualGDB

Posts: 9
Joined: Wed Dec 20, 2017 6:18 am

Debugging Stack/heap problems with VisualGDB

Postby nimbusgb » Fri Apr 24, 2020 10:58 am

Hi I am trying to get a version of Opus encoder running on an ESP32 WroverB

I have an I2S microphone ( Arcelli Inmp441 ) connected to the I2S port of a LyraT 4.3 board. I'm happy that this part is successfully delivering a sane ( or at least semi sane ) data stream as I have streamed the data to a plotter satisfactorily.
The collection runs in a thread simply capturing data and putting it in to a buffer using the standard I2S DMA Driver.

I can create and initialize the Opus encoder.

Another thread simply waits for packets of PCM data and passes them to the Opus encoder.

That's as far as I have got. The call to the Opus encoder blows the stack every time.

I have spent several weeks trying to debug this and have pushed ever further into the Opus code single stepping down further and further. I now have reached the point where i cannot seem to progress. Even the call to a subroutine simply crashes out of the debug of VisualGDB.
Others seem to have got Opus running on the ESP32 but I just can't seem to get past this.

I have reworked the code several different ways, no tasks, tasks, with and without passing data or flags, different sized queues, data areas, samples, and sampling rates. I have tried running all in a simple non threaded way and it makes very little difference to the 'location' of the stack failure.

I really would appreciate some help from someone. Lockdown is bad enough without being able to fix a code problem! :)

Happy to publish my code
(966.51 KiB) Downloaded 72 times

Posts: 21
Joined: Thu May 23, 2019 3:05 pm

Re: Debugging Stack/heap problems with VisualGDB

Postby philippe_44 » Sun Aug 09, 2020 6:42 am

Very late reply, but I can't see in you zip that you have increased stack size. You know that opus takes a fair bit of stack. Try as much as 32k or compile libopus with NONTHREADSAFE_PSEUDOSTACK

Who is online

Users browsing this forum: Baidu [Spider] and 54 guests