rongal I am new to the BELA, and would like to download all or most of the *.h files and the structures associated with the BELA libraries.
Where and how can I download these files?
Do you mean the core Bela code? Here it is https://github.com/BelaPlatform/Bela/tree/master/ .
rongal Is there any way to plant breakpoints in the BELA applications?
Yes, you need to compile with debug flags and run in gdb
. In many cases it will work fine, except that you will not be able to use conditional breakpoints in the real-time thread. Also, sometimes you may get a kernel panic upon hitting a breakpoint. This is not supported from the IDE, so you will have to ssh
into the board and go to the Bela folder (cd Bela
), then you will have to compile with debugging flags. You will also want to remove pre-compiled objects that you want to recompile with debug flags. You can remove some (or all) of the .o
files in ~/Bela/build/core/
and/or the project's own .o
files in ~/Bela/projects/yourProjectName/build
. Then you can build
make -C ~/Bela PROJECT=yourProjectName AT= debug
and then run within gdb
:
cd projects/yourProjectName
gdb yourProjectName
Remember - at the end of your debugging session - to rebuild all the core and project files with optimizations enabled and without the debugging flag:
make -C ~/Bela PROJECT=yourProjectName AT= coreclean projectclean all
If not, how can I retain local (debug oriented) printouts to a file in real time or after the fact?
Depending on what you need to achieve, you can use the WriteFile
class (see e.g.: https://github.com/BelaPlatform/Bela/blob/master/examples/07-DataLogging/logging-sensors/render.cpp ). However, if your program is crashing, so will the file logging and you will lose the last few lines of logging. If your program is crashing and you want the guarantee that all the lines your print are actually printed out, you should use printf
and not rt_printf
, as the latter is buffered and may not make it to the output before the program crashes. On the other hand, using printf
is bad practice and may cause your audio to glitch especially if the CPU usage is high. But sometimes one printf
just before crashing is enough!