Sync PF-build.sh and MK404-build.sh with MK3_3.11.1 branch

This commit is contained in:
3d-gussner 2022-07-12 08:48:22 +02:00
parent 1db9735654
commit 3a77ef3ce7
2 changed files with 45 additions and 40 deletions

View File

@ -10,7 +10,7 @@
# 3. Install latest updates with 'sudo apt-get upgrade'
#
#
# Version: 1.0.0-Build_14
# Version: 1.0.0-Build_18
# Change log:
# 11 Feb 2021, 3d-gussner, Inital
# 11 Feb 2021, 3d-gussner, Optional flags to check for updates
@ -22,8 +22,9 @@
# 18 Jun 2021, 3d-gussner, Added -g 3 and 4 for more details extrusion lines
# 18 Jun 2021, 3d-gussner, Check for updates is default. Fix update if internet connection is lost.
# 21 Jun 2021, 3d-gussner, Change board_flash argument to 'y' and firmware_version to 'f'
# 25 Jan 2021, 3d-gussner, Allow upper and lower case in selection
# 25 Jan 2022, 3d-gussner, Allow upper and lower case in selection
# Add update option to release OR devel
# 01 Jul 2022, 3d-gussner, Limit atmegaMK404 boards mem to 8,16,32
#### Start: Failures
failures()
@ -35,7 +36,7 @@ case "$1" in
4) echo "$(tput setaf 1)Some packages are missing please install these!$(tput sgr0)" ; exit 4 ;;
5) echo "$(tput setaf 1)Wrong printer chosen.$(tput sgr0) Following Printers are supported: MK25, MK25S, MK3 and MK3S" ; exit 5 ;;
6) echo "$(tput setaf 1)Unsupported board flash size chosen.$(tput sgr0) Only '256', '384', '512', '1024' and '32M' are allowed." ; exit 6 ;;
7) echo "$(tput setaf 1)Unsupported board mem size chosen.$(tput sgr0) Only '8', '16', '32' and '64' are allowed." ; exit 7 ;;
7) echo "$(tput setaf 1)Unsupported board mem size chosen.$(tput sgr0) Only '8', '16' and '32' are allowed." ; exit 7 ;;
8) echo "$(tput setaf 1)No firmware version file selected!$(tput sgr0)" ; echo "Add argument -f with path and hex filename to start MK404" ; exit 8 ;;
9) echo "$(tput setaf 1)Tried to determine MK404 printer from hex file, but failed!$(tput sgr0)" ; "Add argument -p with 'MK25', 'MK25S', 'MK3' or 'MK3S' to start MK404" ; exit 9 ;;
10) echo "$(tput setaf 1)Missing printer$(tput sgr0)" ; exit 10 ;;
@ -76,7 +77,7 @@ while getopts c:f:g:m:n:p:u:x:y:?h flag
# '?' 'h' argument usage and help
if [ "$help_flag" == "1" ] ; then
echo "***************************************"
echo "* MK404-build.sh Version: 1.0.0-Build_14 *"
echo "* MK404-build.sh Version: 1.0.0-Build_18 *"
echo "***************************************"
echo "Arguments:"
echo "$(tput setaf 2)-c$(tput sgr0) Check for update"
@ -101,7 +102,7 @@ echo " -m : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' y
echo " -n : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' yes"
echo " -p : '$(tput setaf 2)MK25$(tput sgr0)', '$(tput setaf 2)MK25S$(tput sgr0)', '$(tput setaf 2)MK3$(tput sgr0)' or '$(tput setaf 2)MK3S$(tput sgr0)'"
echo " -u : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' release ', '$(tput setaf 2)2$(tput sgr0)' devel '"
echo " -x : '$(tput setaf 2)8$(tput sgr0)',$(tput setaf 2)16$(tput sgr0)',$(tput setaf 2)32$(tput sgr0)' or '$(tput setaf 2)64$(tput sgr0)' Kb."
echo " -x : '$(tput setaf 2)8$(tput sgr0)',$(tput setaf 2)16$(tput sgr0)' or $(tput setaf 2)32$(tput sgr0)' Kb."
echo " -y : '$(tput setaf 2)256$(tput sgr0)','$(tput setaf 2)384$(tput sgr0)','$(tput setaf 2)512$(tput sgr0)','$(tput setaf 2)1024$(tput sgr0)''$(tput setaf 2)32M$(tput sgr0)'"
echo
echo "Example:"
@ -160,9 +161,6 @@ if [ ! -z "$board_mem_flag" ] ; then
elif [ "$board_mem_flag" == "32" ] ; then
BOARD_MEM="0x7DFF"
echo "Board mem size : $board_mem_flag Kb, $BOARD_MEM (hex)"
elif [ "$board_mem_flag" == "64" ] ; then
BOARD_MEM="0xFFFF"
echo "Board mem size : $board_mem_flag Kb, $BOARD_MEM (hex)"
else
failures 7
fi

View File

@ -56,7 +56,7 @@
# Some may argue that this is only used by a script, BUT as soon someone accidentally or on purpose starts Arduino IDE
# it will use the default Arduino IDE folders and so can corrupt the build environment.
#
# Version: 2.0.2-Build_69
# Version: 2.0.2-Build_80
# Change log:
# 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt'
# 16 Jan 2019, 3d-gussner, Build_2, Added development check to modify 'Configuration.h' to prevent unwanted LCD messages that Firmware is unknown
@ -177,8 +177,12 @@
# Fix DEV_STATUS to set correctly on RC/BETA/ALPHA/DEVEL
# Fix atmegaMK404 Board mem and flash modifications
# Limit atmegaMK404 boards mem to 8,16,32
# 20 Jun 2022, 3d-gussner, Change to Ardunio_boards v 1.0.5-1
# 20 Jun 2022, 3d-gussner, Change to Ardunio_boards v1.0.5-1
# 20 Jun 2022, wavexx , New PO-based language translation support
# 20 Jun 2022, 3d-gussner, fix Mk2.5/S zip after change PO-based language translation support
# 06 Jul 2022, 3d-gussner, Change to v1.0.8 and Ardunio_boards v1.0.5-2
# 06 Jul 2022, 3d-gussner, Fix branch check
# 12 Jul 2022, 3d-gussner, Check if FW_FLAVAVOR and FW_FLAVERSION are correct
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
export SRCDIR=$SCRIPT_PATH
@ -202,6 +206,7 @@ case "$1" in
22) echo "$(tput setaf 1)PF-build.sh has been interrupted/failed. $(tput setaf 6)Restoring 'config.h'$(tput sgr0)" ; if [ $OUTPUT == "1" ] ; then sleep 5 ; fi ;;
24) echo "$(tput setaf 1)PF-build.sh stopped due to compiling errors! Try to restore modified files.$(tput sgr0)"; check_script_failed_nr1 ; check_script_failed_nr2 ; cleanup_firmware ; exit 24 ;;
25) echo "$(tput setaf 1)Failed to execute $(tput sgr0)" ; exit 25 ;;
26) echo "$(tput setaf 1)FW_FLAVAVOR or FW_FLAVERSION commented out in 'Firmware/Configuration.h'$(tput sgr0)"; check_script_failed_nr1 ; check_script_failed_nr2 ; cleanup_firmware ; exit 26 ;;
esac
}
#### End: Failures
@ -235,7 +240,7 @@ while getopts b:c:d:g:h:i:j:l:m:n:o:p:v:x:y:?h flag
# '?' 'h' argument usage and help
if [ "$help_flag" == "1" ] ; then
echo "***************************************"
echo "* PF-build.sh Version: 2.0.2-Build_69 *"
echo "* PF-build.sh Version: 2.0.2-Build_80 *"
echo "***************************************"
echo "Arguments:"
echo "$(tput setaf 2)-b$(tput sgr0) Build/commit number"
@ -261,7 +266,7 @@ echo " -b : '$(tput setaf 2)Auto$(tput sgr0)' needs git or a number"
echo " -c : '$(tput setaf 2)0$(tput sgr0)' clean up, '$(tput setaf 2)1$(tput sgr0)' keep"
echo " -d : '$(tput setaf 2)GOLD$(tput sgr0)', '$(tput setaf 2)RC$(tput sgr0)', '$(tput setaf 2)BETA$(tput sgr0)', '$(tput setaf 2)ALPHA$(tput sgr0)', '$(tput setaf 2)DEBUG$(tput sgr0)', '$(tput setaf 2)DEVEL$(tput sgr0)' and '$(tput setaf 2)UNKNOWN$(tput sgr0)'"
echo " -g : '$(tput setaf 2)0$(tput sgr0)' no '$(tput setaf 2)1$(tput sgr0)' lite '$(tput setaf 2)2$(tput sgr0)' fancy '$(tput setaf 2)3$(tput sgr0)' lite with Quad_HR '$(tput setaf 2)4$(tput sgr0)' fancy with Quad_HR"
echo " -i : '$(tput setaf 2)1.8.5$(tput sgr0)', '$(tput setaf 2)1.8.13$(tput sgr0)', '$(tput setaf 2)1.8.19$(tput sgr0)'"
echo " -i : '$(tput setaf 2)1.8.5$(tput sgr0)', '$(tput setaf 2)1.8.19$(tput sgr0)'"
echo " -j : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' yes"
echo " -l : '$(tput setaf 2)ALL$(tput sgr0)' for multi language or '$(tput setaf 2)EN_ONLY$(tput sgr0)' for English only"
echo " -m : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' yes '$(tput setaf 2)2$(tput sgr0)' with MMU2"
@ -353,7 +358,7 @@ fi
#Start: Check if Arduino IDE version is correct
if [ ! -z "$IDE_flag" ]; then
if [[ "$IDE_flag" == "1.8.5" || "$IDE_flag" == "1.8.13" || "$IDE_flag" == "1.8.19" ]]; then
if [[ "$IDE_flag" == "1.8.5" || "$IDE_flag" == "1.8.19" ]]; then
ARDUINO_ENV="${IDE_flag}"
else
ARDUINO_ENV="1.8.19"
@ -542,11 +547,11 @@ fi
#### Start: Set build environment
set_build_env_variables()
{
BUILD_ENV="1.0.7"
BUILD_ENV="1.0.8"
BOARD="prusa_einsy_rambo"
BOARD_PACKAGE_NAME="PrusaResearch"
if [ "$ARDUINO_ENV" == "1.8.19" ]; then
BOARD_VERSION="1.0.5-1"
BOARD_VERSION="1.0.5-2"
else
BOARD_VERSION="1.0.4"
fi
@ -925,7 +930,6 @@ fi
#Check if Build is selected via argument '-b'
if [ ! -z "$build_flag" ] ; then
if [[ "$build_flag" == "Auto" && "$git_available" == "1" ]] ; then
echo "Build changed to $build_flag"
BUILD=$(git rev-list --count HEAD)
elif [[ $build_flag =~ ^[0-9]+$ ]] ; then
BUILD=$build_flag
@ -934,27 +938,26 @@ if [ ! -z "$build_flag" ] ; then
echo "Only $(tput setaf 2)'Auto' (git needed) or numbers $(tput sgr0) are allowed as build '-b' argument!$(tput sgr0)"
failures 5
fi
echo "New Build number is: $BUILD"
fi
#Check git branch has changed
if [ ! -z "git_available" ]; then
BRANCH=""
CLEAN_PF_FW_BUILD=0
else
BRANCH=$(git branch --show-current)
echo "Current branch is:" $BRANCH
if [ ! -f "$SCRIPT_PATH/../PF-build.branch" ]; then
echo "$BRANCH" >| $SCRIPT_PATH/../PF-build.branch
#echo "$BRANCH" >| $SCRIPT_PATH/../PF-build.branch
echo "created PF-build.branch file"
else
PRE_BRANCH=$(cat "$SCRIPT_PATH/../PF-build.branch")
echo "Previous branch was:" $PRE_BRANCH
#echo "Previous branch was:" $PRE_BRANCH
if [ ! "$BRANCH" == "$PRE_BRANCH" ] ; then
CLEAN_PF_FW_BUILD=1
echo "$BRANCH" >| $SCRIPT_PATH/../PF-build.branch
fi
fi
else
BRANCH=""
CLEAN_PF_FW_BUILD=0
fi
}
#### End: Getting arguments for command line compiling
@ -1018,20 +1021,27 @@ prepare_code_for_compiling()
MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3)
# Check development status
FW_FLAV=$(grep --max-count=1 "//#define FW_FLAVOR\b" $SCRIPT_PATH/Firmware/Configuration.h|cut -d ' ' -f1)
FW_FLAVREV=$(grep --max-count=1 "//#define FW_FLAVERSION\b" $SCRIPT_PATH/Firmware/Configuration.h|cut -d ' ' -f1)
if [[ "$FW_FLAV" == "//#define" && -z $FW_FLAVREV ]];then
failures 26
fi
#echo "FLAV:$FW_FLAV"
if [[ "$FW_FLAV" != "//#define" ]] ; then
FW_FLAVOR=$(grep --max-count=1 "\bFW_FLAVOR\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
#echo "FLAVOR:$FW_FLAVOR"
if [[ "$FW_FLAVREV" != "//#define" ]] ; then
FW_FLAVERSION=$(grep --max-count=1 "\bFW_FLAVERSION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
if [[ "$FW_FLAVOR" != "//#define FW_FLAVOR" ]] ; then
FW="$FW-$FW_FLAVOR"
DEV_CHECK="$FW_FLAVOR"
#echo "DEV:$DEV_CHECK"
echo "DEV:$DEV_CHECK"
if [ ! -z "$FW_FLAVERSION" ] ; then
FW="$FW$FW_FLAVERSION"
fi
else
failures 26
fi
fi
#DEV_CHECK=$(grep --max-count=1 "\bFW_VERSION\b" $SCRIPT_PATH/Firmware/Configuration.h | sed -e's/ */ /g'|cut -d '"' -f2|sed 's/\.//g'|cut -d '-' -f2)
if [ -z "$DEV_STATUS_SELECTED" ] ; then
if [[ "$DEV_CHECK" == *"RC"* ]] ; then
DEV_STATUS="RC"
@ -1155,7 +1165,7 @@ prepare_variant_for_compiling()
fi
#Prepare Configuration.h to use the correct FW_DEV_VERSION to prevent LCD messages when connecting with OctoPrint
sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h
sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_.*/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h
# set FW_REPOSITORY
sed -i -- 's/#define FW_REPOSITORY "Unknown"/#define FW_REPOSITORY "Prusa3d"/g' $SCRIPT_PATH/Firmware/Configuration.h
@ -1345,10 +1355,10 @@ create_multi_firmware()
cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf
else
#Search for created firmware languages
langs=$(find firmware_*.hex | cut -d "_" -f2 | cut -d "." -f1)
langs=$(find Firmware-intl-en_*.hex | cut -d "_" -f2 | cut -d "." -f1)
#Copy found firmware_*.hex files
for la in $langs; do
cp -f firmware_$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
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)"
@ -1356,11 +1366,6 @@ create_multi_firmware()
zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
#rm $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
elif [ $TARGET_OS == "linux" ]; then
# Make a copy for MK404 sim of MK2, MK2.5, MK2.5S firmware
if [ ! -z "$mk404_flag" ]; then
cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.hex
fi
# End of MK2, MK2.5, MK2.5S firmware copy
zip -j ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
fi
fi
@ -1390,8 +1395,10 @@ save_en_firmware()
cleanup_firmware()
{
if [[ -z "$prusa_flag" || "$prusa_flag" == "0" ]]; then
if [ -e "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then
rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || failures 13
fi
fi
# Delete dupblicates
if find $SCRIPT_PATH/lang/ -name '*RAMBo10a*.txt' -printf 1 -quit | grep -q 1
then
@ -1417,8 +1424,8 @@ cleanup_firmware()
fi
# Restore files to previous state
sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h
sed -i -- 's/^#define FW_REPOSITORY "Prusa3d"/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h
sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_.*/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h
sed -i -- 's/^#define FW_REPOSITORY.*/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h
if [ ! -z "$BUILD_ORG" ] ; then
sed -i -- "s/^#define FW_COMMIT_NR.*/#define FW_COMMIT_NR $BUILD_ORG/g" $SCRIPT_PATH/Firmware/Configuration.h
fi
@ -1442,11 +1449,11 @@ cleanup_firmware()
fi
# Restore build env files to previous state
if [ $BOARD_MEM_MODIFIED == "1" ]; then
if [ "$BOARD_MEM_MODIFIED" == "1" ]; then
sed -i -- "s/^#define FLASHEND .*$/#define FLASHEND 0x3FFFF/g" $BUILD_ENV_PATH/hardware/tools/avr/avr/include/avr/iom2560.h
echo "$(tput setaf 2)Restored Board Mem$(tput sgr 0)"
fi
if [ $BOARD_FLASH_MODIFIED == "1" ]; then
if [ "$BOARD_FLASH_MODIFIED" == "1" ]; then
sed -i -- "s/^prusa_einsy_rambo.upload.maximum_size.*/prusa_einsy_rambo.upload.maximum_size=253952/g" $BUILD_ENV_PATH/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr/$BOARD_VERSION/boards.txt
sed -i -- "s/^#define RAMEND.*/#define RAMEND 0x21FF/g" $BUILD_ENV_PATH/hardware/tools/avr/avr/include/avr/iom2560.h
echo "$(tput setaf 2)Restored Board Flash$(tput sgr 0)"