diff --git a/CustomMakefile/CustomMakefileBottom.in b/CustomMakefile/CustomMakefileBottom.in deleted file mode 100644 index 57384af..0000000 --- a/CustomMakefile/CustomMakefileBottom.in +++ /dev/null @@ -1,14 +0,0 @@ -LIB_FULL_SO = libbelafull.so -LIB_FULL_A = libbelafull.a -LIB_FULL_OBJS = build/*/*.o libraries/*/build/*.o - -lib/$(LIB_FULL_SO): $(LIB_FULL_OBJS) - $(AT) echo Building lib/$(LIB_FULL_SO) - $(AT) $(CXX) $(BELA_LDFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(LIB_FULL_SO) -o lib/$(LIB_FULL_SO) $(LIB_FULL_OBJS) $(LDLIBS) $(BELA_EXTRA_LDLIBS) - $(AT) ldconfig $(BELA_DIR)/$@ - -lib/$(LIB_FULL_A): $(LIB_FULL_OBJS) $(PRU_OBJS) $(LIB_DEPS) - $(AT) echo Building lib/$(LIB_FULL_A) - $(AT) ar rcs lib/$(LIB_FULL_A) $(LIB_FULL_OBJS) - -libbelafull: lib/libbelafull.so lib/libbelafull.a \ No newline at end of file diff --git a/CustomMakefile/CustomMakefileTop.in b/CustomMakefile/CustomMakefileTop.in index fc9031c..a0b71e2 100644 --- a/CustomMakefile/CustomMakefileTop.in +++ b/CustomMakefile/CustomMakefileTop.in @@ -1 +1,11 @@ -NO_PROJECT_TARGETS+=lib/libbelafull.a libbelafull \ No newline at end of file +override CC=arm-linux-gnueabihf-gcc +override CXX=arm-linux-gnueabihf-g++ +ASSEMBLER=$(CC) +CPPFLAGS=--sysroot /sysroot -I/sysroot/usr/local/include +LDFLAGS=-L/sysroot/usr/lib -L/sysroot/usr/local/lib -static + +override XENO_CONFIG=true # ignore it, we have to hardcode stuff below instead +override XENOMAI_MAJOR=3 +override DEFAULT_XENOMAI_CFLAGS:=-I/sysroot/usr/xenomai/include/cobalt -I/sysroot/usr/xenomai/include -march=armv7-a -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__COBALT__ -D__COBALT_WRAP__ \ + -DXENOMAI_SKIN_posix -DXENOMAI_MAJOR=3 +override DEFAULT_XENOMAI_LDFLAGS := -Wl,--no-as-needed -L/sysroot/usr/xenomai/lib -lcobalt -lmodechk -lpthread -lrt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d8e80c4..026095c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,18 +13,17 @@ RUN ./build_packages.sh && rm build_packages.sh COPY scripts/build_env.sh ./ RUN ./build_env.sh && rm build_env.sh +COPY CustomMakefile/CustomMakefileTop.in /sysroot/root/Bela/ COPY scripts/build_libs.sh ./ RUN ./build_libs.sh && rm build_libs.sh -COPY CustomMakefile/* /tmp/ -COPY scripts/build_libbelafull.sh ./ -RUN ./build_libbelafull.sh && rm build_libbelafull.sh && rm tmp/CustomMakefile* - COPY scripts/build_bela.sh ./ RUN ./build_bela.sh && rm build_bela.sh && rm build_settings -WORKDIR /workspace +COPY example-project/* /sysroot/root/Bela/projects/basic/ + +WORKDIR /sysroot/root/ COPY Toolchain.cmake ./ CMD /bin/bash \ No newline at end of file diff --git a/example-project/render.cpp b/example-project/render.cpp index dd02d9c..c89fa92 100644 --- a/example-project/render.cpp +++ b/example-project/render.cpp @@ -1,27 +1,24 @@ /* - ____ _____ _ _ -| __ )| ____| | / \ -| _ \| _| | | / _ \ -| |_) | |___| |___ / ___ \ + ____ _____ _ _ +| __ )| ____| | / \ +| _ \| _| | | / _ \ +| |_) | |___| |___ / ___ \ |____/|_____|_____/_/ \_\ -http://bela.io -*/ -/** -\example Fundamentals/sinetone/render.cpp -Producing your first bleep! ---------------------------- +The platform for ultra-low latency audio and sensor processing -This sketch is the hello world of embedded interactive audio. Better known as bleep, it -produces a sine tone. +http://bela.io -The frequency of the sine tone is determined by a global variable, `gFrequency`. -The sine tone is produced by incrementing the phase of a sin function -on every audio frame. +A project of the Augmented Instruments Laboratory within the +Centre for Digital Music at Queen Mary University of London. +http://www.eecs.qmul.ac.uk/~andrewm -In render() you'll see a nested for loop structure. You'll see this in all Bela projects. -The first for loop cycles through 'audioFrames', the second through 'audioChannels' (in this case left 0 and right 1). -It is good to familiarise yourself with this structure as it's fundamental to producing sound with the system. +(c) 2016 Augmented Instruments Laboratory: Andrew McPherson, + Astrid Bin, Liam Donovan, Christian Heinrichs, Robert Jack, + Giulio Moro, Laurel Pardue, Victor Zappi. All rights reserved. + +The Bela software is distributed under the GNU Lesser General Public License +(LGPL 3.0), available here: https://www.gnu.org/licenses/lgpl-3.0.txt */ #include @@ -42,12 +39,18 @@ bool setup(BelaContext *context, void *userData) void render(BelaContext *context, void *userData) { for(unsigned int n = 0; n < context->audioFrames; n++) { - float out = 0.8f * sinf(gPhase); - gPhase += 2.0f * (float)M_PI * gFrequency * gInverseSampleRate; - if(gPhase > M_PI) - gPhase -= 2.0f * (float)M_PI; + float out = 0.8 * sinf(gPhase); + gPhase += 2.0 * M_PI * gFrequency * gInverseSampleRate; + if(gPhase > 2.0 * M_PI) + gPhase -= 2.0 * M_PI; for(unsigned int channel = 0; channel < context->audioOutChannels; channel++) { + // Two equivalent ways to write this code + + // The long way, using the buffers directly: + // context->audioOut[n * context->audioOutChannels + channel] = out; + + // Or using the macros: audioWrite(context, n, channel, out); } } @@ -57,3 +60,22 @@ void cleanup(BelaContext *context, void *userData) { } + + +/** +\example sinetone/render.cpp + +Producing your first bleep! +--------------------------- + +This sketch is the hello world of embedded interactive audio. Better known as bleep, it +produces a sine tone. + +The frequency of the sine tone is determined by a global variable, `gFrequency`. +The sine tone is produced by incrementing the phase of a sin function +on every audio frame. + +In render() you'll see a nested for loop structure. You'll see this in all Bela projects. +The first for loop cycles through 'audioFrames', the second through 'audioChannels' (in this case left 0 and right 1). +It is good to familiarise yourself with this structure as it's fundamental to producing sound with the system. +*/ diff --git a/scripts/build_bela.sh b/scripts/build_bela.sh index 1003fe0..0be271b 100755 --- a/scripts/build_bela.sh +++ b/scripts/build_bela.sh @@ -17,6 +17,7 @@ rsync -avz --out-format=" %n" $BBB_ADDRESS:/usr/lib/libNE10.* /sysroot/usr/lib rsync -avz --out-format=" %n" $BBB_ADDRESS:/usr/lib/libmathneon.* /sysroot/usr/lib # bela +mkdir -p ./sysroot/root/Bela/projects mkdir -p ./sysroot/root/Bela/include mkdir -p ./sysroot/root/Bela/lib rsync -avz --out-format=" %n" $BBB_ADDRESS:/root/Bela/libraries /sysroot/root/Bela diff --git a/scripts/build_env.sh b/scripts/build_env.sh index 3f98c9a..b5acbf3 100755 --- a/scripts/build_env.sh +++ b/scripts/build_env.sh @@ -12,14 +12,20 @@ ssh-keygen -R $1 &> /dev/null || true ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 $BBB_ADDRESS "date -s \"`date '+%Y%m%d %T %z'`\" > /dev/null" # change Bela branch to dev commit -git clone https://github.com/BelaPlatform/Bela.git /tmp/Bela -cd /tmp/Bela +git clone https://github.com/BelaPlatform/Bela.git /sysroot/root/Bela +cd /sysroot/root/Bela git remote add board $BBB_ADDRESS:Bela/ -git checkout $BELA_DEV_COMMIT +git checkout $BELA_COMMIT git switch -c tmp ssh $BBB_ADDRESS "cd Bela && git config receive.denyCurrentBranch updateInstead" git push -f board tmp:tmp ssh $BBB_ADDRESS "cd Bela && git config --unset receive.denyCurrentBranch" - ssh $BBB_ADDRESS "cd Bela && git checkout tmp" -cd /tmp && rm -rf Bela \ No newline at end of file + +# pasm +cd /tmp/ +git clone https://github.com/giuliomoro/am335x_pru_package +cd am335x_pru_package/pru_sw/utils/pasm_source +./linuxbuild +cp ../pasm /usr/local/bin +rm -rf /tmp/am335x_pru_package \ No newline at end of file diff --git a/scripts/build_libbelafull.sh b/scripts/build_libbelafull.sh deleted file mode 100755 index fd7d946..0000000 --- a/scripts/build_libbelafull.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -e - -source build_settings -BBB_ADDRESS=root@$BBB_HOSTNAME - -rsync \ ---timeout=10 \ --avzP /tmp/CustomMakefile* \ -$BBB_ADDRESS:Bela/ - -ssh $BBB_ADDRESS "cd Bela && make libbelafull" diff --git a/scripts/build_settings b/scripts/build_settings index ba181ae..02b013e 100644 --- a/scripts/build_settings +++ b/scripts/build_settings @@ -1,2 +1,2 @@ BBB_HOSTNAME=192.168.7.2 -BELA_DEV_COMMIT=7005724 \ No newline at end of file +BELA_COMMIT=7005724 \ No newline at end of file