🔨 PlatformIO 6 compatibility
This commit is contained in:
committed by
Sven Soost
parent
eee1018122
commit
6fde6ce9c4
@@ -56,7 +56,7 @@ if pioutil.is_pio_build():
|
||||
# Split up passed lines on commas or newlines and iterate
|
||||
# Add common options to the features config under construction
|
||||
# For lib_deps replace a previous instance of the same library
|
||||
atoms = re.sub(r',\s*', '\n', flines).strip().split('\n')
|
||||
atoms = re.sub(r',\\s*', '\n', flines).strip().split('\n')
|
||||
for line in atoms:
|
||||
parts = line.split('=')
|
||||
name = parts.pop(0)
|
||||
@@ -64,16 +64,16 @@ if pioutil.is_pio_build():
|
||||
feat[name] = '='.join(parts)
|
||||
blab("[%s] %s=%s" % (feature, name, feat[name]), 3)
|
||||
else:
|
||||
for dep in re.split(r',\s*', line):
|
||||
for dep in re.split(r",\s*", line):
|
||||
lib_name = re.sub(r'@([~^]|[<>]=?)?[\d.]+', '', dep.strip()).split('=').pop(0)
|
||||
lib_re = re.compile('(?!^' + lib_name + '\\b)')
|
||||
if not 'lib_deps' in feat: feat['lib_deps'] = {}
|
||||
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
|
||||
blab("[%s] lib_deps = %s" % (feature, dep), 3)
|
||||
|
||||
def load_features():
|
||||
def load_config():
|
||||
blab("========== Gather [features] entries...")
|
||||
for key in ProjectConfig().items('features'):
|
||||
items = ProjectConfig().items('features')
|
||||
for key in items:
|
||||
feature = key[0].upper()
|
||||
if not feature in FEATURE_CONFIG:
|
||||
FEATURE_CONFIG[feature] = { 'lib_deps': [] }
|
||||
@@ -81,7 +81,8 @@ if pioutil.is_pio_build():
|
||||
|
||||
# Add options matching custom_marlin.MY_OPTION to the pile
|
||||
blab("========== Gather custom_marlin entries...")
|
||||
for n in env.GetProjectOptions():
|
||||
all_opts = env.GetProjectOptions()
|
||||
for n in all_opts:
|
||||
key = n[0]
|
||||
mat = re.match(r'custom_marlin\.(.+)', key)
|
||||
if mat:
|
||||
@@ -90,7 +91,7 @@ if pioutil.is_pio_build():
|
||||
except:
|
||||
val = None
|
||||
if val:
|
||||
opt = mat[1].upper()
|
||||
opt = mat.group(1).upper()
|
||||
blab("%s.custom_marlin.%s = '%s'" % ( env['PIOENV'], opt, val ))
|
||||
add_to_feat_cnf(opt, val)
|
||||
|
||||
@@ -126,10 +127,10 @@ if pioutil.is_pio_build():
|
||||
set_env_field('lib_ignore', lib_ignore)
|
||||
|
||||
def apply_features_config():
|
||||
load_features()
|
||||
load_config()
|
||||
blab("========== Apply enabled features...")
|
||||
for feature in FEATURE_CONFIG:
|
||||
if not env.MarlinHas(feature):
|
||||
if not env.MarlinFeatureIsEnabled(feature):
|
||||
continue
|
||||
|
||||
feat = FEATURE_CONFIG[feature]
|
||||
@@ -211,7 +212,7 @@ if pioutil.is_pio_build():
|
||||
#
|
||||
# Return True if a matching feature is enabled
|
||||
#
|
||||
def MarlinHas(env, feature):
|
||||
def MarlinFeatureIsEnabled(env, feature):
|
||||
load_marlin_features()
|
||||
r = re.compile('^' + feature + '$')
|
||||
found = list(filter(r.match, env['MARLIN_FEATURES']))
|
||||
@@ -224,7 +225,7 @@ if pioutil.is_pio_build():
|
||||
if val in [ '', '1', 'true' ]:
|
||||
some_on = True
|
||||
elif val in env['MARLIN_FEATURES']:
|
||||
some_on = env.MarlinHas(val)
|
||||
some_on = env.MarlinFeatureIsEnabled(val)
|
||||
|
||||
return some_on
|
||||
|
||||
@@ -238,7 +239,7 @@ if pioutil.is_pio_build():
|
||||
#
|
||||
# Add a method for other PIO scripts to query enabled features
|
||||
#
|
||||
env.AddMethod(MarlinHas)
|
||||
env.AddMethod(MarlinFeatureIsEnabled)
|
||||
|
||||
#
|
||||
# Add dependencies for enabled Marlin features
|
||||
|
||||
@@ -2,18 +2,21 @@
|
||||
# marlin.py
|
||||
# Helper module with some commonly-used functions
|
||||
#
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
import os,shutil
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
env = DefaultEnvironment()
|
||||
|
||||
from os.path import join
|
||||
|
||||
def copytree(src, dst, symlinks=False, ignore=None):
|
||||
for item in src.iterdir():
|
||||
if item.is_dir():
|
||||
shutil.copytree(item, dst / item.name, symlinks, ignore)
|
||||
for item in os.listdir(src):
|
||||
s = join(src, item)
|
||||
d = join(dst, item)
|
||||
if os.path.isdir(s):
|
||||
shutil.copytree(s, d, symlinks, ignore)
|
||||
else:
|
||||
shutil.copy2(item, dst / item.name)
|
||||
shutil.copy2(s, d)
|
||||
|
||||
def replace_define(field, value):
|
||||
envdefs = env['CPPDEFINES'].copy()
|
||||
@@ -32,15 +35,15 @@ def relocate_vtab(address):
|
||||
|
||||
# Replace the existing -Wl,-T with the given ldscript path
|
||||
def custom_ld_script(ldname):
|
||||
apath = str(Path("buildroot/share/PlatformIO/ldscripts", ldname).resolve())
|
||||
apath = os.path.abspath("buildroot/share/PlatformIO/ldscripts/" + ldname)
|
||||
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||
if "-Wl,-T" in flag:
|
||||
env["LINKFLAGS"][i] = "-Wl,-T" + apath
|
||||
elif flag == "-T":
|
||||
env["LINKFLAGS"][i + 1] = apath
|
||||
|
||||
# Encrypt ${PROGNAME}.bin and save it with a new name. This applies (mostly) to MKS boards
|
||||
# This PostAction is set up by offset_and_rename.py for envs with 'build.encrypt_mks'.
|
||||
# Encrypt ${PROGNAME}.bin and save it with a new name
|
||||
# Called by specific encrypt() functions, mostly for MKS boards
|
||||
def encrypt_mks(source, target, env, new_name):
|
||||
import sys
|
||||
|
||||
@@ -50,15 +53,15 @@ def encrypt_mks(source, target, env, new_name):
|
||||
mf = env["MARLIN_FEATURES"]
|
||||
if "FIRMWARE_BIN" in mf: new_name = mf["FIRMWARE_BIN"]
|
||||
|
||||
fwpath = Path(target[0].path)
|
||||
fwfile = fwpath.open("rb")
|
||||
enfile = Path(target[0].dir.path, new_name).open("wb")
|
||||
length = fwpath.stat().st_size
|
||||
fwpath = target[0].path
|
||||
fwfile = open(fwpath, "rb")
|
||||
enfile = open(target[0].dir.path + "/" + new_name, "wb")
|
||||
length = os.path.getsize(fwpath)
|
||||
position = 0
|
||||
try:
|
||||
while position < length:
|
||||
byte = fwfile.read(1)
|
||||
if 320 <= position < 31040:
|
||||
if position >= 320 and position < 31040:
|
||||
byte = chr(ord(byte) ^ key[position & 31])
|
||||
if sys.version_info[0] > 2:
|
||||
byte = bytes(byte, 'latin1')
|
||||
@@ -67,7 +70,7 @@ def encrypt_mks(source, target, env, new_name):
|
||||
finally:
|
||||
fwfile.close()
|
||||
enfile.close()
|
||||
fwpath.unlink()
|
||||
os.remove(fwpath)
|
||||
|
||||
def add_post_action(action):
|
||||
env.AddPostAction(str(Path("$BUILD_DIR", "${PROGNAME}.bin")), action);
|
||||
env.AddPostAction(join("$BUILD_DIR", "${PROGNAME}.bin"), action);
|
||||
|
||||
@@ -14,7 +14,6 @@ YHCB2004 = red-scorp/LiquidCrystal_AIP31068@^1.0.4
|
||||
HAS_TFT_LVGL_UI = lvgl=https://github.com/makerbase-mks/LVGL-6.1.1-MKS/archive/master.zip
|
||||
build_src_filter=+<src/lcd/extui/mks_ui>
|
||||
extra_scripts=download_mks_assets.py
|
||||
MARLIN_TEST_BUILD = build_src_filter=+<src/tests>
|
||||
POSTMORTEM_DEBUGGING = build_src_filter=+<src/HAL/shared/cpu_exception> +<src/HAL/shared/backtrace>
|
||||
build_flags=-funwind-tables
|
||||
MKS_WIFI_MODULE = QRCode=https://github.com/makerbase-mks/QRCode/archive/master.zip
|
||||
@@ -27,6 +26,8 @@ HAS_MOTOR_CURRENT_I2C = SlowSoftI2CMaster
|
||||
build_src_filter=+<src/feature/digipot>
|
||||
HAS_TMC26X = TMC26XStepper=https://github.com/MarlinFirmware/TMC26XStepper/archive/master.zip
|
||||
build_src_filter=+<src/module/stepper/TMC26X.cpp>
|
||||
HAS_L64XX = Arduino-L6470@0.8.0
|
||||
build_src_filter=+<src/libs/L64XX> +<src/module/stepper/L64xx.cpp> +<src/gcode/feature/L6470> +<src/HAL/shared/HAL_spi_L6470.cpp>
|
||||
LIB_INTERNAL_MAX31865 = build_src_filter=+<src/libs/MAX31865.cpp>
|
||||
NEOPIXEL_LED = adafruit/Adafruit NeoPixel@~1.8.0
|
||||
build_src_filter=+<src/feature/leds/neopixel.cpp>
|
||||
@@ -37,7 +38,7 @@ USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4
|
||||
USES_LIQUIDTWI2 = LiquidTWI2@1.2.7
|
||||
HAS_LCDPRINT = build_src_filter=+<src/lcd/lcdprint.cpp>
|
||||
HAS_MARLINUI_HD44780 = build_src_filter=+<src/lcd/HD44780>
|
||||
HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@~0.5.2
|
||||
HAS_MARLINUI_U8GLIB = U8glib-HAL@~0.5.2
|
||||
build_src_filter=+<src/lcd/dogm>
|
||||
HAS_(FSMC|SPI|LTDC)_TFT = build_src_filter=+<src/HAL/STM32/tft> +<src/HAL/STM32F1/tft> +<src/lcd/tft_io>
|
||||
HAS_FSMC_TFT = build_src_filter=+<src/HAL/STM32/tft/tft_fsmc.cpp> +<src/HAL/STM32F1/tft/tft_fsmc.cpp>
|
||||
@@ -99,8 +100,6 @@ HAS_MCP3426_ADC = build_src_filter=+<src/feature/adc> +<s
|
||||
AUTO_BED_LEVELING_BILINEAR = build_src_filter=+<src/feature/bedlevel/abl>
|
||||
AUTO_BED_LEVELING_(3POINT|(BI)?LINEAR) = build_src_filter=+<src/gcode/bedlevel/abl>
|
||||
X_AXIS_TWIST_COMPENSATION = build_src_filter=+<src/feature/x_twist.cpp> +<src/lcd/menu/menu_x_twist.cpp> +<src/gcode/probe/M423.cpp>
|
||||
BD_SENSOR = markyue/Panda_SoftMasterI2C
|
||||
build_src_filter=+<src/feature/bedlevel/bdl> +<src/gcode/probe/M102.cpp>
|
||||
MESH_BED_LEVELING = build_src_filter=+<src/feature/bedlevel/mbl> +<src/gcode/bedlevel/mbl>
|
||||
AUTO_BED_LEVELING_UBL = build_src_filter=+<src/feature/bedlevel/ubl> +<src/gcode/bedlevel/ubl>
|
||||
UBL_HILBERT_CURVE = build_src_filter=+<src/feature/bedlevel/hilbert_curve.cpp>
|
||||
@@ -119,7 +118,7 @@ EMERGENCY_PARSER = build_src_filter=+<src/feature/e_parser
|
||||
EASYTHREED_UI = build_src_filter=+<src/feature/easythreed_ui.cpp>
|
||||
I2C_POSITION_ENCODERS = build_src_filter=+<src/feature/encoder_i2c.cpp>
|
||||
IIC_BL24CXX_EEPROM = build_src_filter=+<src/libs/BL24CXX.cpp>
|
||||
SPI_FLASH = build_src_filter=+<src/libs/W25Qxx.cpp>
|
||||
HAS_SPI_FLASH = build_src_filter=+<src/libs/W25Qxx.cpp>
|
||||
HAS_ETHERNET = build_src_filter=+<src/feature/ethernet.cpp> +<src/gcode/feature/network/M552-M554.cpp>
|
||||
HAS_FANCHECK = build_src_filter=+<src/feature/fancheck.cpp> +<src/gcode/temp/M123.cpp>
|
||||
HAS_FANMUX = build_src_filter=+<src/feature/fanmux.cpp>
|
||||
@@ -187,7 +186,6 @@ HAS_DUPLICATION_MODE = build_src_filter=+<src/gcode/control/M6
|
||||
LIN_ADVANCE = build_src_filter=+<src/gcode/feature/advance>
|
||||
PHOTO_GCODE = build_src_filter=+<src/gcode/feature/camera>
|
||||
CONTROLLER_FAN_EDITABLE = build_src_filter=+<src/gcode/feature/controllerfan>
|
||||
HAS_SHAPING = build_src_filter=+<src/gcode/feature/input_shaping>
|
||||
GCODE_MACROS = build_src_filter=+<src/gcode/feature/macro>
|
||||
GRADIENT_MIX = build_src_filter=+<src/gcode/feature/mixing/M166.cpp>
|
||||
HAS_SAVED_POSITIONS = build_src_filter=+<src/gcode/feature/pause/G60.cpp> +<src/gcode/feature/pause/G61.cpp>
|
||||
@@ -202,13 +200,12 @@ AUTO_REPORT_POSITION = build_src_filter=+<src/gcode/host/M154.
|
||||
REPETIER_GCODE_M360 = build_src_filter=+<src/gcode/host/M360.cpp>
|
||||
HAS_GCODE_M876 = build_src_filter=+<src/gcode/host/M876.cpp>
|
||||
HAS_RESUME_CONTINUE = build_src_filter=+<src/gcode/lcd/M0_M1.cpp>
|
||||
SET_PROGRESS_MANUALLY = build_src_filter=+<src/gcode/lcd/M73.cpp>
|
||||
LCD_SET_PROGRESS_MANUALLY = build_src_filter=+<src/gcode/lcd/M73.cpp>
|
||||
HAS_STATUS_MESSAGE = build_src_filter=+<src/gcode/lcd/M117.cpp>
|
||||
HAS_PREHEAT = build_src_filter=+<src/gcode/lcd/M145.cpp>
|
||||
HAS_LCD_CONTRAST = build_src_filter=+<src/gcode/lcd/M250.cpp>
|
||||
HAS_GCODE_M255 = build_src_filter=+<src/gcode/lcd/M255.cpp>
|
||||
HAS_LCD_BRIGHTNESS = build_src_filter=+<src/gcode/lcd/M256.cpp>
|
||||
HAS_SOUND = build_src_filter=+<src/gcode/lcd/M300.cpp>
|
||||
HAS_BUZZER = build_src_filter=+<src/gcode/lcd/M300.cpp>
|
||||
TOUCH_SCREEN_CALIBRATION = build_src_filter=+<src/gcode/lcd/M995.cpp>
|
||||
ARC_SUPPORT = build_src_filter=+<src/gcode/motion/G2_G3.cpp>
|
||||
GCODE_MOTION_MODES = build_src_filter=+<src/gcode/motion/G80.cpp>
|
||||
@@ -242,6 +239,5 @@ HAS_MICROSTEPS = build_src_filter=+<src/gcode/control/M3
|
||||
(ESP3D_)?WIFISUPPORT = AsyncTCP, ESP Async WebServer
|
||||
ESP3DLib=https://github.com/luc-github/ESP3DLib/archive/master.zip
|
||||
arduinoWebSockets=links2004/WebSockets@2.3.4
|
||||
luc-github/ESP32SSDP@1.1.1
|
||||
luc-github/ESP32SSDP@^1.1.1
|
||||
lib_ignore=ESPAsyncTCP
|
||||
build_flags=-DSRCHOME=${platformio.src_dir}/src -DHALHOME=SRCHOME
|
||||
|
||||
@@ -13,17 +13,15 @@
|
||||
[platformio]
|
||||
src_dir = Marlin
|
||||
boards_dir = buildroot/share/PlatformIO/boards
|
||||
default_envs = STM32G0B1RE_btt
|
||||
default_envs = mega2560
|
||||
include_dir = Marlin
|
||||
extra_configs =
|
||||
Marlin/config.ini
|
||||
ini/avr.ini
|
||||
ini/due.ini
|
||||
ini/esp32.ini
|
||||
ini/features.ini
|
||||
ini/lpc176x.ini
|
||||
ini/native.ini
|
||||
ini/samd21.ini
|
||||
ini/samd51.ini
|
||||
ini/stm32-common.ini
|
||||
ini/stm32f0.ini
|
||||
@@ -46,13 +44,12 @@ extra_configs =
|
||||
build_flags = -g3 -D__MARLIN_FIRMWARE__ -DNDEBUG
|
||||
-fmax-errors=5
|
||||
extra_scripts =
|
||||
pre:buildroot/share/PlatformIO/scripts/configuration.py
|
||||
pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
|
||||
pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py
|
||||
pre:buildroot/share/PlatformIO/scripts/preflight-checks.py
|
||||
post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py
|
||||
lib_deps =
|
||||
default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/tests>
|
||||
default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
|
||||
-<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
|
||||
-<src/HAL/STM32/tft> -<src/HAL/STM32F1/tft>
|
||||
-<src/lcd/e3v2/common> -<src/lcd/e3v2/creality> -<src/lcd/e3v2/proui> -<src/lcd/e3v2/jyersui> -<src/lcd/e3v2/marlinui>
|
||||
@@ -104,7 +101,6 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/t
|
||||
-<src/feature/backlash.cpp>
|
||||
-<src/feature/baricuda.cpp> -<src/gcode/feature/baricuda>
|
||||
-<src/feature/bedlevel/abl> -<src/gcode/bedlevel/abl>
|
||||
-<src/feature/bedlevel/bdl> -<src/gcode/probe/M102.cpp>
|
||||
-<src/feature/bedlevel/mbl> -<src/gcode/bedlevel/mbl>
|
||||
-<src/feature/bedlevel/ubl> -<src/gcode/bedlevel/ubl>
|
||||
-<src/feature/bedlevel/hilbert_curve.cpp>
|
||||
@@ -193,7 +189,6 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/t
|
||||
-<src/gcode/feature/advance>
|
||||
-<src/gcode/feature/camera>
|
||||
-<src/gcode/feature/i2c>
|
||||
-<src/gcode/feature/input_shaping>
|
||||
-<src/gcode/feature/L6470>
|
||||
-<src/gcode/feature/leds/M150.cpp>
|
||||
-<src/gcode/feature/leds/M7219.cpp>
|
||||
@@ -223,7 +218,6 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/t
|
||||
-<src/gcode/lcd/M0_M1.cpp>
|
||||
-<src/gcode/lcd/M73.cpp>
|
||||
-<src/gcode/lcd/M117.cpp>
|
||||
-<src/gcode/lcd/M145.cpp>
|
||||
-<src/gcode/lcd/M250.cpp> -<src/gcode/lcd/M255.cpp> -<src/gcode/lcd/M256.cpp>
|
||||
-<src/gcode/lcd/M300.cpp>
|
||||
-<src/gcode/lcd/M414.cpp>
|
||||
@@ -251,6 +245,7 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/t
|
||||
-<src/gcode/units/M82_M83.cpp>
|
||||
-<src/gcode/units/M149.cpp>
|
||||
-<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>
|
||||
-<src/libs/L64XX> -<src/module/stepper/L64xx.cpp> -<src/HAL/shared/HAL_spi_L6470.cpp>
|
||||
-<src/libs/MAX31865.cpp>
|
||||
-<src/libs/hex_print.cpp>
|
||||
-<src/libs/least_squares_fit.cpp>
|
||||
|
||||
Reference in New Issue
Block a user