Mercurial > hg > beaglert
changeset 399:ff60102d5f39 prerelease
Merge
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 15 Jun 2016 01:34:29 +0100 |
parents | 8a7c35ee8b3f (diff) 5587d7fa0108 (current diff) |
children | adb4fafbeaef |
files | Makefile |
diffstat | 4 files changed, 73 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Tue Jun 14 21:39:06 2016 +0100 +++ b/Makefile Wed Jun 15 01:34:29 2016 +0100 @@ -8,7 +8,7 @@ .DEFAULT_GOAL := Bela -NO_PROJECT_TARGETS=coreclean distclean stop help +NO_PROJECT_TARGETS=coreclean distclean stop help iderun idestop iderunup idenostartup NO_PROJECT_TARGETS_MESSAGE=PROJECT or EXAMPLE should be set for all targets except: $(NO_PROJECT_TARGETS) # Type `$ make help` to get a description of the functionalities of this Makefile. help: ## Show this help @@ -29,6 +29,7 @@ # if we are building an example, just copy it to the projects/ folder # and then treat it as a project ifdef EXAMPLE + #you can alternatively specify PROJECT= along with EXAMPLE= PROJECT?=exampleTempProject PROJECT_DIR?=$(abspath projects/$(PROJECT)) $(shell mkdir -p $(abspath projects)) @@ -39,17 +40,21 @@ endif ifdef PROJECT - $(shell mkdir -p $(PROJECT_DIR)/build) + $(shell mkdir -p $(PROJECT_DIR)/build build/core) endif OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) COMMAND_LINE_OPTIONS?=$(CL) RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) -RUN_IDE_COMMAND?=stdbuf -i0 -o0 -e0 $(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) -BELA_STARTUP_SCRIPT?=/root/Bela_startup.sh +RUN_IDE_COMMAND?=stdbuf -i0 -o0 -e0 $(RUN_COMMAND) +BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh BELA_AUDIO_THREAD_NAME?=bela-audio SCREEN_NAME?=Bela - +BELA_IDE_STARTUP_SCRIPT?=/root/Bela_node.sh +BELA_IDE_HOME?=/root/Bela/IDE +BELA_IDE_SCREEN_NAME?=Bela-IDE +BELA_IDE_RUN_COMMAND?=cd $(BELA_IDE_HOME) && screen -S $(BELA_IDE_SCREEN_NAME) -d -m node index.js +BELA_IDE_STOP_COMMAND?=screen -X -S $(BELA_IDE_SCREEN_NAME) quit > /dev/null RM := rm -rf STATIC_LIBS := ./libprussdrv.a ./libNE10.a @@ -204,7 +209,7 @@ clean: projectclean coreclean: ## Remove the core's build objects - -$(RM) build/* + -$(RM) build/core/* prompt: @printf "Warning: you are about to DELETE the projects/ folder and its content. This operation cannot be undone. Continue? (y/N) " @@ -263,4 +268,22 @@ stop: @PID=`grep $(BELA_AUDIO_THREAD_NAME) /proc/xenomai/stat | cut -d " " -f 5 | sed s/\s//g`; if [ -z $$PID ]; then echo "No process to kill"; else echo "Killing old Bela process $$PID"; kill -2 $$PID; fi; screen -X -S $(SCREEN_NAME) quit > /dev/null; exit 0; -.PHONY: all clean distclean help projectclean nostartup startup startuploop debug run runfg runscreen runscreenfg runscreenfifo stop +iderun: ## Starts the on-board IDE +iderun: + $(BELA_IDE_RUN_COMMAND) + +idestop: ## Stops the on-board IDE + @echo TODO + @exit 1 + +BELA_IDE_STARTUP_COMMAND=printf "\#!/bin/sh\n\#\n\# This file is autogenerated by Bela. Do not edit!\n\necho Running the Bela IDE...\n$(BELA_IDE_RUN_COMMAND)\n" > $(BELA_IDE_STARTUP_SCRIPT) + +idestartup: ## Enables the IDE at startup + @echo "Enabling the IDE at startup" + $(BELA_IDE_STARTUP_COMMAND) + @chmod +x $(BELA_IDE_STARTUP_SCRIPT) + +idenostartup: ## Disables the IDE at startup + @echo "Disabling the IDE at startup" + @printf "#!/bin/sh\n#\n\n# This file is autogenerated by Bela. Do not edit!\n\n# The Bela IDE is disabled on startup.\n" > $(BELA_IDE_STARTUP_SCRIPT) +.PHONY: all clean distclean help projectclean nostartup startup startuploop debug run runfg runscreen runscreenfg runscreenfifo stop iderun idestop iderunup idenostartup
--- a/core/WriteFile.cpp Tue Jun 14 21:39:06 2016 +0100 +++ b/core/WriteFile.cpp Wed Jun 15 01:34:29 2016 +0100 @@ -119,7 +119,7 @@ } } -void WriteFile::log(float* array, int length){ +void WriteFile::log(const float* array, int length){ for(int n = 0; n < length; n++){ log(array[n]); }
--- a/include/WriteFile.h Tue Jun 14 21:39:06 2016 +0100 +++ b/include/WriteFile.h Wed Jun 15 01:34:29 2016 +0100 @@ -90,7 +90,7 @@ * This is ignored in binary mode. */ void setFooter(const char* newFooter); - void log(float* array, int length); + void log(const float* array, int length); void log(float value); void init(const char* filename);
--- a/scripts/build_pd_heavy.sh Tue Jun 14 21:39:06 2016 +0100 +++ b/scripts/build_pd_heavy.sh Wed Jun 15 01:34:29 2016 +0100 @@ -11,12 +11,13 @@ verbose="0" render="0" pdpath="" +NO_UPLOAD="0" WATCH="0" FORCE="0" #make sure the paths have the trailing / . projectpath="../projects/heavy/hvtemp/" [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2" -[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/Bela/" +[ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/BeagleRT/" [ -z "$BBB_PROJECT_HOME" ] && BBB_PROJECT_HOME="${BBB_BELA_HOME}/projects/" BBB_DEFAULT_PROJECT_NAME="heavyProject" [ -z "$BBB_PROJECT_NAME" ] && BBB_PROJECT_NAME=$BBB_DEFAULT_PROJECT_NAME @@ -47,11 +48,11 @@ { printf "\nUSAGE: build_pd.sh [[-i input folder containing _main.pd file ]\ [-o output folder for new heavy project .c files (default ../projects/heavy/hvtemp)]\ - [-b bbb path to copy to (default ~/Bela)] | [-h] | [-f|--force] | [-w|--watch]\n" + [-b bbb path to copy to (default ~/BeagleRT)] | [-h] | [-f|--force] | [-w|--watch] | [-n|--noupload] \n" printf "\nexample: build_pd.sh -i ../projects/heavy/pd/hello-world -o ../projects/heavy/hello-world\n" echo "If --watch is selected, the script will check every 1s for any file that is modified in the source folder, which triggers\ the building process and runs the process. -If --screen is selected, the prompt returns to the user after launching Bela in a screen on the target device. +If --screen is selected, the prompt returns to the user after launching BeagleRT in a screen on the target device. If --screen and --watch are combined, while the process is running in the screen, modifications to the source files will \ still trigger a new build." } @@ -78,6 +79,8 @@ ;; -w | --watch ) WATCH=1 ;; + -n | --noupload ) NO_UPLOAD=1 + ;; -h | --help ) usage exit ;; @@ -123,37 +126,49 @@ function checkUploadBuildRun(){ checkChanged || return # exits if source files have not changed - # remove old static files to avoid obsolete errors - # use -rf to prevent warnings in case they do not exist - rm -rf "$projectpath"/Hv* "$projectpath"/Message* "$projectpath"/Control* "$projectpath"/Signal* &>/dev/null + if [ $NO_UPLOAD -eq 0 ]; then + # remove old static files to avoid obsolete errors + # use -rf to prevent warnings in case they do not exist + rm -rf "$projectpath"/Hv* "$projectpath"/Message* "$projectpath"/Control* "$projectpath"/Signal* &>/dev/null - # invoke the online compiler - "$BELA_PYTHON27" hvresources/uploader.py "$pdpath"/ -n bbb -g c -o "$projectpath"; - if [ $? -ne 0 ]; then - #echo "ERROR: an error occurred while executing the uploader.py script" - echo "error" - exit 1 + # invoke the online compiler + "$BELA_PYTHON27" hvresources/uploader.py "$pdpath"/ -n bbb -g c -o "$projectpath"; + if [ $? -ne 0 ]; then + #echo "ERROR: an error occurred while executing the uploader.py script" + echo "error" + exit 1 + fi; fi; echo ""; #echo "*|*|* Successfully uploaded and converted pd patch into super-fast optimized C code. Brought to you by Heavy! *|*|*"; echo ""; + BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME #make sure there is no trailing slash here + BBB_NETWORK_TARGET_FOLDER=$BBB_ADDRESS:$BBB_PROJECT_FOLDER + # check how to copy/sync render.cpp file... - if [ $render -eq 0 ]; then - cp "hvresources/render.cpp" $projectpath/; + # don't replace render.cpp file if custom one provided in output folder + if [ -f $projectpath"/render.cpp" ]; then + echo "Found custom render.cpp file in output folder"; + ssh -t $BBB_ADDRESS "rm ${BBB_PROJECT_FOLDER}/build/render.*" + else + if [ $render -eq 0 ]; then + cp "hvresources/render.cpp" $projectpath/; + fi; fi; cp "hvresources/HvUtils.h" $projectpath/; echo "updating files on board..." - BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME #make sure there is no trailing slash here - BBB_NETWORK_TARGET_FOLDER=$BBB_ADDRESS:$BBB_PROJECT_FOLDER - rsync -avc --no-t --exclude 'HvContext*' "$projectpath"/ "$BBB_NETWORK_TARGET_FOLDER"; - - # for whatever reason these big files used to hang when transferring with rsync - scp "$projectpath"/HvContext* $BBB_NETWORK_TARGET_FOLDER + echo rsync -c -rv --exclude 'HvContext*' "$projectpath"/ "$BBB_NETWORK_TARGET_FOLDER"; + rsync -c -rv --exclude 'HvContext*' "$projectpath"/ "$BBB_NETWORK_TARGET_FOLDER"; + # rsync -c -rv "$projectpath"/ "$BBB_ADDRESS":"$BBB_BELA_HOME"/source; + if [ $NO_UPLOAD -eq 0 ]; then + # for whatever reason these big files used to hang when transferring with rsync + scp "$projectpath"/HvContext* $BBB_NETWORK_TARGET_FOLDER + fi; if [ $? -ne 0 ]; then echo ""; @@ -167,10 +182,12 @@ # UPDATED_FILES=`rsync -naic --log-format="%f" "$projectpath" "$BBB_BELA_HOME"/source | grep -v "\.$"` # echo "UPDATEDFILES : $UPDATED_FILES" # exit 2 - # sets the date, remove old executable and heavy context .o/.d files - ssh $BBB_ADDRESS "date -s '`date`' > /dev/null; rm -rf "$BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME; - SCREEN_NAME=Bela - # Make new Bela execut/able and run + # remove old executable and heavy context .o/.d files + if [ $NO_UPLOAD -eq 0 ]; then + ssh $BBB_ADDRESS "rm -rf "$BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME; + fi; + SCREEN_NAME=BeagleRT + # Make new BeagleRT execut/able and run # It does not look very nice that we type the same things over and over # but that is because each line is an ssh session in its own right MAKE_COMMAND="make stop -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'"