[opus] Global stack on Cortex-M4
Jean-Marc Valin
jmvalin at jmvalin.ca
Wed Oct 18 21:32:14 UTC 2017
On 18/10/17 04:40 PM, Eric wrote:
> UDEFS = -DOPUS_BUILD -DFIXED_POINT -DDISABLE_FLOAT_API \
> -DOPUS_ARM_INLINE_EDSP -DEMBEDDED_ARM -DNONTHREADSAFE_PSEUDOSTACK \
> -DOVERRIDE_OPUS_ALLOC -DOVERRIDE_OPUS_FREE \
> -D'opus_alloc(x)=NULL' -D'opus_free(x)=NULL'
>
>
> Secondly; With the "overide" directives above no dynamic memory
> allocation is supposed to happen. However, the following call chain
> (obviously) cause a crash:
Presumably, you're using the init() calls and not the create() calls
(which require allocation). In that case, you'll want to also define
OVERRIDE_OPUS_ALLOC_SCRATCH and have opus_alloc_scratch() return a
buffer where to put the stack (as Tim pointed out). Otherwise you can
use alloca() or VLAs, but you have to somehow give Opus some way to get
memory. With the above options, you're basically preventing Opus from
having any stack space.
Cheers,
Jean-Marc
More information about the opus
mailing list