Hi, I have been using Bela with Pd and custom externals extensively over the past years. I used to have a functional "dummy" project on the Bela for compiling my externals but after an adventurous sd card flashing I accidentally got rid of it.
I tried to set it up again using resources from this forum but this time nothing worked.
I've finally found a very straightforward way to do it and therefore took the liberty to share the process here. Please correct me if I'm wrong.
BASICS
- PureData externals are additional objects which are compiled from .c or .cpp files.
- They need to be compiled with the proper target architecture to work on the Bela (e.g. an external on an apple computer will end with
.pd_darwin, on bela it is a .pd_linux)
- to have an external working in your pd patch, it simply needs to be in the same folder as
_main.pd. So once the file is compiled you can simply move it into your project, or upload it using the IDE.
STEPS
1 - Get into the Bela IDE
2 - Create a new project. You can remove all files from it. Name it what you want (pd-externals is fine)
3 - Using the IDE upload your source code file (YOUREXTERNAL.c)
4 - If you don't already use it, download pd-lib-builder (https://github.com/pure-data/pd-lib-builder)
5 - Using the IDE upload the Makefile.pdlibbuilder file in the project
6 - Get pd source code (https://github.com/pure-data/pure-data)
7 - Copy the src directory into the project (I told you it was straightforward). Several ways to do this. But scp works fine scp -r src root@192.168.7.2:/root/Bela/projects/pd-externals/.
I guess you could also just upload all the files directly in the project using the IDE if you like it messy.
8 - Create a Makefile. Minimal info is this :
lib.name = YOUREXTERNAL
class.sources = YOUREXTERNAL.c
include Makefile.pdlibbuilder
The Makefile.pdlibbuilder file is in the same directory so there is no need for PDLIBBUILDER_DIR
9 - From the IDE command line enter cd projects/pd-externals/ to get into the correct working directory
10 - From the IDE command line make PDINCLUDEDIR=src
that's in case you have uploaded the whole src directory, but the idea is simply to tell the compiler where "m_pd.h" is