Page 1 of 1

Problems integrating external library

Posted: Mon May 17, 2021 7:28 am
by rampudia
Hey!

I added an external library to the project, namely https://github.com/mborgerding/kissfft. To do so I include the header files by adding the corresponding directory to the "INCLUDES += -I ... " in the Makefile and placed the source files I needed in a VPATH folder as suggested in this post viewtopic.php?f=6&t=4502&p=20601&hilit= ... arm#p20601. The code compiles with "make clean && make" and I am able to flash the Crazyflie but as soon as it finishes then LEDs 1 and 4 turn RED (no blinking) and the self test routine never takes place.

Do you know what could be happening? I first tried this on a separate STM32F4 platform successfully by adding the headers and source files to the project in STM32CubeIDE to see that the problem was not in the code. Any suggestions?

Re: Problems integrating external library

Posted: Mon May 17, 2021 11:20 am
by arnaud
You are likely hitting a hard-fault very early in the boot. The best would be to connect a debugger to the Crazyflie and to use gdb to find the source of the hardfault.

One lead could be to check the memory usage: are you doing anything that uses a lot of stack or try to allocate a lot of memory using malloc?

Re: Problems integrating external library

Posted: Mon May 17, 2021 7:24 pm
by rampudia
Yes, I am using memory allocation for a considerable amount of memory so I think you are right that this is the cause.

I will no longer be pursuing the implementation of this library as I found a better alternative for now to do the FFT ( viewtopic.php?f=6&t=4844 ) but I did notice on the other solution that dynamically allocating memory inside a thread led to the same fault and when declaring the variables as static in the global scope fixed it so this was helpful.

Thanks!