From 0ec1cb58c77d37886d0b6a0c683122ea614d7e20 Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Mon, 4 Jul 2022 04:49:23 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20OpenBLT=20encode;=20no-boo?= =?UTF-8?q?tloader=20envs=20(#24446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 6 +-- buildroot/share/PlatformIO/scripts/openblt.py | 6 +-- ini/stm32f4.ini | 46 ++++++++++++++----- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index b6c790da87..9c31824b31 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -682,9 +682,9 @@ #elif MB(MKS_ROBIN_NANO_V3_1) #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3_1 env:mks_robin_nano_v3_1_usb_flash_drive env:mks_robin_nano_v3_1_usb_flash_drive_msc #elif MB(ANET_ET4) - #include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_OpenBLT + #include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT #elif MB(ANET_ET4P) - #include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_OpenBLT + #include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT #elif MB(FYSETC_CHEETAH_V20) #include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20 #elif MB(MKS_MONSTER8_V1) @@ -692,7 +692,7 @@ #elif MB(MKS_MONSTER8_V2) #include "stm32f4/pins_MKS_MONSTER8_V2.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc #elif MB(TH3D_EZBOARD_V2) - #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2 + #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2_no_bootloader env:TH3D_EZBoard_V2_OpenBLT #elif MB(OPULO_LUMEN_REV3) #include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3 #elif MB(MKS_ROBIN_NANO_V1_3_F4) diff --git a/buildroot/share/PlatformIO/scripts/openblt.py b/buildroot/share/PlatformIO/scripts/openblt.py index 61b38a5e87..33e82898f7 100644 --- a/buildroot/share/PlatformIO/scripts/openblt.py +++ b/buildroot/share/PlatformIO/scripts/openblt.py @@ -10,11 +10,11 @@ if pioutil.is_pio_build(): board = env.BoardConfig() board_keys = board.get("build").keys() - if 'encrypt' in board_keys: + if 'encode' in board_keys: env.AddPostAction( join("$BUILD_DIR", "${PROGNAME}.bin"), env.VerboseAction(" ".join([ "$OBJCOPY", "-O", "srec", - "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encrypt")) + "\"" - ]), "Building $TARGET") + "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encode")) + "\"" + ]), "Building " + board.get("build.encode")) ) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 17afc7b892..a663d31483 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -106,24 +106,34 @@ extra_scripts = ${stm32_variant.extra_scripts} # # Anet ET4-MB_V1.x/ET4P-MB_V1.x (STM32F407VGT6 ARM Cortex-M4) -# For use with with davidtgbe's OpenBLT bootloader https://github.com/davidtgbe/openblt/releases -# Comment out board_build.offset = 0x10000 if you don't plan to use OpenBLT/flashing directly to 0x08000000. # -[env:Anet_ET4_OpenBLT] +[Anet_ET4] extends = stm32_variant board = marlin_STM32F407VGT6_CCM board_build.variant = MARLIN_F4x7Vx -board_build.encrypt_mks = firmware.srec -board_build.offset = 0x10000 -board_upload.offset_address = 0x08010000 build_flags = ${stm32_variant.build_flags} -DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 + +# +# Anet ET4 directly flashed via ST-Link +# +[env:Anet_ET4_no_bootloader] +extends = Anet_ET4 +debug_tool = stlink +upload_protocol = stlink + +# +# Anet ET4 with OpenBLT from https://github.com/davidtgbe/openblt/releases +# +[env:Anet_ET4_OpenBLT] +extends = Anet_ET4 +board_build.encode = firmware.srec +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/openblt.py -debug_tool = jlink -upload_protocol = jlink # # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) @@ -546,16 +556,28 @@ build_unflags = -DUSBD_USE_CDC # # TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4) # -[env:TH3D_EZBoard_V2] +[TH3D_EZBoard_V2] extends = stm32_variant board = genericSTM32F405RG board_build.variant = MARLIN_TH3D_EZBOARD_V2 -board_build.encrypt_mks = firmware.bin -board_build.offset = 0xC000 -board_upload.offset_address = 0x0800C000 build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0 + +# +# TH3D EZBoard v2.0 directly flashed via ST-Link +# +[env:TH3D_EZBoard_V2_no_bootloader] +extends = TH3D_EZBoard_V2 debug_tool = stlink upload_protocol = stlink + +# +# TH3D EZBoard v2.0 with OpenBLT from https://github.com/rhapsodyv/OpenBLT-STM32 +# +[env:TH3D_EZBoard_V2_OpenBLT] +extends = TH3D_EZBoard_V2 +board_build.encode = firmware.bin +board_build.offset = 0xC000 +board_upload.offset_address = 0x0800C000 extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/openblt.py