🔨 Fix IntelliSense / PIO conflicts (#23058)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
parent
f97635de36
commit
fc2020c6ec
|
@ -4,7 +4,8 @@
|
|||
# Windows: bossac.exe
|
||||
# Other: leave unchanged
|
||||
#
|
||||
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import platform
|
||||
current_OS = platform.system()
|
||||
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
#
|
||||
# sets output_port
|
||||
# upload_extra_script.py
|
||||
# set the output_port
|
||||
# if target_filename is found then that drive is used
|
||||
# else if target_drive is found then that drive is used
|
||||
#
|
||||
from __future__ import print_function
|
||||
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
|
||||
target_filename = "FIRMWARE.CUR"
|
||||
target_drive = "REARM"
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ if __name__ == "__main__":
|
|||
|
||||
# extra script for linker options
|
||||
else:
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
from SCons.Script import DefaultEnvironment
|
||||
env = DefaultEnvironment()
|
||||
env.Append(
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# SAMD51_grandcentral_m4.py
|
||||
# Customizations for env:SAMD51_grandcentral_m4
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
from os.path import join, isfile
|
||||
import shutil
|
||||
from pprint import pprint
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py
|
||||
# STM32F103RC_MEEB_3DP.py
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
|
||||
try:
|
||||
import configparser
|
||||
except ImportError:
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py
|
||||
# STM32F103RC_fysetc.py
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os
|
||||
from os.path import join
|
||||
from os.path import expandvars
|
||||
Import("env")
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#
|
||||
# STM32F1_create_variant.py
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,shutil,marlin
|
||||
from SCons.Script import DefaultEnvironment
|
||||
from platformio import util
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
# add_nanolib.py
|
||||
#
|
||||
Import("env")
|
||||
|
||||
env.Append(LINKFLAGS=["--specs=nano.specs"])
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/chitu_crypt.py
|
||||
# chitu_crypt.py
|
||||
# Customizations for Chitu boards
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,random,struct,uuid,marlin
|
||||
|
||||
# Relocate firmware from 0x08000000 to 0x08008800
|
||||
marlin.relocate_firmware("0x08008800")
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# common-cxxflags.py
|
||||
# Convenience script to apply customizations to CPP flags
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
Import("env")
|
||||
|
||||
cxxflags = [
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#
|
||||
# common-dependencies-post.py
|
||||
# post:common-dependencies-post.py
|
||||
# Convenience script to add build flags for Marlin Enabled Features
|
||||
#
|
||||
|
||||
Import("env")
|
||||
Import("projenv")
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
Import("env", "projenv")
|
||||
|
||||
def apply_board_build_flags():
|
||||
if not 'BOARD_CUSTOM_BUILD_FLAGS' in env['MARLIN_FEATURES']:
|
||||
|
|
|
@ -2,13 +2,19 @@
|
|||
# common-dependencies.py
|
||||
# Convenience script to check dependencies and add libs and sources for Marlin Enabled Features
|
||||
#
|
||||
import subprocess,os,re,pioutil
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
|
||||
import subprocess,os,re
|
||||
Import("env")
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
if pioutil.is_vscode_init():
|
||||
env.Exit(0)
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.project.config import ProjectConfig
|
||||
|
||||
verbose = 0
|
||||
FEATURE_CONFIG = {}
|
||||
|
||||
def validate_pio():
|
||||
PIO_VERSION_MIN = (5, 0, 3)
|
||||
try:
|
||||
from platformio import VERSION as PIO_VERSION
|
||||
|
@ -33,22 +39,10 @@ except SystemExit:
|
|||
except:
|
||||
print("Can't detect PlatformIO Version")
|
||||
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.project.config import ProjectConfig
|
||||
|
||||
#print(env.Dump())
|
||||
|
||||
try:
|
||||
verbose = int(env.GetProjectOption('custom_verbose'))
|
||||
except:
|
||||
verbose = 0
|
||||
|
||||
def blab(str,level=1):
|
||||
if verbose >= level:
|
||||
print("[deps] %s" % str)
|
||||
|
||||
FEATURE_CONFIG = {}
|
||||
|
||||
def add_to_feat_cnf(feature, flines):
|
||||
|
||||
try:
|
||||
|
@ -309,13 +303,16 @@ def MarlinFeatureIsEnabled(env, feature):
|
|||
|
||||
return some_on
|
||||
|
||||
#
|
||||
validate_pio()
|
||||
|
||||
try:
|
||||
verbose = int(env.GetProjectOption('custom_verbose'))
|
||||
except:
|
||||
pass
|
||||
|
||||
# Add a method for other PIO scripts to query enabled features
|
||||
#
|
||||
env.AddMethod(MarlinFeatureIsEnabled)
|
||||
|
||||
#
|
||||
# Add dependencies for enabled Marlin features
|
||||
#
|
||||
apply_features_config()
|
||||
force_ignore_unused_libs()
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/custom_board.py
|
||||
# custom_board.py
|
||||
#
|
||||
# - For build.address replace VECT_TAB_ADDR to relocate the firmware
|
||||
# - For build.ldscript use one of the linker scripts in buildroot/share/PlatformIO/ldscripts
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import marlin
|
||||
board = marlin.env.BoardConfig()
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/download_mks_assets.py
|
||||
# download_mks_assets.py
|
||||
# Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
Import("env")
|
||||
import os,requests,zipfile,tempfile,shutil,pioutil
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
if pioutil.is_vscode_init():
|
||||
env.Exit(0)
|
||||
import os,requests,zipfile,tempfile,shutil
|
||||
|
||||
url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip"
|
||||
deps_path = env.Dictionary("PROJECT_LIBDEPS_DIR")
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#
|
||||
# fix_framework_weakness.py
|
||||
#
|
||||
from os.path import join, isfile
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
|
||||
import shutil
|
||||
from os.path import join, isfile
|
||||
from pprint import pprint
|
||||
|
||||
Import("env")
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# the appropriate framework variants folder, so that its contents
|
||||
# will be picked up by PlatformIO just like any other variant.
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,shutil,marlin
|
||||
from SCons.Script import DefaultEnvironment
|
||||
from platformio import util
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py
|
||||
# jgaurora_a5s_a1_with_bootloader.py
|
||||
# Customizations for env:jgaurora_a5s_a1
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,marlin
|
||||
|
||||
# Append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
|
||||
def addboot(source, target, env):
|
||||
firmware = open(target[0].path, "rb")
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/lerdge.py
|
||||
# lerdge.py
|
||||
# Customizations for Lerdge build environments:
|
||||
# env:LERDGEX env:LERDGEX_usb_flash_drive
|
||||
# env:LERDGES env:LERDGES_usb_flash_drive
|
||||
# env:LERDGEK env:LERDGEK_usb_flash_drive
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,marlin
|
||||
Import("env")
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/marlin.py
|
||||
# marlin.py
|
||||
# Helper module with some commonly-used functions
|
||||
#
|
||||
import os,shutil
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin.py
|
||||
# mks_robin.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08007000", "mks_robin.ld", "Robin.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_e3.py
|
||||
# mks_robin_e3.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_e3p.py
|
||||
# mks_robin_e3p.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_lite.py
|
||||
# mks_robin_lite.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_lite3.py
|
||||
# mks_robin_lite3.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite3.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_mini.py
|
||||
# mks_robin_mini.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08007000", "mks_robin_mini.ld", "Robin_mini.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_nano.py
|
||||
# mks_robin_nano.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
|
||||
# mks_robin_nano35.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_robin_pro.py
|
||||
# mks_robin_pro.py
|
||||
#
|
||||
import robin
|
||||
robin.prepare("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin")
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#
|
||||
# - For 'board_build.rename' add a post-action to rename the firmware file.
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,sys,marlin
|
||||
Import("env")
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#
|
||||
# Convert the ELF to an SREC file suitable for some bootloaders
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,sys
|
||||
from os.path import join
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/pioutil.py
|
||||
# pioutil.py
|
||||
#
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
def is_vscode_init():
|
||||
# Make sure 'vscode init' is not the current command
|
||||
def is_pio_build():
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
return "idedata" in COMMAND_LINE_TARGETS or "_idedata" in COMMAND_LINE_TARGETS
|
||||
return "idedata" not in COMMAND_LINE_TARGETS and "_idedata" not in COMMAND_LINE_TARGETS
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
# preflight-checks.py
|
||||
# Check for common issues prior to compiling
|
||||
#
|
||||
import os,re,sys,pioutil
|
||||
Import("env")
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
if pioutil.is_vscode_init():
|
||||
env.Exit(0)
|
||||
import os,re,sys
|
||||
Import("env")
|
||||
|
||||
def get_envs_for_board(board):
|
||||
with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file:
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# random-bin.py
|
||||
# Set a unique firmware name based on current date and time
|
||||
#
|
||||
Import("env")
|
||||
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
from datetime import datetime
|
||||
|
||||
Import("env")
|
||||
env['PROGNAME'] = datetime.now().strftime("firmware-%Y%m%d-%H%M%S")
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#
|
||||
# buildroot/share/PlatformIO/scripts/robin.py
|
||||
# robin.py
|
||||
#
|
||||
import marlin
|
||||
|
||||
# Apply customizations for a MKS Robin
|
||||
def prepare(address, ldname, fwname):
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import marlin
|
||||
def encrypt(source, target, env):
|
||||
marlin.encrypt_mks(source, target, env, fwname)
|
||||
marlin.relocate_firmware(address)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#
|
||||
# simulator.py
|
||||
# PlatformIO pre: script for simulator builds
|
||||
#
|
||||
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
# Get the environment thus far for the build
|
||||
Import("env")
|
||||
|
||||
|
|
|
@ -1,26 +1,10 @@
|
|||
#
|
||||
# stm32_serialbuffer.py
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
Import("env")
|
||||
|
||||
# Marlin uses the `RX_BUFFER_SIZE` \ `TX_BUFFER_SIZE` options to
|
||||
# configure buffer sizes for receiving \ transmitting serial data.
|
||||
# Stm32duino uses another set of defines for the same purpose, so this
|
||||
# script gets the values from the configuration and uses them to define
|
||||
# `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE` as global build
|
||||
# flags so they are available for use by the platform.
|
||||
#
|
||||
# The script will set the value as the default one (64 bytes)
|
||||
# or the user-configured one, whichever is higher.
|
||||
#
|
||||
# Marlin's default buffer sizes are 128 for RX and 32 for TX.
|
||||
# The highest value is taken (128/64).
|
||||
#
|
||||
# If MF_*_BUFFER_SIZE, SERIAL_*_BUFFER_SIZE, USART_*_BUF_SIZE, are
|
||||
# defined, the first of these values will be used as the minimum.
|
||||
build_flags = env.ParseFlags(env.get('BUILD_FLAGS'))["CPPDEFINES"]
|
||||
mf = env["MARLIN_FEATURES"]
|
||||
|
||||
# Get a build flag's value or None
|
||||
def getBuildFlagValue(name):
|
||||
for flag in build_flags:
|
||||
|
@ -48,6 +32,24 @@ def tryAddFlag(name, value):
|
|||
if getBuildFlagValue(name) is None:
|
||||
env.Append(BUILD_FLAGS=[f"-D{name}={value}"])
|
||||
|
||||
# Marlin uses the `RX_BUFFER_SIZE` \ `TX_BUFFER_SIZE` options to
|
||||
# configure buffer sizes for receiving \ transmitting serial data.
|
||||
# Stm32duino uses another set of defines for the same purpose, so this
|
||||
# script gets the values from the configuration and uses them to define
|
||||
# `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE` as global build
|
||||
# flags so they are available for use by the platform.
|
||||
#
|
||||
# The script will set the value as the default one (64 bytes)
|
||||
# or the user-configured one, whichever is higher.
|
||||
#
|
||||
# Marlin's default buffer sizes are 128 for RX and 32 for TX.
|
||||
# The highest value is taken (128/64).
|
||||
#
|
||||
# If MF_*_BUFFER_SIZE, SERIAL_*_BUFFER_SIZE, USART_*_BUF_SIZE, are
|
||||
# defined, the first of these values will be used as the minimum.
|
||||
build_flags = env.ParseFlags(env.get('BUILD_FLAGS'))["CPPDEFINES"]
|
||||
mf = env["MARLIN_FEATURES"]
|
||||
|
||||
# Get the largest defined buffer sizes for RX or TX, using defaults for undefined
|
||||
rxBuf = getBufferSize("RX", 128)
|
||||
txBuf = getBufferSize("TX", 64)
|
||||
|
|
|
@ -326,7 +326,6 @@ platform = ${common_stm32f1.platform}
|
|||
extends = common_stm32f1
|
||||
board = marlin_CHITU_F103
|
||||
extra_scripts = ${common_stm32f1.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
|
||||
pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/chitu_crypt.py
|
||||
build_flags = ${common_stm32f1.build_flags}
|
||||
|
|
Loading…
Reference in a new issue