Browse Source
* Consolidate variant scripts * Rename Marlin-local boards * Simplify variants where possible * Rename variants * CHITU_F103 and MEEB_3DP: Maple platform `platformio-build-stm32f1.py` uses the 'board' name, not 'board_build.variant' so folder names match 'board' and not `board_build.variant`.vanilla_fb_2.0.x
Scott Lahteine
4 years ago
committed by
GitHub
167 changed files with 337 additions and 837 deletions
@ -1,65 +0,0 @@ |
|||
{ |
|||
"build": { |
|||
"core": "stm32", |
|||
"cpu": "cortex-m4", |
|||
"extra_flags": "-DSTM32F407xx", |
|||
"f_cpu": "168000000L", |
|||
"hwids": [ |
|||
[ |
|||
"0x1EAF", |
|||
"0x0003" |
|||
], |
|||
[ |
|||
"0x0483", |
|||
"0x3748" |
|||
] |
|||
], |
|||
"mcu": "stm32f407zgt6", |
|||
"variant": "LERDGE", |
|||
"ldscript": "LERDGE.ld" |
|||
}, |
|||
"debug": { |
|||
"jlink_device": "STM32F407ZG", |
|||
"openocd_target": "stm32f4x", |
|||
"svd_path": "STM32F40x.svd", |
|||
"tools": { |
|||
"stlink": { |
|||
"server": { |
|||
"arguments": [ |
|||
"-f", |
|||
"scripts/interface/stlink.cfg", |
|||
"-c", |
|||
"transport select hla_swd", |
|||
"-f", |
|||
"scripts/target/stm32f4x.cfg", |
|||
"-c", |
|||
"reset_config none" |
|||
], |
|||
"executable": "bin/openocd", |
|||
"package": "tool-openocd" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"frameworks": [ |
|||
"arduino", |
|||
"stm32cube" |
|||
], |
|||
"name": "STM32F407ZGT6(192k RAM. 1024k Flash)", |
|||
"upload": { |
|||
"disable_flushing": false, |
|||
"maximum_ram_size": 196608, |
|||
"maximum_size": 1048576, |
|||
"protocol": "stlink", |
|||
"protocols": [ |
|||
"stlink", |
|||
"dfu", |
|||
"jlink" |
|||
], |
|||
"require_upload_port": true, |
|||
"use_1200bps_touch": false, |
|||
"wait_for_upload_port": false |
|||
}, |
|||
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ZG.html", |
|||
"vendor": "Generic" |
|||
} |
@ -1,34 +0,0 @@ |
|||
{ |
|||
"build": { |
|||
"core": "arduino", |
|||
"extra_flags": "-DARDUINO_AVR_MEGA2560", |
|||
"f_cpu": "16000000L", |
|||
"hwids": [ |
|||
[ |
|||
"0x27b2", |
|||
"0x0002" |
|||
] |
|||
], |
|||
"mcu": "atmega2560", |
|||
"variant": "fysetcf6" |
|||
}, |
|||
"debug": { |
|||
"simavr_target": "atmega2560", |
|||
"avr-stub": { |
|||
"speed": 115200 |
|||
} |
|||
}, |
|||
"frameworks": [ |
|||
"arduino" |
|||
], |
|||
"name": "FYSETC F6", |
|||
"upload": { |
|||
"maximum_ram_size": 8192, |
|||
"maximum_size": 258048, |
|||
"protocol": "wiring", |
|||
"require_upload_port": true, |
|||
"speed": 115200 |
|||
}, |
|||
"url": "https://www.fysetc.com/", |
|||
"vendor": "FYSETC" |
|||
} |
@ -1,23 +0,0 @@ |
|||
# |
|||
# STM32F103RC_SKR_MINI.py |
|||
# |
|||
import os |
|||
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")) |
|||
|
|||
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"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
@ -1,20 +0,0 @@ |
|||
# |
|||
# STM32F103RET6_creality.py |
|||
# |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/creality.ld") |
|||
|
|||
for i, flag in enumerate(env['LINKFLAGS']): |
|||
if "-Wl,-T" in flag: |
|||
env['LINKFLAGS'][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env['LINKFLAGS'][i + 1] = custom_ld_script |
@ -1,19 +0,0 @@ |
|||
# |
|||
# STM32F103RE_SKR_E3_DIP.py |
|||
# |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RE_SKR_E3_DIP.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
@ -1,36 +1,22 @@ |
|||
# |
|||
# STM32F103VE_longer.py |
|||
# buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py |
|||
# Customizations for env:STM32F103VE_longer |
|||
# |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103VE_longer.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
import os,marlin |
|||
|
|||
# Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D) |
|||
def encrypt(source, target, env): |
|||
firmware = open(target[0].path, "rb") |
|||
marlin_alfa = open(target[0].dir.path +'/project.bin', "wb") |
|||
renamed = open(target[0].dir.path + '/project.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
marlin_alfa.write(byte) |
|||
renamed.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
marlin_alfa.close() |
|||
renamed.close() |
|||
|
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
marlin.add_post_action(encrypt); |
|||
|
@ -1,13 +0,0 @@ |
|||
# |
|||
# STM32F401VE_STEVAL.py |
|||
# Customizations for env:STM32F401VE_STEVAL |
|||
# |
|||
import os |
|||
Import("env") |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/variants/STEVAL_F401VE/ldscript.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
@ -1,49 +0,0 @@ |
|||
# |
|||
# copy_marlin_variant_to_framework.py |
|||
# |
|||
import os,shutil |
|||
from SCons.Script import DefaultEnvironment |
|||
from platformio import util |
|||
from platformio.package.meta import PackageSpec |
|||
|
|||
def copytree(src, dst, symlinks=False, ignore=None): |
|||
for item in os.listdir(src): |
|||
s = os.path.join(src, item) |
|||
d = os.path.join(dst, item) |
|||
if os.path.isdir(s): |
|||
shutil.copytree(s, d, symlinks, ignore) |
|||
else: |
|||
shutil.copy2(s, d) |
|||
|
|||
env = DefaultEnvironment() |
|||
platform = env.PioPlatform() |
|||
board = env.BoardConfig() |
|||
variant = board.get("build.variant") |
|||
|
|||
platform_packages = env.GetProjectOption('platform_packages') |
|||
# if there's no framework defined, take it from the class name of platform |
|||
framewords = { |
|||
"Ststm32Platform": "framework-arduinoststm32", |
|||
"AtmelavrPlatform": "framework-arduino-avr" |
|||
} |
|||
if len(platform_packages) == 0: |
|||
platform_name = framewords[platform.__class__.__name__] |
|||
else: |
|||
platform_name = PackageSpec(platform_packages[0]).name |
|||
|
|||
FRAMEWORK_DIR = platform.get_package_dir(platform_name) |
|||
assert os.path.isdir(FRAMEWORK_DIR) |
|||
assert os.path.isdir("buildroot/share/PlatformIO/variants") |
|||
|
|||
variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) |
|||
|
|||
source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) |
|||
assert os.path.isdir(source_dir) |
|||
|
|||
if os.path.isdir(variant_dir): |
|||
shutil.rmtree(variant_dir) |
|||
|
|||
if not os.path.isdir(variant_dir): |
|||
os.mkdir(variant_dir) |
|||
|
|||
copytree(source_dir, variant_dir) |
@ -0,0 +1,13 @@ |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/custom_board.py |
|||
# |
|||
import marlin |
|||
board = marlin.env.BoardConfig() |
|||
|
|||
address = board.get("build.address", "") |
|||
if address: |
|||
marlin.relocate_firmware(address) |
|||
|
|||
ldscript = board.get("build.ldscript", "") |
|||
if ldscript: |
|||
marlin.custom_ld_script(ldscript) |
@ -1,20 +0,0 @@ |
|||
# |
|||
# fly_mini.py |
|||
# Customizations for env:FLY_MINI |
|||
# |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/fly_mini.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
@ -1,13 +0,0 @@ |
|||
# |
|||
# STM32F401VE_STEVAL.py |
|||
# Customizations for env:STM32F401VE_STEVAL |
|||
# |
|||
import os |
|||
Import("env") |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/variants/FYSETC_CHEETAH_V20/ldscript.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
@ -1,30 +1,54 @@ |
|||
# |
|||
# Generate a generic variant |
|||
# generic_create_variant.py |
|||
# |
|||
import os,shutil |
|||
# Copy one of the variants from buildroot/platformio/variants into |
|||
# the appropriate framework variants folder, so that its contents |
|||
# will be picked up by PlatformIO just like any other variant. |
|||
# |
|||
import os,shutil,marlin |
|||
from SCons.Script import DefaultEnvironment |
|||
from platformio import util |
|||
|
|||
env = DefaultEnvironment() |
|||
|
|||
# |
|||
# Get the platform name from the 'platform_packages' option, |
|||
# or look it up by the platform.class.name. |
|||
# |
|||
platform = env.PioPlatform() |
|||
board = env.BoardConfig() |
|||
|
|||
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32") |
|||
from platformio.package.meta import PackageSpec |
|||
platform_packages = env.GetProjectOption('platform_packages') |
|||
if len(platform_packages) == 0: |
|||
framewords = { |
|||
"Ststm32Platform": "framework-arduinoststm32", |
|||
"AtmelavrPlatform": "framework-arduino-avr" |
|||
} |
|||
platform_name = framewords[platform.__class__.__name__] |
|||
else: |
|||
platform_name = PackageSpec(platform_packages[0]).name |
|||
|
|||
if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "tool-stm32duino" ]: |
|||
platform_name = "framework-arduinoststm32" |
|||
|
|||
FRAMEWORK_DIR = platform.get_package_dir(platform_name) |
|||
assert os.path.isdir(FRAMEWORK_DIR) |
|||
assert os.path.isdir("buildroot/share/PlatformIO/variants") |
|||
|
|||
mcu_type = board.get("build.mcu")[:-2] |
|||
board = env.BoardConfig() |
|||
|
|||
#mcu_type = board.get("build.mcu")[:-2] |
|||
variant = board.get("build.variant") |
|||
series = mcu_type[:7].upper() + "xx" |
|||
#series = mcu_type[:7].upper() + "xx" |
|||
|
|||
# Prepare a new empty folder at the destination |
|||
variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) |
|||
if os.path.isdir(variant_dir): |
|||
shutil.rmtree(variant_dir) |
|||
if not os.path.isdir(variant_dir): |
|||
os.mkdir(variant_dir) |
|||
|
|||
# Source dir is a local variant sub-folder |
|||
source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) |
|||
assert os.path.isdir(source_dir) |
|||
|
|||
if not os.path.isdir(variant_dir): |
|||
os.mkdir(variant_dir) |
|||
|
|||
for file_name in os.listdir(source_dir): |
|||
full_file_name = os.path.join(source_dir, file_name) |
|||
if os.path.isfile(full_file_name): |
|||
shutil.copy(full_file_name, variant_dir) |
|||
marlin.copytree(source_dir, variant_dir) |
|||
|
@ -0,0 +1,75 @@ |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/marlin.py |
|||
# Helper module with some commonly-used functions |
|||
# |
|||
import os,shutil |
|||
|
|||
from SCons.Script import DefaultEnvironment |
|||
env = DefaultEnvironment() |
|||
|
|||
def copytree(src, dst, symlinks=False, ignore=None): |
|||
for item in os.listdir(src): |
|||
s = os.path.join(src, item) |
|||
d = os.path.join(dst, item) |
|||
if os.path.isdir(s): |
|||
shutil.copytree(s, d, symlinks, ignore) |
|||
else: |
|||
shutil.copy2(s, d) |
|||
|
|||
def replace_define(field, value): |
|||
for define in env['CPPDEFINES']: |
|||
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) |
|||
|
|||
# Relocate the vector table with a new offset |
|||
def relocate_vtab(address): |
|||
replace_define("VECT_TAB_OFFSET", address) |
|||
|
|||
# Replace the existing -Wl,-T with the given ldscript path |
|||
def custom_ld_script(ldname): |
|||
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 |
|||
# Called by specific encrypt() functions, mostly for MKS boards |
|||
def encrypt_mks(source, target, env, new_name): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
renamed = open(target[0].dir.path + "/" + new_name, "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
renamed.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
renamed.close() |
|||
|
|||
def add_post_action(action): |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", action); |
|||
|
|||
# Apply customizations for a MKS Robin |
|||
def prepare_robin(address, ldname, fwname): |
|||
def encrypt(source, target, env): |
|||
encrypt_mks(source, target, env, fwname) |
|||
relocate_firmware(address) |
|||
custom_ld_script(ldname) |
|||
add_post_action(encrypt); |
@ -1,32 +1,28 @@ |
|||
import os,sys |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_encrypt.py |
|||
# |
|||
# Apply encryption and save as 'build.firmware' for these environments: |
|||
# - env:mks_robin_stm32 |
|||
# - env:flsun_hispeedv1 |
|||
# - env:mks_robin_nano35_stm32 |
|||
# |
|||
Import("env") |
|||
|
|||
from SCons.Script import DefaultEnvironment |
|||
board = DefaultEnvironment().BoardConfig() |
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as build.firmware ('Robin.bin') |
|||
def encrypt(source, target, env): |
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
if 'firmware' in board.get("build").keys(): |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/'+ board.get("build.firmware"), "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
import marlin |
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as build.firmware |
|||
def encrypt(source, target, env): |
|||
marlin.encrypt_mks(source, target, env, "build.firmware") |
|||
|
|||
marlin.add_post_action(encrypt); |
|||
|
|||
if 'firmware' in board.get("build").keys(): |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
else: |
|||
print("You need to define output file via board_build.firmware = 'filename' parameter", file=sys.stderr) |
|||
exit(1); |
|||
|
|||
import sys |
|||
print("You need to define output file via board_build.firmware = 'filename' parameter", file=sys.stderr) |
|||
env.Exit(1); |
|||
|
@ -1,39 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08007000", "mks_robin.ld", "Robin.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_e3.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin_e3.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_e3.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_e3p.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'mks_robin_e3p.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin_e3p.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_e3p.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/mksLite.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_lite.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08005000", "mks_robin_lite.ld", "mksLite.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/mksLite3.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_lite3.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08005000", "mks_robin_lite.ld", "mksLite3.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin_mini.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_mini.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08005000", "mks_robin_mini.ld", "Robin_mini.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin_nano.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_nano.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin") |
|||
|
@ -1,40 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano35.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin_nano35.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_nano35.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin") |
|||
|
@ -1,39 +1,5 @@ |
|||
import os |
|||
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")) |
|||
|
|||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_pro.ld") |
|||
for i, flag in enumerate(env["LINKFLAGS"]): |
|||
if "-Wl,-T" in flag: |
|||
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script |
|||
elif flag == "-T": |
|||
env["LINKFLAGS"][i + 1] = custom_ld_script |
|||
|
|||
# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin' |
|||
def encrypt(source, target, env): |
|||
import sys |
|||
|
|||
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] |
|||
|
|||
firmware = open(target[0].path, "rb") |
|||
robin = open(target[0].dir.path +'/Robin_pro.bin', "wb") |
|||
length = os.path.getsize(target[0].path) |
|||
position = 0 |
|||
try: |
|||
while position < length: |
|||
byte = firmware.read(1) |
|||
if position >= 320 and position < 31040: |
|||
byte = chr(ord(byte) ^ key[position & 31]) |
|||
if sys.version_info[0] > 2: |
|||
byte = bytes(byte, 'latin1') |
|||
robin.write(byte) |
|||
position += 1 |
|||
finally: |
|||
firmware.close() |
|||
robin.close() |
|||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); |
|||
# |
|||
# buildroot/share/PlatformIO/scripts/mks_robin_pro.py |
|||
# |
|||
import marlin |
|||
marlin.prepare_robin("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin") |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue