Skip to content

Commit

Permalink
giulios fix to use make command in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
pelinski committed Aug 19, 2024
1 parent 0b45039 commit 4989d70
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 59 deletions.
14 changes: 0 additions & 14 deletions CustomMakefile/CustomMakefileBottom.in

This file was deleted.

12 changes: 11 additions & 1 deletion CustomMakefile/CustomMakefileTop.in
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
NO_PROJECT_TARGETS+=lib/libbelafull.a libbelafull
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
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
66 changes: 44 additions & 22 deletions example-project/render.cpp
Original file line number Diff line number Diff line change
@@ -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 <Bela.h>
Expand All @@ -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);
}
}
Expand All @@ -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.
*/
1 change: 1 addition & 0 deletions scripts/build_bela.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions scripts/build_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

# 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
11 changes: 0 additions & 11 deletions scripts/build_libbelafull.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build_settings
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BBB_HOSTNAME=192.168.7.2
BELA_DEV_COMMIT=7005724
BELA_COMMIT=7005724

0 comments on commit 4989d70

Please sign in to comment.