Browse Source

🔨 Build scripts cleanup (#27157)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Andrew 9 months ago
parent
commit
959be66cc2

+ 1 - 1
Marlin/src/HAL/DUE/upload_extra_script.py

@@ -11,7 +11,7 @@ if pioutil.is_pio_build():
 
     if current_OS == 'Windows':
 
-        Import("env")
+        env = pioutil.env
 
         # Use bossac.exe on Windows
         env.Replace(

+ 2 - 2
Marlin/src/HAL/LPC1768/upload_extra_script.py

@@ -13,9 +13,9 @@ if pioutil.is_pio_build():
     target_drive = "REARM"
 
     import platform
-
     current_OS = platform.system()
-    Import("env")
+
+    env = pioutil.env
 
     def print_error(e):
         print('\nUnable to find destination disk (%s)\n' \

+ 0 - 56
Marlin/src/HAL/STM32F1/build_flags.py

@@ -1,56 +0,0 @@
-from __future__ import print_function
-import sys
-
-#dynamic build flags for generic compile options
-if __name__ == "__main__":
-  args = " ".join([ "-std=gnu++14",
-                    "-Os",
-                    "-mcpu=cortex-m3",
-                    "-mthumb",
-
-                    "-fsigned-char",
-                    "-fno-move-loop-invariants",
-                    "-fno-strict-aliasing",
-                    "-fsingle-precision-constant",
-
-                    "--specs=nano.specs",
-                    "--specs=nosys.specs",
-
-                    "-IMarlin/src/HAL/STM32F1",
-
-                    "-MMD",
-                    "-MP",
-                    "-DTARGET_STM32F1"
-                  ])
-
-  for i in range(1, len(sys.argv)):
-    args += " " + sys.argv[i]
-
-  print(args)
-
-# extra script for linker options
-else:
-  import pioutil
-  if pioutil.is_pio_build():
-    from SCons.Script import DefaultEnvironment
-    env = DefaultEnvironment()
-    env.Append(
-      ARFLAGS=["rcs"],
-
-      ASFLAGS=["-x", "assembler-with-cpp"],
-
-      CXXFLAGS=[
-        "-fabi-version=0",
-        "-fno-use-cxa-atexit",
-        "-fno-threadsafe-statics"
-      ],
-      LINKFLAGS=[
-        "-Os",
-        "-mcpu=cortex-m3",
-        "-ffreestanding",
-        "-mthumb",
-        "--specs=nano.specs",
-        "--specs=nosys.specs",
-        "-u_printf_float",
-      ],
-    )

+ 1 - 2
buildroot/share/PlatformIO/scripts/SAMD21_minitronics20.py

@@ -6,8 +6,7 @@ import pioutil
 if pioutil.is_pio_build():
     from os.path import join, isfile
     import shutil
-
-    Import("env")
+    env = pioutil.env
 
     mf = env["MARLIN_FEATURES"]
     rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0"

+ 1 - 2
buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py

@@ -6,8 +6,7 @@ import pioutil
 if pioutil.is_pio_build():
     from os.path import join, isfile
     import shutil
-
-    Import("env")
+    env = pioutil.env
 
     mf = env["MARLIN_FEATURES"]
     rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0"

+ 1 - 2
buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py

@@ -3,8 +3,7 @@
 #
 import pioutil
 if pioutil.is_pio_build():
-
-    Import("env", "projenv")
+    env = pioutil.env
 
     flash_size = 0
     vect_tab_addr = 0

+ 2 - 3
buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py

@@ -3,9 +3,8 @@
 #
 import pioutil
 if pioutil.is_pio_build():
-    from os.path import join
-    from os.path import expandvars
-    Import("env")
+    from os.path import join, expandvars
+    env = pioutil.env
 
     # Custom HEX from ELF
     env.AddPostAction(

+ 63 - 0
buildroot/share/PlatformIO/scripts/STM32F1_build_flags.py

@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+#
+# STM32F1_build_flags.py
+# Add build_flags for the base STM32F1_maple environment (stm32f1-maple.ini)
+#
+from __future__ import print_function
+import sys
+
+# Dynamic build flags for generic compile options
+if __name__ == "__main__":
+
+    # Print these plus the given args when running directly on the command-line
+    args = [
+        "-std=gnu++14",
+        "-Os",
+        "-mcpu=cortex-m3",
+        "-mthumb",
+
+        "-fsigned-char",
+        "-fno-move-loop-invariants",
+        "-fno-strict-aliasing",
+        "-fsingle-precision-constant",
+
+        "--specs=nano.specs",
+        "--specs=nosys.specs",
+
+        "-MMD", "-MP",
+
+        "-IMarlin/src/HAL/STM32F1",
+
+        "-DTARGET_STM32F1",
+        "-DARDUINO_ARCH_STM32",
+        "-DPLATFORM_M997_SUPPORT"
+    ] + sys.argv[1:]
+
+    print(" ".join(args))
+
+else:
+
+    # Extra script for stm32f1-maple.ini build_flags
+
+    import pioutil
+    if pioutil.is_pio_build():
+        pioutil.env.Append(
+            ARFLAGS=["rcs"],
+
+            ASFLAGS=["-x", "assembler-with-cpp"],
+
+            CXXFLAGS=[
+                "-fabi-version=0",
+                "-fno-use-cxa-atexit",
+                "-fno-threadsafe-statics"
+            ],
+            LINKFLAGS=[
+                "-Os",
+                "-mcpu=cortex-m3",
+                "-ffreestanding",
+                "-mthumb",
+                "--specs=nano.specs",
+                "--specs=nosys.specs",
+                "-u_printf_float",
+            ],
+        )

+ 2 - 3
buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py

@@ -3,10 +3,9 @@
 #
 import pioutil
 if pioutil.is_pio_build():
-    import shutil,marlin
+    import shutil, marlin
     from pathlib import Path
-
-    Import("env")
+    env = pioutil.env
     platform = env.PioPlatform()
     board = env.BoardConfig()
 

+ 0 - 6
buildroot/share/PlatformIO/scripts/add_nanolib.py

@@ -1,6 +0,0 @@
-#
-# add_nanolib.py
-#
-Import("env")
-
-env.Append(LINKFLAGS=["--specs=nano.specs"])

Some files were not shown because too many files changed in this diff