Reputation: 11
I am trying to run Kiss FFT (Kiss FFT github) on an MSP430FR6989 Launchpad. For now, I'm just trying to get the kiss_fftr test shown here to work. I am running into an issue with kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem). My input is (16, 0, NULL, NULL). The function reaches this point in kiss_fftr.c and then returns NULL due to the !st if statement.
if (lenmem == NULL) {
st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded);
} else {
if (*lenmem >= memneeded)
st = (kiss_fftr_cfg) mem;
*lenmem = memneeded;
}
if (!st)
{
return NULL;
}
Malloc sets st to NULL, so it failed to allocate the memory. I am sure that there is enough memory available in my MCU. My memory allocation in CCS is 35% RAM (736/2048), 3% FRAM1 (1896/48000) and 28% FRAM2 (23144/81912).
Does anyone have advice on how to fix this, or what I should learn to fix this? I don't want to chase down the wrong rabbit hole if memory allocation is not the issue.
What I've tried: When I try running the test code given in the stack overflow link and sending the output array over UART, I get no output. I checked to see if kiss_fft_alloc is working correctly by making an if statement (st == NULL) that would throw a KISS_FFT_ERROR. The error threw at the point mentioned above, but I cannot figure out how to "fix" malloc failing to allocate memory.
Upvotes: 1
Views: 219