🔨 PlatformIO 6 compatibility
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
STM32_FLASH_SIZE = 256
|
||||
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
if define[0] == "STM32_FLASH_SIZE":
|
||||
STM32_FLASH_SIZE = define[1]
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI_" + str(STM32_FLASH_SIZE) + "K.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -4,10 +4,8 @@ from os.path import expandvars
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08008000
|
||||
#for define in env['CPPDEFINES']:
|
||||
# if define[0] == "VECT_TAB_ADDR":
|
||||
# env['CPPDEFINES'].remove(define)
|
||||
#env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08008000"))
|
||||
#import marlin
|
||||
#marlin.relocate_firmware("0x08008000")
|
||||
|
||||
#custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/fysetc_stm32f103rc.ld")
|
||||
#for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RE_SKR_E3_DIP.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08010000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
|
||||
marlin.relocate_firmware("0x08010000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103VE_longer.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -51,7 +51,7 @@ def add_to_feat_cnf(feature, flines):
|
||||
parts = dep.split('=')
|
||||
name = parts.pop(0)
|
||||
rest = '='.join(parts)
|
||||
if name in ['extra_scripts', 'src_filter', 'lib_ignore']:
|
||||
if name in ['extra_scripts', 'build_src_filter', 'lib_ignore']:
|
||||
feat[name] = rest
|
||||
else:
|
||||
feat['lib_deps'] += [dep]
|
||||
@@ -152,19 +152,19 @@ def apply_features_config():
|
||||
blab("Running extra_scripts for %s... " % feature)
|
||||
env.SConscript(feat['extra_scripts'], exports="env")
|
||||
|
||||
if 'src_filter' in feat:
|
||||
blab("Adding src_filter for %s... " % feature)
|
||||
src_filter = ' '.join(env.GetProjectOption('src_filter'))
|
||||
if 'build_src_filter' in feat:
|
||||
blab("Adding build_src_filter for %s... " % feature)
|
||||
build_src_filter = ' '.join(env.GetProjectOption('build_src_filter'))
|
||||
# first we need to remove the references to the same folder
|
||||
my_srcs = re.findall( r'[+-](<.*?>)', feat['src_filter'])
|
||||
cur_srcs = re.findall( r'[+-](<.*?>)', src_filter)
|
||||
my_srcs = re.findall( r'[+-](<.*?>)', feat['build_src_filter'])
|
||||
cur_srcs = re.findall( r'[+-](<.*?>)', build_src_filter)
|
||||
for d in my_srcs:
|
||||
if d in cur_srcs:
|
||||
src_filter = re.sub(r'[+-]' + d, '', src_filter)
|
||||
build_src_filter = re.sub(r'[+-]' + d, '', build_src_filter)
|
||||
|
||||
src_filter = feat['src_filter'] + ' ' + src_filter
|
||||
set_env_field('src_filter', [src_filter])
|
||||
env.Replace(SRC_FILTER=src_filter)
|
||||
build_src_filter = feat['build_src_filter'] + ' ' + build_src_filter
|
||||
set_env_field('build_src_filter', [build_src_filter])
|
||||
env.Replace(SRC_FILTER=build_src_filter)
|
||||
|
||||
if 'lib_ignore' in feat:
|
||||
blab("Adding lib_ignore for %s... " % feature)
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/creality.ld")
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08005000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
|
||||
marlin.relocate_firmware("0x08005000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/fly_mini.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
17
buildroot/share/PlatformIO/scripts/marlin.py
Normal file
17
buildroot/share/PlatformIO/scripts/marlin.py
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# buildroot/share/PlatformIO/scripts/marlin.py
|
||||
# Helper module with some commonly-used functions
|
||||
#
|
||||
from SCons.Script import DefaultEnvironment
|
||||
env = DefaultEnvironment()
|
||||
|
||||
def replace_define(field, value):
|
||||
envdefs = env['CPPDEFINES'].copy()
|
||||
for define in envdefs:
|
||||
if define[0] == field:
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append((field, value))
|
||||
|
||||
# Relocate the firmware to a new address, such as "0x08005000"
|
||||
def relocate_firmware(address):
|
||||
replace_define("VECT_TAB_ADDR", address)
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08005000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
|
||||
marlin.relocate_firmware("0x08005000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_e3.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_e3p.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08005000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
|
||||
marlin.relocate_firmware("0x08005000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08005000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
|
||||
marlin.relocate_firmware("0x08005000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import os
|
||||
import os, marlin
|
||||
Import("env")
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08007000
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
marlin.relocate_firmware("0x08007000")
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_pro.ld")
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import os,sys,shutil
|
||||
import os,sys,shutil,marlin
|
||||
Import("env")
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
@@ -13,10 +13,7 @@ def noencrypt(source, target, env):
|
||||
if 'offset' in board.get("build").keys():
|
||||
LD_FLASH_OFFSET = board.get("build.offset")
|
||||
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_OFFSET":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
env['CPPDEFINES'].append(("VECT_TAB_OFFSET", LD_FLASH_OFFSET))
|
||||
marlin.replace_define("VECT_TAB_OFFSET", LD_FLASH_OFFSET)
|
||||
|
||||
maximum_ram_size = board.get("upload.maximum_ram_size")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user