PF-build: cleanup whitespace

This commit is contained in:
Yuri D'Elia 2022-12-17 14:42:51 +01:00
parent b30ccbebaa
commit b26c6af8e3
1 changed files with 35 additions and 35 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# This bash script is used to compile automatically the Prusa firmware with a dedicated build environment and settings # This bash script is used to compile automatically the Prusa firmware with a dedicated build environment and settings
# #
# Supported OS: Windows 10, Linux64 bit # Supported OS: Windows 10, Linux64 bit
# Beta OS: Linux32 bit # Beta OS: Linux32 bit
# #
@ -35,12 +35,12 @@
# Useful things to edit and compare your custom Firmware # Useful things to edit and compare your custom Firmware
# 1. Download and install current and correct (64bit or 32bit) Notepad++ version https://notepad-plus-plus.org/download # 1. Download and install current and correct (64bit or 32bit) Notepad++ version https://notepad-plus-plus.org/download
# 2. Another great tool to compare your custom mod and stock firmware is WinMerge http://winmerge.org/downloads/?lang=en # 2. Another great tool to compare your custom mod and stock firmware is WinMerge http://winmerge.org/downloads/?lang=en
# #
# Example for MK3: open git bash and change to your Firmware directory # Example for MK3: open git bash and change to your Firmware directory
# <username>@<machine name> MINGW64 /<drive>/path # <username>@<machine name> MINGW64 /<drive>/path
# bash build.sh 1_75mm_MK3-EINSy10a-E3Dv6full # bash build.sh 1_75mm_MK3-EINSy10a-E3Dv6full
# #
# Example for MK25: open git bash and change to your directory # Example for MK25: open git bash and change to your directory
# gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware/MK3 # gussner@WIN01 MINGW64 /d/Data/Prusa-Firmware/MK3
# bash build.sh 1_75mm_MK25-RAMBo13a-E3Dv6full # bash build.sh 1_75mm_MK25-RAMBo13a-E3Dv6full
# #
@ -63,7 +63,7 @@
# 17 Jan 2019, 3d-gussner, Build_3, Check for OS Windows or Linux and use the right build environment # 17 Jan 2019, 3d-gussner, Build_3, Check for OS Windows or Linux and use the right build environment
# 10 Feb 2019, ropaha, Pull Request, Select variant from list while using build.sh # 10 Feb 2019, ropaha, Pull Request, Select variant from list while using build.sh
# 10 Feb 2019, ropaha, change FW_DEV_VERSION automatically depending on FW_VERSION RC/BETA/ALPHA # 10 Feb 2019, ropaha, change FW_DEV_VERSION automatically depending on FW_VERSION RC/BETA/ALPHA
# 10 Feb 2019, 3d-gussner, 1st tests with English only # 10 Feb 2019, 3d-gussner, 1st tests with English only
# 10 Feb 2019, ropaha, added compiling of all variants and English only # 10 Feb 2019, ropaha, added compiling of all variants and English only
# 10 Feb 2019, 3d-gussner, Set OUTPUT_FOLDER for hex files # 10 Feb 2019, 3d-gussner, Set OUTPUT_FOLDER for hex files
# 11 Feb 2019, 3d-gussner/ropaha, Minor changes and fixes # 11 Feb 2019, 3d-gussner/ropaha, Minor changes and fixes
@ -100,7 +100,7 @@
# 14 Jul 2019, 3d-gussner, Update preferences and make it really portable # 14 Jul 2019, 3d-gussner, Update preferences and make it really portable
# 15 Jul 2019, 3d-gussner, New PF-build-env GitHub branch # 15 Jul 2019, 3d-gussner, New PF-build-env GitHub branch
# 16 Jul 2019, 3d-gussner, New Arduino_boards GitHub fork # 16 Jul 2019, 3d-gussner, New Arduino_boards GitHub fork
# 17 Jul 2019, 3d-gussner, Final tests under Windows 10 and Linux Subsystem for Windows # 17 Jul 2019, 3d-gussner, Final tests under Windows 10 and Linux Subsystem for Windows
# 18 Jul 2019, 3d-gussner, Added python check # 18 Jul 2019, 3d-gussner, Added python check
# 18 Jul 2019, deliopoulos, No need more for changing 'platform.txt' file as it comes with the Arduino Boards. # 18 Jul 2019, deliopoulos, No need more for changing 'platform.txt' file as it comes with the Arduino Boards.
# 18 Jul 2019, deliopoulos, Modified 'PF_BUILD_FILE_URL' to use 'BUILD_ENV' variable # 18 Jul 2019, deliopoulos, Modified 'PF_BUILD_FILE_URL' to use 'BUILD_ENV' variable
@ -144,7 +144,7 @@
# 01-14 prepare build env # 01-14 prepare build env
# 21-32 prepare compiling # 21-32 prepare compiling
# 41-47 compiling # 41-47 compiling
# 51-54 cleanup # 51-54 cleanup
# 61-62 MK404 # 61-62 MK404
# 03 May 2021, 3d-gussner, Update documentation and change version to v1.2.0 # 03 May 2021, 3d-gussner, Update documentation and change version to v1.2.0
# 03 May 2021, 3d-gussner, Add SIM atmega404 # 03 May 2021, 3d-gussner, Add SIM atmega404
@ -155,7 +155,7 @@
# 18 Jun 2021, 3d-gussner, Use atmega404 if extanded RAM or FLASH size are chosen # 18 Jun 2021, 3d-gussner, Use atmega404 if extanded RAM or FLASH size are chosen
# 18 Jun 2021, 3d-gussner, Remove MK404 copy of lang file as it has been fixed in MK404 # 18 Jun 2021, 3d-gussner, Remove MK404 copy of lang file as it has been fixed in MK404
# 21 Jun 2021, 3d-gussner, Change atmega404 board flash argument to y # 21 Jun 2021, 3d-gussner, Change atmega404 board flash argument to y
# Use newer version of MK404-build.sh instead start the program # Use newer version of MK404-build.sh instead start the program
# 22 Jun 2021, 3d-gussner, Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware # 22 Jun 2021, 3d-gussner, Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware
# Added some logic if IDE 1.8.13 is used # Added some logic if IDE 1.8.13 is used
# Added some logic if Arduino_boards 1.0.4 is used # Added some logic if Arduino_boards 1.0.4 is used
@ -302,7 +302,7 @@ if [ ! -z "$verbose_IDE_flag" ]; then
fi fi
else else
verbose_IDE="0" verbose_IDE="0"
fi fi
#Check if Build is selected with argument '-f' #Check if Build is selected with argument '-f'
if [ ! -z "$board_flash_flag" ] ; then if [ ! -z "$board_flash_flag" ] ; then
@ -368,13 +368,13 @@ else
fi fi
#End: Check if Arduino IDE version is correct #End: Check if Arduino IDE version is correct
#Start: Check if Output is selecetd via argument '-o' #Start: Check if Output is selecetd via argument '-o'
if [[ -z "$output_flag" || "$output_flag" == 1 ]] ; then if [[ -z "$output_flag" || "$output_flag" == 1 ]] ; then
OUTPUT=1 OUTPUT=1
else else
OUTPUT=0 OUTPUT=0
fi fi
#End: Check if Output is selecetd via argument '-o' #End: Check if Output is selecetd via argument '-o'
##} ##}
#### End: Check for options/flags #### End: Check for options/flags
@ -399,7 +399,7 @@ fi
#### Start: Check Check if script has been canceled or failed nr1. #### Start: Check Check if script has been canceled or failed nr1.
check_script_failed_nr1() check_script_failed_nr1()
{ {
#Check for "Configuration.tmp" #Check for "Configuration.tmp"
if [ -f "$SCRIPT_PATH/Firmware/Configuration.tmp" ]; then if [ -f "$SCRIPT_PATH/Firmware/Configuration.tmp" ]; then
cp -f $SCRIPT_PATH/Firmware/Configuration.tmp $SCRIPT_PATH/Firmware/Configuration.h cp -f $SCRIPT_PATH/Firmware/Configuration.tmp $SCRIPT_PATH/Firmware/Configuration.h
#echo "Found Configuration.tmp restore Configuration.h" #echo "Found Configuration.tmp restore Configuration.h"
@ -411,7 +411,7 @@ fi
#### Start: Check if script has been canceled or failed nr2. #### Start: Check if script has been canceled or failed nr2.
check_script_failed_nr2() check_script_failed_nr2()
{ {
#Check for "config.tmp" #Check for "config.tmp"
#echo "No config.tmp" #echo "No config.tmp"
if [ -f "$SCRIPT_PATH/Firmware/config.tmp" ]; then if [ -f "$SCRIPT_PATH/Firmware/config.tmp" ]; then
cp -f $SCRIPT_PATH/Firmware/config.tmp $SCRIPT_PATH/Firmware/config.h cp -f $SCRIPT_PATH/Firmware/config.tmp $SCRIPT_PATH/Firmware/config.h
@ -527,7 +527,7 @@ fi
# End: Check python ... needed during language build # End: Check python ... needed during language build
#### Start: Set build environment #### Start: Set build environment
set_build_env_variables() set_build_env_variables()
{ {
BUILD_ENV="1.0.8" BUILD_ENV="1.0.8"
@ -738,12 +738,12 @@ if [[ ! -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$P
if [ ! -d ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr ]; then if [ ! -d ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr ]; then
mkdir ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr mkdir ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr
fi fi
mv ../PF-build-env/$BUILD_ENV/$BOARD_FILENAME-$BOARD_VERSION ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr/$BOARD_VERSION mv ../PF-build-env/$BUILD_ENV/$BOARD_FILENAME-$BOARD_VERSION ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr/$BOARD_VERSION
echo "# $BOARD_FILENAME-$BOARD_VERSION" >> ../PF-build-env/$BUILD_ENV/$BOARD_FILENAME-$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor.txt echo "# $BOARD_FILENAME-$BOARD_VERSION" >> ../PF-build-env/$BUILD_ENV/$BOARD_FILENAME-$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor.txt
echo "$(tput sgr 0)" echo "$(tput sgr 0)"
fi fi
# Download and extract Prusa Firmware specific library files # Download and extract Prusa Firmware specific library files
if [[ "$BOARD_VERSION" == "1.0.3" || "$BOARD_VERSION" == "1.0.2" || "$BOARD_VERSION" == "1.0.1" ]]; then if [[ "$BOARD_VERSION" == "1.0.3" || "$BOARD_VERSION" == "1.0.2" || "$BOARD_VERSION" == "1.0.1" ]]; then
@ -777,7 +777,7 @@ if [ -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Proc
if [ $OUTPUT == "1" ] ; then if [ $OUTPUT == "1" ] ; then
sleep 2 sleep 2
fi fi
fi fi
if [ -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2" ]; then if [ -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2" ]; then
echo "$(tput setaf 6)PrusaReasearch compatible tools have been manually updated...$(tput setaf 2)" echo "$(tput setaf 6)PrusaReasearch compatible tools have been manually updated...$(tput setaf 2)"
if [ $OUTPUT == "1" ] ; then if [ $OUTPUT == "1" ] ; then
@ -790,7 +790,7 @@ if [ -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Proc
cp -f ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/hardware/tools/avr/avr/lib/ldscripts/avr6.xn ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/lib/ldscripts/avr6.xn cp -f ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/hardware/tools/avr/avr/lib/ldscripts/avr6.xn ../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/avr/lib/ldscripts/avr6.xn
echo "# PF-build-env-portable-$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor-$BUILD_ENV" >> ../PF-build-env/$BUILD_ENV/PF-build-env-portable-$BUILD_ENV-$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor.txt echo "# PF-build-env-portable-$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor-$BUILD_ENV" >> ../PF-build-env/$BUILD_ENV/PF-build-env-portable-$BUILD_ENV-$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor.txt
echo "$(tput sgr0)" echo "$(tput sgr0)"
fi fi
if [ -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2" ]; then if [ -d "../PF-build-env/$BUILD_ENV/$ARDUINO_ENV-$BOARD_VERSION-$TARGET_OS-$Processor/portable/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2" ]; then
echo "$(tput setaf 1)Arduino IDE tools have been updated manually to a non supported version!!!" echo "$(tput setaf 1)Arduino IDE tools have been updated manually to a non supported version!!!"
echo "Delete ../PF-build-env/$BUILD_ENV and start the script again" echo "Delete ../PF-build-env/$BUILD_ENV and start the script again"
@ -817,7 +817,7 @@ if type git > /dev/null; then
fi fi
# #
# '-v' argument defines which variant of the Prusa Firmware will be compiled # '-v' argument defines which variant of the Prusa Firmware will be compiled
if [ -z "$variant_flag" ] ; then if [ -z "$variant_flag" ] ; then
# Select which variant of the Prusa Firmware will be compiled, like # Select which variant of the Prusa Firmware will be compiled, like
PS3="Select a variant: " PS3="Select a variant: "
@ -848,7 +848,7 @@ if [ -z "$variant_flag" ] ; then
esac esac
done done
else else
if [ -f "$SCRIPT_PATH/Firmware/variants/$variant_flag" ] ; then if [ -f "$SCRIPT_PATH/Firmware/variants/$variant_flag" ] ; then
VARIANTS=$variant_flag VARIANTS=$variant_flag
elif [ "$variant_flag" == "All" ] ; then elif [ "$variant_flag" == "All" ] ; then
while IFS= read -r -d $'\0' f; do while IFS= read -r -d $'\0' f; do
@ -879,7 +879,7 @@ if [ -z "$language_flag" ] ; then
LANGUAGES="ALL" LANGUAGES="ALL"
break break
;; ;;
"English only") "English only")
LANGUAGES="EN_FARM" LANGUAGES="EN_FARM"
break break
;; ;;
@ -988,7 +988,7 @@ prepare_code_for_compiling()
FW_REVISION=$(grep --max-count=1 "\bFW_REVISION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3) FW_REVISION=$(grep --max-count=1 "\bFW_REVISION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
FW="$FW_MAJOR$FW_MINOR$FW_REVISION" FW="$FW_MAJOR$FW_MINOR$FW_REVISION"
#FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g') #FW=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g')
if [ -z "$BUILD" ] ; then if [ -z "$BUILD" ] ; then
# Find build version in Configuration.h file and use it to generate the hex filename # Find build version in Configuration.h file and use it to generate the hex filename
BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3) BUILD=$(grep --max-count=1 "\bFW_COMMIT_NR\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d ' ' -f3)
else else
@ -1077,7 +1077,7 @@ prepare_hex_folders()
fi fi
OUTPUT_FOLDER="PF-build-hex/FW$FW-Build$BUILD/$BOARD" OUTPUT_FOLDER="PF-build-hex/FW$FW-Build$BUILD/$BOARD"
fi fi
#Define OUTPUT_FILENAME #Define OUTPUT_FILENAME
OUTPUT_FILENAME=FW$FW-Build$BUILD-$VARIANT OUTPUT_FILENAME=FW$FW-Build$BUILD-$VARIANT
#Check for OUTPUT_FILENAME_SUFFIX and add it #Check for OUTPUT_FILENAME_SUFFIX and add it
@ -1165,11 +1165,11 @@ prepare_variant_for_compiling()
sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h sed -i -- "s/^#define LANG_MODE *0/#define LANG_MODE 1/g" $SCRIPT_PATH/Firmware/config.h
echo " " echo " "
fi fi
#Check if compiler flags are set to Prusa specific needs for the rambo board. #Check if compiler flags are set to Prusa specific needs for the rambo board.
#if [ $TARGET_OS == "windows" ]; then #if [ $TARGET_OS == "windows" ]; then
#RAMBO_PLATFORM_FILE="PrusaResearchRambo/avr/platform.txt" #RAMBO_PLATFORM_FILE="PrusaResearchRambo/avr/platform.txt"
#fi #fi
#New fresh PF-Firmware-build #New fresh PF-Firmware-build
if [ "$new_build_flag" == "1" ]; then if [ "$new_build_flag" == "1" ]; then
@ -1261,19 +1261,19 @@ compile_en_firmware()
#Check if compiler flags are set to Prusa specific needs for the rambo board. #Check if compiler flags are set to Prusa specific needs for the rambo board.
# if [ $TARGET_OS == "windows" ]; then # if [ $TARGET_OS == "windows" ]; then
# RAMBO_PLATFORM_FILE="PrusaResearchRambo/avr/platform.txt" # RAMBO_PLATFORM_FILE="PrusaResearchRambo/avr/platform.txt"
# fi # fi
#### End of Prepare building #### End of Prepare building
#### Start building #### Start building
export ARDUINO=$BUILD_ENV_PATH export ARDUINO=$BUILD_ENV_PATH
#echo $BUILD_ENV_PATH #echo $BUILD_ENV_PATH
#export BUILDER=$ARDUINO/arduino-builder #export BUILDER=$ARDUINO/arduino-builder
echo echo
#read -t 5 -p "Press Enter..." #read -t 5 -p "Press Enter..."
echo echo
echo "Start to build Prusa Firmware ..." echo "Start to build Prusa Firmware ..."
echo "Using variant $VARIANT$(tput setaf 3)" echo "Using variant $VARIANT$(tput setaf 3)"
@ -1339,13 +1339,13 @@ create_multi_firmware()
else else
#Search for created firmware languages #Search for created firmware languages
langs=$(find Firmware-intl-en_*.hex | cut -d "_" -f2 | cut -d "." -f1) langs=$(find Firmware-intl-en_*.hex | cut -d "_" -f2 | cut -d "." -f1)
#Copy found firmware_*.hex files #Copy found firmware_*.hex files
for la in $langs; do for la in $langs; do
cp -f Firmware-intl-en_$la.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-$la.hex cp -f Firmware-intl-en_$la.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-$la.hex
done done
cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf
echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to PF-build-hex folder$(tput sgr 0)" echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to PF-build-hex folder$(tput sgr 0)"
if [ $TARGET_OS == "windows" ]; then if [ $TARGET_OS == "windows" ]; then
zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
#rm $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex #rm $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
elif [ $TARGET_OS == "linux" ]; then elif [ $TARGET_OS == "linux" ]; then
@ -1604,7 +1604,7 @@ if [ ! -d "../PF-build-env/$BUILD_ENV" ]; then
check_ArduinoIDE_User_interaction check_ArduinoIDE_User_interaction
fi fi
#### Start #### Start
set_paths set_paths
check_branch_changed check_branch_changed
@ -1613,7 +1613,7 @@ do
check_script_failed_nr1 check_script_failed_nr1
check_script_failed_nr2 check_script_failed_nr2
make_backup1 make_backup1
make_backup2 make_backup2
prepare_code_for_compiling prepare_code_for_compiling
prepare_hex_folders prepare_hex_folders
list_usefull_data list_usefull_data