From 3f34916c57988429c503b7b17e59c147968ca7e6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 27 Feb 2021 22:38:57 -0600 Subject: [PATCH] Tweaks to build scripts --- Marlin/src/HAL/LPC1768/upload_extra_script.py | 7 ++----- .../lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py | 2 +- .../share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py | 3 +++ .../share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py | 3 +++ buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py | 3 +++ .../scripts/{creality.py => STM32F103RET6_creality.py} | 3 +++ .../share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py | 3 +++ buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py | 4 ++++ .../share/PlatformIO/scripts/STM32F1_create_variant.py | 3 +++ .../scripts/{STEVAL__F401XX.py => STM32F401VE_STEVAL.py} | 4 ++++ buildroot/share/PlatformIO/scripts/add_nanolib.py | 3 +++ buildroot/share/PlatformIO/scripts/chitu_crypt.py | 9 +++++---- buildroot/share/PlatformIO/scripts/common-cxxflags.py | 4 ++-- .../share/PlatformIO/scripts/common-dependencies.py | 4 +--- .../scripts/copy_marlin_variant_to_framework.py | 3 +++ .../share/PlatformIO/scripts/download_mks_assets.py | 9 ++++----- .../share/PlatformIO/scripts/fix_framework_weakness.py | 3 +++ buildroot/share/PlatformIO/scripts/fly_mini.py | 4 ++++ buildroot/share/PlatformIO/scripts/lerdge.py | 4 ++++ buildroot/share/PlatformIO/scripts/preflight-checks.py | 3 +-- buildroot/share/PlatformIO/scripts/random-bin.py | 4 ++++ buildroot/share/PlatformIO/scripts/stm32_bootloader.py | 3 +++ buildroot/share/scripts/config-labels.py | 3 +-- buildroot/share/scripts/createTemperatureLookupMarlin.py | 3 +-- buildroot/share/vscode/auto_build.py | 3 +-- .../share/vscode/create_custom_upload_command_CDC.py | 6 ++---- .../share/vscode/create_custom_upload_command_DFU.py | 3 +-- platformio.ini | 8 +++++--- 28 files changed, 77 insertions(+), 37 deletions(-) rename buildroot/share/PlatformIO/scripts/{creality.py => STM32F103RET6_creality.py} (94%) rename buildroot/share/PlatformIO/scripts/{STEVAL__F401XX.py => STM32F401VE_STEVAL.py} (81%) diff --git a/Marlin/src/HAL/LPC1768/upload_extra_script.py b/Marlin/src/HAL/LPC1768/upload_extra_script.py index 1daaa883e..5967a9970 100755 --- a/Marlin/src/HAL/LPC1768/upload_extra_script.py +++ b/Marlin/src/HAL/LPC1768/upload_extra_script.py @@ -8,9 +8,7 @@ from __future__ import print_function target_filename = "FIRMWARE.CUR" target_drive = "REARM" -import os -import getpass -import platform +import os,getpass,platform current_OS = platform.system() Import("env") @@ -33,9 +31,8 @@ try: # # platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:' # Windows - doesn't care about the disk's name, only cares about the drive letter - import subprocess + import subprocess,string from ctypes import windll - import string # getting list of drives # https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py index c6eba3946..aa702ca4b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py @@ -16,7 +16,7 @@ # location: . from __future__ import print_function -import argparse, re, sys +import argparse,re,sys usage = ''' This program extracts line segments from a SVG file and writes diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py index 547d80ace..6d7f21942 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py @@ -1,3 +1,6 @@ +# +# STM32F103RC_MEEB_3DP.py +# try: import configparser except ImportError: diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py index 497a035fd..7e9dc676b 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py @@ -1,3 +1,6 @@ +# +# STM32F103RC_SKR_MINI.py +# import os Import("env") diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py index b69f62578..1a7cc34ed 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py @@ -1,3 +1,6 @@ +# +# STM32F103RC_fysetc.py +# import os from os.path import join from os.path import expandvars diff --git a/buildroot/share/PlatformIO/scripts/creality.py b/buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py similarity index 94% rename from buildroot/share/PlatformIO/scripts/creality.py rename to buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py index b9d7d7039..e3ef98b03 100644 --- a/buildroot/share/PlatformIO/scripts/creality.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py @@ -1,3 +1,6 @@ +# +# STM32F103RET6_creality.py +# import os Import("env") diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py b/buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py index ecdd57f59..06e586f7f 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py @@ -1,3 +1,6 @@ +# +# STM32F103RE_SKR_E3_DIP.py +# import os Import("env") diff --git a/buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py b/buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py index ece47ed09..bbdfcd93b 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py @@ -1,3 +1,7 @@ +# +# STM32F103VE_longer.py +# Customizations for env:STM32F103VE_longer +# import os Import("env") diff --git a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py index 4849f59ce..0ba5d71f2 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py +++ b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py @@ -1,3 +1,6 @@ +# +# STM32F1_create_variant.py +# import os,shutil from SCons.Script import DefaultEnvironment from platformio import util diff --git a/buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py b/buildroot/share/PlatformIO/scripts/STM32F401VE_STEVAL.py similarity index 81% rename from buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py rename to buildroot/share/PlatformIO/scripts/STM32F401VE_STEVAL.py index 580529c9c..ffd5bcd42 100644 --- a/buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py +++ b/buildroot/share/PlatformIO/scripts/STM32F401VE_STEVAL.py @@ -1,3 +1,7 @@ +# +# STM32F401VE_STEVAL.py +# Customizations for env:STM32F401VE_STEVAL +# import os Import("env") diff --git a/buildroot/share/PlatformIO/scripts/add_nanolib.py b/buildroot/share/PlatformIO/scripts/add_nanolib.py index 102b4b9bb..3b74b0d27 100644 --- a/buildroot/share/PlatformIO/scripts/add_nanolib.py +++ b/buildroot/share/PlatformIO/scripts/add_nanolib.py @@ -1,2 +1,5 @@ +# +# add_nanolib.py +# Import("env") env.Append(LINKFLAGS=["--specs=nano.specs"]) diff --git a/buildroot/share/PlatformIO/scripts/chitu_crypt.py b/buildroot/share/PlatformIO/scripts/chitu_crypt.py index aa675878e..3d4854b51 100644 --- a/buildroot/share/PlatformIO/scripts/chitu_crypt.py +++ b/buildroot/share/PlatformIO/scripts/chitu_crypt.py @@ -1,8 +1,9 @@ +# +# chitu_crypt.py +# Customizations for Chitu boards +# Import("env") -import os -import random -import struct -import uuid +import os,random,struct,uuid # Relocate firmware from 0x08000000 to 0x08008800 env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000")) diff --git a/buildroot/share/PlatformIO/scripts/common-cxxflags.py b/buildroot/share/PlatformIO/scripts/common-cxxflags.py index 5c2bde770..ed863a917 100644 --- a/buildroot/share/PlatformIO/scripts/common-cxxflags.py +++ b/buildroot/share/PlatformIO/scripts/common-cxxflags.py @@ -28,8 +28,8 @@ def add_cpu_freq(): if env.GetBuildType() == "debug": env['BUILD_DIR'] = '$PROJECT_BUILD_DIR/$PIOENV/debug' -# On some platform, F_CPU is a runtime variable. Since it's used to convert from ns -# to CPU cycles, this adds overhead preventing small delay (in the order of less than +# On some platform, F_CPU is a runtime variable. Since it's used to convert from ns +# to CPU cycles, this adds overhead preventing small delay (in the order of less than # 30 cycles) to be generated correctly. By using a compile time constant instead # the compiler will perform the computation and this overhead will be avoided add_cpu_freq() diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index 30e168d83..3844d8298 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -2,9 +2,7 @@ # common-dependencies.py # Convenience script to check dependencies and add libs and sources for Marlin Enabled Features # -import subprocess -import os -import re +import subprocess,os,re try: import configparser except ImportError: diff --git a/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py b/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py index f7d3f0d03..7ea7ac57f 100644 --- a/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py +++ b/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py @@ -1,3 +1,6 @@ +# +# copy_marlin_variant_to_framework.py +# import os,shutil from SCons.Script import DefaultEnvironment from platformio import util diff --git a/buildroot/share/PlatformIO/scripts/download_mks_assets.py b/buildroot/share/PlatformIO/scripts/download_mks_assets.py index ae2ce467e..33acab9e1 100644 --- a/buildroot/share/PlatformIO/scripts/download_mks_assets.py +++ b/buildroot/share/PlatformIO/scripts/download_mks_assets.py @@ -1,9 +1,8 @@ +# +# download_mks_assets.py +# Import("env") -import os -import requests -import zipfile -import tempfile -import shutil +import os,requests,zipfile,tempfile,shutil url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip" zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip") diff --git a/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py b/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py index 4944c0003..c7bc45aba 100644 --- a/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py +++ b/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py @@ -1,3 +1,6 @@ +# +# fix_framework_weakness.py +# from os.path import join, isfile import shutil from pprint import pprint diff --git a/buildroot/share/PlatformIO/scripts/fly_mini.py b/buildroot/share/PlatformIO/scripts/fly_mini.py index 34d132958..9c5df359a 100644 --- a/buildroot/share/PlatformIO/scripts/fly_mini.py +++ b/buildroot/share/PlatformIO/scripts/fly_mini.py @@ -1,3 +1,7 @@ +# +# fly_mini.py +# Customizations for env:FLY_MINI +# import os Import("env") diff --git a/buildroot/share/PlatformIO/scripts/lerdge.py b/buildroot/share/PlatformIO/scripts/lerdge.py index fd934a127..ff4f5e446 100644 --- a/buildroot/share/PlatformIO/scripts/lerdge.py +++ b/buildroot/share/PlatformIO/scripts/lerdge.py @@ -1,3 +1,7 @@ +# +# lerdge.py +# Customizations for Lerdge build environments +# import os,sys Import("env") diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index c20e5cb7a..c9bbb42ab 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -2,8 +2,7 @@ # preflight-checks.py # Check for common issues prior to compiling # -import os -import re +import os,re Import("env") def get_envs_for_board(board): diff --git a/buildroot/share/PlatformIO/scripts/random-bin.py b/buildroot/share/PlatformIO/scripts/random-bin.py index 4d7ca5dc0..c03b86344 100644 --- a/buildroot/share/PlatformIO/scripts/random-bin.py +++ b/buildroot/share/PlatformIO/scripts/random-bin.py @@ -1,3 +1,7 @@ +# +# random-bin.py +# Set a unique firmware name based on current date and time +# Import("env") from datetime import datetime diff --git a/buildroot/share/PlatformIO/scripts/stm32_bootloader.py b/buildroot/share/PlatformIO/scripts/stm32_bootloader.py index 7f49ea0e6..bbec61750 100644 --- a/buildroot/share/PlatformIO/scripts/stm32_bootloader.py +++ b/buildroot/share/PlatformIO/scripts/stm32_bootloader.py @@ -1,3 +1,6 @@ +# +# stm32_bootloader.py +# import os,sys,shutil Import("env") diff --git a/buildroot/share/scripts/config-labels.py b/buildroot/share/scripts/config-labels.py index 267aa2d27..700604e45 100755 --- a/buildroot/share/scripts/config-labels.py +++ b/buildroot/share/scripts/config-labels.py @@ -22,8 +22,7 @@ # 2020-06-05 SRL style tweaks #----------------------------------- # -import sys -import os +import sys,os from pathlib import Path from distutils.dir_util import copy_tree # for copy_tree, because shutil.copytree can't handle existing files, dirs diff --git a/buildroot/share/scripts/createTemperatureLookupMarlin.py b/buildroot/share/scripts/createTemperatureLookupMarlin.py index b2d8964f5..b3343de1a 100755 --- a/buildroot/share/scripts/createTemperatureLookupMarlin.py +++ b/buildroot/share/scripts/createTemperatureLookupMarlin.py @@ -22,8 +22,7 @@ from __future__ import print_function from __future__ import division from math import * -import sys -import getopt +import sys,getopt "Constants" ZERO = 273.15 # zero point of Kelvin scale diff --git a/buildroot/share/vscode/auto_build.py b/buildroot/share/vscode/auto_build.py index 61cacca4d..ac8432729 100644 --- a/buildroot/share/vscode/auto_build.py +++ b/buildroot/share/vscode/auto_build.py @@ -72,8 +72,7 @@ from __future__ import print_function from __future__ import division -import sys -import os +import sys,os pwd = os.getcwd() # make sure we're executing from the correct directory level pwd = pwd.replace('\\', '/') diff --git a/buildroot/share/vscode/create_custom_upload_command_CDC.py b/buildroot/share/vscode/create_custom_upload_command_CDC.py index 65edbd15b..4662dd26c 100644 --- a/buildroot/share/vscode/create_custom_upload_command_CDC.py +++ b/buildroot/share/vscode/create_custom_upload_command_CDC.py @@ -13,11 +13,9 @@ from __future__ import print_function from __future__ import division -import subprocess -import os -import sys +import subprocess,os,sys,platform from SCons.Script import DefaultEnvironment -import platform + current_OS = platform.system() env = DefaultEnvironment() diff --git a/buildroot/share/vscode/create_custom_upload_command_DFU.py b/buildroot/share/vscode/create_custom_upload_command_DFU.py index 9082699bf..562e284e6 100644 --- a/buildroot/share/vscode/create_custom_upload_command_DFU.py +++ b/buildroot/share/vscode/create_custom_upload_command_DFU.py @@ -9,8 +9,7 @@ # Will continue on if a COM port isn't found so that the compilation can be done. # -import os -import sys +import os,sys from SCons.Script import DefaultEnvironment import platform current_OS = platform.system() diff --git a/platformio.ini b/platformio.ini index 2c011a9e8..7ddd832f8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1155,7 +1155,7 @@ extends = env:STM32F103RE build_flags = ${env:STM32F103RE.build_flags} -DTEMP_TIMER_CHAN=4 extra_scripts = ${env:STM32F103RE.extra_scripts} pre:buildroot/share/PlatformIO/scripts/random-bin.py - buildroot/share/PlatformIO/scripts/creality.py + buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py debug_tool = jlink upload_protocol = jlink @@ -1194,7 +1194,7 @@ build_flags = ${common_stm32.build_flags} -DDISABLE_GENERIC_SERIALUSB -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py - buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py + buildroot/share/PlatformIO/scripts/STM32F401VE_STEVAL.py # # STM32F401RC @@ -1569,7 +1569,9 @@ board_build.ldscript = ldscript.ld board_build.offset = 0x10000 build_flags = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py buildroot/share/PlatformIO/scripts/stm32_bootloader.py +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + buildroot/share/PlatformIO/scripts/stm32_bootloader.py ################################# # #