From 4a6871ab12f44c78469ef8e23643d73099aa8807 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 15 Nov 2024 20:22:38 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Supporting=20files=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .zed/settings.json | 16 + Marlin/src/HAL/DUE/upload_extra_script.py | 2 +- buildroot/bin/__init__.py | 0 buildroot/bin/build_all_examples | 212 ++++++----- buildroot/bin/build_example | 232 ++++++++++-- buildroot/bin/ci_src_filter | 4 +- buildroot/bin/config.py | 96 +++++ buildroot/bin/generate_version | 83 ++--- buildroot/bin/mftest | 27 +- buildroot/bin/mfutil | 8 +- buildroot/bin/opt_add | 12 +- buildroot/bin/opt_disable | 30 +- buildroot/bin/opt_enable | 30 +- buildroot/bin/opt_find | 4 +- buildroot/bin/opt_set | 36 +- buildroot/bin/pins_set | 16 - buildroot/bin/restore_configs | 3 +- buildroot/bin/uncrust | 2 +- .../variants/MARLIN_MEGA1281/pins_arduino.h | 337 ++++++++++++++++++ buildroot/share/cmake/CMakeLists.txt | 8 +- buildroot/share/fonts/bdf2u8g/bdf2u8g.c | 82 ++--- buildroot/share/fonts/uxggenpages.md | 2 +- buildroot/share/git/mfconfig | 173 --------- buildroot/share/git/mfhelp | 3 +- buildroot/share/git/mfprep | 7 +- buildroot/share/pixmaps/logo/marlin-old.svg | 131 ++++--- buildroot/share/pixmaps/logo/marlin.svg | 25 +- .../share/scripts/MarlinBinaryProtocol.py | 4 +- .../scripts/createTemperatureLookupMarlin.py | 2 +- buildroot/share/scripts/get_test_targets.py | 2 +- .../{gen-tft-image.py => image_to_tft.py} | 41 ++- buildroot/share/scripts/languageExport.py | 10 +- buildroot/share/scripts/languageImport.py | 16 +- buildroot/share/scripts/languageUtil.py | 2 +- buildroot/share/scripts/pinsformat.js | 197 ---------- buildroot/share/scripts/pinsformat.py | 30 +- buildroot/share/scripts/upload.py | 11 +- .../{extras => uncrustify}/file_header.h | 2 +- .../{extras => uncrustify}/func_header.h | 0 .../{extras => uncrustify}/uncrustify.cfg | 2 +- buildroot/share/vscode/auto_build.py | 9 +- buildroot/share/vscode/avrdude.conf | 2 +- buildroot/share/vscode/avrdude_linux.conf | 2 +- buildroot/share/vscode/avrdude_macOS.conf | 2 +- .../create_custom_upload_command_CDC.py | 2 +- .../create_custom_upload_command_DFU.py | 4 +- docs/ConfigEmbedding.md | 2 +- docs/Maintenance.md | 14 + ini/avr.ini | 10 + ini/features.ini | 2 +- ini/native.ini | 49 +-- 52 files changed, 1180 insertions(+), 819 deletions(-) create mode 100644 .zed/settings.json create mode 100644 buildroot/bin/__init__.py create mode 100755 buildroot/bin/config.py delete mode 100755 buildroot/bin/pins_set create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_MEGA1281/pins_arduino.h delete mode 100755 buildroot/share/git/mfconfig rename buildroot/share/scripts/{gen-tft-image.py => image_to_tft.py} (63%) mode change 100644 => 100755 delete mode 100755 buildroot/share/scripts/pinsformat.js rename buildroot/share/{extras => uncrustify}/file_header.h (92%) rename buildroot/share/{extras => uncrustify}/func_header.h (100%) rename buildroot/share/{extras => uncrustify}/uncrustify.cfg (99%) create mode 100644 docs/Maintenance.md diff --git a/.gitignore b/.gitignore index 151fcccd33ee..daa5c5c28898 100755 --- a/.gitignore +++ b/.gitignore @@ -125,6 +125,7 @@ vc-fileutils.settings # Visual Studio Code .vscode/* !.vscode/extensions.json +*.code-workspace # Simulation files imgui.ini diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 000000000000..70bb14920c4c --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,16 @@ +/** + * Marlin-specific settings for Zed + * + * For a full list of overridable settings, and general information on folder-specific settings, + * see the documentation: https://zed.dev/docs/configuring-zed#settings-files + */ +{ + "languages": { + "C": { + "enable_language_server": false + }, + "C++": { + "enable_language_server": false + } + } +} diff --git a/Marlin/src/HAL/DUE/upload_extra_script.py b/Marlin/src/HAL/DUE/upload_extra_script.py index ca12b3b54f43..729b1d67de61 100644 --- a/Marlin/src/HAL/DUE/upload_extra_script.py +++ b/Marlin/src/HAL/DUE/upload_extra_script.py @@ -11,7 +11,7 @@ if current_OS == 'Windows': - Import("env") + env = pioutil.env # Use bossac.exe on Windows env.Replace( diff --git a/buildroot/bin/__init__.py b/buildroot/bin/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/buildroot/bin/build_all_examples b/buildroot/bin/build_all_examples index a77259bb360f..0c4a0ee394a1 100755 --- a/buildroot/bin/build_all_examples +++ b/buildroot/bin/build_all_examples @@ -2,31 +2,48 @@ # # Usage: # -# build_all_examples [-b|--branch=] - Branch to fetch from Configurations repo +# build_all_examples [-b|--branch=] - Branch to fetch from Configurations repo (import-2.1.x) +# [-B|--base] - Base path of configurations, overriding -b # [-c|--continue] - Continue the paused build -# [-d|--debug] - Print extra debug output -# [-i|--ini] - Archive ini/json/yml files in the temp config folder -# [-l|--limit=#] - Limit the number of builds in this run -# [-n|--nobuild] - Don't actually build anything. +# [-p|--purge] - Purge the status file and start over +# [-s|--skip] - Continue the paused build, skipping one # [-r|--resume=] - Start at some config in the filesystem order -# [-s|--skip] - Do the thing -# -# build_all_examples [...] branch [resume-from] +# [-l|--limit=#] - Limit the number of builds in this run +# [-d|--debug] - Print extra debug output (after) +# [-n|--nobuild] - Don't actually build anything +# [-f|--nofail] - Don't stop on a failed build +# [-e|--export=N] - Set CONFIG_EXPORT and export into each config folder +# [-a|--archive] - Copy the binary to the export location +# [-o|--output] - Redirect export / archiving to another location +# (By default export to origin config folders) +# [-h|--help] - Print usage and exit # HERE=`dirname $0` +PATH="$HERE:$PATH" -. "$HERE/mfutil" +. mfutil GITREPO=https://github.com/MarlinFirmware/Configurations.git STAT_FILE=./.pio/.buildall -usage() { echo " -Usage: $SELF [-b|--branch=] [-d|--debug] [-i|--ini] [-r|--resume=] - $SELF [-b|--branch=] [-d|--debug] [-i|--ini] [-c|--continue] - $SELF [-b|--branch=] [-d|--debug] [-i|--ini] [-s|--skip] - $SELF [-b|--branch=] [-d|--debug] [-n|--nobuild] - $SELF [...] branch [resume-point] +usage() { echo "Usage: + +build_all_examples [-b|--branch=] - Branch to fetch from Configurations repo (import-2.1.x) + [-B|--base] - Base path of configurations, overriding -b + [-c|--continue] - Continue the paused build + [-p|--purge] - Purge the status file and start over + [-s|--skip] - Continue the paused build, skipping one + [-r|--resume=] - Start at some config in the filesystem order + [-e|--export=N] - Set CONFIG_EXPORT and export to the export location + [-a|--archive] - Copy the binary to the export location + [-o|--output] - Redirect export / archiving to another location + (By default export to origin config folders) + [-d|--debug] - Print extra debug output (after) + [-l|--limit=#] - Limit the number of builds in this run + [-n|--nobuild] - Don't actually build anything + [-f|--nofail] - Don't stop on a failed build + [-h|--help] - Print usage and exit " } @@ -36,50 +53,60 @@ unset FIRST_CONF EXIT_USAGE= LIMIT=1000 -while getopts 'b:cdhil:nqr:sv-:' OFLAG; do +while getopts 'aB:b:ce:fdhl:no:pr:sv-:' OFLAG; do case "${OFLAG}" in - b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;; - r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;; - c) CONTINUE=1 ; bugout "Continue" ;; - s) CONTSKIP=1 ; bugout "Continue, skipping" ;; - i) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;; + a) ARCHIVE=1 ; bugout "Archiving" ;; + B) CBASE=${OPTARG%/} ; bugout "Base: $CBASE" ;; + b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;; + f) NOFAIL=1 ; bugout "Continue on Fail" ;; + r) ISRES=1 ; FIRST_CONF=$OPTARG ; bugout "Resume: $FIRST_CONF" ;; + c) CONTINUE=1 ; bugout "Continue" ;; + s) CONTSKIP=1 ; bugout "Continue, skipping" ;; + e) CEXPORT=$OPTARG ; bugout "Export $CEXPORT" ;; + o) OUTBASE="${OPTARG%/}" ; bugout "Archive to $OUTBASE" ;; h) EXIT_USAGE=1 ; break ;; - l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;; - d|v) DEBUG=1 ; bugout "Debug ON" ;; - n) DRYRUN=1 ; bugout "Dry Run" ;; - -) IFS="=" read -r ONAM OVAL <<< "$OPTARG" + l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;; + d|v) DEBUG=1 ; bugout "Debug ON" ;; + n) DRYRUN=1 ; bugout "Dry Run" ;; + p) PURGE=1 ; bugout "Purge stat file" ;; + -) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}" case "$ONAM" in - branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;; - resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;; - continue) CONTINUE=1 ; bugout "Continue" ;; - skip) CONTSKIP=2 ; bugout "Continue, skipping" ;; - limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;; - ini) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;; + archive) ARCHIVE=1 ; bugout "Archiving" ;; + base) CBASE=${OVAL%/} ; bugout "Base: $CBASE" ;; + branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;; + nofail) NOFAIL=1 ; bugout "Continue on Fail" ;; + resume) ISRES=1 ; FIRST_CONF=$OVAL ; bugout "Resume: $FIRST_CONF" ;; + continue) CONTINUE=1 ; bugout "Continue" ;; + skip) CONTSKIP=1 ; bugout "Continue, skipping" ;; + export) CEXPORT=$OVAL ; bugout "Export $EXPORT" ;; + output) OUTBASE="${OVAL%/}" ; bugout "Archive to $OUTBASE" ;; + limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;; help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;; - debug) DEBUG=1 ; bugout "Debug ON" ;; - nobuild) DRYRUN=1 ; bugout "Dry Run" ;; + debug) DEBUG=1 ; bugout "Debug ON" ;; + nobuild) DRYRUN=1 ; bugout "Dry Run" ;; + purge) PURGE=1 ; bugout "Purge stat file" ;; *) EXIT_USAGE=2 ; echo "$SELF: unrecognized option \`--$ONAM'" ; break ;; esac ;; *) EXIT_USAGE=2 ; break ;; esac done - -# Extra arguments count as BRANCH, FIRST_CONF shift $((OPTIND - 1)) -[[ $# > 0 ]] && { BRANCH=$1 ; shift 1 ; bugout "BRANCH=$BRANCH" ; } -[[ $# > 0 ]] && { FIRST_CONF=$1 ; shift 1 ; bugout "FIRST_CONF=$FIRST_CONF" ; } -[[ $# > 0 ]] && { EXIT_USAGE=2 ; echo "too many arguments" ; } +# Check for mixed continue, skip, resume arguments. Only one should be used. +((CONTINUE + CONTSKIP + ISRES + PURGE > 1)) && { echo "Don't mix -c, -p, -s, and -r options" ; echo ; EXIT_USAGE=2 ; } + +# Exit with helpful usage information ((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; } -echo "This script downloads each Configuration and attempts to build it." -echo "On failure the last-built configs will be left in your working copy." +echo +echo "This script downloads all example configs and attempts to build them." +echo "On failure the last-built configs are left in your working copy." echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'." +echo -if [[ -f "$STAT_FILE" ]]; then - IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE" -fi +[[ -n $PURGE ]] && rm -f "$STAT_FILE" +[[ -z $FIRST_CONF && -f "$STAT_FILE" ]] && IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE" # If -c is given start from the last attempted build if ((CONTINUE)); then @@ -97,77 +124,90 @@ elif ((CONTSKIP)); then fi # Check if the current repository has unmerged changes -if [[ $SKIP_CONF ]]; then +if ((SKIP_CONF)); then echo "Skipping $FIRST_CONF" -elif [[ $FIRST_CONF ]]; then +elif [[ -n $FIRST_CONF ]]; then echo "Resuming from $FIRST_CONF" else git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; } fi -# Create a temporary folder inside .pio -TMP=./.pio/build-$BRANCH -[[ -d "$TMP" ]] || mkdir -p $TMP - -# Download Configurations into the temporary folder -if [[ ! -e "$TMP/README.md" ]]; then - echo "Fetching Configurations from GitHub to $TMP" - git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$TMP" || { echo "Failed to clone the configuration repository"; exit ; } +# Check for the given base path +if [[ -n $CBASE ]]; then + CBASE="${CBASE/#\~/$HOME}" + [[ -d "$CBASE" ]] || { echo "Given base -B $CBASE not found." ; exit ; } else - echo "Using cached Configurations at $TMP" + # Make a Configurations temporary folder if needed + CBASE=./.pio/build-$BRANCH + [[ -d "$CBASE" ]] || mkdir -p "$CBASE" + # Download the specified Configurations branch if needed + if [[ ! -e "$CBASE/README.md" ]]; then + echo "Fetching Configurations from GitHub to $CBASE" + git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$CBASE" || { echo "Failed to clone the configuration repository"; exit ; } + fi fi -echo -e "Start build...\n=====================" +# Build +echo -e "=====================\nProceed with builds...\n=====================" shopt -s nullglob -IFS=' -' -CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" ) -for CONF in $CONF_TREE ; do + +export PAUSE=1 + +# Get a list of all folders that contain a file matching "Configuration*.h" +find -ds "$CBASE"/config/examples -type d -name 'Configuration.h' -o -name 'Configuration_adv.h' -print0 | while IFS= read -r -d $'\0' CONF; do + + # Remove the file name and slash from the end of the path + CONF=${CONF%/*} # Get a config's directory name - DIR=$( echo $CONF | "$SED" "s|$TMP/config/examples/||" ) + DIR=${CONF#$CBASE/config/examples/} # If looking for a config, skip others - [[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue + [[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && { ((DEBUG)) && echo "[SKIP] $DIR" ; continue ; } # Once found, stop looking unset FIRST_CONF # If skipping, don't build the found one [[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; } - # ...if skipping, don't build this one - compgen -G "${CONF}Con*.h" > /dev/null || continue + # Either Configuration.h or Configuration_adv.h must exist + [[ -f "$CONF"/Configuration.h || -f "$CONF"/Configuration_adv.h ]] || { echo "[NONE] $DIR" ; continue ; } + + # Command arguments for 'build_example' + CARGS=("-b" "$CBASE" "-c" "$DIR") + + # Exporting? Add -e argument + ((CEXPORT)) && CARGS+=("-e" "$CEXPORT") + + # Continue on fail? Add -f argument + ((NOFAIL)) && CARGS+=("-f") + + # Archive the build? Add -a argument + ((ARCHIVE)) && CARGS+=("-a") + + # Redirecting the export/archive output? Add -o argument + [[ -n $OUTBASE ]] && CARGS+=("-o" "$OUTBASE") # Build or print build command for --nobuild - if [[ $DRYRUN ]]; then - echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m" + if ((DRYRUN)); then + echo -e "\033[0;32m[DRYRUN] build_example ${CARGS[@]}\033[0m" else # Remember where we are in case of failure echo "${BRANCH}*${DIR}" >"$STAT_FILE" - # Build folder is unknown so delete all report files - if [[ $COPY_INI ]]; then - IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"' - $IFIND -exec rm "{}" \; - fi - ((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\"" - "$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } - # Build folder is unknown so copy all report files - [[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \; + ((DEBUG)) && echo "build_example ${CARGS[@]}" + # Invoke build_example + build_example "${CARGS[@]}" || { echo "Failed to build $DIR" ; exit ; } fi - ((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; } + echo + ((--LIMIT)) || { echo "Specified limit reached" ; break ; } + echo + + export PAUSE=0 done +echo "Exiting" + # Delete the build state if not paused early -[[ $PAUSE ]] || rm "$STAT_FILE" - -# Delete the temp folder if not preserving generated INI files -if [[ -e "$TMP/config/examples" ]]; then - if [[ $COPY_INI ]]; then - OPEN=$( which gnome-open xdg-open open | head -n1 ) - $OPEN "$TMP" - elif [[ ! $PAUSE ]]; then - rm -rf "$TMP" - fi -fi +((PAUSE)) || rm -f "$STAT_FILE" diff --git a/buildroot/bin/build_example b/buildroot/bin/build_example index dabc4c572cdf..9814058c0e42 100755 --- a/buildroot/bin/build_example +++ b/buildroot/bin/build_example @@ -1,43 +1,229 @@ #!/usr/bin/env bash # -# build_example +# Usage: # -# Usage: build_example internal config-home config-folder +# build_example -b|--base= - Configurations root folder (e.g., ./.pio/build-BRANCH) +# -c|--config= - Sub-path of the configs to build (within config/examples) +# [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location +# [-a|--archive] - Archive the build (to the export location) +# [-o|--output] - Redirect export / archiving to another location +# (By default export to origin config folder) +# [-f|--nofail] - Don't stop on a failed build +# [-w|--nowarn] - Suppress warnings with extra config options +# [-r|--reveal] - Reveal the config/export folder after the build +# [-h|--help] - Print usage and exit +# [--allow] - Allow this script to run standalone # +usage() { echo "Usage: + +build_example -b|--base= - Configurations root folder (e.g., ./.pio/build-BRANCH) + -c|--config= - Sub-path of the configs to build (within config/examples) + [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location + [-a|--archive] - Archive the build (to the export location) + [-o|--output] - Redirect export / archiving to another location + (By default export to origin config folder) + [-f|--nofail] - Don't stop on a failed build + [-w|--nowarn] - Suppress warnings with extra config options + [-r|--reveal] - Reveal the config/export folder after the build + [-h|--help] - Print usage and exit + [--allow] - Allow this script to run standalone +" +} + HERE=`dirname $0` +PATH="$HERE:$PATH" + +. mfutil + +annc() { echo -e "\033[0;32m$1\033[0m" ; } +alrt() { echo -e "\033[0;31m$1\033[0m" ; } + +# Get arguments +BUILD=./.pio/build +CLEANER= +ALLOW= +ARCHIVE= +BASE= +CONFIG= +REVEAL= +EXPNUM= +NOFAIL= +OUTBASE= +while getopts 'ab:c:e:fhio:r-:' OFLAG; do + case "${OFLAG}" in + a) ARCHIVE=1 ;; + b) BASE="${OPTARG%/}" ;; + c) CONFIG="${OPTARG%/}" ;; + e) EXPNUM="$OPTARG" ;; + o) OUTBASE="${OPTARG%/}" ;; + h) EXIT_USAGE=1 ; break ;; + f) NOFAIL=1 ;; + r) REVEAL=1 ;; + -) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}" + case "$ONAM" in + archive) ARCHIVE=1 ;; + allow) ALLOW=1 ;; + base) BASE="${OVAL%/}" ;; + config) CONFIG="${OVAL%/}" ;; + export) EXPNUM="$OVAL" ;; + output) OUTBASE="${OVAL%/}" ;; + help) EXIT_USAGE=1 ; break ;; + nofail) NOFAIL=1 ;; + reveal) REVEAL=1 ;; + *) EXIT_USAGE=2 ; echo "$SELF: unrecognized option \`--$ONAM'" ; break ;; + esac + ;; + *) EXIT_USAGE=2 ; break ;; + esac +done +shift $((OPTIND - 1)) + +# Must be called from another script (or with --allow) +[[ $ALLOW || $SHLVL -gt 2 ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; } + +# Exit with helpful usage information +((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; } -. "$HERE/mfutil" +# -b|--base and -c|--config are required +[[ -z $BASE ]] && { echo "-b|--base is required" ; exit 1 ; } +[[ -z $CONFIG ]] && { echo "-c|--config is required" ; exit 1 ; } -# Require 'internal' as the first argument -[[ "$1" == "internal" ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; } +# Expand ~ to $HOME in provided arguments +BASE=${BASE/#\~/$HOME} +CONFIG=${CONFIG/#\~/$HOME} -echo "Testing $3:" +# Make sure the examples exist +SUB1="$BASE/config/examples" +[[ -d "$SUB1" ]] || { echo "-b|--base $BASE doesn't contain config/examples" ; exit 1 ; } -SUB=$2/config/examples/$3 -[[ -d "$SUB" ]] || { echo "$SUB is not a good path" ; exit 1 ; } +# Make sure the specific config folder exists +SUB="$SUB1/$CONFIG" +[[ -d "$SUB" ]] || { echo "-c|--config $CONFIG doesn't exist" ; exit 1 ; } -compgen -G "${SUB}Con*.h" > /dev/null || { echo "No configuration files found in $SUB" ; exit 1 ; } +# ...and contains Configuration.h or Configuration_adv.h +[[ -f "$SUB"/Configuration.h || -f "$SUB"/Configuration_adv.h ]] || { echo "No configuration files found in $SUB" ; exit 1 ; } +# Get the location for exports and archives +if [[ -n $OUTBASE ]]; then + ARCSUB="${OUTBASE/#\~/$HOME}/$CONFIG" + mkdir -p "$ARCSUB" +else + ARCSUB="$SUB" +fi + +# Delete any config files from previous builds +rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h + +# Copy configurations into the Marlin folder echo "Getting configuration files from $SUB" -cp "$2/config/default"/*.h Marlin/ -cp "$SUB"/Configuration.h Marlin/ 2>/dev/null -cp "$SUB"/Configuration_adv.h Marlin/ 2>/dev/null -cp "$SUB"/_Bootscreen.h Marlin/ 2>/dev/null -cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null +cp "$BASE"/config/default/*.h Marlin/ +cp "$SUB"/*.h Marlin/ + +rm -f Marlin/Config.h Marlin/Config-export.h set -e -# Strip #error lines from Configuration.h -IFS=$'\n'; set -f -$SED -i~ -e "20,30{/#error/d}" Marlin/Configuration.h -rm Marlin/Configuration.h~ -unset IFS; set +f +# Strip #error lines from Configuration.h using +awk 'NR < 20 || NR > 30 || !/#error/' Marlin/Configuration.h > Marlin/Configuration.h~ +mv Marlin/Configuration.h~ Marlin/Configuration.h + +# Hide several warnings when not exporting +[[ -z $EXPNUM ]] && CLEANER=1 # Suppress fatal warnings -echo -e "\n#define NO_CONTROLLER_CUSTOM_WIRING_WARNING" >> Marlin/Configuration.h +if ((CLEANER)); then + opt_add NO_CONTROLLER_CUSTOM_WIRING_WARNING + opt_add NO_AUTO_ASSIGN_WARNING + opt_add NO_CREALITY_DRIVER_WARNING + opt_add DIAG_JUMPERS_REMOVED + opt_add DIAG_PINS_REMOVED + opt_add NO_MK3_FAN_PINS_WARNING + opt_add NO_USER_FEEDBACK_WARNING + opt_add NO_Z_SAFE_HOMING_WARNING + opt_add NO_LCD_CONTRAST_WARNING + opt_add NO_MICROPROBE_WARNING + opt_add NO_CONFIGURATION_EMBEDDING_WARNING + opt_add NO_HOMING_CURRENT_WARNING +fi + +# Possible exported file names (in the build folder) +ENAME=("-name" "marlin_config.json" \ + "-o" "-name" "config.ini" \ + "-o" "-name" "schema.json" \ + "-o" "-name" "schema.yml") + +# Possible built firmware names (in the build folder) +BNAME=("-name" 'firmware*.hex' \ + "-o" "-name" "firmware*.bin" \ + "-o" "-name" "project*.bin" \ + "-o" "-name" "Robin*.bin" \ + "-o" "-name" "main_*.bin") + +mkdir -p "$BUILD" + +# If EXPNUM is set then apply to the config before build +if [[ $EXPNUM ]]; then + opt_set CONFIG_EXPORT $EXPNUM + # Clean up old exports + find "$BUILD" \( "${ENAME[@]}" \) -exec rm "{}" \; +fi + +((ARCHIVE)) && find "$BUILD" \( "${BNAME[@]}" \) -exec rm "{}" \; + +set +e + +echo "Building example $CONFIG ..." +mftest -s -a -n1 ; ERR=$? + +((ERR)) && alrt "Failed ($ERR)" || annc "Success" + +set -e + +if [[ $ERR -gt 0 ]]; then + + # Error? For --nofail simply log. Otherwise return the error. + if [[ -n $NOFAIL ]]; then + date +"%F %T [FAIL] $CONFIG" >>./.pio/error-log.txt + else + exit $ERR + fi + +else + + # Copy exports back to the configs + if [[ -n $EXPNUM ]]; then + annc "Exporting $EXPNUM" + [[ -f Marlin/Config-export.h ]] && { cp Marlin/Config-export.h "$ARCSUB"/Config.h ; } + find "$BUILD" \( "${ENAME[@]}" \) -exec cp "{}" "$ARCSUB" \; + fi + + # Copy potential firmware files into the config folder + # TODO: Consider firmware that needs an STM32F4_UPDATE folder. + # Currently only BOARD_CREALITY_F401RE env:STM32F401RE_creality + if ((ARCHIVE)); then + annc "Archiving" + rm -f "$ARCSUB"/*.bin.tar.gz "$ARCSUB"/*.hex.tar.gz + find "$BUILD" \( "${BNAME[@]}" \) -exec sh -c ' + ARCSUB="$1" + CONFIG="$2" + shift 2 + for FILE in "$@"; do + cd "${FILE%/*}" + NAME=${FILE##*/} + SHRT=${NAME%.*} + SHASUM=$(sha256sum "$NAME" | cut -d" " -f1) + tar -czf "$ARCSUB/$SHRT.tar.gz" "$NAME" + echo "$CONFIG\n$SHASUM" > "$ARCSUB/$NAME.sha256.txt" + rm "$NAME" + cd - >/dev/null + done + ' sh "$ARCSUB" "$CONFIG" {} + + fi + + # Reveal the configs after the build, if requested + ((REVEAL)) && { annc "Revealing $ARCSUB" ; open "$ARCSUB" ; } -echo "Building the firmware now..." -"$HERE/mftest" -s -a -n1 || { echo "Failed"; exit 1; } +fi -echo "Success" +exit 0 diff --git a/buildroot/bin/ci_src_filter b/buildroot/bin/ci_src_filter index 928f492e69fa..1043e57d8149 100755 --- a/buildroot/bin/ci_src_filter +++ b/buildroot/bin/ci_src_filter @@ -3,12 +3,10 @@ # exit on first failure set -e -SED=$(which gsed sed | head -n1) FN="platformio.ini" if [[ $1 == "-n" ]]; then - "${SED}" -i "s/default_src_filter/org_src_filter/" $FN - "${SED}" -i "/org_src_filter/ s/^/default_src_filter = +\n/" $FN + awk '/default_src_filter/ { sub("default_src_filter", "org_src_filter"); print "default_src_filter = +"; } 1' $FN > $FN~ && mv $FN~ $FN else git checkout $FN 2>/dev/null fi diff --git a/buildroot/bin/config.py b/buildroot/bin/config.py new file mode 100755 index 000000000000..b1a67ad9652a --- /dev/null +++ b/buildroot/bin/config.py @@ -0,0 +1,96 @@ +''' +config.py - Helper functions for config manipulation +''' +import re + +FILES = ('Marlin/Configuration.h', 'Marlin/Configuration_adv.h') + +def set(file_path, define_name, value): + ''' + Replaces a define in a file with a new value. + Returns True if the define was found and replaced, False otherwise. + ''' + # Read the contents of the file + with open(file_path, 'r') as f: + content = f.readlines() + + modified = False + for i in range(len(content)): + # Regex to match the desired pattern + match = re.match(r'^(\s*)(/*)(\s*)(#define\s+{})\s+(.*)$'.format(re.escape(define_name)), content[i]) + if match: + new_line = f"{match[1]}{match[3]}{match[4]} {value} // {match[5]}\n" + content[i] = new_line + modified = True + + # Write the modified content back to the file only if changes were made + if modified: + with open(file_path, 'w') as f: + f.writelines(content) + return True + + return False + +def add(file_path, define_name, value=""): + ''' + Insert a define on the first blank line in a file. + Returns True if the define was found and replaced, False otherwise. + ''' + with open(file_path, 'r') as f: + content = f.readlines() + + # Prepend a space to the value if it's not empty + if value != "": + value = " " + value + + # Find the first blank line to insert the new define + for i in range(len(content)): + if content[i].strip() == '': + # Insert the define at the first blank line + content.insert(i, f"#define {define_name}{value}\n") + break + else: + # If no blank line is found, append to the end + content.append(f"#define {define_name}{value}\n") + + with open(file_path, 'w') as f: + f.writelines(content) + +def enable(file_path, define_name, enable=True): + ''' + Uncomment or comment the named defines in the given file path. + Returns True if the define was found, False otherwise. + ''' + # Read the contents of the file + with open(file_path, 'r') as f: + content = f.readlines() + + # Prepare the regex + regex = re.compile(r'^(\s*)(/*)(\s*)(#define\s+{}\b.*?)( *//.*)?$'.format(re.escape(define_name))) + + # Find the define in the file and uncomment or comment it + found = False + modified = False + for i in range(len(content)): + match = regex.match(content[i]) + if not match: continue + found = True + if enable: + if match[2]: + modified = True + comment = '' if match[5] is None else ' ' + match[5] + content[i] = f"{match[1]}{match[3]}{match[4]}{comment}\n" + else: + if not match[2]: + modified = True + comment = '' if match[5] is None else match[5] + if comment.startswith(' '): comment = comment[2:] + content[i] = f"{match[1]}//{match[3]}{match[4]}{comment}\n" + break + + # Write the modified content back to the file only if changes were made + if modified: + with open(file_path, 'w') as f: + f.writelines(content) + + return found diff --git a/buildroot/bin/generate_version b/buildroot/bin/generate_version index 70a108b1fedb..ff85fe7ecf31 100755 --- a/buildroot/bin/generate_version +++ b/buildroot/bin/generate_version @@ -19,6 +19,7 @@ VERSION="$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null || true)" STRING_DISTRIBUTION_DATE="${STRING_DISTRIBUTION_DATE:-$(date '+%Y-%m-%d %H:%M')}" SHORT_BUILD_VERSION="${SHORT_BUILD_VERSION:-${BRANCH}}" DETAILED_BUILD_VERSION="${DETAILED_BUILD_VERSION:-${BRANCH}-${VERSION}}" +PROTOCOL_VERSION="1.0" # Gets some misc options from their defaults DEFAULT_MACHINE_UUID="${DEFAULT_MACHINE_UUID:-$(awk -F'"' \ @@ -65,68 +66,52 @@ cat > "${WRITE_FILE}" </dev/null || { echo "Make sure 'pio' is in your execution PATH." ; exit 1 ; } perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; } errout() { echo -e "\033[0;31m$1\033[0m" ; } @@ -41,7 +41,6 @@ env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 TESTPATH=buildroot/tests STATE_FILE="./.pio/.mftestrc" -SED=$(which gsed sed | head -n1) shopt -s extglob nocasematch @@ -74,7 +73,7 @@ while getopts 'abdhmrsuvyn:t:-:' OFLAG; do u) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;; v) DEBUG=1 ; bugout "Debug ON" ;; y) BUILD_YES='Y' ; bugout "Build will initiate..." ;; - -) IFS="=" read -r ONAM OVAL <<< "$OPTARG" + -) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}" case "$ONAM" in help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;; autobuild) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;; @@ -107,6 +106,7 @@ debug|verbose) DEBUG=1 ; bugout "Debug ON" ;; *) EXIT_USAGE=2 ;; esac done +shift $((OPTIND - 1)) ((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; } @@ -158,13 +158,19 @@ if ((AUTO_BUILD)); then *) SYS='uni' ;; esac echo ; echo -n "Auto " ; ((AUTO_BUILD == 2)) && echo "Upload..." || echo "Build..." - MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//;s/\r//' ) + + # + # Get the MOTHERBOARD define value from the .h file and strip off the "BOARD_" prefix + # + ACODE='/^[[:space:]]*#define[[:space:]]MOTHERBOARD[[:space:]]/ { sub(/^BOARD_/, "", $3); print $3 }' + MB=$(awk "$ACODE" Marlin/Configuration.h 2>/dev/null) + [[ -z $MB ]] && MB=$(awk "$ACODE" Marlin/Config.h 2>/dev/null) [[ -z $MB ]] && { echo "Error - Can't read MOTHERBOARD setting." ; exit 1 ; } BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h ) - BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" ) - BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" ) + BNUM=$( sed -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" ) + BDESC=$( sed -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" ) [[ -z $BNUM ]] && { echo "Error - Can't find BOARD_$MB in core/boards.h." ; exit 1 ; } - ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+(env|$SYS):[^ ]+" | grep -oE "(env|$SYS):[^ ]+" | $SED -E "s/(env|$SYS)://" ) ) + ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+(env|$SYS):[^ ]+" | grep -oE "(env|$SYS):[^ ]+" | sed -E "s/(env|$SYS)://" ) ) [[ -z $ENVS ]] && { errout "Error - Can't find target(s) for $MB ($BNUM)." ; exit 1 ; } ECOUNT=${#ENVS[*]} @@ -192,6 +198,9 @@ if ((AUTO_BUILD)); then [[ $CHOICE > $ECOUNT ]] && { echo "Environment selection out of range." ; exit 1 ; } fi TARGET="${ENVS[$CHOICE-1]}" + if [[ $MB == 'SIMULATED' && $TARGET == 'linux_native' ]]; then + TARGET="simulator_linux_release" # Skip the linux_native environment + fi echo "Selected $TARGET" fi @@ -270,7 +279,7 @@ if [[ $CHOICE == 0 ]]; then while IFS= read -r LINE do if [[ $LINE =~ $ISEXEC ]]; then - DESC=$( "$SED" -E 's/^exec_test \$1 \$2 "([^"]+)".*$/\1/g' <<<"$LINE" ) + DESC=$( sed -E 's/^exec_test \$1 \$2 "([^"]+)".*$/\1/g' <<<"$LINE" ) (( ++IND < 10 )) && echo -n " " echo " $IND) $DESC" fi @@ -315,7 +324,7 @@ echo "$OUT" | { ((IND == CHOICE)) && { GOTX=1 [[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs" - [[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' ) + [[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | sed -e 's/\\//g' | sed -E 's/ +/ /g' ) [[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; } } fi diff --git a/buildroot/bin/mfutil b/buildroot/bin/mfutil index 1699dd9adf6d..e9ee57fb9e83 100755 --- a/buildroot/bin/mfutil +++ b/buildroot/bin/mfutil @@ -4,11 +4,9 @@ # # Check dependencies -which curl 1>/dev/null 2>&1 || { echo "curl not found! Please install it."; exit ; } -which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ; } - -SED=$(which gsed sed | head -n1) -[[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; } +which curl &>/dev/null || { echo "curl not found! Please install it."; exit 1 ; } +which git &>/dev/null || { echo "git not found! Please install it."; exit 1 ; } +which sed &>/dev/null || { echo "sed not found! Please install it."; exit 1 ; } OPEN=$( which gnome-open xdg-open open | head -n1 ) diff --git a/buildroot/bin/opt_add b/buildroot/bin/opt_add index 2306ebdaa1b8..3abe309ab658 100755 --- a/buildroot/bin/opt_add +++ b/buildroot/bin/opt_add @@ -1,3 +1,11 @@ -#!/usr/bin/env bash +#!/usr/bin/env python -eval "echo '#define ${@}' | cat - Marlin/Configuration.h > temp && mv temp Marlin/Configuration.h" +import sys, config + +def main(): + args = sys.argv[1:] + for name in args: + config.add(config.FILES[0], name) + +if __name__ == "__main__": + main() diff --git a/buildroot/bin/opt_disable b/buildroot/bin/opt_disable index 0444e1b773e0..9331b2c924de 100755 --- a/buildroot/bin/opt_disable +++ b/buildroot/bin/opt_disable @@ -1,15 +1,21 @@ -#!/usr/bin/env bash +#!/usr/bin/env python -# exit on first failure -set -e +import sys, os,config -SED=$(which gsed sed | head -n1) +def main(): + args = sys.argv[1:] -for opt in "$@" ; do - DID=0 ; FOUND=0 - for FN in Configuration Configuration_adv; do - "${SED}" -i "/^\(\s*\)\(#define\s\+${opt}\b\s\?\)\(\s\s\)\?/{s//\1\/\/\2/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1 - ((DID||FOUND)) || { grep -E "^\s*//\s*#define\s+${opt}\b" Marlin/$FN.h >/dev/null && FOUND=1 ; } - done - ((DID||FOUND)) || (echo "ERROR: $(basename $0) Can't find ${opt}" >&2 && exit 9) -done + for name in args: + changed = False + + for file in config.FILES: + if os.path.exists(file): + if config.enable(file, name, False): + changed = True + + if not changed: + print(f"ERROR: Can't find {name}") + exit(1) + +if __name__ == "__main__": + main() diff --git a/buildroot/bin/opt_enable b/buildroot/bin/opt_enable index f9be82cbd1f9..fd5c3a1b4b3e 100755 --- a/buildroot/bin/opt_enable +++ b/buildroot/bin/opt_enable @@ -1,15 +1,21 @@ -#!/usr/bin/env bash +#!/usr/bin/env python -# exit on first failure -set -e +import sys, os,config -SED=$(which gsed sed | head -n1) +def main(): + args = sys.argv[1:] -for opt in "$@" ; do - DID=0 ; FOUND=0 - for FN in Configuration Configuration_adv; do - "${SED}" -i "/^\(\s*\)\/\/\(\s*\)\(#define\s\+${opt}\b\)\( \?\)/{s//\1\2\3\4\4\4/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1 - ((DID||FOUND)) || { grep -E "^\s*#define\s+${opt}\b" Marlin/$FN.h >/dev/null && FOUND=1 ; } - done - ((DID||FOUND)) || (echo "ERROR: $(basename $0) Can't find ${opt}" >&2 && exit 9) -done + for name in args: + changed = False + + for file in config.FILES: + if os.path.exists(file): + if config.enable(file, name): + changed = True + + if not changed: + print(f"ERROR: Can't find {name}") + exit(1) + +if __name__ == "__main__": + main() diff --git a/buildroot/bin/opt_find b/buildroot/bin/opt_find index a7c8fd9d71a5..bab9da0e4647 100755 --- a/buildroot/bin/opt_find +++ b/buildroot/bin/opt_find @@ -23,8 +23,8 @@ esac while [[ $# > 0 ]]; do DID=0 - for FN in Configuration Configuration_adv; do - FOUND=$( grep -HEn "^\s*${COMM}#define\s+[A-Z0-9_]*${1}" "Marlin/$FN.h" 2>/dev/null ) + for FN in Marlin/Configuration.h Marlin/Configuration_adv.h; do + FOUND=$( grep -HEn "^\s*${COMM}#define\s+[A-Z0-9_]*${1}" $FN 2>/dev/null ) [[ -n "$FOUND" ]] && { echo "$FOUND" ; DID=1 ; } done ((DID)) || { echo "ERROR: ${MYNAME} - No ${TYPE}match for ${1}" ; exit 9; } diff --git a/buildroot/bin/opt_set b/buildroot/bin/opt_set index b9935512a4b8..cf8bbb9449b6 100755 --- a/buildroot/bin/opt_set +++ b/buildroot/bin/opt_set @@ -1,17 +1,25 @@ -#!/usr/bin/env bash +#!/usr/bin/env python -# exit on first failure -set -e +import sys, os, config -SED=$(which gsed sed | head -n1) +def main(): + args = sys.argv[1:] + if len(args) % 2 != 0: + print("ERROR: Please provide pairs of ") + return -while [[ $# > 1 ]]; do - DID=0 - for FN in Configuration Configuration_adv; do - "${SED}" -i "/^\(\s*\)\/*\s*\(#define\s\+${1}\b\) *\(.*\)$/{s//\1\2 ${2} \/\/ \3/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1 - done - ((DID)) || - eval "echo '#define ${1} ${2}' >>Marlin/Configuration.h" || - (echo "ERROR: opt_set Can't set or add ${1}" >&2 && exit 9) - shift 2 -done + for i in range(0, len(args), 2): + name = args[i] + value = args[i + 1] + changed = False + + for file in config.FILES: + if os.path.exists(file): + if config.set(file, name, value): + changed = True + + if not changed: + config.add(config.FILES[0], name, value) + +if __name__ == "__main__": + main() diff --git a/buildroot/bin/pins_set b/buildroot/bin/pins_set deleted file mode 100755 index 216eabc07686..000000000000 --- a/buildroot/bin/pins_set +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -IFS='/' read -r -a PINPATH <<< "$1" -DIR=${PINPATH[0]} -NAM=${PINPATH[1]} - -SED=$(which gsed sed | head -n1) - -shift -while [[ $# > 1 ]]; do - PIN=$1 ; VAL=$2 - FOUT="${DIR}/pins_${NAM}.h" - eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/${FOUT}" || - (echo "ERROR: pins_set Can't find ${PIN} in ${FOUT}" >&2 && exit 9) - shift 2 -done diff --git a/buildroot/bin/restore_configs b/buildroot/bin/restore_configs index ea998484c243..e1a601679bd1 100755 --- a/buildroot/bin/restore_configs +++ b/buildroot/bin/restore_configs @@ -7,5 +7,6 @@ if [[ $1 == '-d' || $1 == '--default' ]]; then else git checkout Marlin/Configuration.h 2>/dev/null git checkout Marlin/Configuration_adv.h 2>/dev/null - git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null + git checkout Marlin/config.ini 2>/dev/null + git checkout Marlin/src/pins/*/pins_*.h 2>/dev/null fi diff --git a/buildroot/bin/uncrust b/buildroot/bin/uncrust index 7c894174b8b5..db4c3fb03f60 100755 --- a/buildroot/bin/uncrust +++ b/buildroot/bin/uncrust @@ -7,7 +7,7 @@ TMPDIR=`mktemp -d` HERE=`dirname "$0"` # Reformat a single file to tmp/ -if uncrustify -l CPP -c "$HERE/../share/extras/uncrustify.cfg" -f "$1" >$TMPDIR/uncrustify.out ; then +if uncrustify -l CPP -c "$HERE/../share/uncrustify/uncrustify.cfg" -f "$1" >$TMPDIR/uncrustify.out ; then cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file else echo "Something went wrong with uncrustify." diff --git a/buildroot/share/PlatformIO/variants/MARLIN_MEGA1281/pins_arduino.h b/buildroot/share/PlatformIO/variants/MARLIN_MEGA1281/pins_arduino.h new file mode 100644 index 000000000000..47f3ebd5608e --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_MEGA1281/pins_arduino.h @@ -0,0 +1,337 @@ +/* + pins_arduino.h - Pin definition functions for mega1281 + + Originally part of Arduino + Copyright (c) 2007 David A. Mellis + + Modifications for mega1281 by Lubomir Rintel + and Minitronics: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA +*/ + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define NUM_DIGITAL_PINS 53 +#define NUM_ANALOG_INPUTS 8 +#define analogInputToDigitalPin(p) ((p < 16) ? (p) + 54 : -1) +#define digitalPinHasPWM(p) (((p) >= 2 && (p) <= 13) || ((p) >= 44 && (p)<= 46)) + +#define PIN_SPI_SS (9) +#define PIN_SPI_MOSI (11) +#define PIN_SPI_MISO (12) +#define PIN_SPI_SCK (10) + +static const uint8_t SS = PIN_SPI_SS; +static const uint8_t MOSI = PIN_SPI_MOSI; +static const uint8_t MISO = PIN_SPI_MISO; +static const uint8_t SCK = PIN_SPI_SCK; + +#define PIN_WIRE_SDA (20) +#define PIN_WIRE_SCL (21) + +static const uint8_t SDA = PIN_WIRE_SDA; +static const uint8_t SCL = PIN_WIRE_SCL; + +#define LED_BUILTIN 46 + +#define PIN_A0 (46) +#define PIN_A1 (47) +#define PIN_A2 (48) +#define PIN_A3 (49) +#define PIN_A4 (50) +#define PIN_A5 (51) +#define PIN_A6 (52) +#define PIN_A7 (53) + +static const uint8_t A0 = PIN_A0; +static const uint8_t A1 = PIN_A1; +static const uint8_t A2 = PIN_A2; +static const uint8_t A3 = PIN_A3; +static const uint8_t A4 = PIN_A4; +static const uint8_t A5 = PIN_A5; +static const uint8_t A6 = PIN_A6; +static const uint8_t A7 = PIN_A7; + +// A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins) +// Only pins available for RECEIVE (TRANSMIT can be on any pin): +// (I've deliberately left out pin mapping to the Hardware USARTs - seems senseless to me) +// Pins: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 + +#define digitalPinToPCICR(p) ( (((p) >= 10) && ((p) <= 13)) || \ + (((p) >= 50) && ((p) <= 53)) || \ + (((p) >= 62) && ((p) <= 69)) ? (&PCICR) : ((uint8_t *)0) ) + +#define digitalPinToPCICRbit(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? 0 : \ + ( (((p) >= 62) && ((p) <= 69)) ? 2 : \ + 0 ) ) + +#define digitalPinToPCMSK(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? (&PCMSK0) : \ + ( (((p) >= 62) && ((p) <= 69)) ? (&PCMSK2) : \ + ((uint8_t *)0) ) ) + +#define digitalPinToPCMSKbit(p) ( (((p) >= 10) && ((p) <= 13)) ? ((p) - 6) : \ + ( ((p) == 50) ? 3 : \ + ( ((p) == 51) ? 2 : \ + ( ((p) == 52) ? 1 : \ + ( ((p) == 53) ? 0 : \ + ( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \ + 0 ) ) ) ) ) ) + +#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT))) + +#ifdef ARDUINO_MAIN + +const uint16_t PROGMEM port_to_mode_PGM[] = { + NOT_A_PORT, + (uint16_t) &DDRA, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, + (uint16_t) &DDRE, + (uint16_t) &DDRF, + (uint16_t) &DDRG, +}; + +const uint16_t PROGMEM port_to_output_PGM[] = { + NOT_A_PORT, + (uint16_t) &PORTA, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, + (uint16_t) &PORTE, + (uint16_t) &PORTF, + (uint16_t) &PORTG, +}; + +const uint16_t PROGMEM port_to_input_PGM[] = { + NOT_A_PIN, + (uint16_t) &PINA, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, + (uint16_t) &PINE, + (uint16_t) &PINF, + (uint16_t) &PING, +}; + +const uint8_t PROGMEM digital_pin_to_port_PGM[] = { + // PORTLIST + // ------------------------------------------- + PE , // PE 0 ** 0 ** USART0_RX + PE , // PE 1 ** 1 ** USART0_TX + PE , // PE 4 ** 2 ** PWM0 + PE , // PE 5 ** 3 ** PWM1 + PG , // PG 5 ** 4 ** PWM2 + PE , // PE 3 ** 5 ** PWM3 + PB , // PB 4 ** 6 ** PWM4 + PB , // PB 5 ** 7 ** PWM5 + PB , // PB 6 ** 8 ** PWM6 + PB , // PB 7 ** 9 ** PWM7 + PB , // PB 1 ** 10 ** SPI_SCK + PB , // PB 2 ** 11 ** SPI_MOSI + PB , // PB 3 ** 12 ** SPI_MISO + PE , // PE 2 ** 13 ** D13 + PE , // PE 6 ** 14 ** D14 + PE , // PE 7 ** 15 ** D15 + PB , // PB 0 ** 16 ** SPI_SS + PD , // PD 0 ** 17 ** I2C_SCL + PD , // PD 1 ** 18 ** I2C_SDA + PD , // PD 2 ** 19 ** D19 + PD , // PD 3 ** 20 ** D20 + PD , // PD 4 ** 21 ** D21 + PD , // PD 5 ** 22 ** D22 + PD , // PD 6 ** 23 ** D23 + PD , // PD 7 ** 24 ** D24 + PG , // PG 0 ** 25 ** D25 + PG , // PG 1 ** 26 ** D26 + PG , // PG 2 ** 27 ** D27 + PG , // PG 3 ** 28 ** D28 + PG , // PG 4 ** 29 ** D29 + PC , // PC 0 ** 30 ** D30 + PC , // PC 1 ** 31 ** D31 + PC , // PC 2 ** 32 ** D32 + PC , // PC 3 ** 33 ** D33 + PC , // PC 4 ** 34 ** D34 + PC , // PC 5 ** 35 ** D35 + PC , // PC 6 ** 36 ** D36 + PC , // PC 7 ** 37 ** D37 + PA , // PA 0 ** 38 ** D38 + PA , // PA 1 ** 39 ** D39 + PA , // PA 2 ** 40 ** D40 + PA , // PA 3 ** 41 ** D41 + PA , // PA 4 ** 42 ** D42 + PA , // PA 5 ** 43 ** D43 + PA , // PA 6 ** 44 ** D44 + PA , // PA 7 ** 45 ** D45 + PF , // PF 0 ** 46 ** A0 + PF , // PF 1 ** 47 ** A1 + PF , // PF 2 ** 48 ** A2 + PF , // PF 3 ** 49 ** A3 + PF , // PF 4 ** 50 ** A4 + PF , // PF 5 ** 51 ** A5 + PF , // PF 6 ** 52 ** A6 + PF , // PF 7 ** 53 ** A7 +}; + +const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { + // PIN IN PORT + // ------------------------------------------- + + _BV( 0 ) , // PE 0 ** 0 ** USART0_RX + _BV( 1 ) , // PE 1 ** 1 ** USART0_TX + _BV( 4 ) , // PE 4 ** 2 ** PWM0 + _BV( 5 ) , // PE 5 ** 3 ** PWM1 + _BV( 5 ) , // PG 5 ** 4 ** PWM2 + _BV( 3 ) , // PE 3 ** 5 ** PWM3 + _BV( 4 ) , // PB 4 ** 6 ** PWM4 + _BV( 5 ) , // PB 5 ** 7 ** PWM5 + _BV( 6 ) , // PB 6 ** 8 ** PWM6 + _BV( 7 ) , // PB 7 ** 9 ** PWM7 + _BV( 1 ) , // PB 1 ** 10 ** SPI_SCK + _BV( 2 ) , // PB 2 ** 11 ** SPI_MOSI + _BV( 3 ) , // PB 3 ** 12 ** SPI_MISO + _BV( 2 ) , // PE 2 ** 13 ** D13 + _BV( 6 ) , // PE 6 ** 14 ** D14 + _BV( 7 ) , // PE 7 ** 15 ** D15 + _BV( 0 ) , // PB 0 ** 16 ** SPI_SS + _BV( 0 ) , // PD 0 ** 17 ** I2C_SCL + _BV( 1 ) , // PD 1 ** 18 ** I2C_SDA + _BV( 2 ) , // PD 2 ** 19 ** D19 + _BV( 3 ) , // PD 3 ** 20 ** D20 + _BV( 4 ) , // PD 4 ** 21 ** D21 + _BV( 5 ) , // PA 5 ** 22 ** D22 + _BV( 6 ) , // PA 6 ** 23 ** D23 + _BV( 7 ) , // PA 7 ** 24 ** D24 + _BV( 0 ) , // PG 0 ** 25 ** D25 + _BV( 1 ) , // PG 1 ** 26 ** D26 + _BV( 2 ) , // PG 2 ** 27 ** D27 + _BV( 3 ) , // PG 3 ** 28 ** D28 + _BV( 4 ) , // PG 4 ** 29 ** D29 + _BV( 0 ) , // PC 0 ** 30 ** D30 + _BV( 1 ) , // PC 1 ** 31 ** D31 + _BV( 2 ) , // PC 2 ** 32 ** D32 + _BV( 3 ) , // PC 3 ** 33 ** D33 + _BV( 4 ) , // PC 4 ** 34 ** D34 + _BV( 5 ) , // PC 5 ** 35 ** D35 + _BV( 6 ) , // PC 6 ** 36 ** D36 + _BV( 7 ) , // PC 7 ** 37 ** D37 + _BV( 0 ) , // PA 0 ** 38 ** D38 + _BV( 1 ) , // PA 1 ** 39 ** D39 + _BV( 2 ) , // PA 2 ** 40 ** D40 + _BV( 3 ) , // PA 3 ** 41 ** D41 + _BV( 4 ) , // PA 4 ** 42 ** D42 + _BV( 5 ) , // PA 5 ** 43 ** D43 + _BV( 6 ) , // PA 6 ** 44 ** D44 + _BV( 7 ) , // PA 7 ** 45 ** D45 + _BV( 0 ) , // PF 0 ** 46 ** A0 + _BV( 1 ) , // PF 1 ** 47 ** A1 + _BV( 2 ) , // PF 2 ** 48 ** A2 + _BV( 3 ) , // PF 3 ** 49 ** A3 + _BV( 4 ) , // PF 4 ** 50 ** A4 + _BV( 5 ) , // PF 5 ** 51 ** A5 + _BV( 6 ) , // PF 6 ** 52 ** A6 + _BV( 7 ) , // PF 7 ** 53 ** A7 +}; + +const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { + // TIMERS + // ------------------------------------------- + NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX + NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX + TIMER3B , // PE 4 ** 2 ** PWM0 + TIMER3C , // PE 5 ** 3 ** PWM1 + TIMER0B , // PG 5 ** 4 ** PWM2 + TIMER3A , // PE 3 ** 5 ** PWM3 + TIMER2A , // PB 4 ** 6 ** PWM4 + TIMER1A , // PB 5 ** 7 ** PWM5 + TIMER1B , // PB 6 ** 8 ** PWM6 + TIMER0A , // PB 7 ** 9 ** PWM7 + NOT_ON_TIMER , // PB 1 ** 10 ** SPI_SCK + NOT_ON_TIMER , // PB 2 ** 11 ** SPI_MOSI + NOT_ON_TIMER , // PB 3 ** 12 ** SPI_MISO + NOT_ON_TIMER , // PE 2 ** 13 ** D13 + NOT_ON_TIMER , // PE 6 ** 14 ** D14 + NOT_ON_TIMER , // PE 7 ** 15 ** D15 + NOT_ON_TIMER , // PB 0 ** 16 ** SPI_SS + NOT_ON_TIMER , // PD 0 ** 17 ** I2C_SCL + NOT_ON_TIMER , // PD 1 ** 18 ** I2C_SDA + NOT_ON_TIMER , // PD 2 ** 19 ** D19 + NOT_ON_TIMER , // PD 3 ** 20 ** D20 + NOT_ON_TIMER , // PD 4 ** 21 ** D21 + NOT_ON_TIMER , // PA 5 ** 22 ** D22 + NOT_ON_TIMER , // PA 6 ** 23 ** D23 + NOT_ON_TIMER , // PA 7 ** 24 ** D24 + NOT_ON_TIMER , // PG 0 ** 25 ** D25 + NOT_ON_TIMER , // PG 1 ** 26 ** D26 + NOT_ON_TIMER , // PG 2 ** 27 ** D27 + NOT_ON_TIMER , // PG 3 ** 28 ** D28 + NOT_ON_TIMER , // PG 4 ** 29 ** D29 + NOT_ON_TIMER , // PC 0 ** 30 ** D30 + NOT_ON_TIMER , // PC 1 ** 31 ** D31 + NOT_ON_TIMER , // PC 2 ** 32 ** D32 + NOT_ON_TIMER , // PC 3 ** 33 ** D33 + NOT_ON_TIMER , // PC 4 ** 34 ** D34 + NOT_ON_TIMER , // PC 5 ** 35 ** D35 + NOT_ON_TIMER , // PC 6 ** 36 ** D36 + NOT_ON_TIMER , // PC 7 ** 37 ** D37 + NOT_ON_TIMER , // PA 0 ** 38 ** D38 + NOT_ON_TIMER , // PA 1 ** 39 ** D39 + NOT_ON_TIMER , // PA 2 ** 40 ** D40 + NOT_ON_TIMER , // PA 3 ** 41 ** D41 + NOT_ON_TIMER , // PA 4 ** 42 ** D42 + NOT_ON_TIMER , // PA 5 ** 43 ** D43 + NOT_ON_TIMER , // PA 6 ** 44 ** D44 + NOT_ON_TIMER , // PA 7 ** 45 ** D45 + NOT_ON_TIMER , // PF 0 ** 46 ** A0 + NOT_ON_TIMER , // PF 1 ** 47 ** A1 + NOT_ON_TIMER , // PF 2 ** 48 ** A2 + NOT_ON_TIMER , // PF 3 ** 49 ** A3 + NOT_ON_TIMER , // PF 4 ** 50 ** A4 + NOT_ON_TIMER , // PF 5 ** 51 ** A5 + NOT_ON_TIMER , // PF 6 ** 52 ** A6 + NOT_ON_TIMER , // PF 7 ** 53 ** A7 + +}; + +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_HARDWARE Serial +#define SERIAL_PORT_HARDWARE1 Serial1 +#define SERIAL_PORT_HARDWARE2 Serial2 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 +#define SERIAL_PORT_HARDWARE_OPEN1 Serial2 + +#endif diff --git a/buildroot/share/cmake/CMakeLists.txt b/buildroot/share/cmake/CMakeLists.txt index 09b5b6f1bff1..5f15d266808b 100644 --- a/buildroot/share/cmake/CMakeLists.txt +++ b/buildroot/share/cmake/CMakeLists.txt @@ -20,7 +20,7 @@ cmake_minimum_required(VERSION 3.5) # and add the path to the module path # #====================================================================# -set(SCRIPT_BRANCH 1.0.2) #Set to wanted marlin-cmake release tag or branch +set(SCRIPT_BRANCH 1.0.2) # Set to wanted marlin-cmake release tag or branch if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake) @@ -88,7 +88,7 @@ file(WRITE "${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/Platform/Arduino.cmake" "${NE set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/modules) #====================================================================# -# Custom path to Arduino SDK can be set here. # +# Custom path to Arduino SDK can be set here # # It can also be set from command line. eg.: # # cmake .. -DARDUINO_SDK_PATH="/path/to/arduino-1.x.x" # #====================================================================# @@ -113,14 +113,14 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/marlin-cmake/toolchain/Arduin # If you receive this error: # # 'Unknown CMake command "_cmake_record_install_prefix".' # # # -# Go to the file in your CMake directory. # +# Go to the file in your CMake directory # # # # For Windows: cmake\Modules\Platform\WindowsPaths.cmake # # For Linux: cmake/Modules/Platform/UnixPaths.cmake # # # # Comment out "_cmake_record_install_prefix()" # # - OR - # -# Add "include(CMakeSystemSpecificInformation)" above the line. # +# Add "include(CMakeSystemSpecificInformation)" above the line # # # #====================================================================# project(Marlin C CXX) diff --git a/buildroot/share/fonts/bdf2u8g/bdf2u8g.c b/buildroot/share/fonts/bdf2u8g/bdf2u8g.c index 0421bbd87fb9..6501ead80d1c 100644 --- a/buildroot/share/fonts/bdf2u8g/bdf2u8g.c +++ b/buildroot/share/fonts/bdf2u8g/bdf2u8g.c @@ -1,69 +1,69 @@ /* general font collections - http://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/ - http://techmagazine.ws/most-popular-free-quality-fonts/ - http://openfontlibrary.org/ + https://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/ + https://techmagazine.ws/most-popular-free-quality-fonts/ + https://openfontlibrary.org/ bitmap font collections - http://www.orgdot.com/aliasfonts/ (includes links) - http://www.04.jp.org/ - http://www.miniml.com - http://www.fontspace.com/010bus + https://www.orgdot.com/aliasfonts/ (includes links) + https://www.04.jp.org/ + https://www.miniml.com + https://www.fontspace.com/010bus - http://en.wikipedia.org/wiki/Unicode_typeface + https://en.wikipedia.org/wiki/Unicode_typeface da könnten auch ein paar fonts dabei sein, die die m2tklib sonderzeichen beinhalten: - Caslon Roman http://en.wikipedia.org/wiki/Caslon_Roman - Charis Sil http://en.wikipedia.org/wiki/Charis_SIL - DejaVu Sans http://en.wikipedia.org/wiki/DejaVu_fonts - Doulos http://en.wikipedia.org/wiki/Doulos_SIL - Free Serif http://en.wikipedia.org/wiki/FreeSerif http://ftp.gnu.org/gnu/freefont/ + Caslon Roman https://en.wikipedia.org/wiki/Caslon_Roman + Charis Sil https://en.wikipedia.org/wiki/Charis_SIL + DejaVu Sans https://en.wikipedia.org/wiki/DejaVu_fonts + Doulos https://en.wikipedia.org/wiki/Doulos_SIL + Free Serif https://en.wikipedia.org/wiki/FreeSerif https://ftp.gnu.org/gnu/freefont/ --> keine box, aber es gibt pfeile/invertierte pfeile und kreise für m2tklib - Gentium Plus ???? http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=Gentium_download#02b091ae + Gentium Plus ???? https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=Gentium_download#02b091ae --> keine graphic - GNU Unifont http://en.wikipedia.org/wiki/GNU_Unifont, http://unifoundry.com/unifont.html + GNU Unifont https://en.wikipedia.org/wiki/GNU_Unifont, https://unifoundry.com/unifont.html - Titus cyberbit Basic http://en.wikipedia.org/wiki/TITUS_Cyberbit_Basic + Titus cyberbit Basic https://en.wikipedia.org/wiki/TITUS_Cyberbit_Basic fonts Gentium - http://openfontlibrary.org/font/gentium + https://openfontlibrary.org/font/gentium license: OFL Old-Standard - http://openfontlibrary.org/font/old-standard + https://openfontlibrary.org/font/old-standard license: OFL Hanuman - http://openfontlibrary.org/font/hanumanb + https://openfontlibrary.org/font/hanumanb license: OFL FreeUniversal - http://openfontlibrary.org/font/freeuniversal + https://openfontlibrary.org/font/freeuniversal license: OFL FriendShip-Code <--- nicht so sicher... - http://openfontlibrary.org/font/friendship-code + https://openfontlibrary.org/font/friendship-code license: CC-BY-SA LinuxLibertine - http://de.wikipedia.org/wiki/Linux_Libertine - http://sourceforge.net/projects/linuxlibertine/files/linuxlibertine/5.1.3-2/ + https://de.wikipedia.org/wiki/Linux_Libertine + https://sourceforge.net/projects/linuxlibertine/files/linuxlibertine/5.1.3-2/ license: OFL DidactGothic - source: http://openfontlibrary.org/ + source: https://openfontlibrary.org/ judson - source: http://openfontlibrary.org/ + source: https://openfontlibrary.org/ unicons - source: http://openfontlibrary.org/ + source: https://openfontlibrary.org/ license: OFL suggested pt: 26, 30 org_V01, fixed_V0 - source: http://www.orgdot.com/aliasfonts/ + source: https://www.orgdot.com/aliasfonts/ license: open source, individual, cite required suggested pt: 8 04b_03b.zip 04b_03.zip 04b_09.zip 04b_11.zip 04b_19.zip 04b_21.zip 04b_25.zip 04b_30.zip - source: http://www.04.jp.org/ + source: https://www.04.jp.org/ license: "Freeware: You may use them as you like" 7px4bus - source: http://www.fontspace.com/010bus + source: https://www.fontspace.com/010bus license: Licensed as: Freeware, Commercial use allowed! suggested 7pt 8pxbus - source: http://www.fontspace.com/010bus + source: https://www.fontspace.com/010bus license: Licensed as: Freeware, Commercial use allowed! suggested 8pt @@ -1090,23 +1090,23 @@ void bdf_WriteC(const char *outname, const char *fontname) { capital_ascent = bdf_capital_A_height > 0 ? bdf_capital_A_height : bdf_capital_1_height; - fprintf(out_fp, "/*\n"); - fprintf(out_fp, " Fontname: %s\n", bdf_font); - fprintf(out_fp, " Copyright: %s\n", bdf_copyright); - fprintf(out_fp, " Capital A Height: %d, '1' Height: %d\n", bdf_capital_A_height, bdf_capital_1_height); - fprintf(out_fp, " Calculated Max Values w=%2d h=%2d x=%2d y=%2d dx=%2d dy=%2d ascent=%2d len=%2d\n", + fprintf(out_fp, "/**\n"); + fprintf(out_fp, " * Fontname: %s\n", bdf_font); + fprintf(out_fp, " * Copyright: %s\n", bdf_copyright); + fprintf(out_fp, " * Capital A Height: %d, '1' Height: %d\n", bdf_capital_A_height, bdf_capital_1_height); + fprintf(out_fp, " * Calculated Max Values w=%2d h=%2d x=%2d y=%2d dx=%2d dy=%2d ascent=%2d len=%2d\n", bdf_char_max_width, bdf_char_max_height, bdf_char_max_x, bdf_char_max_y, bdf_delta_max_x, bdf_delta_max_y, bdf_char_max_ascent, bdf_glyph_data_max_len); - fprintf(out_fp, " Font Bounding box w=%2d h=%2d x=%2d y=%2d\n", + fprintf(out_fp, " * Font Bounding box w=%2d h=%2d x=%2d y=%2d\n", bdf_font_width, bdf_font_height, bdf_font_x, bdf_font_y); - fprintf(out_fp, " Calculated Min Values x=%2d y=%2d dx=%2d dy=%2d\n", + fprintf(out_fp, " * Calculated Min Values x=%2d y=%2d dx=%2d dy=%2d\n", bdf_char_min_x, bdf_char_min_y, bdf_delta_min_x, bdf_delta_min_y); - fprintf(out_fp, " Pure Font ascent =%2d descent=%2d\n", capital_ascent, bdf_lower_g_descent); - fprintf(out_fp, " X Font ascent =%2d descent=%2d\n", bdf_char_xascent, bdf_char_xdescent); - fprintf(out_fp, " Max Font ascent =%2d descent=%2d\n", bdf_char_max_ascent, bdf_char_min_y); + fprintf(out_fp, " * Pure Font ascent =%2d descent=%2d\n", capital_ascent, bdf_lower_g_descent); + fprintf(out_fp, " * X Font ascent =%2d descent=%2d\n", bdf_char_xascent, bdf_char_xdescent); + fprintf(out_fp, " * Max Font ascent =%2d descent=%2d\n", bdf_char_max_ascent, bdf_char_min_y); - fprintf(out_fp, "*/\n"); + fprintf(out_fp, " */\n"); fprintf(out_fp, "const u8g_fntpgm_uint8_t %s[%d] U8G_FONT_SECTION(\"%s\") = {\n", fontname, data_pos, fontname); fprintf(out_fp, " "); data_Write(out_fp, " "); diff --git a/buildroot/share/fonts/uxggenpages.md b/buildroot/share/fonts/uxggenpages.md index 5e40c392f7f6..ec5986a81f8a 100644 --- a/buildroot/share/fonts/uxggenpages.md +++ b/buildroot/share/fonts/uxggenpages.md @@ -103,7 +103,7 @@ At this time, the font file `marlin-6x12-3.bdf` is used to generate the font dat Documents related to the old version of the language engine: -- [Marlin Fonts Documentation](https://www.marlinfw.org/docs/development/fonts.html) +- [Marlin Fonts Documentation](https://marlinfw.org/docs/development/fonts.html) - [Marlin LCD Language](https://marlinfw.org/docs/development/lcd_language.html) - [U8GLIB](https://github.com/olikraus/u8glib.git) - [UTF-8 for U8GLIB](https://github.com/yhfudev/u8glib-fontutf8.git) diff --git a/buildroot/share/git/mfconfig b/buildroot/share/git/mfconfig deleted file mode 100755 index 0c4a0de5c8b6..000000000000 --- a/buildroot/share/git/mfconfig +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env bash -# -# mfconfig init source dest -# mfconfig manual source dest -# -# The MarlinFirmware/Configurations layout could be broken up into branches, -# but this makes management more complicated and requires more commits to -# perform the same operation, so this uses a single branch with subfolders. -# -# init - Initialize the repo with a base commit and changes: -# - Source will be an 'import' branch containing all current configs. -# - Create an empty 'BASE' branch from 'init-repo'. -# - Add Marlin config files, but reset all to defaults. -# - Commit this so changes will be clear in following commits. -# - Add changed Marlin config files and commit. -# -# manual - Manually import changes from the Marlin repo -# - Replace 'default' configs with those from the Marlin repo. -# - Wait for manual propagation to the rest of the configs. -# - Run init with the given 'source' and 'dest' -# - -REPOHOME="`dirname ~/Projects/Maker/Firmware/.`" -MARLINREPO="$REPOHOME/MarlinFirmware" -CONFIGREPO="$REPOHOME/Configurations" - -CEXA=config/examples -CDEF=config/default -BC=Configuration.h -AC=Configuration_adv.h - -COMMIT_STEPS=0 - -#cd "$CONFIGREPO" 2>/dev/null || { echo "Can't find Configurations repo!" ; exit 1; } - -ACTION=${1:-init} -IMPORT=${2:-"import-2.1.x"} -EXPORT=${3:-"bugfix-2.1.x"} - -echo -n "Doing grhh ... " ; grhh ; echo - -if [[ $ACTION == "manual" ]]; then - - # - # Copy the latest default configs from MarlinFirmware/Marlin - # or one of the import branches here, then use them to construct - # a 'BASE' branch with only defaults as a starting point. - # - - echo "- Updating '$IMPORT' from Marlin..." - - git checkout $IMPORT || exit - - # Reset from the latest complete state - #git reset --hard bugfix-2.1.x - - cp "$MARLINREPO/Marlin/"Configuration*.h "$CDEF/" - #git add . && git commit -m "Changes from Marlin ($(date '+%Y-%m-%d %H:%M'))." - - echo "- Fix up the import branch and come back." - - read -p "- Ready to init [y/N] ?" INIT_YES - echo - - [[ $INIT_YES == 'Y' || $INIT_YES == 'y' ]] || { echo "Done." ; exit ; } - - ACTION='init' -fi - -if [[ $ACTION == "init" ]]; then - # - # Copy all configs from a source such as MarlinFirmware/Marlin - # or one of the import branches here, then use them to construct - # a 'BASE' branch with only defaults as a starting point. - # - - SED=$(which gsed sed | head -n1) - - echo "- Initializing BASE branch..." - - # Use the import branch as the source - git checkout $IMPORT || exit - - # Copy to a temporary location - TEMP=$( mktemp -d ) ; cp -R config $TEMP - - # Strip all #error lines - IFS=$'\n'; set -f - for fn in $( find $TEMP/config -type f -name "Configuration.h" ); do - $SED -i~ -e "20,30{/#error/d}" "$fn" - rm "$fn~" - done - unset IFS; set +f - - # Make sure we're not on the 'BASE' branch... - git checkout init-repo >/dev/null 2>&1 || exit - - # Create 'BASE' as a copy of 'init-repo' (README, LICENSE, etc.) - git branch -D BASE 2>/dev/null - git checkout init-repo -b BASE || exit - - # Copy all config files into place - echo "- Copying all configs from fresh $IMPORT..." - cp -R "$TEMP/config" . - - # Delete anything that's not a Configuration file - find config -type f \! -name "Configuration*" -exec rm "{}" \; - - # DEBUG: Commit the original config files for comparison - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Commit for comparison" >/dev/null - - # Init Cartesian/SCARA/TPARA configurations to default - echo "- Initializing configs to default state..." - - find "$CEXA" -name $BC -print0 \ - | while read -d $'\0' F ; do cp "$CDEF/$BC" "$F" ; done - find "$CEXA" -name $AC -print0 \ - | while read -d $'\0' F ; do cp "$CDEF/$AC" "$F" ; done - - # DEBUG: Commit the reset for review - ((COMMIT_STEPS)) && git add . >/dev/null && git commit -m "Reset configs..." >/dev/null - - # Update the %VERSION% in the README.md file - VERS=$( echo $EXPORT | $SED 's/release-//' ) - eval "${SED} -E -i~ -e 's/%VERSION%/$VERS/g' README.md" - rm -f README.md~ - - # NOT DEBUGGING: Commit the 'BASE', ready for customizations - ((COMMIT_STEPS)) || git add . >/dev/null && git commit --amend --no-edit >/dev/null - - # Create a new branch from 'BASE' for the final result - echo "- Creating '$EXPORT' branch for the result..." - git branch -D $EXPORT 2>/dev/null - git checkout -b $EXPORT || exit - - # Delete temporary branch - git branch -D BASE 2>/dev/null - - echo "- Applying example config customizations..." - cp -R "$TEMP/config" . - find config -type f \! -name "Configuration*" -exec rm "{}" \; - - addpathlabels() { - find config -name "Conf*.h" -print0 | while read -d $'\0' fn ; do - fldr=$(dirname "$fn") - blank_line=$(awk '/^\s*$/ {print NR; exit}' "$fn") - $SED -i~ "${blank_line}i\\\n#define CONFIG_EXAMPLES_DIR \"$fldr\"" "$fn" - rm -f "$fn~" - done - } - - echo "- Adding path labels to all configs..." - addpathlabels - - git add . >/dev/null && git commit -m "Examples Customizations" >/dev/null - - echo "- Copying extras from Marlin..." - cp -R "$TEMP/config" . - - # Apply labels again! - addpathlabels - - git add . >/dev/null && git commit -m "Examples Extras" >/dev/null - - rm -rf $TEMP - - git push -f --set-upstream upstream "$EXPORT" - -else - - echo "Usage: mfconfig init|manual|rebase" - -fi diff --git a/buildroot/share/git/mfhelp b/buildroot/share/git/mfhelp index 46a0ebfc5333..cbdd6ec4ef95 100755 --- a/buildroot/share/git/mfhelp +++ b/buildroot/share/git/mfhelp @@ -40,7 +40,6 @@ Modify Configuration.h / Configuration_adv.h: Modify pins files: - pins_set ............. Set the value of a pin in a pins file - pinsformat.js ........ Node.js script to format pins files + pinsformat.py ........ Python script to format pins files THIS diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep index 75776cbba310..4554bdc44194 100755 --- a/buildroot/share/git/mfprep +++ b/buildroot/share/git/mfprep @@ -9,7 +9,6 @@ # so at every release be sure to create a dev- tag and publish it to origin. # -SED=$(which gsed sed | head -n1) SELF=`basename "$0"` DRYRUN=0 @@ -36,10 +35,10 @@ TMPF="$TMPDIR/tmp.txt" SCRF="$TMPDIR/update-$DEST.sh" git checkout bugfix-2.1.x -git log --pretty="[%h] %s" dev-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB" +git log --pretty="[%h] %s" dev-$TAG1..$TAG2 | grep -v '\[cron\]' | sed '1!G;h;$!d' >"$LOGB" git checkout $DEST -git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag dev-$TAG1" ; exit 1 ; } +git log --pretty="[%h] %s" $TAG1..$TAG2 | sed '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag dev-$TAG1" ; exit 1 ; } # Go through commit text from DEST removing all matches from the bugfix log @@ -57,7 +56,7 @@ cat "$LOG2" | while read line; do #echo "... $PATT" [[ -n "$PATT" ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } else - PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" ) + PATT=$( sed -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" ) [[ -n "$PATT" ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } fi done diff --git a/buildroot/share/pixmaps/logo/marlin-old.svg b/buildroot/share/pixmaps/logo/marlin-old.svg index d621d3ab870b..a8c9369f8e62 100644 --- a/buildroot/share/pixmaps/logo/marlin-old.svg +++ b/buildroot/share/pixmaps/logo/marlin-old.svg @@ -1,6 +1,9 @@ - - + - Marlin Firmware - + Marlin Firmware + - - - - image/svg+xml - - Marlin Firmware - - - Ahmet Cem TURAN - - - - - MarlinFirmware - - - - - João Brázio - - - marlin-logo-old - - + + Ahmnet Cem TURAN + https://github.com/ahmetcemturan + CC-BY-NC-SA - - - - - - - - - + + + + image/svg+xml + + Marlin Firmware + + + Ahmet Cem TURAN + + + + + MarlinFirmware + + + + + João Brázio + + + marlin-logo-old + + + + + + + + + + + + diff --git a/buildroot/share/pixmaps/logo/marlin.svg b/buildroot/share/pixmaps/logo/marlin.svg index e608a7eed9db..5327c6986a8a 100644 --- a/buildroot/share/pixmaps/logo/marlin.svg +++ b/buildroot/share/pixmaps/logo/marlin.svg @@ -1,6 +1,9 @@ - - + Marlin Firmware +Marlin Firmware + + Ahmnet Cem TURAN + https://github.com/ahmetcemturan + CC-BY-NC-SA + +image/svg+xmlMarlin Firmware Ahmet Cem TURANJoão BrázioMarlinFirmwaremarlin-logo-newMarlin Firmware Ahmet Cem TURANJoão BrázioMarlinFirmwaremarlin-logo-new + + \ No newline at end of file + d="M 403.52901,561.50203" /> + diff --git a/buildroot/share/scripts/MarlinBinaryProtocol.py b/buildroot/share/scripts/MarlinBinaryProtocol.py index 6d902dbeeb0b..5ec83b15032d 100644 --- a/buildroot/share/scripts/MarlinBinaryProtocol.py +++ b/buildroot/share/scripts/MarlinBinaryProtocol.py @@ -181,7 +181,7 @@ def send_ascii(self, data, send_and_forget = False): except ReadTimeout: self.errors += 1 #print("Packetloss detected..") - except serial.serialutil.SerialException: + except serial.SerialException: return self.packet_transit = None @@ -201,7 +201,7 @@ def corrupt_array(self, data): def transmit_packet(self, packet): packet = bytearray(packet) - if(self.simulate_errors > 0 and random.random() > (1.0 - self.simulate_errors)): + if (self.simulate_errors > 0 and random.random() > (1.0 - self.simulate_errors)): if random.random() > 0.9: #random data drop start = random.randint(0, len(packet)) diff --git a/buildroot/share/scripts/createTemperatureLookupMarlin.py b/buildroot/share/scripts/createTemperatureLookupMarlin.py index 5902e91a87d6..e2441f5d89d5 100755 --- a/buildroot/share/scripts/createTemperatureLookupMarlin.py +++ b/buildroot/share/scripts/createTemperatureLookupMarlin.py @@ -22,7 +22,7 @@ from __future__ import division from math import * -import sys,getopt +import sys, getopt "Constants" ZERO = 273.15 # zero point of Kelvin scale diff --git a/buildroot/share/scripts/get_test_targets.py b/buildroot/share/scripts/get_test_targets.py index f51951ae12f7..b187de9cacaa 100644 --- a/buildroot/share/scripts/get_test_targets.py +++ b/buildroot/share/scripts/get_test_targets.py @@ -5,7 +5,7 @@ import yaml # Set the yaml file to parse -yaml_file = '.github/workflows/test-builds.yml' +yaml_file = '.github/workflows/ci-build-tests.yml' # Parse the yaml file, and load it into a dictionary (github_configuration) with open(yaml_file) as f: diff --git a/buildroot/share/scripts/gen-tft-image.py b/buildroot/share/scripts/image_to_tft.py old mode 100644 new mode 100755 similarity index 63% rename from buildroot/share/scripts/gen-tft-image.py rename to buildroot/share/scripts/image_to_tft.py index f3786aef706c..f8257ef8b04d --- a/buildroot/share/scripts/gen-tft-image.py +++ b/buildroot/share/scripts/image_to_tft.py @@ -22,43 +22,54 @@ # Generate Marlin TFT Images from bitmaps/PNG/JPG -import sys,struct +import sys, struct from PIL import Image -def image2bin(image, output_file): +def image2bin(image, output_file, transparency): + w, h = image.size[0], image.size[1] + print(f"Converting image with dimensions {w}x{h}...") if output_file.endswith(('.c', '.cpp')): - f = open(output_file, 'wt') is_cpp = True - f.write("const uint16_t image[%d] = {\n" % (image.size[1] * image.size[0])) + row_sp, item_sp = (" ", "") if w >= 480 else (" ", " ") + row_end, data_end = "\n", "};\n" + f = open(output_file, 'wt') + f.write("const uint16_t image[%d] = {\n" % (h * w)) else: - f = open(output_file, 'wb') is_cpp = False + row_sp, row_end, data_end = b"", b"", b"" + f = open(output_file, 'wb') + tcolor, got_tcolor = 0, False pixs = image.load() - for y in range(image.size[1]): - for x in range(image.size[0]): + for y in range(h): + f.write(row_sp) + for x in range(w): R = pixs[x, y][0] >> 3 G = pixs[x, y][1] >> 2 B = pixs[x, y][2] >> 3 rgb = (R << 11) | (G << 5) | B + if transparency: + if not got_tcolor: + got_tcolor = True + tcolor = rgb # First pixel color is transparent + if rgb == tcolor: rgb = 1 # "color 1" is transparent if is_cpp: - strHex = '0x{0:04X}, '.format(rgb) + strHex = item_sp + "0x{0:04X},".format(rgb) f.write(strHex) else: f.write(struct.pack("B", (rgb & 0xFF))) f.write(struct.pack("B", (rgb >> 8) & 0xFF)) - if is_cpp: - f.write("\n") - if is_cpp: - f.write("};\n") + f.write(row_end) + f.write(data_end) f.close() if len(sys.argv) <= 2: print("Utility to export a image in Marlin TFT friendly format.") print("It will dump a raw bin RGB565 image or create a CPP file with an array of 16 bit image pixels.") - print("Usage: gen-tft-image.py INPUT_IMAGE.(png|bmp|jpg) OUTPUT_FILE.(cpp|bin)") - print("Author: rhapsodyv") + print("Usage: gen-tft-image.py INPUT_IMAGE.(png|bmp|jpg) OUTPUT_FILE.(cpp|bin) [--transparency]") + print("Authors: rhapsodyv, thinkyhead") exit(1) +transparency = len(sys.argv) > 3 and sys.argv[3] == "--transparency" output_img = sys.argv[2] img = Image.open(sys.argv[1]) -image2bin(img, output_img) +image2bin(img, output_img, transparency) diff --git a/buildroot/share/scripts/languageExport.py b/buildroot/share/scripts/languageExport.py index 46485aa1241c..ca1998c18e97 100755 --- a/buildroot/share/scripts/languageExport.py +++ b/buildroot/share/scripts/languageExport.py @@ -1,20 +1,22 @@ #!/usr/bin/env python3 ''' -languageExport.py +languageExport.py [--single] Export LCD language strings to CSV files for easier translation. -Use importTranslations.py to import CSV into the language files. +Use languageImport.py to import CSV into the language files. +Use --single to export all languages to a single CSV file. ''' import re from pathlib import Path +from sys import argv from languageUtil import namebyid LANGHOME = "Marlin/src/lcd/language" # Write multiple sheets if true, otherwise write one giant sheet -MULTISHEET = True +MULTISHEET = '--single' not in argv[1:] OUTDIR = 'out-csv' # Check for the path to the language files @@ -28,7 +30,7 @@ # A dictionary to contain strings for each language. # Init with 'en' so English will always be first. -language_strings = { 'en': 0 } +language_strings = { 'en': {} } # A dictionary to contain all distinct LCD string names names = {} diff --git a/buildroot/share/scripts/languageImport.py b/buildroot/share/scripts/languageImport.py index a535040ad085..c0bbd5951cb6 100755 --- a/buildroot/share/scripts/languageImport.py +++ b/buildroot/share/scripts/languageImport.py @@ -17,7 +17,7 @@ """ import sys, re, requests, csv, datetime -from languageUtil import namebyid +#from languageUtil import namebyid LANGHOME = "Marlin/src/lcd/language" OUTDIR = 'out-language' @@ -76,10 +76,10 @@ # Add the named string for all the included languages name = row[0] for i in range(1, numcols): - str = row[i] - if str: + str_key = row[i] + if str_key: col = columns[i] - strings_per_lang[col['lang']][col['style']][name] = str + strings_per_lang[col['lang']][col['style']][name] = str_key # Create a folder for the imported language outfiles from pathlib import Path @@ -199,11 +199,11 @@ comm = '' if lang != 'en' and 'en' in strings_per_lang: en = strings_per_lang['en'] - if name in en[style]: str = en[style][name] - elif name in en['Narrow']: str = en['Narrow'][name] - if str: + if name in en[style]: str_key = en[style][name] + elif name in en['Narrow']: str_key = en['Narrow'][name] + if str_key: cfmt = '%%%ss// %%s' % (50 - len(val) if len(val) < 50 else 1) - comm = cfmt % (' ', str) + comm = cfmt % (' ', str_key) # Write out the string definition f.write(lstr_fmt % (name, val, comm)) diff --git a/buildroot/share/scripts/languageUtil.py b/buildroot/share/scripts/languageUtil.py index 789561e7b9a4..996db5dd31ac 100755 --- a/buildroot/share/scripts/languageUtil.py +++ b/buildroot/share/scripts/languageUtil.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# marlang.py +# languageUtil.py # # A dictionary to contain language names diff --git a/buildroot/share/scripts/pinsformat.js b/buildroot/share/scripts/pinsformat.js deleted file mode 100755 index 16e9dcb88f08..000000000000 --- a/buildroot/share/scripts/pinsformat.js +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env node - -// -// Formatter script for pins_MYPINS.h files -// -// Usage: mffmt [infile] [outfile] -// -// With no parameters convert STDIN to STDOUT -// - -const fs = require("fs"); - -var do_log = false -function logmsg(msg, line='') { - if (do_log) console.log(msg, line); -} - -// String lpad / rpad -String.prototype.lpad = function(len, chr) { - if (!len) return this; - if (chr === undefined) chr = ' '; - var s = this+'', need = len - s.length; - if (need > 0) s = new Array(need+1).join(chr) + s; - return s; -}; - -String.prototype.rpad = function(len, chr) { - if (!len) return this; - if (chr === undefined) chr = ' '; - var s = this+'', need = len - s.length; - if (need > 0) s += new Array(need+1).join(chr); - return s; -}; - -// Concatenate a string, adding a space if necessary -// to avoid merging two words -String.prototype.concat_with_space = function(str) { - const c = this.substr(-1), d = str.charAt(0); - if (c !== ' ' && c !== '' && d !== ' ' && d !== '') - str = ' ' + str; - return this + str; -}; - -const mpatt = [ '-?\\d{1,3}', 'P[A-I]\\d+', 'P\\d_\\d+', 'Pin[A-Z]\\d\\b' ], - definePatt = new RegExp(`^\\s*(//)?#define\\s+[A-Z_][A-Z0-9_]+\\s+(${mpatt.join('|')})\\s*(//.*)?$`, 'gm'), - ppad = [ 3, 4, 5, 5 ], - col_comment = 50, - col_value_rj = col_comment - 3; - -var mexpr = []; -for (let m of mpatt) mexpr.push(new RegExp('^' + m + '$')); - -const argv = process.argv.slice(2), argc = argv.length; - -var src_file = 0, dst_file; -if (argc > 0) { - let ind = 0; - if (argv[0] == '-v') { do_log = true; ind++; } - dst_file = src_file = argv[ind++]; - if (ind < argc) dst_file = argv[ind]; -} - -// Read from file or STDIN until it terminates -const filtered = process_text(fs.readFileSync(src_file).toString()); -if (dst_file) - fs.writeFileSync(dst_file, filtered); -else - console.log(filtered); - -// Find the pin pattern so non-pin defines can be skipped -function get_pin_pattern(txt) { - var r, m = 0, match_count = [ 0, 0, 0, 0 ]; - var max_match_count = 0, max_match_index = -1; - definePatt.lastIndex = 0; - while ((r = definePatt.exec(txt)) !== null) { - let ind = -1; - if (mexpr.some((p) => { - ind++; - const didmatch = r[2].match(p); - return r[2].match(p); - }) ) { - const m = ++match_count[ind]; - if (m > max_match_count) { - max_match_count = m; - max_match_index = ind; - } - } - } - if (max_match_index === -1) return null; - - return { match:mpatt[max_match_index], pad:ppad[max_match_index] }; -} - -function process_text(txt) { - if (!txt.length) return '(no text)'; - const patt = get_pin_pattern(txt); - if (!patt) return txt; - const pindefPatt = new RegExp(`^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(${patt.match})\\s*(//.*)?$`), - noPinPatt = new RegExp(`^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(-1)\\s*(//.*)?$`), - skipPatt1 = new RegExp('^(\\s*(//)?#define)\\s+(AT90USB|USBCON|(BOARD|DAC|FLASH|HAS|IS|USE)_.+|.+_(ADDRESS|AVAILABLE|BAUDRATE|CLOCK|CONNECTION|DEFAULT|ERROR|EXTRUDERS|FREQ|ITEM|MKS_BASE_VERSION|MODULE|NAME|ONLY|ORIENTATION|PERIOD|RANGE|RATE|READ_RETRIES|SERIAL|SIZE|SPI|STATE|STEP|TIMER|VERSION))\\s+(.+)\\s*(//.*)?$'), - skipPatt2 = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+(0x[0-9A-Fa-f]+|\d+|.+[a-z].+)\\s*(//.*)?$'), - skipPatt3 = /^\s*#e(lse|ndif)\b.*$/, - aliasPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+([A-Z_][A-Z0-9_()]+)\\s*(//.*)?$'), - switchPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s*(//.*)?$'), - undefPatt = new RegExp('^(\\s*(//)?#undef)\\s+([A-Z_][A-Z0-9_]+)\\s*(//.*)?$'), - defPatt = new RegExp('^(\\s*(//)?#define)\\s+([A-Z_][A-Z0-9_]+)\\s+([-_\\w]+)\\s*(//.*)?$'), - condPatt = new RegExp('^(\\s*(//)?#(if|ifn?def|elif)(\\s+\\S+)*)\\s+(//.*)$'), - commPatt = new RegExp('^\\s{20,}(//.*)?$'); - const col_value_lj = col_comment - patt.pad - 2; - var r, out = '', check_comment_next = false; - txt.split('\n').forEach((line) => { - if (check_comment_next) - check_comment_next = ((r = commPatt.exec(line)) !== null); - - if (check_comment_next) - // Comments in column 45 - line = ''.rpad(col_comment) + r[1]; - - else if (skipPatt1.exec(line) !== null) { - // - // #define SKIP_ME - // - logmsg("skip:", line); - } - else if ((r = pindefPatt.exec(line)) !== null) { - // - // #define MY_PIN [pin] - // - logmsg("pin:", line); - const pinnum = r[4].charAt(0) == 'P' ? r[4] : r[4].lpad(patt.pad); - line = r[1] + ' ' + r[3]; - line = line.rpad(col_value_lj).concat_with_space(pinnum); - if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); - } - else if ((r = noPinPatt.exec(line)) !== null) { - // - // #define MY_PIN -1 - // - logmsg("pin -1:", line); - line = r[1] + ' ' + r[3]; - line = line.rpad(col_value_lj).concat_with_space('-1'); - if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); - } - else if (skipPatt2.exec(line) !== null || skipPatt3.exec(line) !== null) { - // - // #define SKIP_ME - // #else, #endif - // - logmsg("skip:", line); - } - else if ((r = aliasPatt.exec(line)) !== null) { - // - // #define ALIAS OTHER - // - logmsg("alias:", line); - line = r[1] + ' ' + r[3]; - line = line.concat_with_space(r[4].lpad(col_value_rj + 1 - line.length)); - if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); - } - else if ((r = switchPatt.exec(line)) !== null) { - // - // #define SWITCH - // - logmsg("switch:", line); - line = r[1] + ' ' + r[3]; - if (r[4]) line = line.rpad(col_comment).concat_with_space(r[4]); - check_comment_next = true; - } - else if ((r = defPatt.exec(line)) !== null) { - // - // #define ... - // - logmsg("def:", line); - line = r[1] + ' ' + r[3] + ' '; - line = line.concat_with_space(r[4].lpad(col_value_rj + 1 - line.length)); - if (r[5]) line = line.rpad(col_comment - 1) + ' ' + r[5]; - } - else if ((r = undefPatt.exec(line)) !== null) { - // - // #undef ... - // - logmsg("undef:", line); - line = r[1] + ' ' + r[3]; - if (r[4]) line = line.rpad(col_comment).concat_with_space(r[4]); - } - else if ((r = condPatt.exec(line)) !== null) { - // - // #if, #ifdef, #ifndef, #elif ... - // - logmsg("cond:", line); - line = r[1].rpad(col_comment).concat_with_space(r[5]); - check_comment_next = true; - } - out += line + '\n'; - }); - return out.replace(/\n\n+/g, '\n\n').replace(/\n\n$/g, '\n'); -} diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py index b49ae4931d09..0260d3174e17 100755 --- a/buildroot/share/scripts/pinsformat.py +++ b/buildroot/share/scripts/pinsformat.py @@ -27,6 +27,13 @@ def rpad(astr, fill, c=' '): need = fill - len(astr) return astr if need <= 0 else astr + (need * c) +# Concatenate a string, adding a space if necessary +# to avoid merging two words +def concat_with_space(s1, s2): + if not s1.endswith(' ') and not s2.startswith(' '): + s1 += ' ' + return s1 + s2 + # Pin patterns mpatt = [ r'-?\d{1,3}', r'P[A-I]\d+', r'P\d_\d+', r'Pin[A-Z]\d\b' ] mstr = '|'.join(mpatt) @@ -36,7 +43,7 @@ def rpad(astr, fill, c=' '): ppad = [ 3, 4, 5, 5 ] # Match a define line -definePatt = re.compile(rf'^\s*(//)?#define\s+[A-Z_][A-Z0-9_]+\s+({mstr})\s*(//.*)?$') +definePinPatt = re.compile(rf'^\s*(//)?#define\s+[A-Z_][A-Z0-9_]+?_PIN\s+({mstr})\s*(//.*)?$') def format_pins(argv): src_file = 'stdin' @@ -45,6 +52,7 @@ def format_pins(argv): scnt = 0 for arg in argv: if arg == '-v': + global do_log do_log = True elif scnt == 0: # Get a source file if specified. Default destination is the same file @@ -85,7 +93,7 @@ def get_pin_pattern(txt): # Find the most common matching pattern match_threshold = 5 for line in txt.split('\n'): - r = definePatt.match(line) + r = definePinPatt.match(line) if r == None: continue ind = -1 for p in mexpr: @@ -135,7 +143,7 @@ def tryPindef(d): logmsg("pin:", line) pinnum = r[4] if r[4][0] == 'P' else lpad(r[4], patt['pad']) line = f'{r[1]} {r[3]}' - line = rpad(line, col_value_lj) + pinnum + line = concat_with_space(rpad(line, col_value_lj), pinnum) if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line return True @@ -149,7 +157,7 @@ def tryNoPin(d): if r == None: return False logmsg("pin -1:", line) line = f'{r[1]} {r[3]}' - line = rpad(line, col_value_lj) + '-1' + line = concat_with_space(rpad(line, col_value_lj), '-1') if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line return True @@ -179,8 +187,8 @@ def tryAlias(d): if r == None: return False logmsg("alias:", line) line = f'{r[1]} {r[3]}' - line += lpad(r[4], col_value_rj + 1 - len(line)) - if r[5]: line = rpad(line, col_comment) + r[5] + line = concat_with_space(line, lpad(r[4], col_value_rj + 1 - len(line))) + if r[5]: line = concat_with_space(rpad(line, col_comment), r[5]) d['line'] = line return True @@ -193,7 +201,7 @@ def trySwitch(d): if r == None: return False logmsg("switch:", line) line = f'{r[1]} {r[3]}' - if r[4]: line = rpad(line, col_comment) + r[4] + if r[4]: line = concat_with_space(rpad(line, col_comment), r[4]) d['line'] = line d['check_comment_next'] = True return True @@ -207,7 +215,7 @@ def tryDef(d): if r == None: return False logmsg("def:", line) line = f'{r[1]} {r[3]} ' - line += lpad(r[4], col_value_rj + 1 - len(line)) + line = concat_with_space(line, lpad(r[4], col_value_rj + 1 - len(line))) if r[5]: line = rpad(line, col_comment - 1) + ' ' + r[5] d['line'] = line return True @@ -221,7 +229,7 @@ def tryUndef(d): if r == None: return False logmsg("undef:", line) line = f'{r[1]} {r[3]}' - if r[4]: line = rpad(line, col_comment) + r[4] + if r[4]: line = concat_with_space(rpad(line, col_comment), r[4]) d['line'] = line return True @@ -233,7 +241,7 @@ def tryCond(d): r = condPatt.match(line) if r == None: return False logmsg("cond:", line) - line = rpad(r[1], col_comment) + r[5] + line = concat_with_space(rpad(r[1], col_comment), r[5]) d['line'] = line d['check_comment_next'] = True return True @@ -263,7 +271,7 @@ def tryCond(d): elif tryUndef(wDict): pass #undef ... elif tryCond(wDict): pass #if|ifdef|ifndef|elif ... - out += wDict['line'] + '\n' + out += wDict['line'].rstrip() + '\n' return re.sub('\n\n$', '\n', re.sub(r'\n\n+', '\n\n', out)) diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py index ae7f7e62617b..a20c2701fe78 100644 --- a/buildroot/share/scripts/upload.py +++ b/buildroot/share/scripts/upload.py @@ -1,11 +1,6 @@ -import argparse -import sys -import os -import time -import random -import serial - -Import("env") +import argparse, sys, os, time, random, serial +from SCons.Script import DefaultEnvironment +env = DefaultEnvironment() import MarlinBinaryProtocol diff --git a/buildroot/share/extras/file_header.h b/buildroot/share/uncrustify/file_header.h similarity index 92% rename from buildroot/share/extras/file_header.h rename to buildroot/share/uncrustify/file_header.h index 0c868aebb36f..79c9c363e20c 100644 --- a/buildroot/share/extras/file_header.h +++ b/buildroot/share/uncrustify/file_header.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/buildroot/share/extras/func_header.h b/buildroot/share/uncrustify/func_header.h similarity index 100% rename from buildroot/share/extras/func_header.h rename to buildroot/share/uncrustify/func_header.h diff --git a/buildroot/share/extras/uncrustify.cfg b/buildroot/share/uncrustify/uncrustify.cfg similarity index 99% rename from buildroot/share/extras/uncrustify.cfg rename to buildroot/share/uncrustify/uncrustify.cfg index 73ccadc5e37e..02b74dd5ee82 100644 --- a/buildroot/share/extras/uncrustify.cfg +++ b/buildroot/share/uncrustify/uncrustify.cfg @@ -3055,7 +3055,7 @@ cmt_multi_first_len_minimum = 4 # unsigned number # Path to a file that contains text to insert at the beginning of a file if # the file doesn't start with a C/C++ comment. If the inserted text contains # '$(filename)', that will be replaced with the current file's name. -cmt_insert_file_header = "./buildroot/share/extras/file_header.h" # string +cmt_insert_file_header = "./buildroot/share/uncrustify/file_header.h" # string # Path to a file that contains text to insert at the end of a file if the # file doesn't end with a C/C++ comment. If the inserted text contains diff --git a/buildroot/share/vscode/auto_build.py b/buildroot/share/vscode/auto_build.py index 80b8b2e6c119..dcbf119d4920 100644 --- a/buildroot/share/vscode/auto_build.py +++ b/buildroot/share/vscode/auto_build.py @@ -72,7 +72,7 @@ from __future__ import print_function from __future__ import division -import sys,os,re +import sys, os, re pwd = os.getcwd() # make sure we're executing from the correct directory level pwd = pwd.replace('\\', '/') @@ -103,7 +103,7 @@ target_env = '' board_name = '' -from datetime import datetime, date, time +from datetime import datetime ######### # Python 2 error messages: @@ -151,8 +151,6 @@ def disable_event(): root_get_answer.protocol("WM_DELETE_WINDOW", disable_event) root_get_answer.resizable(False, False) - root_get_answer.radio_state = default_value # declare variables used by TK and enable - global get_answer_val get_answer_val = default_value # return get_answer_val, set default to match radio_state default @@ -880,7 +878,6 @@ def run_PIO(dummy): print('build_type: ', build_type) import subprocess - import sys print('starting platformio') @@ -965,7 +962,6 @@ def run_PIO(dummy): ######################################################################## -import time import threading if python_ver == 2: import Tkinter as tk @@ -978,7 +974,6 @@ def run_PIO(dummy): import tkinter as tk import queue as queue from tkinter import ttk, Tk, Frame, Text, Menu -import subprocess import sys que = queue.Queue() #IO_queue = queue.Queue() diff --git a/buildroot/share/vscode/avrdude.conf b/buildroot/share/vscode/avrdude.conf index a1a3ef4ba4b8..c6056b4c0f60 100644 --- a/buildroot/share/vscode/avrdude.conf +++ b/buildroot/share/vscode/avrdude.conf @@ -184,7 +184,7 @@ # section avr061.zip which accompanies the application note # AVR061 available from: # -# http://www.atmel.com/atmel/acrobat/doc2525.pdf +# https://www.microchip.com/en-us/application-notes/an2525 # #define ATTINY10 0x10 /* the _old_ one that never existed! */ diff --git a/buildroot/share/vscode/avrdude_linux.conf b/buildroot/share/vscode/avrdude_linux.conf index f889e3e14260..f43d8da0ea4e 100644 --- a/buildroot/share/vscode/avrdude_linux.conf +++ b/buildroot/share/vscode/avrdude_linux.conf @@ -184,7 +184,7 @@ # section avr061.zip which accompanies the application note # AVR061 available from: # -# http://www.atmel.com/atmel/acrobat/doc2525.pdf +# https://www.microchip.com/en-us/application-notes/an2525 # #define ATTINY10 0x10 /* the _old_ one that never existed! */ diff --git a/buildroot/share/vscode/avrdude_macOS.conf b/buildroot/share/vscode/avrdude_macOS.conf index c3235eed2b76..e2ff7cac984c 100644 --- a/buildroot/share/vscode/avrdude_macOS.conf +++ b/buildroot/share/vscode/avrdude_macOS.conf @@ -184,7 +184,7 @@ # section avr061.zip which accompanies the application note # AVR061 available from: # -# http://www.atmel.com/atmel/acrobat/doc2525.pdf +# https://www.microchip.com/en-us/application-notes/an2525 # #define ATTINY10 0x10 /* the _old_ one that never existed! */ diff --git a/buildroot/share/vscode/create_custom_upload_command_CDC.py b/buildroot/share/vscode/create_custom_upload_command_CDC.py index 4926faf06a68..b2d4d5715a3f 100644 --- a/buildroot/share/vscode/create_custom_upload_command_CDC.py +++ b/buildroot/share/vscode/create_custom_upload_command_CDC.py @@ -13,7 +13,7 @@ from __future__ import print_function from __future__ import division -import subprocess,os,platform +import subprocess, os, platform from SCons.Script import DefaultEnvironment current_OS = platform.system() diff --git a/buildroot/share/vscode/create_custom_upload_command_DFU.py b/buildroot/share/vscode/create_custom_upload_command_DFU.py index 27c5a34802f8..22809e177f42 100644 --- a/buildroot/share/vscode/create_custom_upload_command_DFU.py +++ b/buildroot/share/vscode/create_custom_upload_command_DFU.py @@ -9,9 +9,9 @@ # Will continue on if a COM port isn't found so that the compilation can be done. # -import os +import os, platform from SCons.Script import DefaultEnvironment -import platform + current_OS = platform.system() env = DefaultEnvironment() diff --git a/docs/ConfigEmbedding.md b/docs/ConfigEmbedding.md index 90075bc37343..562661e11112 100644 --- a/docs/ConfigEmbedding.md +++ b/docs/ConfigEmbedding.md @@ -3,7 +3,7 @@ Starting with version 2.0.9.3, Marlin can automatically extract the configuration used to generate the firmware and store it in the firmware binary. This is enabled by defining `CONFIGURATION_EMBEDDING` in `Configuration_adv.h`. ## How it's done -At the start of the PlatformIO build process, we create an embedded configuration by extracting all active options from the Configuration files and writing them out as JSON to `marlin_config.json`, which also includes specific build information (like the git revision, the build date, and some version information. The JSON file is then compressed in a ZIP archive called `.pio/build/mc.zip` which is converted into a C array and stored in a C++ file called `mc.h` which is included in the build. +At the start of the PlatformIO build process, we create an embedded configuration by extracting all active options from the Configuration files and writing them out as JSON to `marlin_config.json`, which also includes specific build information (like the git revision, the build date, and some version information). The JSON file is then compressed in a ZIP archive called `.pio/build/mc.zip` which is converted into a C array and stored in a C++ file called `mc.h` which is included in the build. ## Extracting configurations from a Marlin binary To get the configuration out of a binary firmware, you'll need a non-write-protected SD card inserted into the printer while running the firmware. diff --git a/docs/Maintenance.md b/docs/Maintenance.md new file mode 100644 index 000000000000..a0bb62b7794b --- /dev/null +++ b/docs/Maintenance.md @@ -0,0 +1,14 @@ +# Marlin Code Maintenance + +In addition to the general work of fixing bugs, supporting new hardware, developing new features, and refining existing features we have to also maintain supporting files that change in tandem with the codebase. Some of this maintenance can be done as part of CI, and we may even generate commits to the development branch using periodic checks whenever any auto-generated files need to be regenerated. (See `bump-date.yml` for one example.) + +## Configuration Tasks + +- Add CI build tests and Unit Testing to catch future breaking changes. +- Periodically run `buildroot/bin/build_all_examples` to make sure configs and code are buildable. +- Periodically run `buildroot/share/scripts/makeBaseConfigs.py` to generate new base configurations. + +## Documentation Tasks + +- For any G-code command changes update G-code pages and the RepRap wiki G-code page. +- For a new feature or changes to an existing feature update Configuration page and any articles about the feature. diff --git a/ini/avr.ini b/ini/avr.ini index f2f0658d842f..5e7861037d83 100644 --- a/ini/avr.ini +++ b/ini/avr.ini @@ -46,6 +46,16 @@ extra_scripts = ${common.extra_scripts} extends = common_avr8 board = megaatmega1280 +# +# ATmega1281 pin mapping (Minitronics) +# +[env:mega1281] +extends = env:mega1280 +board_build.mcu = atmega1281 +board_build.variant = MARLIN_MEGA1281 +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + # # MightyBoard AVR with extended pins # diff --git a/ini/features.ini b/ini/features.ini index d62b0a832c99..efeed37509cd 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -187,7 +187,7 @@ SD_ABORT_ON_ENDSTOP_HIT = build_src_filter=+ HAS_SMART_EFF_MOD = build_src_filter=+ COOLANT_CONTROL|AIR_ASSIST = build_src_filter=+ -AIR_EVACUATION = build_src_filter=+ +AIR_EVACUATION = build_src_filter=+ HAS_SOFTWARE_ENDSTOPS = build_src_filter=+ SERVO_DETACH_GCODE = build_src_filter=+ HAS_DUPLICATION_MODE = build_src_filter=+ diff --git a/ini/native.ini b/ini/native.ini index 8d5a63dea2fe..5b62c87add5e 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -15,13 +15,26 @@ [env:linux_native] platform = native framework = -build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined +build_flags = ${common.build_flags} -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined build_src_flags = -Wall -IMarlin/src/HAL/LINUX/include build_unflags = -Wall lib_ldf_mode = off -lib_deps = build_src_filter = ${common.default_src_filter} + +# Environment specifically for unit testing through the Makefile +# This is somewhat unorthodox, in that it uses the PlatformIO Unity testing framework, +# but actual targets are dynamically generated during the build. This seems to prevent +# Unity from being automatically included, so it is added here. +[env:linux_native_test] +extends = env:linux_native +extra_scripts = ${common.extra_scripts} + post:buildroot/share/PlatformIO/scripts/collect-code-tests.py +build_src_filter = ${env:linux_native.build_src_filter} + +lib_deps = throwtheswitch/Unity@^2.5.2 +test_build_src = true +build_unflags = +build_flags = ${env:linux_native.build_flags} -Werror + # # Native Simulation # Builds with a small subset of available features @@ -36,19 +49,20 @@ build_src_filter = ${common.default_src_filter} + [simulator_common] platform = native framework = -build_flags = ${common.build_flags} -std=gnu++17 -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS +build_flags = ${common.build_flags} -std=gnu++17 -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g + -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS -DGLM_ENABLE_EXPERIMENTAL build_src_flags = -Wall -Wno-expansion-to-defined -Wno-deprecated-declarations -Wcast-align release_flags = -g0 -O3 -flto debug_build_flags = -fstack-protector-strong -g -g3 -ggdb lib_compat_mode = off build_src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} - MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/8791f3ff43.zip - Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip - LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/simulator.py + MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/afe7c1c293.zip + Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/c6b319f447.zip + LiquidCrystal=https://github.com/p3p/LiquidCrystal/archive/322fb5fc23.zip +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/simulator.py [simulator_linux] extends = simulator_common @@ -69,37 +83,32 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # # MacPorts: -# sudo port install gcc12 glm libsdl2 libsdl2_net +# sudo port install gcc14 glm mesa libsdl2 libsdl2_net # # cd /opt/local/bin # sudo rm gcc g++ cc ld -# sudo ln -s gcc-mp-12 gcc ; sudo ln -s g++-mp-12 g++ ; sudo ln -s g++ cc +# sudo ln -s gcc-mp-14 gcc ; sudo ln -s g++-mp-14 g++ ; sudo ln -s g++ cc # sudo ln -s ld-classic ld # cd - # rehash # -# Use 'sudo port install mesa' to get a if no Xcode is installed. -# If Xcode is installed be sure to run `xcode-select --install` first. -# #================================================================================== # # Homebrew: # /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # -# brew install gcc@12 glm sdl2 sdl2_net +# brew install gcc@14 glm mesa sdl2 sdl2_net # # cd /opt/homebrew/bin # sudo rm -f gcc g++ cc -# sudo ln -s gcc-12 gcc ; sudo ln -s g++-12 g++ ; sudo ln -s g++ cc +# sudo ln -s gcc-14 gcc ; sudo ln -s g++-14 g++ ; sudo ln -s g++ cc # cd - # -# Use 'brew install mesa' to get a if no Xcode is installed. -# If Xcode is installed be sure to run `xcode-select --install` first. -# [simulator_macos] -build_unflags = -lGL -fstack-protector-strong -build_flags = +build_unflags = -g3 -lGL -fstack-protector-strong +build_flags = -g2 + -DHAS_LIBBSD -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/SDL2/