diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py index 5a09dd3d14..668475dc01 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py @@ -10,7 +10,7 @@ Import("env") env.AddPostAction( join("$BUILD_DIR", "${PROGNAME}.elf"), env.VerboseAction(" ".join([ - "$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf + "$OBJCOPY", "-O ihex", "$TARGET", "\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path ]), "Building $TARGET")) diff --git a/buildroot/share/PlatformIO/scripts/mks_encrypt.py b/buildroot/share/PlatformIO/scripts/mks_encrypt.py deleted file mode 100644 index bd3548ab36..0000000000 --- a/buildroot/share/PlatformIO/scripts/mks_encrypt.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# buildroot/share/PlatformIO/scripts/mks_encrypt.py -# -# Apply encryption and save as 'build.firmware' for these environments: -# - env:mks_robin -# - env:mks_robin_e3 -# - env:flsun_hispeedv1 -# - env:mks_robin_nano35 -# -Import("env") - -from SCons.Script import DefaultEnvironment -board = DefaultEnvironment().BoardConfig() - -if 'encrypt' in board.get("build").keys(): - - import marlin - - # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt - def encrypt(source, target, env): - marlin.encrypt_mks(source, target, env, board.get("build.encrypt")) - - marlin.add_post_action(encrypt); - -else: - - import sys - print("You need to define output file via board_build.encrypt = 'filename' parameter", file=sys.stderr) - env.Exit(1); diff --git a/buildroot/share/PlatformIO/scripts/stm32_bootloader.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py similarity index 83% rename from buildroot/share/PlatformIO/scripts/stm32_bootloader.py rename to buildroot/share/PlatformIO/scripts/offset_and_rename.py index f3b1b273a2..b42b2f3531 100644 --- a/buildroot/share/PlatformIO/scripts/stm32_bootloader.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -1,5 +1,5 @@ # -# stm32_bootloader.py +# offset_and_rename.py # # - If 'build.offset' is provided, either by JSON or by the environment... # - Set linker flag LD_FLASH_OFFSET and relocate the VTAB based on 'build.offset'. @@ -36,6 +36,17 @@ if 'offset' in board_keys: if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag: env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40) +# +# For build.encrypt rename and encode the firmware file. +# +if 'encrypt' in board_keys: + + # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt + def encrypt(source, target, env): + marlin.encrypt_mks(source, target, env, board.get("build.encrypt")) + + marlin.add_post_action(encrypt); + # # For build.rename simply rename the firmware file. # diff --git a/ini/avr.ini b/ini/avr.ini index cd10f13499..88f54a723c 100644 --- a/ini/avr.ini +++ b/ini/avr.ini @@ -53,8 +53,7 @@ board = megaatmega1280 [mega_extended_optimized] extends = common_avr8 board_build.variant = MARLIN_MEGA_EXTENDED -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py +extra_scripts = ${env:mega2560ext.extra_scripts} upload_speed = 57600 build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 58f1fc1058..d5f0741d41 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -34,6 +34,11 @@ src_filter = ${common.default_src_filter} + +