Skip to content

Commit 3a77ef3

Browse files
committed
Sync PF-build.sh and MK404-build.sh with MK3_3.11.1 branch
1 parent 1db9735 commit 3a77ef3

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

MK404-build.sh

+6-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# 3. Install latest updates with 'sudo apt-get upgrade'
1111
#
1212
#
13-
# Version: 1.0.0-Build_14
13+
# Version: 1.0.0-Build_18
1414
# Change log:
1515
# 11 Feb 2021, 3d-gussner, Inital
1616
# 11 Feb 2021, 3d-gussner, Optional flags to check for updates
@@ -22,8 +22,9 @@
2222
# 18 Jun 2021, 3d-gussner, Added -g 3 and 4 for more details extrusion lines
2323
# 18 Jun 2021, 3d-gussner, Check for updates is default. Fix update if internet connection is lost.
2424
# 21 Jun 2021, 3d-gussner, Change board_flash argument to 'y' and firmware_version to 'f'
25-
# 25 Jan 2021, 3d-gussner, Allow upper and lower case in selection
25+
# 25 Jan 2022, 3d-gussner, Allow upper and lower case in selection
2626
# Add update option to release OR devel
27+
# 01 Jul 2022, 3d-gussner, Limit atmegaMK404 boards mem to 8,16,32
2728

2829
#### Start: Failures
2930
failures()
@@ -35,7 +36,7 @@ case "$1" in
3536
4) echo "$(tput setaf 1)Some packages are missing please install these!$(tput sgr0)" ; exit 4 ;;
3637
5) echo "$(tput setaf 1)Wrong printer chosen.$(tput sgr0) Following Printers are supported: MK25, MK25S, MK3 and MK3S" ; exit 5 ;;
3738
6) echo "$(tput setaf 1)Unsupported board flash size chosen.$(tput sgr0) Only '256', '384', '512', '1024' and '32M' are allowed." ; exit 6 ;;
38-
7) echo "$(tput setaf 1)Unsupported board mem size chosen.$(tput sgr0) Only '8', '16', '32' and '64' are allowed." ; exit 7 ;;
39+
7) echo "$(tput setaf 1)Unsupported board mem size chosen.$(tput sgr0) Only '8', '16' and '32' are allowed." ; exit 7 ;;
3940
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 ;;
4041
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 ;;
4142
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
7677
# '?' 'h' argument usage and help
7778
if [ "$help_flag" == "1" ] ; then
7879
echo "***************************************"
79-
echo "* MK404-build.sh Version: 1.0.0-Build_14 *"
80+
echo "* MK404-build.sh Version: 1.0.0-Build_18 *"
8081
echo "***************************************"
8182
echo "Arguments:"
8283
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
101102
echo " -n : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' yes"
102103
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)'"
103104
echo " -u : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' release ', '$(tput setaf 2)2$(tput sgr0)' devel '"
104-
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."
105+
echo " -x : '$(tput setaf 2)8$(tput sgr0)',$(tput setaf 2)16$(tput sgr0)' or $(tput setaf 2)32$(tput sgr0)' Kb."
105106
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)'"
106107
echo
107108
echo "Example:"
@@ -160,9 +161,6 @@ if [ ! -z "$board_mem_flag" ] ; then
160161
elif [ "$board_mem_flag" == "32" ] ; then
161162
BOARD_MEM="0x7DFF"
162163
echo "Board mem size : $board_mem_flag Kb, $BOARD_MEM (hex)"
163-
elif [ "$board_mem_flag" == "64" ] ; then
164-
BOARD_MEM="0xFFFF"
165-
echo "Board mem size : $board_mem_flag Kb, $BOARD_MEM (hex)"
166164
else
167165
failures 7
168166
fi

PF-build.sh

+39-32
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
# Some may argue that this is only used by a script, BUT as soon someone accidentally or on purpose starts Arduino IDE
5757
# it will use the default Arduino IDE folders and so can corrupt the build environment.
5858
#
59-
# Version: 2.0.2-Build_69
59+
# Version: 2.0.2-Build_80
6060
# Change log:
6161
# 12 Jan 2019, 3d-gussner, Fixed "compiler.c.elf.flags=-w -Os -Wl,-u,vfprintf -lprintf_flt -lm -Wl,--gc-sections" in 'platform.txt'
6262
# 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 @@
177177
# Fix DEV_STATUS to set correctly on RC/BETA/ALPHA/DEVEL
178178
# Fix atmegaMK404 Board mem and flash modifications
179179
# Limit atmegaMK404 boards mem to 8,16,32
180-
# 20 Jun 2022, 3d-gussner, Change to Ardunio_boards v 1.0.5-1
181-
180+
# 20 Jun 2022, 3d-gussner, Change to Ardunio_boards v1.0.5-1
181+
# 20 Jun 2022, wavexx , New PO-based language translation support
182+
# 20 Jun 2022, 3d-gussner, fix Mk2.5/S zip after change PO-based language translation support
183+
# 06 Jul 2022, 3d-gussner, Change to v1.0.8 and Ardunio_boards v1.0.5-2
184+
# 06 Jul 2022, 3d-gussner, Fix branch check
185+
# 12 Jul 2022, 3d-gussner, Check if FW_FLAVAVOR and FW_FLAVERSION are correct
182186

183187
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
184188
export SRCDIR=$SCRIPT_PATH
@@ -202,6 +206,7 @@ case "$1" in
202206
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 ;;
203207
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 ;;
204208
25) echo "$(tput setaf 1)Failed to execute $(tput sgr0)" ; exit 25 ;;
209+
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 ;;
205210
esac
206211
}
207212
#### 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
235240
# '?' 'h' argument usage and help
236241
if [ "$help_flag" == "1" ] ; then
237242
echo "***************************************"
238-
echo "* PF-build.sh Version: 2.0.2-Build_69 *"
243+
echo "* PF-build.sh Version: 2.0.2-Build_80 *"
239244
echo "***************************************"
240245
echo "Arguments:"
241246
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"
261266
echo " -c : '$(tput setaf 2)0$(tput sgr0)' clean up, '$(tput setaf 2)1$(tput sgr0)' keep"
262267
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)'"
263268
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"
264-
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)'"
269+
echo " -i : '$(tput setaf 2)1.8.5$(tput sgr0)', '$(tput setaf 2)1.8.19$(tput sgr0)'"
265270
echo " -j : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' yes"
266271
echo " -l : '$(tput setaf 2)ALL$(tput sgr0)' for multi language or '$(tput setaf 2)EN_ONLY$(tput sgr0)' for English only"
267272
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
353358

354359
#Start: Check if Arduino IDE version is correct
355360
if [ ! -z "$IDE_flag" ]; then
356-
if [[ "$IDE_flag" == "1.8.5" || "$IDE_flag" == "1.8.13" || "$IDE_flag" == "1.8.19" ]]; then
361+
if [[ "$IDE_flag" == "1.8.5" || "$IDE_flag" == "1.8.19" ]]; then
357362
ARDUINO_ENV="${IDE_flag}"
358363
else
359364
ARDUINO_ENV="1.8.19"
@@ -542,11 +547,11 @@ fi
542547
#### Start: Set build environment
543548
set_build_env_variables()
544549
{
545-
BUILD_ENV="1.0.7"
550+
BUILD_ENV="1.0.8"
546551
BOARD="prusa_einsy_rambo"
547552
BOARD_PACKAGE_NAME="PrusaResearch"
548553
if [ "$ARDUINO_ENV" == "1.8.19" ]; then
549-
BOARD_VERSION="1.0.5-1"
554+
BOARD_VERSION="1.0.5-2"
550555
else
551556
BOARD_VERSION="1.0.4"
552557
fi
@@ -925,7 +930,6 @@ fi
925930
#Check if Build is selected via argument '-b'
926931
if [ ! -z "$build_flag" ] ; then
927932
if [[ "$build_flag" == "Auto" && "$git_available" == "1" ]] ; then
928-
echo "Build changed to $build_flag"
929933
BUILD=$(git rev-list --count HEAD)
930934
elif [[ $build_flag =~ ^[0-9]+$ ]] ; then
931935
BUILD=$build_flag
@@ -934,27 +938,26 @@ if [ ! -z "$build_flag" ] ; then
934938
echo "Only $(tput setaf 2)'Auto' (git needed) or numbers $(tput sgr0) are allowed as build '-b' argument!$(tput sgr0)"
935939
failures 5
936940
fi
937-
echo "New Build number is: $BUILD"
938941
fi
939942

940943
#Check git branch has changed
941944
if [ ! -z "git_available" ]; then
942-
BRANCH=""
943-
CLEAN_PF_FW_BUILD=0
944-
else
945945
BRANCH=$(git branch --show-current)
946946
echo "Current branch is:" $BRANCH
947947
if [ ! -f "$SCRIPT_PATH/../PF-build.branch" ]; then
948-
echo "$BRANCH" >| $SCRIPT_PATH/../PF-build.branch
948+
#echo "$BRANCH" >| $SCRIPT_PATH/../PF-build.branch
949949
echo "created PF-build.branch file"
950950
else
951951
PRE_BRANCH=$(cat "$SCRIPT_PATH/../PF-build.branch")
952-
echo "Previous branch was:" $PRE_BRANCH
952+
#echo "Previous branch was:" $PRE_BRANCH
953953
if [ ! "$BRANCH" == "$PRE_BRANCH" ] ; then
954954
CLEAN_PF_FW_BUILD=1
955955
echo "$BRANCH" >| $SCRIPT_PATH/../PF-build.branch
956956
fi
957957
fi
958+
else
959+
BRANCH=""
960+
CLEAN_PF_FW_BUILD=0
958961
fi
959962
}
960963
#### End: Getting arguments for command line compiling
@@ -1018,20 +1021,27 @@ prepare_code_for_compiling()
10181021
MOTHERBOARD=$(grep --max-count=1 "\bMOTHERBOARD\b" $SCRIPT_PATH/Firmware/variants/$VARIANT.h | sed -e's/ */ /g' |cut -d ' ' -f3)
10191022
# Check development status
10201023
FW_FLAV=$(grep --max-count=1 "//#define FW_FLAVOR\b" $SCRIPT_PATH/Firmware/Configuration.h|cut -d ' ' -f1)
1024+
FW_FLAVREV=$(grep --max-count=1 "//#define FW_FLAVERSION\b" $SCRIPT_PATH/Firmware/Configuration.h|cut -d ' ' -f1)
1025+
if [[ "$FW_FLAV" == "//#define" && -z $FW_FLAVREV ]];then
1026+
failures 26
1027+
fi
10211028
#echo "FLAV:$FW_FLAV"
10221029
if [[ "$FW_FLAV" != "//#define" ]] ; then
10231030
FW_FLAVOR=$(grep --max-count=1 "\bFW_FLAVOR\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
10241031
#echo "FLAVOR:$FW_FLAVOR"
1025-
FW_FLAVERSION=$(grep --max-count=1 "\bFW_FLAVERSION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
1026-
if [[ "$FW_FLAVOR" != "//#define FW_FLAVOR" ]] ; then
1032+
if [[ "$FW_FLAVREV" != "//#define" ]] ; then
1033+
FW_FLAVERSION=$(grep --max-count=1 "\bFW_FLAVERSION\b" $SCRIPT_PATH/Firmware/Configuration.h| sed -e's/ */ /g'|cut -d ' ' -f3)
10271034
FW="$FW-$FW_FLAVOR"
10281035
DEV_CHECK="$FW_FLAVOR"
1029-
#echo "DEV:$DEV_CHECK"
1036+
echo "DEV:$DEV_CHECK"
10301037
if [ ! -z "$FW_FLAVERSION" ] ; then
10311038
FW="$FW$FW_FLAVERSION"
10321039
fi
1040+
else
1041+
failures 26
10331042
fi
10341043
fi
1044+
#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)
10351045
if [ -z "$DEV_STATUS_SELECTED" ] ; then
10361046
if [[ "$DEV_CHECK" == *"RC"* ]] ; then
10371047
DEV_STATUS="RC"
@@ -1155,7 +1165,7 @@ prepare_variant_for_compiling()
11551165
fi
11561166

11571167
#Prepare Configuration.h to use the correct FW_DEV_VERSION to prevent LCD messages when connecting with OctoPrint
1158-
sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h
1168+
sed -i -- "s/#define FW_DEV_VERSION FW_VERSION_.*/#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/g" $SCRIPT_PATH/Firmware/Configuration.h
11591169

11601170
# set FW_REPOSITORY
11611171
sed -i -- 's/#define FW_REPOSITORY "Unknown"/#define FW_REPOSITORY "Prusa3d"/g' $SCRIPT_PATH/Firmware/Configuration.h
@@ -1345,23 +1355,18 @@ create_multi_firmware()
13451355
cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf
13461356
else
13471357
#Search for created firmware languages
1348-
langs=$(find firmware_*.hex | cut -d "_" -f2 | cut -d "." -f1)
1358+
langs=$(find Firmware-intl-en_*.hex | cut -d "_" -f2 | cut -d "." -f1)
13491359
#Copy found firmware_*.hex files
13501360
for la in $langs; do
1351-
cp -f firmware_$la.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-$la.hex
1361+
cp -f Firmware-intl-en_$la.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-$la.hex
13521362
done
13531363
cp -f $BUILD_PATH/Firmware.ino.elf $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.elf
13541364
echo "$(tput setaf 2)Zip multi language firmware for MK2.5/miniRAMbo board to PF-build-hex folder$(tput sgr 0)"
13551365
if [ $TARGET_OS == "windows" ]; then
13561366
zip a $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
13571367
#rm $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
13581368
elif [ $TARGET_OS == "linux" ]; then
1359-
# Make a copy for MK404 sim of MK2, MK2.5, MK2.5S firmware
1360-
if [ ! -z "$mk404_flag" ]; then
1361-
cp -f firmware_de.hex $SCRIPT_PATH/../$OUTPUT_FOLDER/$OUTPUT_FILENAME.hex
1362-
fi
1363-
# End of MK2, MK2.5, MK2.5S firmware copy
1364-
zip -j ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
1369+
zip -j ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME.zip ../../$OUTPUT_FOLDER/$OUTPUT_FILENAME-??.hex
13651370
fi
13661371
fi
13671372

@@ -1390,7 +1395,9 @@ save_en_firmware()
13901395
cleanup_firmware()
13911396
{
13921397
if [[ -z "$prusa_flag" || "$prusa_flag" == "0" ]]; then
1393-
rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || failures 13
1398+
if [ -e "$SCRIPT_PATH/Firmware/Configuration_prusa.h" ]; then
1399+
rm $SCRIPT_PATH/Firmware/Configuration_prusa.h || failures 13
1400+
fi
13941401
fi
13951402
# Delete dupblicates
13961403
if find $SCRIPT_PATH/lang/ -name '*RAMBo10a*.txt' -printf 1 -quit | grep -q 1
@@ -1417,8 +1424,8 @@ cleanup_firmware()
14171424
fi
14181425

14191426
# Restore files to previous state
1420-
sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_$DEV_STATUS/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h
1421-
sed -i -- 's/^#define FW_REPOSITORY "Prusa3d"/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h
1427+
sed -i -- "s/^#define FW_DEV_VERSION FW_VERSION_.*/#define FW_DEV_VERSION FW_VERSION_UNKNOWN/g" $SCRIPT_PATH/Firmware/Configuration.h
1428+
sed -i -- 's/^#define FW_REPOSITORY.*/#define FW_REPOSITORY "Unknown"/g' $SCRIPT_PATH/Firmware/Configuration.h
14221429
if [ ! -z "$BUILD_ORG" ] ; then
14231430
sed -i -- "s/^#define FW_COMMIT_NR.*/#define FW_COMMIT_NR $BUILD_ORG/g" $SCRIPT_PATH/Firmware/Configuration.h
14241431
fi
@@ -1442,11 +1449,11 @@ cleanup_firmware()
14421449
fi
14431450

14441451
# Restore build env files to previous state
1445-
if [ $BOARD_MEM_MODIFIED == "1" ]; then
1452+
if [ "$BOARD_MEM_MODIFIED" == "1" ]; then
14461453
sed -i -- "s/^#define FLASHEND .*$/#define FLASHEND 0x3FFFF/g" $BUILD_ENV_PATH/hardware/tools/avr/avr/include/avr/iom2560.h
14471454
echo "$(tput setaf 2)Restored Board Mem$(tput sgr 0)"
14481455
fi
1449-
if [ $BOARD_FLASH_MODIFIED == "1" ]; then
1456+
if [ "$BOARD_FLASH_MODIFIED" == "1" ]; then
14501457
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
14511458
sed -i -- "s/^#define RAMEND.*/#define RAMEND 0x21FF/g" $BUILD_ENV_PATH/hardware/tools/avr/avr/include/avr/iom2560.h
14521459
echo "$(tput setaf 2)Restored Board Flash$(tput sgr 0)"

0 commit comments

Comments
 (0)