Browse Source

Limit atmegaMK404 boards mem to 8,16,32

3d-gussner 2 years ago
parent
commit
3f3915304e
1 changed files with 9 additions and 12 deletions
  1. 9 12
      PF-build.sh

+ 9 - 12
PF-build.sh

@@ -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.1-Build_66
+# Version: 2.0.1-Build_67
 # 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
@@ -168,6 +168,7 @@
 # 24 Feb 2021, 3d-gussner, Change to Arduino IDE 1.8.19 and Arduino boards 1.0.5
 #                          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
 
 
 SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
@@ -224,7 +225,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.1-Build_66 *"
+echo "* PF-build.sh Version: 2.0.1-Build_67 *"
 echo "***************************************"
 echo "Arguments:"
 echo "$(tput setaf 2)-b$(tput sgr0) Build/commit number"
@@ -258,7 +259,7 @@ echo "  -n : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' y
 echo "  -o : '$(tput setaf 2)1$(tput sgr0)' force or '$(tput setaf 2)0$(tput sgr0)' block output and delays"
 echo "  -p : '$(tput setaf 2)0$(tput sgr0)' no, '$(tput setaf 2)1$(tput sgr0)' yes"
 echo "  -v : '$(tput setaf 2)All$(tput sgr0)' or variant file name"
-echo "  -x : '$(tput setaf 2)8$(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:"
@@ -334,12 +335,8 @@ if [ ! -z "$board_mem_flag" ] ; then
         BOARD_MEM="0x7DFF"
         echo "Board mem size   :    $board_mem_flag Kb, $BOARD_MEM (hex)"
         OUTPUT_FILENAME_SUFFIX="${OUTPUT_FILENAME_SUFFIX}_RAM-$board_mem_flag"
-    elif [ "$board_mem_flag" == "64" ] ; then
-        BOARD_MEM="0xFFFF"
-        echo "Board mem size   :    $board_mem_flag Kb, $BOARD_MEM (hex)"
-        OUTPUT_FILENAME_SUFFIX="${OUTPUT_FILENAME_SUFFIX}_RAM-$board_mem_flag"
     else
-        echo "Unsupported board mem size chosen. Only '8', '64' are allowed."
+        echo "Unsupported board mem size chosen. Only '8', '16' and '32' are allowed."
         failures 5
     fi
 fi
@@ -1185,7 +1182,7 @@ compile_en_firmware()
     ## Check board mem size
     CURRENT_BOARD_MEM=$(grep "#define RAMEND" $BUILD_ENV_PATH/hardware/tools/avr/avr/include/avr/iom2560.h | sed -e's/.* //g'|cut -d ' ' -f2 |tr -d ' \t\n\r')
     if [ $CURRENT_BOARD_MEM != "0x21FF" ] ; then
-        echo "Board mem has been already modified or not reset"
+        echo "$(tput setaf 1)Board mem has been modified or not reset$(tput sgr 0)"
         echo "Current:" $CURRENT_BOARD_MEM
         PS3="Select $(tput setaf 2)Yes$(tput sgr 0) if you want to reset it."
         select yn in "Yes" "No"; do
@@ -1221,7 +1218,7 @@ compile_en_firmware()
     CURRENT_BOARD_FLASH=$(grep "#define FLASHEND" $BUILD_ENV_PATH/hardware/tools/avr/avr/include/avr/iom2560.h | sed -e's/.* //g'|cut -d ' ' -f2 |tr -d ' \t\n\r')
     CURRENT_BOARD_maximum_size=$(grep "prusa_einsy_rambo.upload.maximum_size" $BUILD_ENV_PATH/portable/packages/$BOARD_PACKAGE_NAME/hardware/avr/$BOARD_VERSION/boards.txt |cut -d '=' -f2|tr -d ' \t\n\r')
     if [[ $CURRENT_BOARD_FLASH != "0x3FFFF" || $CURRENT_BOARD_maximum_size != "253952" ]] ; then
-        echo "$(tput setaf 3)Board flash has been already modified or not reset$(tput sgr 0)"
+        echo "$(tput setaf 1)Board flash has been modified or not reset$(tput sgr 0)"
         echo "Current flash size:" $CURRENT_BOARD_FLASH
         echo "Current max.  size:" $CURRENT_BOARD_maximum_size
         PS3="Select $(tput setaf 2)Yes$(tput sgr 0) if you want to reset it."
@@ -1242,11 +1239,11 @@ compile_en_firmware()
             esac
         done
     else
-        BOARD_FLASH_MODIFIED=0
+        BOARD_FLASH_MODIFIED=1
     fi
     ## Modify boad flash size
     if [[ ! -z $BOARD_FLASH && "$BOARD_FLASH" != "0x3FFFF" ]] ; then
-        echo "Modifying board flash size (hex):"
+        echo "$(tput setaf 3)Modifying board flash size (hex):$(tput sgr 0)"
         echo "Old flash size:" $CURRENT_BOARD_FLASH
         echo "New flash size:" $BOARD_FLASH
         echo "Old max.  size:" $CURRENT_BOARD_maximum_size